mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-07 17:08:30 +01:00
Add EquipmentSlot.armors
Signed-off-by: TheMode <themode@outlook.fr>
This commit is contained in:
parent
cb01b08b04
commit
64de8f87c0
@ -3,6 +3,8 @@ package net.minestom.server.entity;
|
|||||||
import net.minestom.server.item.attribute.AttributeSlot;
|
import net.minestom.server.item.attribute.AttributeSlot;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import static net.minestom.server.utils.inventory.PlayerInventoryUtils.*;
|
import static net.minestom.server.utils.inventory.PlayerInventoryUtils.*;
|
||||||
|
|
||||||
public enum EquipmentSlot {
|
public enum EquipmentSlot {
|
||||||
@ -13,6 +15,8 @@ public enum EquipmentSlot {
|
|||||||
CHESTPLATE(true, CHESTPLATE_SLOT),
|
CHESTPLATE(true, CHESTPLATE_SLOT),
|
||||||
HELMET(true, HELMET_SLOT);
|
HELMET(true, HELMET_SLOT);
|
||||||
|
|
||||||
|
private static final List<EquipmentSlot> ARMORS = List.of(BOOTS, LEGGINGS, CHESTPLATE, HELMET);
|
||||||
|
|
||||||
private final boolean armor;
|
private final boolean armor;
|
||||||
private final int armorSlot;
|
private final int armorSlot;
|
||||||
|
|
||||||
@ -33,7 +37,11 @@ public enum EquipmentSlot {
|
|||||||
return armorSlot;
|
return armorSlot;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static EquipmentSlot fromAttributeSlot(@NotNull AttributeSlot attributeSlot) {
|
public static @NotNull List<@NotNull EquipmentSlot> armors() {
|
||||||
|
return ARMORS;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static @NotNull EquipmentSlot fromAttributeSlot(@NotNull AttributeSlot attributeSlot) {
|
||||||
return switch (attributeSlot) {
|
return switch (attributeSlot) {
|
||||||
case MAINHAND -> MAIN_HAND;
|
case MAINHAND -> MAIN_HAND;
|
||||||
case OFFHAND -> OFF_HAND;
|
case OFFHAND -> OFF_HAND;
|
||||||
|
Loading…
Reference in New Issue
Block a user