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

@ -0,0 +1,392 @@
package io.papermc.paper.registry.keys;
import static net.kyori.adventure.key.Key.key;
import io.papermc.paper.generated.GeneratedFrom;
import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.TypedKey;
import net.kyori.adventure.key.Key;
import org.bukkit.Art;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.jetbrains.annotations.ApiStatus;
/**
* Vanilla keys for {@link RegistryKey#PAINTING_VARIANT}.
*
* @apiNote The fields provided here are a direct representation of
* what is available from the vanilla game source. They may be
* changed (including removals) on any Minecraft version
* bump, so cross-version compatibility is not provided on the
* same level as it is on most of the other API.
*/
@SuppressWarnings({
"unused",
"SpellCheckingInspection"
})
@GeneratedFrom("1.21.3")
@ApiStatus.Experimental
public final class PaintingVariantKeys {
/**
* {@code minecraft:alban}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Art> ALBAN = create(key("alban"));
/**
* {@code minecraft:aztec}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Art> AZTEC = create(key("aztec"));
/**
* {@code minecraft:aztec2}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Art> AZTEC2 = create(key("aztec2"));
/**
* {@code minecraft:backyard}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Art> BACKYARD = create(key("backyard"));
/**
* {@code minecraft:baroque}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Art> BAROQUE = create(key("baroque"));
/**
* {@code minecraft:bomb}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Art> BOMB = create(key("bomb"));
/**
* {@code minecraft:bouquet}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Art> BOUQUET = create(key("bouquet"));
/**
* {@code minecraft:burning_skull}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Art> BURNING_SKULL = create(key("burning_skull"));
/**
* {@code minecraft:bust}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Art> BUST = create(key("bust"));
/**
* {@code minecraft:cavebird}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Art> CAVEBIRD = create(key("cavebird"));
/**
* {@code minecraft:changing}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Art> CHANGING = create(key("changing"));
/**
* {@code minecraft:cotan}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Art> COTAN = create(key("cotan"));
/**
* {@code minecraft:courbet}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Art> COURBET = create(key("courbet"));
/**
* {@code minecraft:creebet}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Art> CREEBET = create(key("creebet"));
/**
* {@code minecraft:donkey_kong}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Art> DONKEY_KONG = create(key("donkey_kong"));
/**
* {@code minecraft:earth}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Art> EARTH = create(key("earth"));
/**
* {@code minecraft:endboss}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Art> ENDBOSS = create(key("endboss"));
/**
* {@code minecraft:fern}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Art> FERN = create(key("fern"));
/**
* {@code minecraft:fighters}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Art> FIGHTERS = create(key("fighters"));
/**
* {@code minecraft:finding}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Art> FINDING = create(key("finding"));
/**
* {@code minecraft:fire}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Art> FIRE = create(key("fire"));
/**
* {@code minecraft:graham}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Art> GRAHAM = create(key("graham"));
/**
* {@code minecraft:humble}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Art> HUMBLE = create(key("humble"));
/**
* {@code minecraft:kebab}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Art> KEBAB = create(key("kebab"));
/**
* {@code minecraft:lowmist}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Art> LOWMIST = create(key("lowmist"));
/**
* {@code minecraft:match}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Art> MATCH = create(key("match"));
/**
* {@code minecraft:meditative}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Art> MEDITATIVE = create(key("meditative"));
/**
* {@code minecraft:orb}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Art> ORB = create(key("orb"));
/**
* {@code minecraft:owlemons}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Art> OWLEMONS = create(key("owlemons"));
/**
* {@code minecraft:passage}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Art> PASSAGE = create(key("passage"));
/**
* {@code minecraft:pigscene}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Art> PIGSCENE = create(key("pigscene"));
/**
* {@code minecraft:plant}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Art> PLANT = create(key("plant"));
/**
* {@code minecraft:pointer}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Art> POINTER = create(key("pointer"));
/**
* {@code minecraft:pond}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Art> POND = create(key("pond"));
/**
* {@code minecraft:pool}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Art> POOL = create(key("pool"));
/**
* {@code minecraft:prairie_ride}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Art> PRAIRIE_RIDE = create(key("prairie_ride"));
/**
* {@code minecraft:sea}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Art> SEA = create(key("sea"));
/**
* {@code minecraft:skeleton}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Art> SKELETON = create(key("skeleton"));
/**
* {@code minecraft:skull_and_roses}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Art> SKULL_AND_ROSES = create(key("skull_and_roses"));
/**
* {@code minecraft:stage}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Art> STAGE = create(key("stage"));
/**
* {@code minecraft:sunflowers}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Art> SUNFLOWERS = create(key("sunflowers"));
/**
* {@code minecraft:sunset}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Art> SUNSET = create(key("sunset"));
/**
* {@code minecraft:tides}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Art> TIDES = create(key("tides"));
/**
* {@code minecraft:unpacked}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Art> UNPACKED = create(key("unpacked"));
/**
* {@code minecraft:void}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Art> VOID = create(key("void"));
/**
* {@code minecraft:wanderer}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Art> WANDERER = create(key("wanderer"));
/**
* {@code minecraft:wasteland}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Art> WASTELAND = create(key("wasteland"));
/**
* {@code minecraft:water}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Art> WATER = create(key("water"));
/**
* {@code minecraft:wind}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Art> WIND = create(key("wind"));
/**
* {@code minecraft:wither}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Art> WITHER = create(key("wither"));
private PaintingVariantKeys() {
}
/**
* Creates a key for {@link Art} in the registry {@code minecraft:painting_variant}.
*
* @param key the value's key in the registry
* @return a new typed key
*/
@ApiStatus.Experimental
public static @NonNull TypedKey<Art> create(final @NonNull Key key) {
return TypedKey.create(RegistryKey.PAINTING_VARIANT, key);
}
}

File diff suppressed because it is too large Load Diff

View File

@ -8,10 +8,12 @@ import io.papermc.paper.registry.RegistryKey;
import net.minecraft.core.Registry; import net.minecraft.core.Registry;
import net.minecraft.core.registries.Registries; import net.minecraft.core.registries.Registries;
import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceKey;
import org.bukkit.Art;
import org.bukkit.Fluid; import org.bukkit.Fluid;
import org.bukkit.GameEvent; import org.bukkit.GameEvent;
import org.bukkit.JukeboxSong; import org.bukkit.JukeboxSong;
import org.bukkit.MusicInstrument; import org.bukkit.MusicInstrument;
import org.bukkit.Sound;
import org.bukkit.attribute.Attribute; import org.bukkit.attribute.Attribute;
import org.bukkit.block.Biome; import org.bukkit.block.Biome;
import org.bukkit.block.BlockType; import org.bukkit.block.BlockType;
@ -49,6 +51,7 @@ public interface Generators {
simpleKey("MenuTypeKeys", MenuType.class, Registries.MENU, RegistryKey.MENU, false), simpleKey("MenuTypeKeys", MenuType.class, Registries.MENU, RegistryKey.MENU, false),
simpleKey("AttributeKeys", Attribute.class, Registries.ATTRIBUTE, RegistryKey.ATTRIBUTE, false), simpleKey("AttributeKeys", Attribute.class, Registries.ATTRIBUTE, RegistryKey.ATTRIBUTE, false),
simpleKey("FluidKeys", Fluid.class, Registries.FLUID, RegistryKey.FLUID, false), simpleKey("FluidKeys", Fluid.class, Registries.FLUID, RegistryKey.FLUID, false),
simpleKey("SoundEventKeys", Sound.class, Registries.SOUND_EVENT, RegistryKey.SOUND_EVENT, false),
// data-driven // data-driven
simpleKey("BiomeKeys", Biome.class, Registries.BIOME, RegistryKey.BIOME, true), simpleKey("BiomeKeys", Biome.class, Registries.BIOME, RegistryKey.BIOME, true),
@ -60,6 +63,7 @@ public interface Generators {
simpleKey("EnchantmentKeys", Enchantment.class, Registries.ENCHANTMENT, RegistryKey.ENCHANTMENT, false), simpleKey("EnchantmentKeys", Enchantment.class, Registries.ENCHANTMENT, RegistryKey.ENCHANTMENT, false),
simpleKey("JukeboxSongKeys", JukeboxSong.class, Registries.JUKEBOX_SONG, RegistryKey.JUKEBOX_SONG, true), simpleKey("JukeboxSongKeys", JukeboxSong.class, Registries.JUKEBOX_SONG, RegistryKey.JUKEBOX_SONG, true),
simpleKey("BannerPatternKeys", PatternType.class, Registries.BANNER_PATTERN, RegistryKey.BANNER_PATTERN, true), simpleKey("BannerPatternKeys", PatternType.class, Registries.BANNER_PATTERN, RegistryKey.BANNER_PATTERN, true),
simpleKey("PaintingVariantKeys", Art.class, Registries.PAINTING_VARIANT, RegistryKey.PAINTING_VARIANT, true),
// tags // tags
simpleTagKey("EnchantmentTagKeys", Enchantment.class, Registries.ENCHANTMENT, RegistryKey.ENCHANTMENT), simpleTagKey("EnchantmentTagKeys", Enchantment.class, Registries.ENCHANTMENT, RegistryKey.ENCHANTMENT),

View File

@ -211,6 +211,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/org/bukkit/Registry.java --- a/src/main/java/org/bukkit/Registry.java
+++ b/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> { @@ -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. * Attribute.
* *
* @see Attribute * @see Attribute
@ -320,7 +329,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
/** /**
* Sound keys. * 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. * Trim materials.
* *
* @see TrimMaterial * @see TrimMaterial

View File

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

View File

@ -214,6 +214,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ * @see io.papermc.paper.registry.keys.FluidKeys + * @see io.papermc.paper.registry.keys.FluidKeys
+ */ + */
+ RegistryKey<Fluid> FLUID = create("fluid"); + 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 + * @see io.papermc.paper.registry.keys.BannerPatternKeys
+ */ + */
+ RegistryKey<PatternType> BANNER_PATTERN = create("banner_pattern"); + 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 * + * API-only Registries *
+ * ******************* */ + * ******************* */
+ RegistryKey<Art> PAINTING_VARIANT = create("painting_variant");
+ RegistryKey<EntityType> ENTITY_TYPE = create("entity_type"); + RegistryKey<EntityType> ENTITY_TYPE = create("entity_type");
+ RegistryKey<Particle> PARTICLE_TYPE = create("particle_type"); + RegistryKey<Particle> PARTICLE_TYPE = create("particle_type");
+ RegistryKey<PotionType> POTION = create("potion"); + RegistryKey<PotionType> POTION = create("potion");
+ RegistryKey<Sound> SOUND_EVENT = create("sound_event");
+ RegistryKey<MemoryKey<?>> MEMORY_MODULE_TYPE = create("memory_module_type"); + 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 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. 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 diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/Bukkit.java --- 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 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/Art.java --- a/src/main/java/org/bukkit/Art.java
+++ b/src/main/java/org/bukkit/Art.java +++ b/src/main/java/org/bukkit/Art.java
@@ -0,0 +0,0 @@ public enum Art implements Keyed { @@ -0,0 +0,0 @@ public interface Art extends OldEnum<Art>, Keyed {
return id; @Deprecated(since = "1.6.2")
} int getId();
+ // Paper start - deprecate getKey + // 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. + * and {@link io.papermc.paper.registry.RegistryKey#PAINTING_VARIANT}. Painting variants can exist without a key.
+ */ + */
+ @Deprecated(since = "1.21") + @Deprecated(since = "1.21")
+ @Override
+ @NotNull NamespacedKey getKey();
+ // Paper end - deprecate 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 diff --git a/src/main/java/org/bukkit/MusicInstrument.java b/src/main/java/org/bukkit/MusicInstrument.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/MusicInstrument.java --- 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 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/Sound.java --- a/src/main/java/org/bukkit/Sound.java
+++ b/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 @@ -0,0 +0,0 @@ public interface Sound extends OldEnum<Sound>, Keyed, net.kyori.adventure.sound.
this.key = NamespacedKey.minecraft(key); return sound;
} }
+ // Paper start - deprecate getKey + // Paper start - deprecate getKey
@ -159,10 +162,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ * can exist without a key. + * can exist without a key.
+ */ + */
+ @Deprecated(since = "1.20.5") + @Deprecated(since = "1.20.5")
+ @Override
+ @NotNull NamespacedKey getKey();
+ // Paper end - deprecate 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 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 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/block/banner/PatternType.java --- 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) { public static Instrument getByType(final byte type) {
return BY_DATA.get(type); return BY_DATA.get(type);
diff --git a/src/test/java/org/bukkit/InstrumentTest.java b/src/test/java/org/bukkit/InstrumentTest.java 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 --- a/src/test/java/org/bukkit/InstrumentTest.java
+++ b/src/test/java/org/bukkit/InstrumentTest.java +++ /dev/null
@@ -0,0 +0,0 @@ public class InstrumentTest { @@ -0,0 +0,0 @@
@Test -package org.bukkit;
public void getByType() { -
for (Instrument instrument : Instrument.values()) { -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) { - if (instrument.getType() < 0) {
- continue; - continue;
- } - }
+ // Paper - byte magic values are still used -
- assertThat(Instrument.getByType(instrument.getType()), is(instrument));
assertThat(Instrument.getByType(instrument.getType()), is(instrument)); - }
} - }
-}

View File

@ -15,7 +15,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Paper start - API for updating recipes on clients + // Paper start - API for updating recipes on clients
+ this.reloadAdvancementData(); + this.reloadAdvancementData();
+ this.reloadTagData(); + this.reloadTagData();
+ this.reloadRecipeData(); + this.reloadRecipes();
+ } + }
+ public void reloadAdvancementData() { + public void reloadAdvancementData() {
+ // Paper end - API for updating recipes on clients + // Paper end - API for updating recipes on clients
@ -30,12 +30,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ } + }
+ public void reloadTagData() { + public void reloadTagData() {
this.broadcastAll(new ClientboundUpdateTagsPacket(TagNetworkSerialization.serializeTagsToNetwork(this.registries))); this.broadcastAll(new ClientboundUpdateTagsPacket(TagNetworkSerialization.serializeTagsToNetwork(this.registries)));
+ } // CraftBukkit start
+ public void reloadRecipeData() { - this.reloadRecipes();
+ // this.reloadRecipes(); // Paper - do not reload recipes just because tag data was reloaded
+ // Paper end - API for updating recipes on clients + // Paper end - API for updating recipes on clients
RecipeManager craftingmanager = this.server.getRecipeManager(); }
ClientboundUpdateRecipesPacket packetplayoutrecipeupdate = new ClientboundUpdateRecipesPacket(craftingmanager.getSynchronizedItemProperties(), craftingmanager.getSynchronizedStonecutterRecipes());
Iterator iterator1 = this.players.iterator(); public void reloadRecipes() {
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@ -52,7 +53,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ +
+ @Override + @Override
+ public void updateRecipes() { + public void updateRecipes() {
+ this.playerList.reloadRecipeData(); + this.playerList.reloadRecipes();
+ } + }
+ // Paper end - API for updating recipes on clients + // Paper end - API for updating recipes on clients
+ +
@ -79,7 +80,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
toAdd.addToCraftingManager(); toAdd.addToCraftingManager();
+ // Paper start - API for updating recipes on clients + // Paper start - API for updating recipes on clients
+ if (true || resendRecipes) { // Always needs to be resent now... TODO + if (true || resendRecipes) { // Always needs to be resent now... TODO
+ this.playerList.reloadRecipeData(); + this.playerList.reloadRecipes();
+ } + }
+ // Paper end - API for updating recipes on clients + // Paper end - API for updating recipes on clients
return true; return true;
@ -103,7 +104,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ final ResourceKey<net.minecraft.world.item.crafting.Recipe<?>> minecraftKey = CraftRecipe.toMinecraft(recipeKey); + final ResourceKey<net.minecraft.world.item.crafting.Recipe<?>> minecraftKey = CraftRecipe.toMinecraft(recipeKey);
+ final boolean removed = this.getServer().getRecipeManager().removeRecipe(minecraftKey); + final boolean removed = this.getServer().getRecipeManager().removeRecipe(minecraftKey);
+ if (removed/* && resendRecipes*/) { // TODO Always need to resend them rn - deprecate this method? + if (removed/* && resendRecipes*/) { // TODO Always need to resend them rn - deprecate this method?
+ this.playerList.reloadRecipeData(); + this.playerList.reloadRecipes();
+ } + }
+ return removed; + return removed;
+ // Paper end - resend recipes on successful removal + // Paper end - resend recipes on successful removal

View File

@ -28,7 +28,7 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecart.java b/sr
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecart.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecart.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecart.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecart.java
@@ -0,0 +0,0 @@ package org.bukkit.craftbukkit.entity; @@ -0,0 +0,0 @@ import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.entity.vehicle.AbstractMinecart; import net.minecraft.world.entity.vehicle.AbstractMinecart;
import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;

View File

@ -28,19 +28,23 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+import net.minecraft.core.Registry; +import net.minecraft.core.Registry;
+import net.minecraft.core.registries.Registries; +import net.minecraft.core.registries.Registries;
+import net.minecraft.resources.ResourceKey; +import net.minecraft.resources.ResourceKey;
+import org.bukkit.Art;
+import org.bukkit.Fluid; +import org.bukkit.Fluid;
+import org.bukkit.GameEvent; +import org.bukkit.GameEvent;
+import org.bukkit.JukeboxSong; +import org.bukkit.JukeboxSong;
+import org.bukkit.Keyed; +import org.bukkit.Keyed;
+import org.bukkit.MusicInstrument; +import org.bukkit.MusicInstrument;
+import org.bukkit.Sound;
+import org.bukkit.attribute.Attribute; +import org.bukkit.attribute.Attribute;
+import org.bukkit.block.Biome; +import org.bukkit.block.Biome;
+import org.bukkit.block.BlockType; +import org.bukkit.block.BlockType;
+import org.bukkit.block.banner.PatternType; +import org.bukkit.block.banner.PatternType;
+import org.bukkit.craftbukkit.CraftArt;
+import org.bukkit.craftbukkit.CraftFluid; +import org.bukkit.craftbukkit.CraftFluid;
+import org.bukkit.craftbukkit.CraftGameEvent; +import org.bukkit.craftbukkit.CraftGameEvent;
+import org.bukkit.craftbukkit.CraftJukeboxSong; +import org.bukkit.craftbukkit.CraftJukeboxSong;
+import org.bukkit.craftbukkit.CraftMusicInstrument; +import org.bukkit.craftbukkit.CraftMusicInstrument;
+import org.bukkit.craftbukkit.CraftSound;
+import org.bukkit.craftbukkit.attribute.CraftAttribute; +import org.bukkit.craftbukkit.attribute.CraftAttribute;
+import org.bukkit.craftbukkit.block.CraftBiome; +import org.bukkit.craftbukkit.block.CraftBiome;
+import org.bukkit.craftbukkit.block.CraftBlockType; +import org.bukkit.craftbukkit.block.CraftBlockType;
@ -106,6 +110,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ entry(Registries.MENU, RegistryKey.MENU, MenuType.class, CraftMenuType::new), + entry(Registries.MENU, RegistryKey.MENU, MenuType.class, CraftMenuType::new),
+ entry(Registries.ATTRIBUTE, RegistryKey.ATTRIBUTE, Attribute.class, CraftAttribute::new), + entry(Registries.ATTRIBUTE, RegistryKey.ATTRIBUTE, Attribute.class, CraftAttribute::new),
+ entry(Registries.FLUID, RegistryKey.FLUID, Fluid.class, CraftFluid::new), + entry(Registries.FLUID, RegistryKey.FLUID, Fluid.class, CraftFluid::new),
+ entry(Registries.SOUND_EVENT, RegistryKey.SOUND_EVENT, Sound.class, CraftSound::new),
+ +
+ // data-drivens + // data-drivens
+ entry(Registries.BIOME, RegistryKey.BIOME, Biome.class, CraftBiome::new).delayed(), + entry(Registries.BIOME, RegistryKey.BIOME, Biome.class, CraftBiome::new).delayed(),
@ -117,13 +122,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ entry(Registries.ENCHANTMENT, RegistryKey.ENCHANTMENT, Enchantment.class, CraftEnchantment::new).withSerializationUpdater(FieldRename.ENCHANTMENT_RENAME).delayed(), + entry(Registries.ENCHANTMENT, RegistryKey.ENCHANTMENT, Enchantment.class, CraftEnchantment::new).withSerializationUpdater(FieldRename.ENCHANTMENT_RENAME).delayed(),
+ entry(Registries.JUKEBOX_SONG, RegistryKey.JUKEBOX_SONG, JukeboxSong.class, CraftJukeboxSong::new).delayed(), + entry(Registries.JUKEBOX_SONG, RegistryKey.JUKEBOX_SONG, JukeboxSong.class, CraftJukeboxSong::new).delayed(),
+ entry(Registries.BANNER_PATTERN, RegistryKey.BANNER_PATTERN, PatternType.class, CraftPatternType::new).delayed(), + entry(Registries.BANNER_PATTERN, RegistryKey.BANNER_PATTERN, PatternType.class, CraftPatternType::new).delayed(),
+ entry(Registries.PAINTING_VARIANT, RegistryKey.PAINTING_VARIANT, Art.class, CraftArt::new).delayed(),
+ +
+ // api-only + // api-only
+ apiOnly(Registries.PAINTING_VARIANT, RegistryKey.PAINTING_VARIANT, () -> org.bukkit.Registry.ART),
+ apiOnly(Registries.ENTITY_TYPE, RegistryKey.ENTITY_TYPE, () -> org.bukkit.Registry.ENTITY_TYPE), + apiOnly(Registries.ENTITY_TYPE, RegistryKey.ENTITY_TYPE, () -> org.bukkit.Registry.ENTITY_TYPE),
+ apiOnly(Registries.PARTICLE_TYPE, RegistryKey.PARTICLE_TYPE, () -> org.bukkit.Registry.PARTICLE_TYPE), + apiOnly(Registries.PARTICLE_TYPE, RegistryKey.PARTICLE_TYPE, () -> org.bukkit.Registry.PARTICLE_TYPE),
+ apiOnly(Registries.POTION, RegistryKey.POTION, () -> org.bukkit.Registry.POTION), + apiOnly(Registries.POTION, RegistryKey.POTION, () -> org.bukkit.Registry.POTION),
+ apiOnly(Registries.SOUND_EVENT, RegistryKey.SOUND_EVENT, () -> org.bukkit.Registry.SOUNDS),
+ apiOnly(Registries.MEMORY_MODULE_TYPE, RegistryKey.MEMORY_MODULE_TYPE, () -> (org.bukkit.Registry<MemoryKey<?>>) (org.bukkit.Registry) org.bukkit.Registry.MEMORY_MODULE_TYPE) + apiOnly(Registries.MEMORY_MODULE_TYPE, RegistryKey.MEMORY_MODULE_TYPE, () -> (org.bukkit.Registry<MemoryKey<?>>) (org.bukkit.Registry) org.bukkit.Registry.MEMORY_MODULE_TYPE)
+ ); + );
+ final Map<RegistryKey<?>, RegistryEntry<?, ?>> byRegistryKey = new IdentityHashMap<>(REGISTRY_ENTRIES.size()); + final Map<RegistryKey<?>, RegistryEntry<?, ?>> byRegistryKey = new IdentityHashMap<>(REGISTRY_ENTRIES.size());
@ -764,6 +768,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- * @return the bukkit registry of the provided class - * @return the bukkit registry of the provided class
- */ - */
- public static <B extends Keyed> Registry<?> createRegistry(Class<? super B> bukkitClass, RegistryAccess registryHolder) { - public static <B extends Keyed> Registry<?> createRegistry(Class<? super B> bukkitClass, RegistryAccess registryHolder) {
- if (bukkitClass == Art.class) {
- return new CraftRegistry<>(Art.class, registryHolder.lookupOrThrow(Registries.PAINTING_VARIANT), CraftArt::new, FieldRename.NONE);
- }
- if (bukkitClass == Attribute.class) { - if (bukkitClass == Attribute.class) {
- return new CraftRegistry<>(Attribute.class, registryHolder.lookupOrThrow(Registries.ATTRIBUTE), CraftAttribute::new, FieldRename.ATTRIBUTE_RENAME); - return new CraftRegistry<>(Attribute.class, registryHolder.lookupOrThrow(Registries.ATTRIBUTE), CraftAttribute::new, FieldRename.ATTRIBUTE_RENAME);
- } - }
@ -788,6 +795,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- if (bukkitClass == PotionEffectType.class) { - if (bukkitClass == PotionEffectType.class) {
- return new CraftRegistry<>(PotionEffectType.class, registryHolder.lookupOrThrow(Registries.MOB_EFFECT), CraftPotionEffectType::new, FieldRename.NONE); - return new CraftRegistry<>(PotionEffectType.class, registryHolder.lookupOrThrow(Registries.MOB_EFFECT), CraftPotionEffectType::new, FieldRename.NONE);
- } - }
- if (bukkitClass == Sound.class) {
- return new CraftRegistry<>(Sound.class, registryHolder.lookupOrThrow(Registries.SOUND_EVENT), CraftSound::new, FieldRename.NONE);
- }
- if (bukkitClass == Structure.class) { - if (bukkitClass == Structure.class) {
- return new CraftRegistry<>(Structure.class, registryHolder.lookupOrThrow(Registries.STRUCTURE), CraftStructure::new, FieldRename.NONE); - return new CraftRegistry<>(Structure.class, registryHolder.lookupOrThrow(Registries.STRUCTURE), CraftStructure::new, FieldRename.NONE);
- } - }
@ -1275,6 +1285,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
static { static {
- // Order: Bukkit class, Minecraft Registry key, CraftBukkit class, Minecraft class - // Order: Bukkit class, Minecraft Registry key, CraftBukkit class, Minecraft class
- register(Art.class, Registries.PAINTING_VARIANT, CraftArt.class, PaintingVariant.class);
- register(Attribute.class, Registries.ATTRIBUTE, CraftAttribute.class, net.minecraft.world.entity.ai.attributes.Attribute.class); - register(Attribute.class, Registries.ATTRIBUTE, CraftAttribute.class, net.minecraft.world.entity.ai.attributes.Attribute.class);
- register(Biome.class, Registries.BIOME, CraftBiome.class, net.minecraft.world.level.biome.Biome.class); - register(Biome.class, Registries.BIOME, CraftBiome.class, net.minecraft.world.level.biome.Biome.class);
- register(Enchantment.class, Registries.ENCHANTMENT, CraftEnchantment.class, net.minecraft.world.item.enchantment.Enchantment.class); - register(Enchantment.class, Registries.ENCHANTMENT, CraftEnchantment.class, net.minecraft.world.item.enchantment.Enchantment.class);
@ -1283,6 +1294,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- register(MusicInstrument.class, Registries.INSTRUMENT, CraftMusicInstrument.class, Instrument.class); - register(MusicInstrument.class, Registries.INSTRUMENT, CraftMusicInstrument.class, Instrument.class);
- register(MenuType.class, Registries.MENU, CraftMenuType.class, net.minecraft.world.inventory.MenuType.class); - register(MenuType.class, Registries.MENU, CraftMenuType.class, net.minecraft.world.inventory.MenuType.class);
- register(PotionEffectType.class, Registries.MOB_EFFECT, CraftPotionEffectType.class, MobEffect.class); - register(PotionEffectType.class, Registries.MOB_EFFECT, CraftPotionEffectType.class, MobEffect.class);
- register(Sound.class, Registries.SOUND_EVENT, CraftSound.class, SoundEvent.class);
- register(Structure.class, Registries.STRUCTURE, CraftStructure.class, net.minecraft.world.level.levelgen.structure.Structure.class); - register(Structure.class, Registries.STRUCTURE, CraftStructure.class, net.minecraft.world.level.levelgen.structure.Structure.class);
- register(StructureType.class, Registries.STRUCTURE_TYPE, CraftStructureType.class, net.minecraft.world.level.levelgen.structure.StructureType.class); - register(StructureType.class, Registries.STRUCTURE_TYPE, CraftStructureType.class, net.minecraft.world.level.levelgen.structure.StructureType.class);
- register(Villager.Type.class, Registries.VILLAGER_TYPE, CraftVillager.CraftType.class, VillagerType.class); - register(Villager.Type.class, Registries.VILLAGER_TYPE, CraftVillager.CraftType.class, VillagerType.class);
@ -1300,6 +1312,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- register(PatternType.class, Registries.BANNER_PATTERN, CraftPatternType.class, BannerPattern.class); - register(PatternType.class, Registries.BANNER_PATTERN, CraftPatternType.class, BannerPattern.class);
- -
+ // Order: RegistryKey, Bukkit class, Minecraft Registry key, CraftBukkit class, Minecraft class + // Order: RegistryKey, Bukkit class, Minecraft Registry key, CraftBukkit class, Minecraft class
+ register(RegistryKey.PAINTING_VARIANT, Art.class, Registries.PAINTING_VARIANT, CraftArt.class, PaintingVariant.class);
+ register(RegistryKey.ATTRIBUTE, Attribute.class, Registries.ATTRIBUTE, CraftAttribute.class, net.minecraft.world.entity.ai.attributes.Attribute.class); + register(RegistryKey.ATTRIBUTE, Attribute.class, Registries.ATTRIBUTE, CraftAttribute.class, net.minecraft.world.entity.ai.attributes.Attribute.class);
+ register(RegistryKey.BIOME, Biome.class, Registries.BIOME, CraftBiome.class, net.minecraft.world.level.biome.Biome.class); + register(RegistryKey.BIOME, Biome.class, Registries.BIOME, CraftBiome.class, net.minecraft.world.level.biome.Biome.class);
+ register(RegistryKey.ENCHANTMENT, Enchantment.class, Registries.ENCHANTMENT, CraftEnchantment.class, net.minecraft.world.item.enchantment.Enchantment.class); + register(RegistryKey.ENCHANTMENT, Enchantment.class, Registries.ENCHANTMENT, CraftEnchantment.class, net.minecraft.world.item.enchantment.Enchantment.class);
@ -1307,6 +1320,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ register(RegistryKey.GAME_EVENT, GameEvent.class, Registries.GAME_EVENT, CraftGameEvent.class, net.minecraft.world.level.gameevent.GameEvent.class); + register(RegistryKey.GAME_EVENT, GameEvent.class, Registries.GAME_EVENT, CraftGameEvent.class, net.minecraft.world.level.gameevent.GameEvent.class);
+ register(RegistryKey.INSTRUMENT, MusicInstrument.class, Registries.INSTRUMENT, CraftMusicInstrument.class, Instrument.class); + register(RegistryKey.INSTRUMENT, MusicInstrument.class, Registries.INSTRUMENT, CraftMusicInstrument.class, Instrument.class);
+ register(RegistryKey.MOB_EFFECT, PotionEffectType.class, Registries.MOB_EFFECT, CraftPotionEffectType.class, MobEffect.class); + register(RegistryKey.MOB_EFFECT, PotionEffectType.class, Registries.MOB_EFFECT, CraftPotionEffectType.class, MobEffect.class);
+ register(RegistryKey.SOUND_EVENT, Sound.class, Registries.SOUND_EVENT, CraftSound.class, SoundEvent.class);
+ register(RegistryKey.STRUCTURE, Structure.class, Registries.STRUCTURE, CraftStructure.class, net.minecraft.world.level.levelgen.structure.Structure.class); + register(RegistryKey.STRUCTURE, Structure.class, Registries.STRUCTURE, CraftStructure.class, net.minecraft.world.level.levelgen.structure.Structure.class);
+ register(RegistryKey.STRUCTURE_TYPE, StructureType.class, Registries.STRUCTURE_TYPE, CraftStructureType.class, net.minecraft.world.level.levelgen.structure.StructureType.class); + register(RegistryKey.STRUCTURE_TYPE, StructureType.class, Registries.STRUCTURE_TYPE, CraftStructureType.class, net.minecraft.world.level.levelgen.structure.StructureType.class);
+ register(RegistryKey.VILLAGER_TYPE, Villager.Type.class, Registries.VILLAGER_TYPE, CraftVillager.CraftType.class, VillagerType.class); + register(RegistryKey.VILLAGER_TYPE, Villager.Type.class, Registries.VILLAGER_TYPE, CraftVillager.CraftType.class, VillagerType.class);

View File

@ -82,6 +82,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "place", "Allows the user to place features and structures", PermissionDefault.OP, commands); + DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "place", "Allows the user to place features and structures", PermissionDefault.OP, commands);
+ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "return", "Allows the user to use the /return command", PermissionDefault.OP, commands); + DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "return", "Allows the user to use the /return command", PermissionDefault.OP, commands);
+ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "random", "Allows the user to generate a random number", PermissionDefault.OP, commands); + DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "random", "Allows the user to generate a random number", PermissionDefault.OP, commands);
+ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "rotate", "Allows the user to change the rotation of entities", PermissionDefault.OP, commands);
+ // Paper end + // Paper end
DefaultPermissions.registerPermission("minecraft.admin.command_feedback", "Receive command broadcasts when sendCommandFeedback is true", PermissionDefault.OP, commands); DefaultPermissions.registerPermission("minecraft.admin.command_feedback", "Receive command broadcasts when sendCommandFeedback is true", PermissionDefault.OP, commands);

View File

@ -34,7 +34,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ writable(Registries.ENCHANTMENT, RegistryKey.ENCHANTMENT, Enchantment.class, CraftEnchantment::new, PaperEnchantmentRegistryEntry.PaperBuilder::new).withSerializationUpdater(FieldRename.ENCHANTMENT_RENAME).delayed(), + writable(Registries.ENCHANTMENT, RegistryKey.ENCHANTMENT, Enchantment.class, CraftEnchantment::new, PaperEnchantmentRegistryEntry.PaperBuilder::new).withSerializationUpdater(FieldRename.ENCHANTMENT_RENAME).delayed(),
entry(Registries.JUKEBOX_SONG, RegistryKey.JUKEBOX_SONG, JukeboxSong.class, CraftJukeboxSong::new).delayed(), entry(Registries.JUKEBOX_SONG, RegistryKey.JUKEBOX_SONG, JukeboxSong.class, CraftJukeboxSong::new).delayed(),
entry(Registries.BANNER_PATTERN, RegistryKey.BANNER_PATTERN, PatternType.class, CraftPatternType::new).delayed(), entry(Registries.BANNER_PATTERN, RegistryKey.BANNER_PATTERN, PatternType.class, CraftPatternType::new).delayed(),
entry(Registries.PAINTING_VARIANT, RegistryKey.PAINTING_VARIANT, Art.class, CraftArt::new).delayed(),
diff --git a/src/main/java/io/papermc/paper/registry/data/PaperEnchantmentRegistryEntry.java b/src/main/java/io/papermc/paper/registry/data/PaperEnchantmentRegistryEntry.java diff --git a/src/main/java/io/papermc/paper/registry/data/PaperEnchantmentRegistryEntry.java b/src/main/java/io/papermc/paper/registry/data/PaperEnchantmentRegistryEntry.java
new file mode 100644 new file mode 100644
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000

View File

@ -375,7 +375,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
import net.minecraft.world.entity.boss.EnderDragonPart; import net.minecraft.world.entity.boss.EnderDragonPart;
import net.minecraft.world.entity.boss.enderdragon.EndCrystal; import net.minecraft.world.entity.boss.enderdragon.EndCrystal;
import net.minecraft.world.entity.boss.enderdragon.EnderDragon; import net.minecraft.world.entity.boss.enderdragon.EnderDragon;
import net.minecraft.world.entity.boss.wither.WitherBoss; @@ -0,0 +0,0 @@ import net.minecraft.world.entity.boss.wither.WitherBoss;
import net.minecraft.world.entity.item.ItemEntity;
import net.minecraft.world.entity.item.PrimedTnt; import net.minecraft.world.entity.item.PrimedTnt;
import net.minecraft.world.entity.monster.Creeper; import net.minecraft.world.entity.monster.Creeper;
-import net.minecraft.world.entity.monster.Monster; -import net.minecraft.world.entity.monster.Monster;
@ -668,7 +669,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
/** /**
@@ -0,0 +0,0 @@ public class ActivationRange @@ -0,0 +0,0 @@ public class ActivationRange
if ( entity instanceof FireworkRocketEntity ) { if (entity instanceof FireworkRocketEntity || (entity instanceof ItemEntity && (entity.tickCount + entity.getId() + 1) % 4 == 0)) {
return true; return true;
} }
+ // Paper start - special case always immunities + // Paper start - special case always immunities
@ -705,8 +706,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
} }
+ // Paper end + // Paper end
isActive = true; isActive = true;
} else if (entity instanceof net.minecraft.world.entity.item.ItemEntity && (entity.tickCount + entity.getId()) % 4 == 0) { // Paper - Needed for item gravity, see ItemEntity tick }
isActive = true; }
diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/spigotmc/SpigotWorldConfig.java --- a/src/main/java/org/spigotmc/SpigotWorldConfig.java

View File

@ -8,9 +8,9 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/CraftSound.java b/src/main/jav
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftSound.java --- a/src/main/java/org/bukkit/craftbukkit/CraftSound.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftSound.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftSound.java
@@ -0,0 +0,0 @@ public class CraftSound { @@ -0,0 +0,0 @@ public class CraftSound implements Sound, Handleable<SoundEvent> {
throw new IllegalArgumentException("No Reference holder found for " + bukkit public int hashCode() {
+ ", this can happen if a plugin creates its own sound effect with out properly registering it."); return this.getKey().hashCode();
} }
+ +
+ // Paper start + // Paper start

View File

@ -25,11 +25,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/org/spigotmc/ActivationRange.java --- a/src/main/java/org/spigotmc/ActivationRange.java
+++ b/src/main/java/org/spigotmc/ActivationRange.java +++ b/src/main/java/org/spigotmc/ActivationRange.java
@@ -0,0 +0,0 @@ public class ActivationRange @@ -0,0 +0,0 @@ public class ActivationRange
entity.activatedTick = MinecraftServer.currentTick + 20;
} }
isActive = true; isActive = true;
+ } else if (entity instanceof net.minecraft.world.entity.item.ItemEntity && (entity.tickCount + entity.getId()) % 4 == 0) { // Paper - Needed for item gravity, see ItemEntity tick
+ isActive = true;
} }
- // Add a little performance juice to active entities. Skip 1/4 if not immune. - // Add a little performance juice to active entities. Skip 1/4 if not immune.
- } else if ( !entity.defaultActivationState && entity.tickCount % 4 == 0 && !ActivationRange.checkEntityImmunities( entity ) ) - } else if ( !entity.defaultActivationState && entity.tickCount % 4 == 0 && !ActivationRange.checkEntityImmunities( entity ) )

View File

@ -76,7 +76,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@Override @Override
public Art getArt() { public Art getArt() {
- return CraftArt.minecraftHolderToBukkit(this.getHandle().getVariant()); - return CraftArt.minecraftHolderToBukkit(this.getHandle().getVariant());
+ return org.bukkit.craftbukkit.CraftRegistry.unwrapAndConvertHolder(org.bukkit.Registry.ART, this.getHandle().getVariant()).orElseThrow(() -> new IllegalStateException("Inlined/custom painting variants are not supported yet in the API!")); // Paper + return org.bukkit.craftbukkit.CraftRegistry.unwrapAndConvertHolder(org.bukkit.Registry.ART, this.getHandle().getVariant()).orElseThrow(() -> new IllegalStateException("Inlined painting variants are not supported yet in the API!")); // Paper
} }
@Override @Override

View File

@ -115,7 +115,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+++ b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java +++ b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java
@@ -0,0 +0,0 @@ public abstract class AbstractMinecart extends VehicleEntity { @@ -0,0 +0,0 @@ public abstract class AbstractMinecart extends VehicleEntity {
private double flyingZ = 0.95; private double flyingZ = 0.95;
public double maxSpeed = 0.4D; public Double maxSpeed;
// CraftBukkit end // CraftBukkit end
+ public net.kyori.adventure.util.TriState frictionState = net.kyori.adventure.util.TriState.NOT_SET; // Paper - Friction API + public net.kyori.adventure.util.TriState frictionState = net.kyori.adventure.util.TriState.NOT_SET; // Paper - Friction API

View File

@ -951,8 +951,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public static boolean checkIfActive(Entity entity) public static boolean checkIfActive(Entity entity)
{ {
- SpigotTimings.checkIfActiveTimer.startTiming(); - SpigotTimings.checkIfActiveTimer.startTiming();
// Never safe to skip fireworks or entities not yet added to chunk // Never safe to skip fireworks or item gravity
if ( entity instanceof FireworkRocketEntity ) { if (entity instanceof FireworkRocketEntity || (entity instanceof ItemEntity && (entity.tickCount + entity.getId() + 1) % 4 == 0)) {
- SpigotTimings.checkIfActiveTimer.stopTiming(); - SpigotTimings.checkIfActiveTimer.stopTiming();
return true; return true;
} }

View File

@ -452,3 +452,81 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
RegistryHelper.registry = layers.compositeAccess().freeze(); RegistryHelper.registry = layers.compositeAccess().freeze();
// Register vanilla pack // Register vanilla pack
RegistryHelper.dataPack = ReloadableServerResources.loadResources(ireloadableresourcemanager, layers, list, featureFlagSet, Commands.CommandSelection.DEDICATED, 0, MoreExecutors.directExecutor(), MoreExecutors.directExecutor()).join(); RegistryHelper.dataPack = ReloadableServerResources.loadResources(ireloadableresourcemanager, layers, list, featureFlagSet, Commands.CommandSelection.DEDICATED, 0, MoreExecutors.directExecutor(), MoreExecutors.directExecutor()).join();
diff --git a/src/test/java/org/bukkit/support/suite/AllFeaturesTestSuite.java b/src/test/java/org/bukkit/support/suite/AllFeaturesTestSuite.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/test/java/org/bukkit/support/suite/AllFeaturesTestSuite.java
+++ b/src/test/java/org/bukkit/support/suite/AllFeaturesTestSuite.java
@@ -0,0 +0,0 @@ import org.junit.platform.suite.api.SuiteDisplayName;
@Suite(failIfNoTests = false)
@SuiteDisplayName("Test suite for test which need registry values present, with all feature flags set")
@IncludeTags("AllFeatures")
-@SelectPackages("org.bukkit")
+@SelectPackages({"org.bukkit", "io.papermc"})
@SelectClasses({RegistryClassTest.class, PerRegistryTest.class, RegistryConversionTest.class}) // Make sure general registry tests are run first
@ExcludeClassNamePatterns("org.bukkit.craftbukkit.inventory.ItemStack.*Test")
@ConfigurationParameter(key = "TestSuite", value = "AllFeatures")
diff --git a/src/test/java/org/bukkit/support/suite/BundleFeatureTestSuite.java b/src/test/java/org/bukkit/support/suite/BundleFeatureTestSuite.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/test/java/org/bukkit/support/suite/BundleFeatureTestSuite.java
+++ b/src/test/java/org/bukkit/support/suite/BundleFeatureTestSuite.java
@@ -0,0 +0,0 @@ import org.junit.platform.suite.api.SuiteDisplayName;
@Suite(failIfNoTests = false)
@SuiteDisplayName("Test suite for test which need registry values present, with the bundle feature flag set")
@IncludeTags("BundleFeature")
-@SelectPackages("org.bukkit")
+@SelectPackages({"org.bukkit", "io.papermc"})
@ConfigurationParameter(key = "TestSuite", value = "BundleFeature")
public class BundleFeatureTestSuite {
}
diff --git a/src/test/java/org/bukkit/support/suite/LegacyTestSuite.java b/src/test/java/org/bukkit/support/suite/LegacyTestSuite.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/test/java/org/bukkit/support/suite/LegacyTestSuite.java
+++ b/src/test/java/org/bukkit/support/suite/LegacyTestSuite.java
@@ -0,0 +0,0 @@ import org.junit.platform.suite.api.SuiteDisplayName;
@Suite(failIfNoTests = false)
@SuiteDisplayName("Test suite for legacy tests")
@IncludeTags("Legacy")
-@SelectPackages("org.bukkit")
+@SelectPackages({"org.bukkit", "io.papermc"})
@ConfigurationParameter(key = "TestSuite", value = "Legacy")
public class LegacyTestSuite {
}
diff --git a/src/test/java/org/bukkit/support/suite/NormalTestSuite.java b/src/test/java/org/bukkit/support/suite/NormalTestSuite.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/test/java/org/bukkit/support/suite/NormalTestSuite.java
+++ b/src/test/java/org/bukkit/support/suite/NormalTestSuite.java
@@ -0,0 +0,0 @@ import org.junit.platform.suite.api.SuiteDisplayName;
@Suite(failIfNoTests = false)
@SuiteDisplayName("Test suite for standalone tests, which don't need any registry values present")
@IncludeTags("Normal")
-@SelectPackages("org.bukkit")
+@SelectPackages({"org.bukkit", "io.papermc"})
@ConfigurationParameter(key = "TestSuite", value = "Normal")
public class NormalTestSuite {
}
diff --git a/src/test/java/org/bukkit/support/suite/SlowTestSuite.java b/src/test/java/org/bukkit/support/suite/SlowTestSuite.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/test/java/org/bukkit/support/suite/SlowTestSuite.java
+++ b/src/test/java/org/bukkit/support/suite/SlowTestSuite.java
@@ -0,0 +0,0 @@ import org.junit.platform.suite.api.SuiteDisplayName;
@Suite(failIfNoTests = false)
@SuiteDisplayName("Test suite for slow tests, which don't need to run every time")
@IncludeTags("Slow")
-@SelectPackages("org.bukkit")
+@SelectPackages({"org.bukkit", "io.papermc"})
@ConfigurationParameter(key = "TestSuite", value = "Slow")
public class SlowTestSuite {
}
diff --git a/src/test/java/org/bukkit/support/suite/VanillaFeatureTestSuite.java b/src/test/java/org/bukkit/support/suite/VanillaFeatureTestSuite.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/test/java/org/bukkit/support/suite/VanillaFeatureTestSuite.java
+++ b/src/test/java/org/bukkit/support/suite/VanillaFeatureTestSuite.java
@@ -0,0 +0,0 @@ import org.junit.platform.suite.api.SuiteDisplayName;
@Suite(failIfNoTests = false)
@SuiteDisplayName("Test suite for test which need vanilla registry values present")
@IncludeTags("VanillaFeature")
-@SelectPackages("org.bukkit")
+@SelectPackages({"org.bukkit", "io.papermc"})
@ConfigurationParameter(key = "TestSuite", value = "VanillaFeature")
public class VanillaFeatureTestSuite {
}

View File

@ -55,3 +55,29 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ assertEquals(nms.getSoundEvent(), CraftSound.bukkitToMinecraftHolder(bukkit.getSound())); + assertEquals(nms.getSoundEvent(), CraftSound.bukkitToMinecraftHolder(bukkit.getSound()));
+ } + }
+} +}
diff --git a/src/test/java/org/bukkit/InstrumentTest.java b/src/test/java/org/bukkit/InstrumentTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
--- /dev/null
+++ b/src/test/java/org/bukkit/InstrumentTest.java
@@ -0,0 +0,0 @@
+package org.bukkit;
+
+import org.bukkit.support.environment.AllFeatures;
+import org.junit.jupiter.api.Test;
+
+import static org.bukkit.support.MatcherAssert.assertThat;
+import static org.hamcrest.CoreMatchers.is;
+
+@AllFeatures
+public class InstrumentTest { // Paper - moved to internals as this test now access the sound registry.
+
+ @Test
+ public void getByType() {
+ for (Instrument instrument : Instrument.values()) {
+ // Paper - byte magic values are still used
+
+ assertThat(Instrument.getByType(instrument.getType()), is(instrument));
+ }
+ }
+}

@ -1 +1 @@
Subproject commit 97c5926140420c7b9e8a06b2b8348b1816f2a6bd Subproject commit b9df8e9f23bd025e9f99e9ebe0d46deff75717a5

@ -1 +1 @@
Subproject commit 7235ad7b04542ce214869eb1ec1966bb392aedc7 Subproject commit df1efc0bbfc40d10132d440345c8b28aa7130909

@ -1 +1 @@
Subproject commit 5eb8a94b2f4dfefed5c71a40f87a84c34d1c8828 Subproject commit e65d67a7a97d6502296109d5c295255ecbc04575