Fix body equipmentslot and effect enum

This commit is contained in:
Nassim Jahnke 2024-06-14 18:53:32 +02:00
parent 1aee096320
commit 3f581a6024
5 changed files with 32 additions and 5 deletions

View file

@ -21,6 +21,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
* additional info. * additional info.
*/ */
POTION_BREAK(2002, Type.VISUAL, Color.class), POTION_BREAK(2002, Type.VISUAL, Color.class),
@@ -0,0 +0,0 @@ public enum Effect {
PORTAL_TRAVEL(1032, Type.SOUND),
/**
* The sound played when launching an endereye
+ * @deprecated No longer exists
*/
+ @Deprecated(forRemoval = true, since = "1.21") // Paper
ENDEREYE_LAUNCH(1003, Type.SOUND),
/**
* The sound played when launching a firework
@@ -0,0 +0,0 @@ public enum Effect { @@ -0,0 +0,0 @@ public enum Effect {
/** /**
* Particles displayed when a villager grows a plant, data * Particles displayed when a villager grows a plant, data
@ -208,7 +218,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ /** + /**
+ * {@link Boolean} param is true for "ominous" vaults + * {@link Boolean} param is true for "ominous" vaults
+ */ + */
+ TRIAL_SPAWNER_SPAWN_ITEM(3021, Type.VISUAL, Boolean.class) + TRIAL_SPAWNER_SPAWN_ITEM(3021, Type.VISUAL, Boolean.class),
+
+ SOUND_WITH_CHARGE_SHOT(1051, Type.SOUND),
; ;
+ private static final org.apache.logging.log4j.Logger LOGGER = org.apache.logging.log4j.LogManager.getLogger(); + private static final org.apache.logging.log4j.Logger LOGGER = org.apache.logging.log4j.LogManager.getLogger();
+ // Paper end + // Paper end

View file

@ -47,14 +47,29 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
*/ */
@NotNull @NotNull
public ItemStack getItem(@NotNull EquipmentSlot slot); public ItemStack getItem(@NotNull EquipmentSlot slot);
diff --git a/src/main/java/org/bukkit/inventory/EquipmentSlot.java b/src/main/java/org/bukkit/inventory/EquipmentSlot.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/inventory/EquipmentSlot.java
+++ b/src/main/java/org/bukkit/inventory/EquipmentSlot.java
@@ -0,0 +0,0 @@ public enum EquipmentSlot {
/**
* Only for certain entities such as horses and wolves.
*/
- BODY(() -> EquipmentSlotGroup.ARMOR);
+ BODY(() -> EquipmentSlotGroup.BODY); // Paper - add missing slot type
private final Supplier<EquipmentSlotGroup> group; // Supplier because of class loading order, since EquipmentSlot and EquipmentSlotGroup reference each other on class init
diff --git a/src/main/java/org/bukkit/inventory/EquipmentSlotGroup.java b/src/main/java/org/bukkit/inventory/EquipmentSlotGroup.java diff --git a/src/main/java/org/bukkit/inventory/EquipmentSlotGroup.java b/src/main/java/org/bukkit/inventory/EquipmentSlotGroup.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/inventory/EquipmentSlotGroup.java --- a/src/main/java/org/bukkit/inventory/EquipmentSlotGroup.java
+++ b/src/main/java/org/bukkit/inventory/EquipmentSlotGroup.java +++ b/src/main/java/org/bukkit/inventory/EquipmentSlotGroup.java
@@ -0,0 +0,0 @@ public final class EquipmentSlotGroup implements Predicate<EquipmentSlot> { @@ -0,0 +0,0 @@ public final class EquipmentSlotGroup implements Predicate<EquipmentSlot> {
public static final EquipmentSlotGroup LEGS = get("legs", EquipmentSlot.LEGS);
public static final EquipmentSlotGroup CHEST = get("chest", EquipmentSlot.CHEST); public static final EquipmentSlotGroup CHEST = get("chest", EquipmentSlot.CHEST);
public static final EquipmentSlotGroup HEAD = get("head", EquipmentSlot.HEAD); public static final EquipmentSlotGroup HEAD = get("head", EquipmentSlot.HEAD);
public static final EquipmentSlotGroup ARMOR = get("armor", (test) -> test == EquipmentSlot.FEET || test == EquipmentSlot.LEGS || test == EquipmentSlot.CHEST || test == EquipmentSlot.HEAD, EquipmentSlot.CHEST); - public static final EquipmentSlotGroup ARMOR = get("armor", (test) -> test == EquipmentSlot.FEET || test == EquipmentSlot.LEGS || test == EquipmentSlot.CHEST || test == EquipmentSlot.HEAD, EquipmentSlot.CHEST);
+ public static final EquipmentSlotGroup ARMOR = get("armor", (test) -> test == EquipmentSlot.FEET || test == EquipmentSlot.LEGS || test == EquipmentSlot.CHEST || test == EquipmentSlot.HEAD || test == EquipmentSlot.BODY, EquipmentSlot.CHEST); // Paper - add missing slot type
+ public static final EquipmentSlotGroup BODY = get("body", EquipmentSlot.BODY); // Paper - add missing slot group + public static final EquipmentSlotGroup BODY = get("body", EquipmentSlot.BODY); // Paper - add missing slot group
// //
private final String key; private final String key;

View file

@ -922,7 +922,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
class RegistryKeyTest extends AbstractTestingBase { class RegistryKeyTest extends AbstractTestingBase {
@@ -0,0 +0,0 @@ class RegistryKeyTest extends AbstractTestingBase { @@ -0,0 +0,0 @@ class RegistryKeyTest extends AbstractTestingBase {
void testApiRegistryKeysExist(final RegistryKey<?> key) { void testApiRegistryKeysExist(final RegistryKey<?> key) {
final Optional<Registry<Object>> registry = AbstractTestingBase.REGISTRY_CUSTOM.registry(ResourceKey.createRegistryKey(new ResourceLocation(key.key().asString()))); final Optional<Registry<Object>> registry = AbstractTestingBase.REGISTRY_CUSTOM.registry(ResourceKey.createRegistryKey(ResourceLocation.parse(key.key().asString())));
assertTrue(registry.isPresent(), "Missing vanilla registry for " + key.key().asString()); assertTrue(registry.isPresent(), "Missing vanilla registry for " + key.key().asString());
+ } + }

View file

@ -90,7 +90,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public void checkColor(DyeColor dye) { public void checkColor(DyeColor dye) {
Color color = dye.getColor(); Color color = dye.getColor();
- int nmsColorArray = DyeColor.byId(dye.getWoolData()).getTextureDiffuseColor(); - int nmsColorArray = DyeColor.byId(dye.getWoolData()).getTextureDiffuseColor();
+ int nmsColorArray = net.minecraft.world.item.DyeColor.byId(dye.getWoolData()).getTextureDiffuseColors(); // Paper - remap fix + int nmsColorArray = net.minecraft.world.item.DyeColor.byId(dye.getWoolData()).getTextureDiffuseColor(); // Paper - remap fix
Color nmsColor = Color.fromARGB(nmsColorArray); Color nmsColor = Color.fromARGB(nmsColorArray);
assertThat(color, is(nmsColor)); assertThat(color, is(nmsColor));
} }

View file

@ -63,7 +63,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ @ParameterizedTest + @ParameterizedTest
+ @MethodSource("data") + @MethodSource("data")
+ void testApiRegistryKeysExist(final RegistryKey<?> key) { + void testApiRegistryKeysExist(final RegistryKey<?> key) {
+ final Optional<Registry<Object>> registry = AbstractTestingBase.REGISTRY_CUSTOM.registry(ResourceKey.createRegistryKey(new ResourceLocation(key.key().asString()))); + final Optional<Registry<Object>> registry = AbstractTestingBase.REGISTRY_CUSTOM.registry(ResourceKey.createRegistryKey(ResourceLocation.parse(key.key().asString())));
+ assertTrue(registry.isPresent(), "Missing vanilla registry for " + key.key().asString()); + assertTrue(registry.isPresent(), "Missing vanilla registry for " + key.key().asString());
+ +
+ } + }