Posted July 12, 201411 yr Hello MCF forums, I would like to know how to make the player take no fall damage while my custom item is in there inventory. I have tried entity.addVelocity() in my onUpdate Method. But it doesn't seed to do anything except me me jump higher. Please help.
July 12, 201411 yr Use the LivingFallEvent and set the fall distance field to 0. There might be some other field in the event, though I'm not sure. Kain
July 13, 201411 yr Author wait would how would i get this to work ONLY if the player has my custom item?
July 13, 201411 yr wait would how would i get this to work ONLY if the player has my custom item? InventoryPlayer inventory = new InventoryPlayer(player); inventory.copyInventory(player.inventory); for(ItemStack itemstack : inventory.mainInventory) { if(itemstack != null && itemstack.getItem() != null && itemstack.getItem() == Items.apple) { System.out.println("apple found"); } }
July 13, 201411 yr No need to copy the inventory, and there are already methods that look for items, i.e. player.inventory.hasItem(Items.apple) and player.inventory.hasItemStack(ItemStack). http://i.imgur.com/NdrFdld.png[/img]
July 14, 201411 yr Author Well thank you, I figured out how to do it through the onUpdate method i did it like this. @Override public void onUpdate(ItemStack stack, World world, Entity entity, int i1, boolean b1) { if(stack.getItemDamage() == 1) { if(entity.fallDistance > 3F) { entity.fallDistance = 0.0F; }
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.