Posted December 24, 20168 yr So i got a small problem ... dunno why , cant find the small error , or i forget anything? import DevilFruitSkills.IceBall; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.SoundEvents; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.stats.StatList; import net.minecraft.util.ActionResult; import net.minecraft.util.EnumActionResult; import net.minecraft.util.EnumHand; import net.minecraft.util.SoundCategory; import net.minecraft.world.World; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; public class IceBallItem extends Item{ public IceBallItem() { super(); this.setMaxStackSize(1); } public ActionResult<ItemStack> onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn, EnumHand hand) { if (!playerIn.capabilities.isCreativeMode) { --itemStackIn.stackSize; } worldIn.playSound((EntityPlayer)null, playerIn.posX, playerIn.posY, playerIn.posZ, SoundEvents.ENTITY_SNOWBALL_THROW, SoundCategory.NEUTRAL, 0.4F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F)); if (!worldIn.isRemote) { IceBall entitythrowable = new IceBall(worldIn, playerIn); entitythrowable.setHeadingFromThrower(playerIn, playerIn.rotationPitch, playerIn.rotationYaw, 0.0F, 1.5F, 1.0F); worldIn.spawnEntityInWorld(entitythrowable); } playerIn.addStat(StatList.getObjectUseStats(this)); return new ActionResult(EnumActionResult.SUCCESS, itemStackIn); } } after rightclick the entity get spawned but my item is gone the "return" function should help me there but dont know how to realitze it .. he has to return "null" or the "item" ? i mean after he uses it i want still to keep the item
December 24, 20168 yr Author You reduce the stack size. What did you expect that to do except, well, reduce the stack size? thx, saw it, changed it, thank you Merry Christmas!
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.