@@ -1,7 +1,9 @@
|
||||
package org.bukkit.craftbukkit;
|
||||
|
||||
import java.util.Locale;
|
||||
import net.minecraft.world.EnumHand;
|
||||
import net.minecraft.world.entity.EnumItemSlot;
|
||||
import net.minecraft.world.entity.EquipmentSlotGroup;
|
||||
import org.bukkit.inventory.EquipmentSlot;
|
||||
|
||||
public class CraftEquipmentSlot {
|
||||
@@ -16,6 +18,7 @@ public class CraftEquipmentSlot {
|
||||
set(EquipmentSlot.LEGS, EnumItemSlot.LEGS);
|
||||
set(EquipmentSlot.CHEST, EnumItemSlot.CHEST);
|
||||
set(EquipmentSlot.HEAD, EnumItemSlot.HEAD);
|
||||
set(EquipmentSlot.BODY, EnumItemSlot.BODY);
|
||||
}
|
||||
|
||||
private static void set(EquipmentSlot type, EnumItemSlot value) {
|
||||
@@ -27,10 +30,18 @@ public class CraftEquipmentSlot {
|
||||
return enums[nms.ordinal()];
|
||||
}
|
||||
|
||||
public static org.bukkit.inventory.EquipmentSlotGroup getSlot(EquipmentSlotGroup nms) {
|
||||
return org.bukkit.inventory.EquipmentSlotGroup.getByName(nms.getSerializedName());
|
||||
}
|
||||
|
||||
public static EnumItemSlot getNMS(EquipmentSlot slot) {
|
||||
return slots[slot.ordinal()];
|
||||
}
|
||||
|
||||
public static EquipmentSlotGroup getNMSGroup(org.bukkit.inventory.EquipmentSlotGroup slot) {
|
||||
return EquipmentSlotGroup.valueOf(slot.toString().toUpperCase(Locale.ROOT));
|
||||
}
|
||||
|
||||
public static EquipmentSlot getHand(EnumHand enumhand) {
|
||||
return (enumhand == EnumHand.MAIN_HAND) ? EquipmentSlot.HAND : EquipmentSlot.OFF_HAND;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user