update generated API

This commit is contained in:
Jake Potrebic 2024-06-14 13:11:23 -07:00
parent 2bfea35de3
commit f7118d4e22
14 changed files with 37 additions and 41 deletions

View file

@ -70,7 +70,7 @@ import org.jetbrains.annotations.NotNull;
"unused", "unused",
"SpellCheckingInspection" "SpellCheckingInspection"
}) })
@GeneratedFrom("1.20.6") @GeneratedFrom("1.21")
public interface VanillaGoal<T extends Mob> extends Goal<T> { public interface VanillaGoal<T extends Mob> extends Goal<T> {
GoalKey<AbstractHorse> RANDOM_STAND = create("random_stand", AbstractHorse.class); GoalKey<AbstractHorse> RANDOM_STAND = create("random_stand", AbstractHorse.class);
@ -330,8 +330,6 @@ public interface VanillaGoal<T extends Mob> extends Goal<T> {
GoalKey<PolarBear> POLAR_BEAR_MELEE_ATTACK = create("polar_bear_melee_attack", PolarBear.class); GoalKey<PolarBear> POLAR_BEAR_MELEE_ATTACK = create("polar_bear_melee_attack", PolarBear.class);
GoalKey<PolarBear> POLAR_BEAR_PANIC = create("polar_bear_panic", PolarBear.class);
GoalKey<PufferFish> PUFFERFISH_PUFF = create("pufferfish_puff", PufferFish.class); GoalKey<PufferFish> PUFFERFISH_PUFF = create("pufferfish_puff", PufferFish.class);
GoalKey<Rabbit> RABBIT_AVOID_ENTITY = create("rabbit_avoid_entity", Rabbit.class); GoalKey<Rabbit> RABBIT_AVOID_ENTITY = create("rabbit_avoid_entity", Rabbit.class);
@ -406,6 +404,8 @@ public interface VanillaGoal<T extends Mob> extends Goal<T> {
GoalKey<Tameable> SIT_WHEN_ORDERED_TO = create("sit_when_ordered_to", Tameable.class); GoalKey<Tameable> SIT_WHEN_ORDERED_TO = create("sit_when_ordered_to", Tameable.class);
GoalKey<Tameable> TAMABLE_ANIMAL_PANIC = create("tamable_animal_panic", Tameable.class);
GoalKey<Turtle> TURTLE_BREED = create("turtle_breed", Turtle.class); GoalKey<Turtle> TURTLE_BREED = create("turtle_breed", Turtle.class);
GoalKey<Turtle> TURTLE_GO_HOME = create("turtle_go_home", Turtle.class); GoalKey<Turtle> TURTLE_GO_HOME = create("turtle_go_home", Turtle.class);
@ -436,8 +436,6 @@ public interface VanillaGoal<T extends Mob> extends Goal<T> {
GoalKey<Wolf> WOLF_AVOID_ENTITY = create("wolf_avoid_entity", Wolf.class); GoalKey<Wolf> WOLF_AVOID_ENTITY = create("wolf_avoid_entity", Wolf.class);
GoalKey<Wolf> WOLF_PANIC = create("wolf_panic", Wolf.class);
GoalKey<Zombie> ZOMBIE_ATTACK = create("zombie_attack", Zombie.class); GoalKey<Zombie> ZOMBIE_ATTACK = create("zombie_attack", Zombie.class);
GoalKey<Zombie> ZOMBIE_ATTACK_TURTLE_EGG = create("zombie_attack_turtle_egg", Zombie.class); GoalKey<Zombie> ZOMBIE_ATTACK_TURTLE_EGG = create("zombie_attack_turtle_egg", Zombie.class);

View file

@ -23,7 +23,7 @@ import org.jetbrains.annotations.NotNull;
"unused", "unused",
"SpellCheckingInspection" "SpellCheckingInspection"
}) })
@GeneratedFrom("1.20.6") @GeneratedFrom("1.21")
@ApiStatus.Experimental @ApiStatus.Experimental
public final class BiomeKeys { public final class BiomeKeys {
/** /**

View file

@ -6,7 +6,6 @@ import io.papermc.paper.generated.GeneratedFrom;
import io.papermc.paper.registry.RegistryKey; import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.TypedKey; import io.papermc.paper.registry.TypedKey;
import net.kyori.adventure.key.Key; import net.kyori.adventure.key.Key;
import org.bukkit.MinecraftExperimental;
import org.bukkit.damage.DamageType; import org.bukkit.damage.DamageType;
import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@ -24,7 +23,7 @@ import org.jetbrains.annotations.NotNull;
"unused", "unused",
"SpellCheckingInspection" "SpellCheckingInspection"
}) })
@GeneratedFrom("1.20.6") @GeneratedFrom("1.21")
@ApiStatus.Experimental @ApiStatus.Experimental
public final class DamageTypeKeys { public final class DamageTypeKeys {
/** /**
@ -48,6 +47,13 @@ public final class DamageTypeKeys {
*/ */
public static final TypedKey<DamageType> CACTUS = create(key("cactus")); public static final TypedKey<DamageType> 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<DamageType> CAMPFIRE = create(key("campfire"));
/** /**
* {@code minecraft:cramming} * {@code minecraft:cramming}
* *

View file

@ -6,7 +6,6 @@ import io.papermc.paper.generated.GeneratedFrom;
import io.papermc.paper.registry.RegistryKey; import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.TypedKey; import io.papermc.paper.registry.TypedKey;
import net.kyori.adventure.key.Key; import net.kyori.adventure.key.Key;
import org.bukkit.MinecraftExperimental;
import org.bukkit.enchantments.Enchantment; import org.bukkit.enchantments.Enchantment;
import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@ -24,7 +23,7 @@ import org.jetbrains.annotations.NotNull;
"unused", "unused",
"SpellCheckingInspection" "SpellCheckingInspection"
}) })
@GeneratedFrom("1.20.6") @GeneratedFrom("1.21")
@ApiStatus.Experimental @ApiStatus.Experimental
public final class EnchantmentKeys { 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 * @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/ */
@ApiStatus.Experimental
public static final TypedKey<Enchantment> BREACH = create(key("breach")); public static final TypedKey<Enchantment> 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 * @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/ */
@ApiStatus.Experimental
public static final TypedKey<Enchantment> DENSITY = create(key("density")); public static final TypedKey<Enchantment> DENSITY = create(key("density"));
/** /**

View file

@ -23,7 +23,7 @@ import org.jetbrains.annotations.NotNull;
"unused", "unused",
"SpellCheckingInspection" "SpellCheckingInspection"
}) })
@GeneratedFrom("1.20.6") @GeneratedFrom("1.21")
@ApiStatus.Experimental @ApiStatus.Experimental
public final class GameEventKeys { public final class GameEventKeys {
/** /**

View file

@ -23,7 +23,7 @@ import org.jetbrains.annotations.NotNull;
"unused", "unused",
"SpellCheckingInspection" "SpellCheckingInspection"
}) })
@GeneratedFrom("1.20.6") @GeneratedFrom("1.21")
@ApiStatus.Experimental @ApiStatus.Experimental
public final class InstrumentKeys { public final class InstrumentKeys {
/** /**

View file

@ -6,7 +6,6 @@ import io.papermc.paper.generated.GeneratedFrom;
import io.papermc.paper.registry.RegistryKey; import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.TypedKey; import io.papermc.paper.registry.TypedKey;
import net.kyori.adventure.key.Key; import net.kyori.adventure.key.Key;
import org.bukkit.MinecraftExperimental;
import org.bukkit.potion.PotionEffectType; import org.bukkit.potion.PotionEffectType;
import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@ -24,7 +23,7 @@ import org.jetbrains.annotations.NotNull;
"unused", "unused",
"SpellCheckingInspection" "SpellCheckingInspection"
}) })
@GeneratedFrom("1.20.6") @GeneratedFrom("1.21")
@ApiStatus.Experimental @ApiStatus.Experimental
public final class MobEffectKeys { 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 * @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/ */
@ApiStatus.Experimental
public static final TypedKey<PotionEffectType> INFESTED = create(key("infested")); public static final TypedKey<PotionEffectType> 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 * @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/ */
@ApiStatus.Experimental
public static final TypedKey<PotionEffectType> TRIAL_OMEN = create(key("trial_omen")); public static final TypedKey<PotionEffectType> 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 * @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/ */
@ApiStatus.Experimental
public static final TypedKey<PotionEffectType> WEAVING = create(key("weaving")); public static final TypedKey<PotionEffectType> 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 * @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/ */
@ApiStatus.Experimental
public static final TypedKey<PotionEffectType> WIND_CHARGED = create(key("wind_charged")); public static final TypedKey<PotionEffectType> WIND_CHARGED = create(key("wind_charged"));
/** /**

View file

@ -6,7 +6,6 @@ import io.papermc.paper.generated.GeneratedFrom;
import io.papermc.paper.registry.RegistryKey; import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.TypedKey; import io.papermc.paper.registry.TypedKey;
import net.kyori.adventure.key.Key; import net.kyori.adventure.key.Key;
import org.bukkit.MinecraftExperimental;
import org.bukkit.generator.structure.Structure; import org.bukkit.generator.structure.Structure;
import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@ -24,7 +23,7 @@ import org.jetbrains.annotations.NotNull;
"unused", "unused",
"SpellCheckingInspection" "SpellCheckingInspection"
}) })
@GeneratedFrom("1.20.6") @GeneratedFrom("1.21")
@ApiStatus.Experimental @ApiStatus.Experimental
public final class StructureKeys { public final class StructureKeys {
/** /**

View file

@ -23,7 +23,7 @@ import org.jetbrains.annotations.NotNull;
"unused", "unused",
"SpellCheckingInspection" "SpellCheckingInspection"
}) })
@GeneratedFrom("1.20.6") @GeneratedFrom("1.21")
@ApiStatus.Experimental @ApiStatus.Experimental
public final class StructureTypeKeys { public final class StructureTypeKeys {
/** /**

View file

@ -23,7 +23,7 @@ import org.jetbrains.annotations.NotNull;
"unused", "unused",
"SpellCheckingInspection" "SpellCheckingInspection"
}) })
@GeneratedFrom("1.20.6") @GeneratedFrom("1.21")
@ApiStatus.Experimental @ApiStatus.Experimental
public final class TrimMaterialKeys { public final class TrimMaterialKeys {
/** /**

View file

@ -6,7 +6,6 @@ import io.papermc.paper.generated.GeneratedFrom;
import io.papermc.paper.registry.RegistryKey; import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.TypedKey; import io.papermc.paper.registry.TypedKey;
import net.kyori.adventure.key.Key; import net.kyori.adventure.key.Key;
import org.bukkit.MinecraftExperimental;
import org.bukkit.inventory.meta.trim.TrimPattern; import org.bukkit.inventory.meta.trim.TrimPattern;
import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@ -24,7 +23,7 @@ import org.jetbrains.annotations.NotNull;
"unused", "unused",
"SpellCheckingInspection" "SpellCheckingInspection"
}) })
@GeneratedFrom("1.20.6") @GeneratedFrom("1.21")
@ApiStatus.Experimental @ApiStatus.Experimental
public final class TrimPatternKeys { 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 * @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/ */
@ApiStatus.Experimental
public static final TypedKey<TrimPattern> BOLT = create(key("bolt")); public static final TypedKey<TrimPattern> BOLT = create(key("bolt"));
/** /**

View file

@ -23,7 +23,7 @@ import org.jetbrains.annotations.NotNull;
"unused", "unused",
"SpellCheckingInspection" "SpellCheckingInspection"
}) })
@GeneratedFrom("1.20.6") @GeneratedFrom("1.21")
@ApiStatus.Experimental @ApiStatus.Experimental
public final class WolfVariantKeys { public final class WolfVariantKeys {
/** /**

View file

@ -28,7 +28,6 @@ import net.minecraft.core.Holder;
import net.minecraft.core.HolderLookup; import net.minecraft.core.HolderLookup;
import net.minecraft.core.Registry; import net.minecraft.core.Registry;
import net.minecraft.core.RegistrySetBuilder; import net.minecraft.core.RegistrySetBuilder;
import net.minecraft.data.registries.UpdateOneTwentyOneRegistries;
import net.minecraft.data.registries.VanillaRegistries; import net.minecraft.data.registries.VanillaRegistries;
import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceKey;
import net.minecraft.world.flag.FeatureElement; import net.minecraft.world.flag.FeatureElement;
@ -54,8 +53,7 @@ public class GeneratedKeyType<T, A> extends SimpleGenerator {
private static final Map<ResourceKey<? extends Registry<?>>, RegistrySetBuilder.RegistryBootstrap<?>> VANILLA_REGISTRY_ENTRIES = VanillaRegistries.BUILDER.entries.stream() private static final Map<ResourceKey<? extends Registry<?>>, RegistrySetBuilder.RegistryBootstrap<?>> VANILLA_REGISTRY_ENTRIES = VanillaRegistries.BUILDER.entries.stream()
.collect(Collectors.toMap(RegistrySetBuilder.RegistryStub::key, RegistrySetBuilder.RegistryStub::bootstrap)); .collect(Collectors.toMap(RegistrySetBuilder.RegistryStub::key, RegistrySetBuilder.RegistryStub::bootstrap));
private static final Map<ResourceKey<? extends Registry<?>>, RegistrySetBuilder.RegistryBootstrap<?>> EXPERIMENTAL_REGISTRY_ENTRIES = UpdateOneTwentyOneRegistries.BUILDER.entries.stream() private static final Map<ResourceKey<? extends Registry<?>>, RegistrySetBuilder.RegistryBootstrap<?>> EXPERIMENTAL_REGISTRY_ENTRIES = Collections.emptyMap(); // Update for Experimental API
.collect(Collectors.toMap(RegistrySetBuilder.RegistryStub::key, RegistrySetBuilder.RegistryStub::bootstrap));
private static final Map<RegistryKey<?>, String> REGISTRY_KEY_FIELD_NAMES; private static final Map<RegistryKey<?>, String> REGISTRY_KEY_FIELD_NAMES;
static { static {
@ -139,15 +137,15 @@ public class GeneratedKeyType<T, A> extends SimpleGenerator {
.initializer("$N(key($S))", createMethod.build(), keyPath) .initializer("$N(key($S))", createMethod.build(), keyPath)
.addJavadoc(Javadocs.getVersionDependentField("{@code $L}"), key.location().toString()); .addJavadoc(Javadocs.getVersionDependentField("{@code $L}"), key.location().toString());
if (experimental.contains(key)) { if (experimental.contains(key)) {
fieldBuilder.addAnnotations(experimentalAnnotations(MinecraftExperimental.Requires.UPDATE_1_21)); fieldBuilder.addAnnotations(experimentalAnnotations(null)); // Update for Experimental API
} else { } else {
allExperimental = false; allExperimental = false;
} }
typeBuilder.addField(fieldBuilder.build()); typeBuilder.addField(fieldBuilder.build());
} }
if (allExperimental) { if (allExperimental) {
typeBuilder.addAnnotations(experimentalAnnotations(MinecraftExperimental.Requires.UPDATE_1_21)); typeBuilder.addAnnotations(experimentalAnnotations(null)); // Update for Experimental API
createMethod.addAnnotations(experimentalAnnotations(MinecraftExperimental.Requires.UPDATE_1_21)); createMethod.addAnnotations(experimentalAnnotations(null)); // Update for Experimental API
} else { } else {
typeBuilder.addAnnotation(EXPERIMENTAL_API_ANNOTATION); // TODO experimental API typeBuilder.addAnnotation(EXPERIMENTAL_API_ANNOTATION); // TODO experimental API
} }
@ -164,7 +162,7 @@ public class GeneratedKeyType<T, A> extends SimpleGenerator {
private Set<ResourceKey<T>> collectExperimentalKeysBuiltIn(final Registry<T> registry) { private Set<ResourceKey<T>> collectExperimentalKeysBuiltIn(final Registry<T> registry) {
final HolderLookup.RegistryLookup<T> filteredLookup = registry.asLookup().filterElements(v -> { final HolderLookup.RegistryLookup<T> 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()); return filteredLookup.listElementIds().collect(Collectors.toUnmodifiableSet());
} }

View file

@ -1,6 +1,7 @@
package io.papermc.generator.utils; package io.papermc.generator.utils;
import com.squareup.javapoet.AnnotationSpec; import com.squareup.javapoet.AnnotationSpec;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import io.papermc.paper.generated.GeneratedFrom; import io.papermc.paper.generated.GeneratedFrom;
@ -12,13 +13,17 @@ import org.jetbrains.annotations.Nullable;
public final class Annotations { public final class Annotations {
public static List<AnnotationSpec> experimentalAnnotations(final MinecraftExperimental.Requires requiredFeatureFlag) { public static List<AnnotationSpec> experimentalAnnotations(final MinecraftExperimental.@Nullable Requires requiredFeatureFlag) {
return List.of( final List<AnnotationSpec> annotationSpecs = new ArrayList<>();
AnnotationSpec.builder(ApiStatus.Experimental.class).build(), annotationSpecs.add(AnnotationSpec.builder(ApiStatus.Experimental.class).build());
AnnotationSpec.builder(MinecraftExperimental.class) if (requiredFeatureFlag != null) {
annotationSpecs.add(AnnotationSpec.builder(MinecraftExperimental.class)
.addMember("value", "$T.$L", MinecraftExperimental.Requires.class, requiredFeatureFlag.name()) .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) { public static AnnotationSpec deprecatedVersioned(final @Nullable String version, boolean forRemoval) {