I just want the item to do something simple and saw the itemInteractionForEntity() method in a tutorial. Does this still work or has it changed?
I'm currently running 964. The item shows up when running, but when hitting an enemy I get no response from the item.
Here is my code for that item:
package billabrian6.mymod;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.monster.EntityCreeper;
import net.minecraft.entity.monster.EntityZombie;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
public class MyItem extends Item {
public MyItem(int id) {
super(id);
setMaxStackSize(16);
setCreativeTab(CreativeTabs.tabMisc);
setUnlocalizedName("myItem");
}
@Override
public boolean itemInteractionForEntity(ItemStack itemstack,
EntityPlayer player, EntityLivingBase target) {
player.addChatMessage("Your inside me ");
if (!target.worldObj.isRemote) {
target.motionY = 2;
}
return false;
}
}