[1.15.2] onItemRightClick is doesn't work

Started by min03 on Tue, 11/10/2020 - 12:58

Topic category: Help with MCreator software

Last seen on 08:13, 29. Aug 2021
Joined May 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
[1.15.2] onItemRightClick is doesn't work
Tue, 11/10/2020 - 12:58
		   public ActionResult<ItemStack> onItemRightClick(World worldIn, PlayerEntity playerIn, Hand handIn, LivingEntity LivingEntity) 
		   {
			   	  ItemStack itemstack = playerIn.getHeldItem(handIn);
			      Vec3d look = playerIn.getLookVec();
			      ArrowCustomEntity arrowcustomentity = new ArrowCustomEntity(JItem.arrow, worldIn);
			      arrowcustomentity.setPosition(playerIn.getPosX() + look.x * 1.5D, playerIn.getPosY() + look.y * 1.5D, playerIn.getPosZ() + look.z * 1.5D);
			      arrowcustomentity.shoot(playerIn, playerIn.rotationPitch, playerIn.rotationYaw, 0.0F, 1.5F, 0.5F);
			      if(!worldIn.isRemote) 
			      {
			    	  worldIn.addEntity(arrowcustomentity);
			      }
			      return ActionResult.resultSuccess(itemstack);
		    }

is there any wrong code here?

technically fine, but it doesn't work in-game