Fix body equipmentslot and effect enum

This commit is contained in:
Nassim Jahnke 2024-06-14 18:53:32 +02:00
parent 038f8d915e
commit 66f7b672ed
No known key found for this signature in database
GPG key ID: EF6771C01F6EF02F
6 changed files with 44 additions and 17 deletions

View file

@ -6,7 +6,7 @@ Subject: [PATCH] Add missing effects
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
diff --git a/src/main/java/org/bukkit/Effect.java b/src/main/java/org/bukkit/Effect.java
index fd9cf25f2fdef5ee3b7143f27e5f43dfe3f21a38..88e93da6021b90a3351df17d95adc4d9277578f8 100644
index fd9cf25f2fdef5ee3b7143f27e5f43dfe3f21a38..d98612cad7f7477f6d4fe496f4d87b139aa3c681 100644
--- a/src/main/java/org/bukkit/Effect.java
+++ b/src/main/java/org/bukkit/Effect.java
@@ -131,9 +131,9 @@ public enum Effect {
@ -21,7 +21,17 @@ index fd9cf25f2fdef5ee3b7143f27e5f43dfe3f21a38..88e93da6021b90a3351df17d95adc4d9
* additional info.
*/
POTION_BREAK(2002, Type.VISUAL, Color.class),
@@ -177,7 +177,9 @@ public enum Effect {
@@ -168,7 +168,9 @@ 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
@@ -177,7 +179,9 @@ public enum Effect {
/**
* Particles displayed when a villager grows a plant, data
* is the number of particles
@ -31,7 +41,7 @@ index fd9cf25f2fdef5ee3b7143f27e5f43dfe3f21a38..88e93da6021b90a3351df17d95adc4d9
VILLAGER_PLANT_GROW(2005, Type.VISUAL, Integer.class),
/**
* The sound/particles used by the enderdragon's breath
@@ -336,21 +338,197 @@ public enum Effect {
@@ -336,21 +340,199 @@ public enum Effect {
* block.
*/
OXIDISED_COPPER_SCRAPE(3005, Type.VISUAL),
@ -208,7 +218,9 @@ index fd9cf25f2fdef5ee3b7143f27e5f43dfe3f21a38..88e93da6021b90a3351df17d95adc4d9
+ /**
+ * {@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();
+ // Paper end
@ -233,7 +245,7 @@ index fd9cf25f2fdef5ee3b7143f27e5f43dfe3f21a38..88e93da6021b90a3351df17d95adc4d9
}
/**
@@ -366,8 +544,10 @@ public enum Effect {
@@ -366,8 +548,10 @@ public enum Effect {
/**
* @return The type of the effect.
@ -244,7 +256,7 @@ index fd9cf25f2fdef5ee3b7143f27e5f43dfe3f21a38..88e93da6021b90a3351df17d95adc4d9
public Type getType() {
return this.type;
}
@@ -378,9 +558,16 @@ public enum Effect {
@@ -378,9 +562,16 @@ public enum Effect {
*/
@Nullable
public Class<?> getData() {
@ -262,7 +274,7 @@ index fd9cf25f2fdef5ee3b7143f27e5f43dfe3f21a38..88e93da6021b90a3351df17d95adc4d9
/**
* Gets the Effect associated with the given ID.
*
@@ -396,12 +583,26 @@ public enum Effect {
@@ -396,12 +587,26 @@ public enum Effect {
static {
for (Effect effect : values()) {

View file

@ -47,14 +47,29 @@ index 1b34286fb6cbedb3841c84c499eb626f61885126..0829418cc4b586ea9c800617f7184b1e
*/
@NotNull
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 c1c69ba4c361740f0ad422a7840a7f0f055c186a..1bedf9b7ee16729397e1fa2915dd76a1c6fbe212 100644
--- a/src/main/java/org/bukkit/inventory/EquipmentSlot.java
+++ b/src/main/java/org/bukkit/inventory/EquipmentSlot.java
@@ -15,7 +15,7 @@ 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
index 0019c8d91eefbfb44e76b9f929b25cd189295b79..5ce9da41ac4967f036e376fa270d4065b3d2e5d5 100644
index 0019c8d91eefbfb44e76b9f929b25cd189295b79..2ba475ee5e976a6f5451021be17697345b29110a 100644
--- a/src/main/java/org/bukkit/inventory/EquipmentSlotGroup.java
+++ b/src/main/java/org/bukkit/inventory/EquipmentSlotGroup.java
@@ -26,6 +26,7 @@ public final class EquipmentSlotGroup implements Predicate<EquipmentSlot> {
@@ -25,7 +25,8 @@ 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 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
//
private final String key;