From f7118d4e22c89a936fef98a2f00388ce02a26bb5 Mon Sep 17 00:00:00 2001 From: Jake Potrebic Date: Fri, 14 Jun 2024 13:11:23 -0700 Subject: [PATCH] update generated API --- .../paper/entity/ai/VanillaGoal.java | 8 +++----- .../papermc/paper/registry/keys/BiomeKeys.java | 2 +- .../paper/registry/keys/DamageTypeKeys.java | 10 ++++++++-- .../paper/registry/keys/EnchantmentKeys.java | 5 +---- .../paper/registry/keys/GameEventKeys.java | 2 +- .../paper/registry/keys/InstrumentKeys.java | 2 +- .../paper/registry/keys/MobEffectKeys.java | 7 +------ .../paper/registry/keys/StructureKeys.java | 3 +-- .../paper/registry/keys/StructureTypeKeys.java | 2 +- .../paper/registry/keys/TrimMaterialKeys.java | 2 +- .../paper/registry/keys/TrimPatternKeys.java | 4 +--- .../paper/registry/keys/WolfVariantKeys.java | 2 +- .../generator/types/GeneratedKeyType.java | 12 +++++------- .../io/papermc/generator/utils/Annotations.java | 17 +++++++++++------ 14 files changed, 37 insertions(+), 41 deletions(-) diff --git a/paper-api-generator/generated/com/destroystokyo/paper/entity/ai/VanillaGoal.java b/paper-api-generator/generated/com/destroystokyo/paper/entity/ai/VanillaGoal.java index 43f4deacef..0f8111e46b 100644 --- a/paper-api-generator/generated/com/destroystokyo/paper/entity/ai/VanillaGoal.java +++ b/paper-api-generator/generated/com/destroystokyo/paper/entity/ai/VanillaGoal.java @@ -70,7 +70,7 @@ import org.jetbrains.annotations.NotNull; "unused", "SpellCheckingInspection" }) -@GeneratedFrom("1.20.6") +@GeneratedFrom("1.21") public interface VanillaGoal extends Goal { GoalKey RANDOM_STAND = create("random_stand", AbstractHorse.class); @@ -330,8 +330,6 @@ public interface VanillaGoal extends Goal { GoalKey POLAR_BEAR_MELEE_ATTACK = create("polar_bear_melee_attack", PolarBear.class); - GoalKey POLAR_BEAR_PANIC = create("polar_bear_panic", PolarBear.class); - GoalKey PUFFERFISH_PUFF = create("pufferfish_puff", PufferFish.class); GoalKey RABBIT_AVOID_ENTITY = create("rabbit_avoid_entity", Rabbit.class); @@ -406,6 +404,8 @@ public interface VanillaGoal extends Goal { GoalKey SIT_WHEN_ORDERED_TO = create("sit_when_ordered_to", Tameable.class); + GoalKey TAMABLE_ANIMAL_PANIC = create("tamable_animal_panic", Tameable.class); + GoalKey TURTLE_BREED = create("turtle_breed", Turtle.class); GoalKey TURTLE_GO_HOME = create("turtle_go_home", Turtle.class); @@ -436,8 +436,6 @@ public interface VanillaGoal extends Goal { GoalKey WOLF_AVOID_ENTITY = create("wolf_avoid_entity", Wolf.class); - GoalKey WOLF_PANIC = create("wolf_panic", Wolf.class); - GoalKey ZOMBIE_ATTACK = create("zombie_attack", Zombie.class); GoalKey ZOMBIE_ATTACK_TURTLE_EGG = create("zombie_attack_turtle_egg", Zombie.class); diff --git a/paper-api-generator/generated/io/papermc/paper/registry/keys/BiomeKeys.java b/paper-api-generator/generated/io/papermc/paper/registry/keys/BiomeKeys.java index 173550253f..9552d0bc39 100644 --- a/paper-api-generator/generated/io/papermc/paper/registry/keys/BiomeKeys.java +++ b/paper-api-generator/generated/io/papermc/paper/registry/keys/BiomeKeys.java @@ -23,7 +23,7 @@ import org.jetbrains.annotations.NotNull; "unused", "SpellCheckingInspection" }) -@GeneratedFrom("1.20.6") +@GeneratedFrom("1.21") @ApiStatus.Experimental public final class BiomeKeys { /** diff --git a/paper-api-generator/generated/io/papermc/paper/registry/keys/DamageTypeKeys.java b/paper-api-generator/generated/io/papermc/paper/registry/keys/DamageTypeKeys.java index b9931bda8f..bc74d22dc8 100644 --- a/paper-api-generator/generated/io/papermc/paper/registry/keys/DamageTypeKeys.java +++ b/paper-api-generator/generated/io/papermc/paper/registry/keys/DamageTypeKeys.java @@ -6,7 +6,6 @@ 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.MinecraftExperimental; import org.bukkit.damage.DamageType; import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.NotNull; @@ -24,7 +23,7 @@ import org.jetbrains.annotations.NotNull; "unused", "SpellCheckingInspection" }) -@GeneratedFrom("1.20.6") +@GeneratedFrom("1.21") @ApiStatus.Experimental public final class DamageTypeKeys { /** @@ -48,6 +47,13 @@ public final class DamageTypeKeys { */ public static final TypedKey CACTUS = create(key("cactus")); + /** + * {@code minecraft:campfire} + * + * @apiNote This field is version-dependant and may be removed in future Minecraft versions + */ + public static final TypedKey CAMPFIRE = create(key("campfire")); + /** * {@code minecraft:cramming} * diff --git a/paper-api-generator/generated/io/papermc/paper/registry/keys/EnchantmentKeys.java b/paper-api-generator/generated/io/papermc/paper/registry/keys/EnchantmentKeys.java index 0acf663315..c3e649e05e 100644 --- a/paper-api-generator/generated/io/papermc/paper/registry/keys/EnchantmentKeys.java +++ b/paper-api-generator/generated/io/papermc/paper/registry/keys/EnchantmentKeys.java @@ -6,7 +6,6 @@ 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.MinecraftExperimental; import org.bukkit.enchantments.Enchantment; import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.NotNull; @@ -24,7 +23,7 @@ import org.jetbrains.annotations.NotNull; "unused", "SpellCheckingInspection" }) -@GeneratedFrom("1.20.6") +@GeneratedFrom("1.21") @ApiStatus.Experimental public final class EnchantmentKeys { /** @@ -60,7 +59,6 @@ public final class EnchantmentKeys { * * @apiNote This field is version-dependant and may be removed in future Minecraft versions */ - @ApiStatus.Experimental public static final TypedKey BREACH = create(key("breach")); /** @@ -75,7 +73,6 @@ public final class EnchantmentKeys { * * @apiNote This field is version-dependant and may be removed in future Minecraft versions */ - @ApiStatus.Experimental public static final TypedKey DENSITY = create(key("density")); /** diff --git a/paper-api-generator/generated/io/papermc/paper/registry/keys/GameEventKeys.java b/paper-api-generator/generated/io/papermc/paper/registry/keys/GameEventKeys.java index 6d228f2f02..d8246a92d3 100644 --- a/paper-api-generator/generated/io/papermc/paper/registry/keys/GameEventKeys.java +++ b/paper-api-generator/generated/io/papermc/paper/registry/keys/GameEventKeys.java @@ -23,7 +23,7 @@ import org.jetbrains.annotations.NotNull; "unused", "SpellCheckingInspection" }) -@GeneratedFrom("1.20.6") +@GeneratedFrom("1.21") @ApiStatus.Experimental public final class GameEventKeys { /** diff --git a/paper-api-generator/generated/io/papermc/paper/registry/keys/InstrumentKeys.java b/paper-api-generator/generated/io/papermc/paper/registry/keys/InstrumentKeys.java index 0cddaa1936..218932a292 100644 --- a/paper-api-generator/generated/io/papermc/paper/registry/keys/InstrumentKeys.java +++ b/paper-api-generator/generated/io/papermc/paper/registry/keys/InstrumentKeys.java @@ -23,7 +23,7 @@ import org.jetbrains.annotations.NotNull; "unused", "SpellCheckingInspection" }) -@GeneratedFrom("1.20.6") +@GeneratedFrom("1.21") @ApiStatus.Experimental public final class InstrumentKeys { /** diff --git a/paper-api-generator/generated/io/papermc/paper/registry/keys/MobEffectKeys.java b/paper-api-generator/generated/io/papermc/paper/registry/keys/MobEffectKeys.java index 5f3525a4da..a6c99ef964 100644 --- a/paper-api-generator/generated/io/papermc/paper/registry/keys/MobEffectKeys.java +++ b/paper-api-generator/generated/io/papermc/paper/registry/keys/MobEffectKeys.java @@ -6,7 +6,6 @@ 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.MinecraftExperimental; import org.bukkit.potion.PotionEffectType; import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.NotNull; @@ -24,7 +23,7 @@ import org.jetbrains.annotations.NotNull; "unused", "SpellCheckingInspection" }) -@GeneratedFrom("1.20.6") +@GeneratedFrom("1.21") @ApiStatus.Experimental public final class MobEffectKeys { /** @@ -116,7 +115,6 @@ public final class MobEffectKeys { * * @apiNote This field is version-dependant and may be removed in future Minecraft versions */ - @ApiStatus.Experimental public static final TypedKey INFESTED = create(key("infested")); /** @@ -257,7 +255,6 @@ public final class MobEffectKeys { * * @apiNote This field is version-dependant and may be removed in future Minecraft versions */ - @ApiStatus.Experimental public static final TypedKey TRIAL_OMEN = create(key("trial_omen")); /** @@ -286,7 +283,6 @@ public final class MobEffectKeys { * * @apiNote This field is version-dependant and may be removed in future Minecraft versions */ - @ApiStatus.Experimental public static final TypedKey WEAVING = create(key("weaving")); /** @@ -294,7 +290,6 @@ public final class MobEffectKeys { * * @apiNote This field is version-dependant and may be removed in future Minecraft versions */ - @ApiStatus.Experimental public static final TypedKey WIND_CHARGED = create(key("wind_charged")); /** diff --git a/paper-api-generator/generated/io/papermc/paper/registry/keys/StructureKeys.java b/paper-api-generator/generated/io/papermc/paper/registry/keys/StructureKeys.java index 4fc0d8f198..d1149e828e 100644 --- a/paper-api-generator/generated/io/papermc/paper/registry/keys/StructureKeys.java +++ b/paper-api-generator/generated/io/papermc/paper/registry/keys/StructureKeys.java @@ -6,7 +6,6 @@ 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.MinecraftExperimental; import org.bukkit.generator.structure.Structure; import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.NotNull; @@ -24,7 +23,7 @@ import org.jetbrains.annotations.NotNull; "unused", "SpellCheckingInspection" }) -@GeneratedFrom("1.20.6") +@GeneratedFrom("1.21") @ApiStatus.Experimental public final class StructureKeys { /** diff --git a/paper-api-generator/generated/io/papermc/paper/registry/keys/StructureTypeKeys.java b/paper-api-generator/generated/io/papermc/paper/registry/keys/StructureTypeKeys.java index bd36a38558..3da18a90c5 100644 --- a/paper-api-generator/generated/io/papermc/paper/registry/keys/StructureTypeKeys.java +++ b/paper-api-generator/generated/io/papermc/paper/registry/keys/StructureTypeKeys.java @@ -23,7 +23,7 @@ import org.jetbrains.annotations.NotNull; "unused", "SpellCheckingInspection" }) -@GeneratedFrom("1.20.6") +@GeneratedFrom("1.21") @ApiStatus.Experimental public final class StructureTypeKeys { /** diff --git a/paper-api-generator/generated/io/papermc/paper/registry/keys/TrimMaterialKeys.java b/paper-api-generator/generated/io/papermc/paper/registry/keys/TrimMaterialKeys.java index 0635cecd49..8b45ea515c 100644 --- a/paper-api-generator/generated/io/papermc/paper/registry/keys/TrimMaterialKeys.java +++ b/paper-api-generator/generated/io/papermc/paper/registry/keys/TrimMaterialKeys.java @@ -23,7 +23,7 @@ import org.jetbrains.annotations.NotNull; "unused", "SpellCheckingInspection" }) -@GeneratedFrom("1.20.6") +@GeneratedFrom("1.21") @ApiStatus.Experimental public final class TrimMaterialKeys { /** diff --git a/paper-api-generator/generated/io/papermc/paper/registry/keys/TrimPatternKeys.java b/paper-api-generator/generated/io/papermc/paper/registry/keys/TrimPatternKeys.java index ec8930239a..cff40f6c97 100644 --- a/paper-api-generator/generated/io/papermc/paper/registry/keys/TrimPatternKeys.java +++ b/paper-api-generator/generated/io/papermc/paper/registry/keys/TrimPatternKeys.java @@ -6,7 +6,6 @@ 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.MinecraftExperimental; import org.bukkit.inventory.meta.trim.TrimPattern; import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.NotNull; @@ -24,7 +23,7 @@ import org.jetbrains.annotations.NotNull; "unused", "SpellCheckingInspection" }) -@GeneratedFrom("1.20.6") +@GeneratedFrom("1.21") @ApiStatus.Experimental public final class TrimPatternKeys { /** @@ -32,7 +31,6 @@ public final class TrimPatternKeys { * * @apiNote This field is version-dependant and may be removed in future Minecraft versions */ - @ApiStatus.Experimental public static final TypedKey BOLT = create(key("bolt")); /** diff --git a/paper-api-generator/generated/io/papermc/paper/registry/keys/WolfVariantKeys.java b/paper-api-generator/generated/io/papermc/paper/registry/keys/WolfVariantKeys.java index 5ae854aba8..0da194922a 100644 --- a/paper-api-generator/generated/io/papermc/paper/registry/keys/WolfVariantKeys.java +++ b/paper-api-generator/generated/io/papermc/paper/registry/keys/WolfVariantKeys.java @@ -23,7 +23,7 @@ import org.jetbrains.annotations.NotNull; "unused", "SpellCheckingInspection" }) -@GeneratedFrom("1.20.6") +@GeneratedFrom("1.21") @ApiStatus.Experimental public final class WolfVariantKeys { /** diff --git a/paper-api-generator/src/main/java/io/papermc/generator/types/GeneratedKeyType.java b/paper-api-generator/src/main/java/io/papermc/generator/types/GeneratedKeyType.java index 8307fcad4c..19cbf63cd4 100644 --- a/paper-api-generator/src/main/java/io/papermc/generator/types/GeneratedKeyType.java +++ b/paper-api-generator/src/main/java/io/papermc/generator/types/GeneratedKeyType.java @@ -28,7 +28,6 @@ import net.minecraft.core.Holder; import net.minecraft.core.HolderLookup; import net.minecraft.core.Registry; import net.minecraft.core.RegistrySetBuilder; -import net.minecraft.data.registries.UpdateOneTwentyOneRegistries; import net.minecraft.data.registries.VanillaRegistries; import net.minecraft.resources.ResourceKey; import net.minecraft.world.flag.FeatureElement; @@ -54,8 +53,7 @@ public class GeneratedKeyType extends SimpleGenerator { private static final Map>, RegistrySetBuilder.RegistryBootstrap> VANILLA_REGISTRY_ENTRIES = VanillaRegistries.BUILDER.entries.stream() .collect(Collectors.toMap(RegistrySetBuilder.RegistryStub::key, RegistrySetBuilder.RegistryStub::bootstrap)); - private static final Map>, RegistrySetBuilder.RegistryBootstrap> EXPERIMENTAL_REGISTRY_ENTRIES = UpdateOneTwentyOneRegistries.BUILDER.entries.stream() - .collect(Collectors.toMap(RegistrySetBuilder.RegistryStub::key, RegistrySetBuilder.RegistryStub::bootstrap)); + private static final Map>, RegistrySetBuilder.RegistryBootstrap> EXPERIMENTAL_REGISTRY_ENTRIES = Collections.emptyMap(); // Update for Experimental API private static final Map, String> REGISTRY_KEY_FIELD_NAMES; static { @@ -139,15 +137,15 @@ public class GeneratedKeyType extends SimpleGenerator { .initializer("$N(key($S))", createMethod.build(), keyPath) .addJavadoc(Javadocs.getVersionDependentField("{@code $L}"), key.location().toString()); if (experimental.contains(key)) { - fieldBuilder.addAnnotations(experimentalAnnotations(MinecraftExperimental.Requires.UPDATE_1_21)); + fieldBuilder.addAnnotations(experimentalAnnotations(null)); // Update for Experimental API } else { allExperimental = false; } typeBuilder.addField(fieldBuilder.build()); } if (allExperimental) { - typeBuilder.addAnnotations(experimentalAnnotations(MinecraftExperimental.Requires.UPDATE_1_21)); - createMethod.addAnnotations(experimentalAnnotations(MinecraftExperimental.Requires.UPDATE_1_21)); + typeBuilder.addAnnotations(experimentalAnnotations(null)); // Update for Experimental API + createMethod.addAnnotations(experimentalAnnotations(null)); // Update for Experimental API } else { typeBuilder.addAnnotation(EXPERIMENTAL_API_ANNOTATION); // TODO experimental API } @@ -164,7 +162,7 @@ public class GeneratedKeyType extends SimpleGenerator { private Set> collectExperimentalKeysBuiltIn(final Registry registry) { final HolderLookup.RegistryLookup filteredLookup = registry.asLookup().filterElements(v -> { - return ((FeatureElement) v).requiredFeatures().contains(FeatureFlags.UPDATE_1_21); + return false; // Update for Experimental API }); return filteredLookup.listElementIds().collect(Collectors.toUnmodifiableSet()); } diff --git a/paper-api-generator/src/main/java/io/papermc/generator/utils/Annotations.java b/paper-api-generator/src/main/java/io/papermc/generator/utils/Annotations.java index a00a682330..52c876edba 100644 --- a/paper-api-generator/src/main/java/io/papermc/generator/utils/Annotations.java +++ b/paper-api-generator/src/main/java/io/papermc/generator/utils/Annotations.java @@ -1,6 +1,7 @@ package io.papermc.generator.utils; import com.squareup.javapoet.AnnotationSpec; +import java.util.ArrayList; import java.util.List; import io.papermc.paper.generated.GeneratedFrom; @@ -12,13 +13,17 @@ import org.jetbrains.annotations.Nullable; public final class Annotations { - public static List experimentalAnnotations(final MinecraftExperimental.Requires requiredFeatureFlag) { - return List.of( - AnnotationSpec.builder(ApiStatus.Experimental.class).build(), - AnnotationSpec.builder(MinecraftExperimental.class) + public static List experimentalAnnotations(final MinecraftExperimental.@Nullable Requires requiredFeatureFlag) { + final List annotationSpecs = new ArrayList<>(); + annotationSpecs.add(AnnotationSpec.builder(ApiStatus.Experimental.class).build()); + if (requiredFeatureFlag != null) { + annotationSpecs.add(AnnotationSpec.builder(MinecraftExperimental.class) .addMember("value", "$T.$L", MinecraftExperimental.Requires.class, requiredFeatureFlag.name()) - .build() - ); + .build()); + } else { + annotationSpecs.add(AnnotationSpec.builder(MinecraftExperimental.class).build()); + } + return annotationSpecs; } public static AnnotationSpec deprecatedVersioned(final @Nullable String version, boolean forRemoval) {