Posted August 12, 20205 yr When I run @Override onItemRightClick it works just fine returning list of items around me @Override public ActionResult<ItemStack> onItemRightClick(World worldIn, PlayerEntity playerIn, Hand handIn) { playerIn.swingArm(handIn); double x = playerIn.getPosX() ; double y = playerIn.getPosY() /*+ 1.0d*/; double z = playerIn.getPosZ(); AxisAlignedBB playerRange = new AxisAlignedBB(x - 3.0f, y - 3.0f, z - 3.0f, x + 3.0f,y + 3.0f,z + 3.0f); System.out.println(playerIn.getEntityWorld().getEntitiesWithinAABB(ItemEntity.class,playerRange)); But when I try same thing using @SubscribeEvent I get empty list, why? @SubscribeEvent public static void RightClickItem(PlayerInteractEvent.RightClickItem event) { double x = event.getPlayer().getPosX() ; double y = event.getPlayer().getPosX() /*+ 1.0d*/; double z = event.getPlayer().getPosX(); AxisAlignedBB playerRange = new AxisAlignedBB(x - 3.0f, y - 3.0f, z - 3.0f, x + 3.0f,y + 3.0f,z + 3.0f); System.out.println(event.getWorld().getEntitiesWithinAABB(ItemEntity.class,playerRange));
August 12, 20205 yr double x = event.getPlayer().getPosX(); double y = event.getPlayer().getPosX <--------??? (); double z = event.getPlayer().getPosX <--------??? ();
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.