This site works best with JavaScript enabled. Please enable JavaScript to get the best experience from this site.
0
I can not believe how silly I was, I've been trying to get it to work for the last 3 days... and in the end I forgot to change the item register to the new class. Thanks everyone for your help!
I'm not sure what that means, sorry I'm fairly new to java.
I have registered the item using that class.
Thanks, but onFoodEaten still isn't getting called.
Here is the class
package org.dagwoodland.purple_lab.items; import org.dagwoodland.purple_lab.init.PurpleLabItems; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemFood; import net.minecraft.item.ItemStack; import net.minecraft.world.World; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; public class ItemChocolateBubbly extends ItemFood { public ItemChocolateBubbly(int amount, float saturation, boolean isWolfFood, int effectAmplifier) { super(amount, saturation, isWolfFood); // TODO Auto-generated constructor stub this.setMaxDamage(0); this.setAlwaysEdible(); this.setPotionEffect(1, 10, effectAmplifier, 1.0f); //this.setPotionEffect(8, 10, effectAmplifier, 1.0f); this.maxStackSize = 16; } @Override protected void onFoodEaten(ItemStack stack, World worldIn, EntityPlayer entityPlayer) { // TODO Auto-generated method stub super.onFoodEaten(stack, worldIn, entityPlayer); entityPlayer.capabilities.allowFlying = true; //entityPlayer.capabilities.isFlying = true; entityPlayer.sendPlayerAbilities(); } }
It extends ItemFood.
I've checked using a breakpoint and for some reason OnFoodEaten isn't getting called.
@Override protected void onFoodEaten(ItemStack stack, World worldIn, EntityPlayer entityPlayer) { // TODO Auto-generated method stub super.onFoodEaten(stack, worldIn, entityPlayer); entityPlayer.capabilities.allowFlying = true; //entityPlayer.capabilities.isFlying = true; entityPlayer.sendPlayerAbilities(); }
0
I can not believe how silly I was, I've been trying to get it to work for the last 3 days... and in the end I forgot to change the item register to the new class. Thanks everyone for your help!
0
I'm not sure what that means, sorry I'm fairly new to java.
I have registered the item using that class.
0
Thanks, but onFoodEaten still isn't getting called.
0
Here is the class
0
It extends ItemFood.
0
I've checked using a breakpoint and for some reason OnFoodEaten isn't getting called.
0
I have tried the following but it doesn't work :