Jump to content

Grodomir

Members
  • Posts

    3
  • Joined

  • Last visited

Grodomir's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. Yeah thanks it worked. But.. i have now another problem xD. I tried to limit it to 2 jumps but i don't know what i'm doing wrong :/. package com.testmod.item; import javax.swing.text.html.parser.Entity; import com.testmod.TestMod; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.EntityLiving; 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; private boolean hasJumped = false; private int jumps = 0; 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); } if(!playerIn.isAirBorne && hasJumped) { hasJumped = false; //System.out.println("(2) isAirBorne " + playerIn.isAirBorne); //System.out.println("(2) hasJumped " + hasJumped); } if(playerIn.isAirBorne && playerIn.motionY < 0.7 && !hasJumped && jumps <=1) { playerIn.motionY=0.8; hasJumped = true; jumps+=1; //System.out.println("(1) isAirBorne " + playerIn.isAirBorne); //System.out.println("(1) hasJumped " + hasJumped); //System.out.println("(1) jumps " + jumps); } if(jumps>=2) { jumps = 0; //System.out.println("(1) jumps " + jumps); } return new ActionResult(EnumActionResult.SUCCESS, itemStackIn); } }
  2. In file (which i gave code in post) i commented motionY because it wasn't working.
  3. 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); } }
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.