1
0
Fork 0
mirror of https://github.com/PaperMC/Paper.git synced 2025-04-02 04:27:19 +02:00

cat and frog variants registries are now data-driven

This commit is contained in:
Lulu13022002 2025-03-16 18:29:11 +01:00
parent bf417ba732
commit 7f6f64f443
No known key found for this signature in database
GPG key ID: 491C8F0B8ACDEB01
4 changed files with 22 additions and 16 deletions
paper-api-generator/src/main/java/io/papermc/generator
paper-api/src/main/java
io/papermc/paper/registry
org/bukkit
paper-server/src/main/java/io/papermc/paper/registry

View file

@ -43,8 +43,6 @@ public interface Generators {
simpleKey("MobEffectKeys", PotionEffectType.class, Registries.MOB_EFFECT, RegistryKey.MOB_EFFECT, false),
simpleKey("BlockTypeKeys", BlockType.class, Registries.BLOCK, RegistryKey.BLOCK, false),
simpleKey("ItemTypeKeys", ItemType.class, Registries.ITEM, RegistryKey.ITEM, false),
simpleKey("CatVariantKeys", Cat.Type.class, Registries.CAT_VARIANT, RegistryKey.CAT_VARIANT, false),
simpleKey("FrogVariantKeys", Frog.Variant.class, Registries.FROG_VARIANT, RegistryKey.FROG_VARIANT, false),
simpleKey("VillagerProfessionKeys", Villager.Profession.class, Registries.VILLAGER_PROFESSION, RegistryKey.VILLAGER_PROFESSION, false),
simpleKey("VillagerTypeKeys", Villager.Type.class, Registries.VILLAGER_TYPE, RegistryKey.VILLAGER_TYPE, false),
simpleKey("MapDecorationTypeKeys", MapCursor.Type.class, Registries.MAP_DECORATION_TYPE, RegistryKey.MAP_DECORATION_TYPE, false),
@ -65,6 +63,8 @@ public interface Generators {
simpleKey("BannerPatternKeys", PatternType.class, Registries.BANNER_PATTERN, RegistryKey.BANNER_PATTERN, true),
simpleKey("PaintingVariantKeys", Art.class, Registries.PAINTING_VARIANT, RegistryKey.PAINTING_VARIANT, true),
simpleKey("InstrumentKeys", MusicInstrument.class, Registries.INSTRUMENT, RegistryKey.INSTRUMENT, true),
simpleKey("CatVariantKeys", Cat.Type.class, Registries.CAT_VARIANT, RegistryKey.CAT_VARIANT, true),
simpleKey("FrogVariantKeys", Frog.Variant.class, Registries.FROG_VARIANT, RegistryKey.FROG_VARIANT, true),
// tags
simpleTagKey("GameEventTagKeys", GameEvent.class, Registries.GAME_EVENT, RegistryKey.GAME_EVENT),

View file

@ -83,19 +83,10 @@ public sealed interface RegistryKey<T> extends Keyed permits RegistryKeyImpl {
/**
* @apiNote use preferably only in the context of registry entries.
* @see io.papermc.paper.registry.data
* @see io.papermc.paper.registry.keys.ItemTypeKeys
*/
@ApiStatus.Experimental // Paper - already required for registry builders
RegistryKey<ItemType> ITEM = create("item");
/**
* Built-in registry for cat variants.
* @see io.papermc.paper.registry.keys.CatVariantKeys
*/
RegistryKey<Cat.Type> CAT_VARIANT = create("cat_variant");
/**
* Built-in registry for frog variants.
* @see io.papermc.paper.registry.keys.FrogVariantKeys
*/
RegistryKey<Frog.Variant> FROG_VARIANT = create("frog_variant");
/**
* Built-in registry for villager professions.
* @see io.papermc.paper.registry.keys.VillagerProfessionKeys
@ -197,6 +188,16 @@ public sealed interface RegistryKey<T> extends Keyed permits RegistryKeyImpl {
* @see io.papermc.paper.registry.keys.InstrumentKeys
*/
RegistryKey<MusicInstrument> INSTRUMENT = create("instrument");
/**
* Data-driven registry for cat variants.
* @see io.papermc.paper.registry.keys.CatVariantKeys
*/
RegistryKey<Cat.Type> CAT_VARIANT = create("cat_variant");
/**
* Data-driven registry for frog variants.
* @see io.papermc.paper.registry.keys.FrogVariantKeys
*/
RegistryKey<Frog.Variant> FROG_VARIANT = create("frog_variant");
/**
* Data-driven registry for chicken variants.
* <!-- @see io.papermc.paper.registry.keys.ChickenVariantKeys -->
@ -214,6 +215,7 @@ public sealed interface RegistryKey<T> extends Keyed permits RegistryKeyImpl {
RegistryKey<Pig.Variant> PIG_VARIANT = create("pig_variant");
/* ******************* *
* API-only Registries *
* ******************* */

View file

@ -148,8 +148,10 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
* Server cat types.
*
* @see Cat.Type
* @deprecated use {@link RegistryAccess#getRegistry(RegistryKey)} with {@link RegistryKey#CAT_VARIANT}
*/
Registry<Cat.Type> CAT_VARIANT = registryFor(RegistryKey.CAT_VARIANT);
@Deprecated(since = "1.21.5")
Registry<Cat.Type> CAT_VARIANT = legacyRegistryFor(Cat.Type.class);
/**
* Server enchantments.
*
@ -318,8 +320,10 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
* Frog variants.
*
* @see Frog.Variant
* @deprecated use {@link RegistryAccess#getRegistry(RegistryKey)} with {@link RegistryKey#FROG_VARIANT}
*/
Registry<Frog.Variant> FROG_VARIANT = registryFor(RegistryKey.FROG_VARIANT);
@Deprecated(since = "1.21.5")
Registry<Frog.Variant> FROG_VARIANT = legacyRegistryFor(Frog.Variant.class);
/**
* Wolf variants.
*

View file

@ -95,8 +95,6 @@ public final class PaperRegistries {
start(Registries.MOB_EFFECT, RegistryKey.MOB_EFFECT).craft(PotionEffectType.class, CraftPotionEffectType::new).build(),
start(Registries.BLOCK, RegistryKey.BLOCK).craft(BlockType.class, CraftBlockType::new).build(),
start(Registries.ITEM, RegistryKey.ITEM).craft(ItemType.class, CraftItemType::new).build(),
start(Registries.CAT_VARIANT, RegistryKey.CAT_VARIANT).craft(Cat.Type.class, CraftCat.CraftType::new).build(),
start(Registries.FROG_VARIANT, RegistryKey.FROG_VARIANT).craft(Frog.Variant.class, CraftFrog.CraftVariant::new).build(),
start(Registries.VILLAGER_PROFESSION, RegistryKey.VILLAGER_PROFESSION).craft(Villager.Profession.class, CraftVillager.CraftProfession::new).build(),
start(Registries.VILLAGER_TYPE, RegistryKey.VILLAGER_TYPE).craft(Villager.Type.class, CraftVillager.CraftType::new).build(),
start(Registries.MAP_DECORATION_TYPE, RegistryKey.MAP_DECORATION_TYPE).craft(MapCursor.Type.class, CraftMapCursor.CraftType::new).build(),
@ -118,6 +116,8 @@ public final class PaperRegistries {
start(Registries.BANNER_PATTERN, RegistryKey.BANNER_PATTERN).craft(PatternType.class, CraftPatternType::new, true).writable(PaperBannerPatternRegistryEntry.PaperBuilder::new).delayed(),
start(Registries.PAINTING_VARIANT, RegistryKey.PAINTING_VARIANT).craft(Art.class, CraftArt::new, true).writable(PaperPaintingVariantRegistryEntry.PaperBuilder::new).delayed(),
start(Registries.INSTRUMENT, RegistryKey.INSTRUMENT).craft(MusicInstrument.class, CraftMusicInstrument::new, true).build().delayed(),
start(Registries.CAT_VARIANT, RegistryKey.CAT_VARIANT).craft(Cat.Type.class, CraftCat.CraftType::new).build().delayed(),
start(Registries.FROG_VARIANT, RegistryKey.FROG_VARIANT).craft(Frog.Variant.class, CraftFrog.CraftVariant::new).build().delayed(),
start(Registries.CHICKEN_VARIANT, RegistryKey.CHICKEN_VARIANT).craft(Chicken.Variant.class, CraftChicken.CraftVariant::new).build(),
start(Registries.COW_VARIANT, RegistryKey.COW_VARIANT).craft(Cow.Variant.class, CraftCow.CraftVariant::new).build(),
start(Registries.PIG_VARIANT, RegistryKey.PIG_VARIANT).craft(Pig.Variant.class, CraftPig.CraftVariant::new).build(),