Posted July 19, 201312 yr Ok, so when my item is right clicked, it sends the player launching in the direction they are looking. (Thank you hydroflame ) This would be fine, but, however, if the player is in survival mode, they, of course, take massive amounts of fall damage. So, this is what I tried doing (yes, I do have the fallDistance variable): @Override public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player) { player.motionY = 0.7; double calculatedX = 10 * (double) (-MathHelper.sin(player.rotationYaw/ 180.0F * (float) Math.PI)* MathHelper.cos(player.rotationPitch / 180.0F* (float) Math.PI) * 0.4f); double calculatedZ = 10 * (double) (MathHelper.cos(player.rotationYaw / 180.0F * (float) Math.PI)* MathHelper.cos(player.rotationPitch / 180.0F* (float) Math.PI) * 0.4f); double calculatedY = 10 * (double) (-MathHelper.sin((player.rotationPitch)/ 180.0F * (float) Math.PI) * 0.4f); player.motionY = calculatedY; player.motionX = calculatedX; player.motionZ = calculatedZ; player.fallDistance = 0.0f; return itemStack; } Of course, though, when you right click again, it just makes you fly again, adding more fallDistance, which means you always take fall damage. I'm having trouble finding a fix. If I could find a way to do a loop when holding this item (It would be OK to negate all fall damage when holding this) and continually set fall distance to 0. Of course, I have very limited Java knowledge so I do not know how to do this. If someone could help, that would be great!
July 19, 201312 yr put this in your item class, It gets called every tick on both sides so should work: @Override public void onUpdate(ItemStack par1ItemStack, World par2World, Entity par3Entity, int par4, boolean par5) { super.onUpdate(par1ItemStack, par2World, par3Entity, par4, par5); par3Entity.fallDistance = 0; } have fun github
July 19, 201312 yr Author put this in your item class, It gets called every tick on both sides so should work: @Override public void onUpdate(ItemStack par1ItemStack, World par2World, Entity par3Entity, int par4, boolean par5) { super.onUpdate(par1ItemStack, par2World, par3Entity, par4, par5); par3Entity.fallDistance = 0; } have fun Applause to you, sir! I could never figure out this kinda code on my own I am new to coding.
July 19, 201312 yr hardly anything complicated, it's overriding a single vanilla method and adding a single line of code... I would take a look at learning a bit more basic coding before you continue with modding. If you want to make anything worthwhile you will need a lot more knowledge github
July 19, 201312 yr Author hardly anything complicated, it's overriding a single vanilla method and adding a single line of code... I would take a look at learning a bit more basic coding before you continue with modding. If you want to make anything worthwhile you will need a lot more knowledge I'm mostly just making a mod for my server, and I really do want to learn how to be a better modder.
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.