コード例 #1
0
 public static boolean entityOtherPlayerIsItemInUseHook(
     EntityOtherPlayerMP player, boolean isItemInUse) {
   ItemStack mainhand = player.getCurrentEquippedItem();
   if (!isItemInUse && player.isEating() && mainhand != null) {
     // ItemStack itemstack = player.inventory.mainInventory[player.inventory.currentItem];
     player.setItemInUse(
         mainhand, Item.itemsList[mainhand.itemID].getMaxItemUseDuration(mainhand));
     return true;
   } else if (isItemInUse && !player.isEating()) {
     player.clearItemInUse();
     return false;
   } else {
     return isItemInUse;
   }
 }