Updated Upstream (Bukkit/CraftBukkit/Spigot) (#11561)

Updated Upstream (Bukkit/CraftBukkit/Spigot)

Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
b9df8e9f SPIGOT-7933: Improve custom Minecart max speed
fc496179 Fix InstrumentTest
7c0ec598 PR-1075: Make Art an interface
c389f5a4 PR-1074: Make Sound an interface

CraftBukkit Changes:
df1efc0bb SPIGOT-7945: `Bukkit#dispatchCommand` throws `UnsupportedOperationException`
285df6e85 SPIGOT-7933: Improve custom Minecart max speed
a0f3d4e50 SPIGOT-7940: Recipe book errors after reload
9e0618ec2 SPIGOT-7937: Cannot spawn minecart during world generation with minecart_improvements enabled
1eb4d28da SPIGOT-7941: Fix resistance over 4 amplify causing issues in damage
52b99158a PR-1504: Make Art an interface
e18ae35f1 PR-1502: Make Sound an interface

Spigot Changes:
e65d67a7 SPIGOT-7934: Item entities start "bouncing" under certain conditions
This commit is contained in:
Jake Potrebic
2024-11-04 09:42:38 -08:00
parent 75993b6fb4
commit 071b776261
25 changed files with 12102 additions and 92 deletions

View File

@@ -211,6 +211,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/org/bukkit/Registry.java
+++ b/src/main/java/org/bukkit/Registry.java
@@ -0,0 +0,0 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
* Server art.
*
* @see Art
+ * @deprecated use {@link io.papermc.paper.registry.RegistryAccess#getRegistry(io.papermc.paper.registry.RegistryKey)} with {@link io.papermc.paper.registry.RegistryKey#PAINTING_VARIANT}
*/
- Registry<Art> ART = Objects.requireNonNull(Bukkit.getRegistry(Art.class), "No registry present for Art. This is a bug.");
+ @Deprecated(since = "1.21.3") // Paper
+ Registry<Art> ART = Objects.requireNonNull(io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(Art.class), "No registry present for Art. This is a bug.");
/**
* Attribute.
*
* @see Attribute
@@ -320,7 +329,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
/**
* Sound keys.
*
@@ -0,0 +0,0 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
* @see Sound
*/
- Registry<Sound> SOUNDS = Objects.requireNonNull(Bukkit.getRegistry(Sound.class), "No registry present for Sound. This is a bug.");
+ Registry<Sound> SOUNDS = io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(io.papermc.paper.registry.RegistryKey.SOUND_EVENT); // Paper
/**
* Trim materials.
*
* @see TrimMaterial

View File

@@ -1498,23 +1498,23 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/org/bukkit/Sound.java
+++ b/src/main/java/org/bukkit/Sound.java
@@ -0,0 +0,0 @@ import org.jetbrains.annotations.NotNull;
* guarantee values will not be removed from this Enum. As such, you should not
* guarantee values will not be removed from this interface. As such, you should not
* depend on the ordinal values of this class.
*/
-public enum Sound implements Keyed {
+public enum Sound implements Keyed, net.kyori.adventure.sound.Sound.Type { // Paper - implement Sound.Type
-public interface Sound extends OldEnum<Sound>, Keyed {
+public interface Sound extends OldEnum<Sound>, Keyed, net.kyori.adventure.sound.Sound.Type { // Paper - implement Sound.Type
AMBIENT_BASALT_DELTAS_ADDITIONS("ambient.basalt_deltas.additions"),
AMBIENT_BASALT_DELTAS_LOOP("ambient.basalt_deltas.loop"),
@@ -0,0 +0,0 @@ public enum Sound implements Keyed {
public NamespacedKey getKey() {
return key;
Sound AMBIENT_BASALT_DELTAS_ADDITIONS = getSound("ambient.basalt_deltas.additions");
Sound AMBIENT_BASALT_DELTAS_LOOP = getSound("ambient.basalt_deltas.loop");
@@ -0,0 +0,0 @@ public interface Sound extends OldEnum<Sound>, Keyed {
static Sound[] values() {
return Lists.newArrayList(Registry.SOUNDS).toArray(new Sound[0]);
}
+
+ // Paper start
+ @Override
+ public net.kyori.adventure.key.@NotNull Key key() {
+ return this.key;
+ default net.kyori.adventure.key.@NotNull Key key() {
+ return this.getKey();
+ }
+ // Paper end
}

View File

@@ -214,6 +214,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ * @see io.papermc.paper.registry.keys.FluidKeys
+ */
+ RegistryKey<Fluid> FLUID = create("fluid");
+ /**
+ * Built-in registry for sound events.
+ * @see io.papermc.paper.registry.keys.SoundEventKeys
+ */
+ RegistryKey<Sound> SOUND_EVENT = create("sound_event");
+
+
+
@@ -265,16 +270,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ * @see io.papermc.paper.registry.keys.BannerPatternKeys
+ */
+ RegistryKey<PatternType> BANNER_PATTERN = create("banner_pattern");
+ /**
+ * Data-driven registry for painting variants.
+ * @see io.papermc.paper.registry.keys.PaintingVariantKeys
+ */
+ RegistryKey<Art> PAINTING_VARIANT = create("painting_variant");
+
+
+ /* ******************* *
+ * API-only Registries *
+ * ******************* */
+ RegistryKey<Art> PAINTING_VARIANT = create("painting_variant");
+ RegistryKey<EntityType> ENTITY_TYPE = create("entity_type");
+ RegistryKey<Particle> PARTICLE_TYPE = create("particle_type");
+ RegistryKey<PotionType> POTION = create("potion");
+ RegistryKey<Sound> SOUND_EVENT = create("sound_event");
+ RegistryKey<MemoryKey<?>> MEMORY_MODULE_TYPE = create("memory_module_type");
+}
diff --git a/src/main/java/io/papermc/paper/registry/RegistryKeyImpl.java b/src/main/java/io/papermc/paper/registry/RegistryKeyImpl.java

View File

@@ -11,34 +11,6 @@ that continues to have use (internally).
These do not help plugin developers if they bring moise noise than value.
diff --git a/src/main/java/org/bukkit/Art.java b/src/main/java/org/bukkit/Art.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/Art.java
+++ b/src/main/java/org/bukkit/Art.java
@@ -0,0 +0,0 @@ public enum Art implements Keyed {
* Get the ID of this painting.
*
* @return The ID of this painting
- * @deprecated Magic value
+ * @apiNote Internal Use Only
*/
- @Deprecated
+ @org.jetbrains.annotations.ApiStatus.Internal // Paper
public int getId() {
return id;
}
@@ -0,0 +0,0 @@ public enum Art implements Keyed {
*
* @param id The ID
* @return The painting
- * @deprecated Magic value
+ * @apiNote Internal Use Only
*/
- @Deprecated
+ @org.jetbrains.annotations.ApiStatus.Internal // Paper
@Nullable
public static Art getById(int id) {
return BY_ID.get(id);
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/Bukkit.java

View File

@@ -13,9 +13,9 @@ diff --git a/src/main/java/org/bukkit/Art.java b/src/main/java/org/bukkit/Art.ja
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/Art.java
+++ b/src/main/java/org/bukkit/Art.java
@@ -0,0 +0,0 @@ public enum Art implements Keyed {
return id;
}
@@ -0,0 +0,0 @@ public interface Art extends OldEnum<Art>, Keyed {
@Deprecated(since = "1.6.2")
int getId();
+ // Paper start - deprecate getKey
+ /**
@@ -23,10 +23,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ * and {@link io.papermc.paper.registry.RegistryKey#PAINTING_VARIANT}. Painting variants can exist without a key.
+ */
+ @Deprecated(since = "1.21")
+ @Override
+ @NotNull NamespacedKey getKey();
+ // Paper end - deprecate getKey
@NotNull
@Override
public NamespacedKey getKey() {
+
/**
* Get a painting by its numeric ID
*
diff --git a/src/main/java/org/bukkit/MusicInstrument.java b/src/main/java/org/bukkit/MusicInstrument.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/MusicInstrument.java
@@ -149,8 +152,8 @@ diff --git a/src/main/java/org/bukkit/Sound.java b/src/main/java/org/bukkit/Soun
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/Sound.java
+++ b/src/main/java/org/bukkit/Sound.java
@@ -0,0 +0,0 @@ public enum Sound implements Keyed, net.kyori.adventure.sound.Sound.Type { // Pa
this.key = NamespacedKey.minecraft(key);
@@ -0,0 +0,0 @@ public interface Sound extends OldEnum<Sound>, Keyed, net.kyori.adventure.sound.
return sound;
}
+ // Paper start - deprecate getKey
@@ -159,10 +162,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ * can exist without a key.
+ */
+ @Deprecated(since = "1.20.5")
+ @Override
+ @NotNull NamespacedKey getKey();
+ // Paper end - deprecate getKey
@NotNull
@Override
public NamespacedKey getKey() {
+
/**
* @return an array of all known sounds.
* @deprecated use {@link Registry#iterator()}.
diff --git a/src/main/java/org/bukkit/block/banner/PatternType.java b/src/main/java/org/bukkit/block/banner/PatternType.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/block/banner/PatternType.java

View File

@@ -99,17 +99,27 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public static Instrument getByType(final byte type) {
return BY_DATA.get(type);
diff --git a/src/test/java/org/bukkit/InstrumentTest.java b/src/test/java/org/bukkit/InstrumentTest.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
deleted file mode 100644
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
--- a/src/test/java/org/bukkit/InstrumentTest.java
+++ b/src/test/java/org/bukkit/InstrumentTest.java
@@ -0,0 +0,0 @@ public class InstrumentTest {
@Test
public void getByType() {
for (Instrument instrument : Instrument.values()) {
+++ /dev/null
@@ -0,0 +0,0 @@
-package org.bukkit;
-
-import static org.bukkit.support.MatcherAssert.*;
-import static org.hamcrest.CoreMatchers.*;
-import org.bukkit.support.AbstractTestingBase;
-import org.junit.jupiter.api.Test;
-
-public class InstrumentTest extends AbstractTestingBase {
- @Test
- public void getByType() {
- for (Instrument instrument : Instrument.values()) {
- if (instrument.getType() < 0) {
- continue;
- }
+ // Paper - byte magic values are still used
assertThat(Instrument.getByType(instrument.getType()), is(instrument));
}
-
- assertThat(Instrument.getByType(instrument.getType()), is(instrument));
- }
- }
-}