13
0
geforkt von Mirrors/Paper

Fix body equipmentslot and effect enum

Dieser Commit ist enthalten in:
Nassim Jahnke 2024-06-14 18:53:32 +02:00
Ursprung 038f8d915e
Commit 66f7b672ed
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: EF6771C01F6EF02F
6 geänderte Dateien mit 44 neuen und 17 gelöschten Zeilen

Datei anzeigen

@ -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()) {

Datei anzeigen

@ -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;

Datei anzeigen

@ -74,7 +74,7 @@ index 9051f0186c09eeb8ecccf62b0116f6da1800a1df..b231f90317fe7df9133674b12d478735
private Optional<ResourceLocation> randomSequence;
diff --git a/src/test/java/org/bukkit/DyeColorsTest.java b/src/test/java/org/bukkit/DyeColorsTest.java
index dfc3e4f5a5cfee0456097a44d579587719a231a7..4e1b6c009fe82e970a32dbdb564763c3f9081b2c 100644
index dfc3e4f5a5cfee0456097a44d579587719a231a7..9342abe7853a611776684c1eb0b24164148cb5f2 100644
--- a/src/test/java/org/bukkit/DyeColorsTest.java
+++ b/src/test/java/org/bukkit/DyeColorsTest.java
@@ -3,7 +3,6 @@ package org.bukkit;
@ -90,7 +90,7 @@ index dfc3e4f5a5cfee0456097a44d579587719a231a7..4e1b6c009fe82e970a32dbdb564763c3
public void checkColor(DyeColor dye) {
Color color = dye.getColor();
- 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);
assertThat(color, is(nmsColor));
}

Datei anzeigen

@ -31,7 +31,7 @@ index f276414e9e81abf8f1f80991ebd5ab43472e07b1..7a0f2391a464eeebc5e57856300bc000
}
diff --git a/src/test/java/io/papermc/paper/registry/RegistryKeyTest.java b/src/test/java/io/papermc/paper/registry/RegistryKeyTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..e070aa1bb69859224493d958621389ee757f8752
index 0000000000000000000000000000000000000000..e1c14886064cde56be7fcd8f22a6ecb2d222a762
--- /dev/null
+++ b/src/test/java/io/papermc/paper/registry/RegistryKeyTest.java
@@ -0,0 +1,33 @@
@ -63,7 +63,7 @@ index 0000000000000000000000000000000000000000..e070aa1bb69859224493d958621389ee
+ @ParameterizedTest
+ @MethodSource("data")
+ 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());
+
+ }

Datei anzeigen

@ -60,7 +60,7 @@ index 0000000000000000000000000000000000000000..d926ad804355ee2fdc5910b2505e8671
+}
diff --git a/src/main/java/com/destroystokyo/paper/network/StandardPaperServerListPingEventImpl.java b/src/main/java/com/destroystokyo/paper/network/StandardPaperServerListPingEventImpl.java
new file mode 100644
index 0000000000000000000000000000000000000000..aa2aff62c873ba85b0cbced5382398c858420e59
index 0000000000000000000000000000000000000000..874dcbefea469440a9028ddc399a37c929429f62
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/network/StandardPaperServerListPingEventImpl.java
@@ -0,0 +1,97 @@

Datei anzeigen

@ -898,7 +898,7 @@ index 0000000000000000000000000000000000000000..b9d00e65639521eecd44bd2be3e01226
+ }
+}
diff --git a/src/test/java/io/papermc/paper/registry/RegistryKeyTest.java b/src/test/java/io/papermc/paper/registry/RegistryKeyTest.java
index e070aa1bb69859224493d958621389ee757f8752..311837ac7cea6b75eedee01bf893317a8763cdf9 100644
index e1c14886064cde56be7fcd8f22a6ecb2d222a762..f4da2afd8977030e3200ac5d4bf51b7206a90bd7 100644
--- a/src/test/java/io/papermc/paper/registry/RegistryKeyTest.java
+++ b/src/test/java/io/papermc/paper/registry/RegistryKeyTest.java
@@ -1,15 +1,18 @@
@ -922,7 +922,7 @@ index e070aa1bb69859224493d958621389ee757f8752..311837ac7cea6b75eedee01bf893317a
class RegistryKeyTest extends AbstractTestingBase {
@@ -28,6 +31,12 @@ class RegistryKeyTest extends AbstractTestingBase {
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());
+ }