wangfei22
  1. @Override
  2.     public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn,@Nullable ItemStack heldItem, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {

  3. }
复制代码
我刚自己摸索Mod开发 发现api文档上的@Nullable ItemStack heldItem在我的MDK中根本不存在 我去找了父类的Block中的方法确实没发现@Nullable ItemStack heldItem

下面是父类 我的MDK版本是1.12.2请问一下大佬 现在是怎么判断激活方块时手中的物品啊
  1. /**
  2.      * Called when the block is right clicked by a player.
  3.      */
  4.     public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
  5.     {
  6.         return false;
  7.     }
复制代码



GiNYAi
  1. playerIn.getHeldItem(hand)
复制代码

第一页 上一页 下一页 最后一页