Fixed possible NPE for when harvesting blocks.

This commit is contained in:
WayofTime 2021-01-29 14:18:15 -05:00
parent 94aa68caf9
commit a3d7a8c3b1

View file

@ -672,7 +672,12 @@ public class GenericHandler
@SubscribeEvent
public void onCheckLooting(LootingLevelEvent event)
{
Entity entity = event.getDamageSource().getTrueSource();
DamageSource source = event.getDamageSource();
if (source == null)
{
return;
}
Entity entity = source.getTrueSource();
if (entity instanceof PlayerEntity)
{
ItemStack heldStack = ((PlayerEntity) entity).getHeldItemMainhand();