Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Poseidon_22

Members
  • Joined

  • Last visited

  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

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.