Ayo.
I created an item and i wanted it to make me jump (but higher than jumping with space, and can be used once after regular jump) and i founded OnUse funcution but can't find anything working for jumping.
package com.testmod.item;
import com.testmod.TestMod;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.projectile.EntitySnowball;
import net.minecraft.init.MobEffects;
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.util.math.MathHelper;
import net.minecraft.world.World;
public class JumpRune extends Item implements ItemModelProvider {
protected String name;
public JumpRune(String name) {
this.name = name;
setUnlocalizedName(name);
setRegistryName(name);
this.maxStackSize = 1;
this.setMaxDamage(64);
//setCreativeTab(TestMod.creativeTab);
}
@Override
public void registerItemModel(Item item) {
TestMod.proxy.registerItemRenderer(this, 0, name);
}
@Override
public JumpRune setCreativeTab(CreativeTabs tab) {
super.setCreativeTab(tab);
return this;
}
public ActionResult<ItemStack> onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn, EnumHand hand)
{
if (!playerIn.capabilities.isCreativeMode)
{
itemStackIn.damageItem(1, playerIn);
}
worldIn.playSound((EntityPlayer)null, playerIn.posX, playerIn.posY, playerIn.posZ, SoundEvents.ENTITY_SNOWBALL_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
//playerIn.heal(5f);
if (!worldIn.isRemote)
{
//playerIn.motionY=0.8;
//playerIn.jumpMovementFactor=7f;
}
return new ActionResult(EnumActionResult.SUCCESS, itemStackIn);
}
}