From 1fefbf9b988be4173df80888d1928418243efec8 Mon Sep 17 00:00:00 2001 From: Matthew Date: Fri, 11 Mar 2016 13:01:26 -0500 Subject: [PATCH] SPIGOT-1806: Implement HumanEntity#getMainHand --- .../java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java index 14751d8bf4..9902e9eeac 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java @@ -7,6 +7,7 @@ import net.minecraft.server.*; import org.bukkit.GameMode; import org.bukkit.Location; +import org.bukkit.inventory.MainHand; import org.bukkit.Material; import org.bukkit.entity.HumanEntity; import org.bukkit.event.inventory.InventoryType; @@ -60,6 +61,10 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { return enderChest; } + public MainHand getMainHand() { + return getHandle().cr() == EnumMainHand.LEFT ? MainHand.LEFT : MainHand.RIGHT; // PAIL Rename cr()->getMainHand() + } + public ItemStack getItemInHand() { return getInventory().getItemInHand(); }