Field inventory is only in type EntityPlayer (and its children). You have to check if the entity is an instance of EntityPlayer and if so, you need to cast the entity to EntityPlayer. Also, you can check EntityLivingBase instead of EntityPlayer and then use getActiveItemStack() for getting the held ItemStack ( or getHeldItem() in older versions)
As always - telling something without seeing the whole code is actually quite hard. However, because you say that you have got the very same error I personally guess that you are still using the entity variable instead of the player variable when getting the inventory.
@#2 Yeah sorry, but thanks to your comment I solved it just checking for the player as I wrote above and replacing entity in [spoiler]if (entity.inventory.getCurrentItem() != null && entity.inventory.getCurrentItem().getItem() == mcreator_animaLuciferiSwordTool.block)[/spoiler] with player
Field inventory is only in type EntityPlayer (and its children). You have to check if the entity is an instance of EntityPlayer and if so, you need to cast the entity to EntityPlayer.
Also, you can check EntityLivingBase instead of EntityPlayer and then use getActiveItemStack() for getting the held ItemStack ( or getHeldItem() in older versions)
@#1 Yeah I've already tried to check if the entity is istanceof EntityPlayer, but I'm writing "wrong" or in the wrong place
@#1 I tried this, but I get same errors
if (entity instanceof EntityPlayer) { EntityPlayer player = (EntityPlayer) entity;[spoiler]
[/spoiler]
As always - telling something without seeing the whole code is actually quite hard. However, because you say that you have got the very same error I personally guess that you are still using the entity variable instead of the player variable when getting the inventory.
@#2 Yeah sorry, but thanks to your comment I solved it just checking for the player as I wrote above and replacing entity in [spoiler]if (entity.inventory.getCurrentItem() != null && entity.inventory.getCurrentItem().getItem() == mcreator_animaLuciferiSwordTool.block)[/spoiler] with player
Thanks a lot