Fixed possible NPE for when harvesting blocks.
This commit is contained in:
parent
94aa68caf9
commit
a3d7a8c3b1
|
@ -672,7 +672,12 @@ public class GenericHandler
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onCheckLooting(LootingLevelEvent event)
|
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)
|
if (entity instanceof PlayerEntity)
|
||||||
{
|
{
|
||||||
ItemStack heldStack = ((PlayerEntity) entity).getHeldItemMainhand();
|
ItemStack heldStack = ((PlayerEntity) entity).getHeldItemMainhand();
|
||||||
|
|
Loading…
Reference in a new issue