Jump to content

Poseidon_22

Members
  • Posts

    2
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Poseidon_22's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. Thanks for your reply. So this is where I ended up with. @Override public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand handIn) { onclick(worldIn, playerIn, handIn); return new ActionResult(EnumActionResult.SUCCESS, new ItemStack(this)); } @SideOnly(Side.CLIENT) private void onclick(World worldIn, EntityPlayer playerIn, EnumHand handIn){ RayTraceResult ray = new RayTraceResult(playerIn); Entity entity = ray.entityHit; if(entity == null){ } else entity.onKillCommand(); } } It kills me instead of the entity.
  2. Hello, I want to damage an entity when I right click it from a distance. I saw in the RayTraceResult class that there is something with entityHit. So I suppose I have to use RayTraceResult. Though I'm doing something wrong. @Override public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand handIn) { if(!worldIn.isRemote) { RayTraceResult ray = playerIn.rayTrace(100,20); Entity entity = ray.entityHit; entity.setDead(); return new ActionResult(EnumActionResult.SUCCESS, new ItemStack(this)); } else { return new ActionResult(EnumActionResult.FAIL, new ItemStack(this)); } } What am I doing wrong? Thanks
×
×
  • Create New...

Important Information

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