我的世界MC mod开发日志-开发

我的世界MC mod开发日志-Item物品事件-自己的物品3

视频https://space.bilibili.com/55964508
Q群528864733

Item物品添加
{建立模板}
{注册物品}
{物品信息}
{创造模式的 物品栏的图标}
Item物品事件-自己的物品
Item物品事件-世界的物品

 

 

 

{物品使用事件}
//在自己的物品模板类中添加的代码
      //物品使用事件
      public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
      {
        if (world.isRemote) {
          return super.onItemUse(player, world, pos, hand, facing, hitX, hitY, hitZ);
        }
        IBlockState hitState = world.getBlockState(pos); //选择的方块
        bool_isBlock = hitState.getBlock() instanceof Block;  //确定 有选择方块
        bool_isBlock = false;
        return super.onItemUse(player, world, pos, hand, facing, hitX, hitY, hitZ);
      }    

 

posted on 2019-03-07 14:37  nq17656721  阅读(189)  评论(0)    收藏  举报

导航