13
0
geforkt von Mirrors/Paper
Paper/src/main/java/org/bukkit/craftbukkit/CraftEquipmentSlot.java

33 Zeilen
1.0 KiB
Java

2015-02-15 02:24:14 +01:00
package org.bukkit.craftbukkit;
2016-02-29 22:32:46 +01:00
import net.minecraft.server.EnumItemSlot;
2015-02-15 02:24:14 +01:00
import org.bukkit.inventory.EquipmentSlot;
public class CraftEquipmentSlot {
2016-02-29 22:32:46 +01:00
private static final EnumItemSlot[] slots = new EnumItemSlot[EquipmentSlot.values().length];
private static final EquipmentSlot[] enums = new EquipmentSlot[EnumItemSlot.values().length];
2015-02-15 02:24:14 +01:00
static {
2016-02-29 22:32:46 +01:00
set(EquipmentSlot.HAND, EnumItemSlot.MAINHAND);
set(EquipmentSlot.OFF_HAND, EnumItemSlot.OFFHAND);
set(EquipmentSlot.FEET, EnumItemSlot.FEET);
set(EquipmentSlot.LEGS, EnumItemSlot.LEGS);
set(EquipmentSlot.CHEST, EnumItemSlot.CHEST);
set(EquipmentSlot.HEAD, EnumItemSlot.HEAD);
2015-02-15 02:24:14 +01:00
}
2016-02-29 22:32:46 +01:00
private static void set(EquipmentSlot type, EnumItemSlot value) {
2015-02-15 02:24:14 +01:00
slots[type.ordinal()] = value;
2016-02-29 22:32:46 +01:00
enums[value.ordinal()] = type;
2015-02-15 02:24:14 +01:00
}
2016-02-29 22:32:46 +01:00
public static EquipmentSlot getSlot(EnumItemSlot nms) {
return enums[nms.ordinal()];
2015-02-15 02:24:14 +01:00
}
2016-02-29 22:32:46 +01:00
public static EnumItemSlot getNMS(EquipmentSlot slot) {
2015-02-15 02:24:14 +01:00
return slots[slot.ordinal()];
}
}