mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-24 09:58:00 +01:00
correctly change enchantment registry to a 'delayed' version
This commit is contained in:
parent
56b5b7d452
commit
c1aefeecc6
@ -85,10 +85,10 @@ index 0000000000000000000000000000000000000000..2512dba27edfdccbc4430815b6cba048
|
|||||||
+}
|
+}
|
||||||
diff --git a/src/main/java/io/papermc/paper/registry/RegistryKey.java b/src/main/java/io/papermc/paper/registry/RegistryKey.java
|
diff --git a/src/main/java/io/papermc/paper/registry/RegistryKey.java b/src/main/java/io/papermc/paper/registry/RegistryKey.java
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
index 0000000000000000000000000000000000000000..adf24eb062460e2fd08d3e91337eba379d76a27d
|
index 0000000000000000000000000000000000000000..76daccf4ea502e1747a6f9176dc16fd20c561286
|
||||||
--- /dev/null
|
--- /dev/null
|
||||||
+++ b/src/main/java/io/papermc/paper/registry/RegistryKey.java
|
+++ b/src/main/java/io/papermc/paper/registry/RegistryKey.java
|
||||||
@@ -0,0 +1,146 @@
|
@@ -0,0 +1,147 @@
|
||||||
+package io.papermc.paper.registry;
|
+package io.papermc.paper.registry;
|
||||||
+
|
+
|
||||||
+import net.kyori.adventure.key.Keyed;
|
+import net.kyori.adventure.key.Keyed;
|
||||||
@ -157,11 +157,6 @@ index 0000000000000000000000000000000000000000..adf24eb062460e2fd08d3e91337eba37
|
|||||||
+ */
|
+ */
|
||||||
+ RegistryKey<MusicInstrument> INSTRUMENT = create("instrument");
|
+ RegistryKey<MusicInstrument> INSTRUMENT = create("instrument");
|
||||||
+ /**
|
+ /**
|
||||||
+ * Built-in registry for enchantments.
|
|
||||||
+ * @see io.papermc.paper.registry.keys.EnchantmentKeys
|
|
||||||
+ */
|
|
||||||
+ RegistryKey<Enchantment> ENCHANTMENT = create("enchantment");
|
|
||||||
+ /**
|
|
||||||
+ * Built-in registry for potion effect types (mob effects).
|
+ * Built-in registry for potion effect types (mob effects).
|
||||||
+ * @see io.papermc.paper.registry.keys.MobEffectKeys
|
+ * @see io.papermc.paper.registry.keys.MobEffectKeys
|
||||||
+ */
|
+ */
|
||||||
@ -212,8 +207,14 @@ index 0000000000000000000000000000000000000000..adf24eb062460e2fd08d3e91337eba37
|
|||||||
+ */
|
+ */
|
||||||
+ RegistryKey<Wolf.Variant> WOLF_VARIANT = create("wolf_variant");
|
+ RegistryKey<Wolf.Variant> WOLF_VARIANT = create("wolf_variant");
|
||||||
+ /**
|
+ /**
|
||||||
|
+ * Data-driven registry for enchantments.
|
||||||
|
+ * @see io.papermc.paper.registry.keys.EnchantmentKeys
|
||||||
|
+ */
|
||||||
|
+ RegistryKey<Enchantment> ENCHANTMENT = create("enchantment");
|
||||||
|
+ /**
|
||||||
+ * Data-driven registry for jukebox songs.
|
+ * Data-driven registry for jukebox songs.
|
||||||
+ */
|
+ */
|
||||||
|
+ @ApiStatus.Experimental
|
||||||
+ RegistryKey<JukeboxSong> JUKEBOX_SONG = create("jukebox_song");
|
+ RegistryKey<JukeboxSong> JUKEBOX_SONG = create("jukebox_song");
|
||||||
+
|
+
|
||||||
+
|
+
|
||||||
|
@ -206,7 +206,7 @@ index 188280a8fdf35a70a5a358f8cfe7cf44f05855b1..ceaa901fa830e904d6ac7a1727d1e7d1
|
|||||||
return server.getRegistry(tClass);
|
return server.getRegistry(tClass);
|
||||||
}
|
}
|
||||||
diff --git a/src/main/java/org/bukkit/Registry.java b/src/main/java/org/bukkit/Registry.java
|
diff --git a/src/main/java/org/bukkit/Registry.java b/src/main/java/org/bukkit/Registry.java
|
||||||
index 3effaea369d9c7a6a22979fbfc270f55f9f25cf2..d40c2b492a2be6ce87105ce910a05c7c344ddf84 100644
|
index 3effaea369d9c7a6a22979fbfc270f55f9f25cf2..93e898c14728491a59bb2d08aff0dd678feef26a 100644
|
||||||
--- 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
|
||||||
@@ -102,7 +102,7 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
|
@@ -102,7 +102,7 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
|
||||||
@ -218,16 +218,19 @@ index 3effaea369d9c7a6a22979fbfc270f55f9f25cf2..d40c2b492a2be6ce87105ce910a05c7c
|
|||||||
/**
|
/**
|
||||||
* Custom boss bars.
|
* Custom boss bars.
|
||||||
*
|
*
|
||||||
@@ -140,7 +140,7 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
|
@@ -139,8 +139,10 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
|
||||||
|
* Server enchantments.
|
||||||
*
|
*
|
||||||
* @see Enchantment
|
* @see Enchantment
|
||||||
|
+ * @deprecated use {@link io.papermc.paper.registry.RegistryAccess#getRegistry(io.papermc.paper.registry.RegistryKey)} with {@link io.papermc.paper.registry.RegistryKey#ENCHANTMENT}
|
||||||
*/
|
*/
|
||||||
- Registry<Enchantment> ENCHANTMENT = Objects.requireNonNull(Bukkit.getRegistry(Enchantment.class), "No registry present for Enchantment. This is a bug.");
|
- Registry<Enchantment> ENCHANTMENT = Objects.requireNonNull(Bukkit.getRegistry(Enchantment.class), "No registry present for Enchantment. This is a bug.");
|
||||||
+ Registry<Enchantment> ENCHANTMENT = io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(io.papermc.paper.registry.RegistryKey.ENCHANTMENT); // Paper
|
+ @Deprecated(since = "1.21")
|
||||||
|
+ Registry<Enchantment> ENCHANTMENT = Objects.requireNonNull(io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(Enchantment.class), "No registry present for Enchantment. This is a bug."); // Paper
|
||||||
/**
|
/**
|
||||||
* Server entity types.
|
* Server entity types.
|
||||||
*
|
*
|
||||||
@@ -152,7 +152,7 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
|
@@ -152,7 +154,7 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
|
||||||
*
|
*
|
||||||
* @see MusicInstrument
|
* @see MusicInstrument
|
||||||
*/
|
*/
|
||||||
@ -236,7 +239,7 @@ index 3effaea369d9c7a6a22979fbfc270f55f9f25cf2..d40c2b492a2be6ce87105ce910a05c7c
|
|||||||
/**
|
/**
|
||||||
* Server item types.
|
* Server item types.
|
||||||
*
|
*
|
||||||
@@ -160,7 +160,7 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
|
@@ -160,7 +162,7 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
|
||||||
* @apiNote ItemType is not ready for public usage yet
|
* @apiNote ItemType is not ready for public usage yet
|
||||||
*/
|
*/
|
||||||
@ApiStatus.Internal
|
@ApiStatus.Internal
|
||||||
@ -245,7 +248,7 @@ index 3effaea369d9c7a6a22979fbfc270f55f9f25cf2..d40c2b492a2be6ce87105ce910a05c7c
|
|||||||
/**
|
/**
|
||||||
* Default server loot tables.
|
* Default server loot tables.
|
||||||
*
|
*
|
||||||
@@ -178,7 +178,7 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
|
@@ -178,7 +180,7 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
|
||||||
*
|
*
|
||||||
* @see PotionEffectType
|
* @see PotionEffectType
|
||||||
*/
|
*/
|
||||||
@ -254,7 +257,7 @@ index 3effaea369d9c7a6a22979fbfc270f55f9f25cf2..d40c2b492a2be6ce87105ce910a05c7c
|
|||||||
/**
|
/**
|
||||||
* Server particles.
|
* Server particles.
|
||||||
*
|
*
|
||||||
@@ -201,14 +201,16 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
|
@@ -201,14 +203,16 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
|
||||||
* Server structures.
|
* Server structures.
|
||||||
*
|
*
|
||||||
* @see Structure
|
* @see Structure
|
||||||
@ -273,7 +276,7 @@ index 3effaea369d9c7a6a22979fbfc270f55f9f25cf2..d40c2b492a2be6ce87105ce910a05c7c
|
|||||||
/**
|
/**
|
||||||
* Sound keys.
|
* Sound keys.
|
||||||
*
|
*
|
||||||
@@ -219,28 +221,33 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
|
@@ -219,28 +223,35 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
|
||||||
* Trim materials.
|
* Trim materials.
|
||||||
*
|
*
|
||||||
* @see TrimMaterial
|
* @see TrimMaterial
|
||||||
@ -305,14 +308,16 @@ index 3effaea369d9c7a6a22979fbfc270f55f9f25cf2..d40c2b492a2be6ce87105ce910a05c7c
|
|||||||
* Jukebox songs.
|
* Jukebox songs.
|
||||||
*
|
*
|
||||||
* @see JukeboxSong
|
* @see JukeboxSong
|
||||||
|
+ * @deprecated use {@link io.papermc.paper.registry.RegistryAccess#getRegistry(io.papermc.paper.registry.RegistryKey)} with {@link io.papermc.paper.registry.RegistryKey#JUKEBOX_SONG}
|
||||||
*/
|
*/
|
||||||
@ApiStatus.Experimental
|
@ApiStatus.Experimental
|
||||||
- Registry<JukeboxSong> JUKEBOX_SONG = Objects.requireNonNull(Bukkit.getRegistry(JukeboxSong.class), "No registry present for JukeboxSong. This is a bug.");
|
- Registry<JukeboxSong> JUKEBOX_SONG = Objects.requireNonNull(Bukkit.getRegistry(JukeboxSong.class), "No registry present for JukeboxSong. This is a bug.");
|
||||||
+ Registry<JukeboxSong> JUKEBOX_SONG = io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(io.papermc.paper.registry.RegistryKey.JUKEBOX_SONG); // Paper
|
+ @Deprecated(since = "1.21")
|
||||||
|
+ Registry<JukeboxSong> JUKEBOX_SONG = Objects.requireNonNull(io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(JukeboxSong.class), "No registry present for JukeboxSong. This is a bug."); // Paper
|
||||||
/**
|
/**
|
||||||
* Villager profession.
|
* Villager profession.
|
||||||
*
|
*
|
||||||
@@ -294,8 +301,10 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
|
@@ -294,8 +305,10 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
|
||||||
* Wolf variants.
|
* Wolf variants.
|
||||||
*
|
*
|
||||||
* @see Wolf.Variant
|
* @see Wolf.Variant
|
||||||
@ -324,7 +329,7 @@ index 3effaea369d9c7a6a22979fbfc270f55f9f25cf2..d40c2b492a2be6ce87105ce910a05c7c
|
|||||||
/**
|
/**
|
||||||
* Map cursor types.
|
* Map cursor types.
|
||||||
*
|
*
|
||||||
@@ -308,7 +317,7 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
|
@@ -308,7 +321,7 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
|
||||||
*
|
*
|
||||||
* @see GameEvent
|
* @see GameEvent
|
||||||
*/
|
*/
|
||||||
|
@ -5,10 +5,10 @@ Subject: [PATCH] More PotionEffectType API
|
|||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/org/bukkit/Registry.java b/src/main/java/org/bukkit/Registry.java
|
diff --git a/src/main/java/org/bukkit/Registry.java b/src/main/java/org/bukkit/Registry.java
|
||||||
index d40c2b492a2be6ce87105ce910a05c7c344ddf84..5ba5cf06bf12fc2e81500e09209e26047e683fa9 100644
|
index 93e898c14728491a59bb2d08aff0dd678feef26a..17714f04fdd87ed4332ea62bcfab7063560bf1be 100644
|
||||||
--- 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
|
||||||
@@ -318,6 +318,33 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
|
@@ -322,6 +322,33 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
|
||||||
* @see GameEvent
|
* @see GameEvent
|
||||||
*/
|
*/
|
||||||
Registry<GameEvent> GAME_EVENT = io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(io.papermc.paper.registry.RegistryKey.GAME_EVENT); // Paper
|
Registry<GameEvent> GAME_EVENT = io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(io.papermc.paper.registry.RegistryKey.GAME_EVENT); // Paper
|
||||||
|
@ -31,10 +31,10 @@ index 62d2b3f950860dee0898d77b0a29635c3f9a7e23..704dba92f9246ef398ed8d162ebee3cf
|
|||||||
@Override
|
@Override
|
||||||
public @NotNull String translationKey() {
|
public @NotNull String translationKey() {
|
||||||
diff --git a/src/main/java/org/bukkit/Registry.java b/src/main/java/org/bukkit/Registry.java
|
diff --git a/src/main/java/org/bukkit/Registry.java b/src/main/java/org/bukkit/Registry.java
|
||||||
index 5ba5cf06bf12fc2e81500e09209e26047e683fa9..802511eaf697d703cadb4b418fe51ea6d31ff3c8 100644
|
index 17714f04fdd87ed4332ea62bcfab7063560bf1be..bc7144f02ac6857dbeec13c3995b71f6920e022a 100644
|
||||||
--- 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
|
||||||
@@ -354,6 +354,49 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
|
@@ -358,6 +358,49 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
|
||||||
@Nullable
|
@Nullable
|
||||||
T get(@NotNull NamespacedKey key);
|
T get(@NotNull NamespacedKey key);
|
||||||
|
|
||||||
@ -84,7 +84,7 @@ index 5ba5cf06bf12fc2e81500e09209e26047e683fa9..802511eaf697d703cadb4b418fe51ea6
|
|||||||
/**
|
/**
|
||||||
* Returns a new stream, which contains all registry items, which are registered to the registry.
|
* Returns a new stream, which contains all registry items, which are registered to the registry.
|
||||||
*
|
*
|
||||||
@@ -428,5 +471,12 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
|
@@ -432,5 +475,12 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
|
||||||
public Class<T> getType() {
|
public Class<T> getType() {
|
||||||
return this.type;
|
return this.type;
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ public net.minecraft.server.RegistryLayer STATIC_ACCESS
|
|||||||
|
|
||||||
diff --git a/src/main/java/io/papermc/paper/registry/PaperRegistries.java b/src/main/java/io/papermc/paper/registry/PaperRegistries.java
|
diff --git a/src/main/java/io/papermc/paper/registry/PaperRegistries.java b/src/main/java/io/papermc/paper/registry/PaperRegistries.java
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
index 0000000000000000000000000000000000000000..55feffc03d2924e5ec0f55fc65e8aa148cb0cc62
|
index 0000000000000000000000000000000000000000..c1ee87876af79d0fcacd7b930d17d110464ac9d1
|
||||||
--- /dev/null
|
--- /dev/null
|
||||||
+++ b/src/main/java/io/papermc/paper/registry/PaperRegistries.java
|
+++ b/src/main/java/io/papermc/paper/registry/PaperRegistries.java
|
||||||
@@ -0,0 +1,122 @@
|
@@ -0,0 +1,122 @@
|
||||||
@ -72,7 +72,6 @@ index 0000000000000000000000000000000000000000..55feffc03d2924e5ec0f55fc65e8aa14
|
|||||||
+ static {
|
+ static {
|
||||||
+ REGISTRY_ENTRIES = List.of(
|
+ REGISTRY_ENTRIES = List.of(
|
||||||
+ // built-ins
|
+ // built-ins
|
||||||
+ entry(Registries.ENCHANTMENT, RegistryKey.ENCHANTMENT, Enchantment.class, CraftEnchantment::new).withSerializationUpdater(FieldRename.ENCHANTMENT_RENAME),
|
|
||||||
+ entry(Registries.GAME_EVENT, RegistryKey.GAME_EVENT, GameEvent.class, CraftGameEvent::new),
|
+ entry(Registries.GAME_EVENT, RegistryKey.GAME_EVENT, GameEvent.class, CraftGameEvent::new),
|
||||||
+ entry(Registries.INSTRUMENT, RegistryKey.INSTRUMENT, MusicInstrument.class, CraftMusicInstrument::new),
|
+ entry(Registries.INSTRUMENT, RegistryKey.INSTRUMENT, MusicInstrument.class, CraftMusicInstrument::new),
|
||||||
+ entry(Registries.MOB_EFFECT, RegistryKey.MOB_EFFECT, PotionEffectType.class, CraftPotionEffectType::new),
|
+ entry(Registries.MOB_EFFECT, RegistryKey.MOB_EFFECT, PotionEffectType.class, CraftPotionEffectType::new),
|
||||||
@ -86,6 +85,7 @@ index 0000000000000000000000000000000000000000..55feffc03d2924e5ec0f55fc65e8aa14
|
|||||||
+ entry(Registries.TRIM_PATTERN, RegistryKey.TRIM_PATTERN, TrimPattern.class, CraftTrimPattern::new).delayed(),
|
+ entry(Registries.TRIM_PATTERN, RegistryKey.TRIM_PATTERN, TrimPattern.class, CraftTrimPattern::new).delayed(),
|
||||||
+ entry(Registries.DAMAGE_TYPE, RegistryKey.DAMAGE_TYPE, DamageType.class, CraftDamageType::new).delayed(),
|
+ entry(Registries.DAMAGE_TYPE, RegistryKey.DAMAGE_TYPE, DamageType.class, CraftDamageType::new).delayed(),
|
||||||
+ entry(Registries.WOLF_VARIANT, RegistryKey.WOLF_VARIANT, Wolf.Variant.class, CraftWolf.CraftVariant::new).delayed(),
|
+ entry(Registries.WOLF_VARIANT, RegistryKey.WOLF_VARIANT, Wolf.Variant.class, CraftWolf.CraftVariant::new).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(),
|
||||||
+
|
+
|
||||||
+ // api-only
|
+ // api-only
|
||||||
|
Loading…
Reference in New Issue
Block a user