我的世界MC mod开发日志-Item物品事件-自己的物品2
视频https://space.bilibili.com/55964508
Q群528864733
{物品右键事件} //在自己的物品模板类中添加的代码 //本物品右键事件 public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand) { ItemStack stack = player.getHeldItem(hand); if (!world.isRemote) { if (player.isSneaking()) { if (!bool_isBlock) absorbAllLevelExpFromPlayer(stack, player); else absorbOneLevelExpFromPlayer(stack, player); } else { if (!bool_isBlock) giveAllLevelExpToPlayer(stack, player); else giveOneLevelExpToPlayer(stack, player); } } return new ActionResult(EnumActionResult.SUCCESS, stack); }
posted on 2019-03-07 14:36 nq17656721 阅读(132) 评论(0) 收藏 举报
浙公网安备 33010602011771号