Fix tag key generator output inconsistencies (#11218)

* Fix tag key generator output inconsistencies

* use NonNull instead of NotNull for generated api

---------

Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
Dieser Commit ist enthalten in:
Lulu13022002 2024-08-11 00:11:57 +02:00 committet von GitHub
Ursprung 70dfa467e7
Commit 1cecc24cad
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: B5690EEEBB952194
22 geänderte Dateien mit 1166 neuen und 1186 gelöschten Zeilen

Datei anzeigen

@ -51,7 +51,7 @@ import org.bukkit.entity.WanderingTrader;
import org.bukkit.entity.Wither;
import org.bukkit.entity.Wolf;
import org.bukkit.entity.Zombie;
import org.jetbrains.annotations.NotNull;
import org.checkerframework.checker.nullness.qual.NonNull;
/**
* Vanilla keys for Mob Goals.
@ -436,8 +436,8 @@ public interface VanillaGoal<T extends Mob> extends Goal<T> {
GoalKey<Zombie> ZOMBIE_ATTACK_TURTLE_EGG = create("zombie_attack_turtle_egg", Zombie.class);
private static <T extends Mob> @NotNull GoalKey<T> create(final @NotNull String key,
final @NotNull Class<T> type) {
private static <T extends Mob> @NonNull GoalKey<T> create(final @NonNull String key,
final @NonNull Class<T> type) {
return GoalKey.of(type, NamespacedKey.minecraft(key));
}
}

Datei anzeigen

@ -7,8 +7,8 @@ import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.TypedKey;
import net.kyori.adventure.key.Key;
import org.bukkit.block.Biome;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
/**
* Vanilla keys for {@link RegistryKey#BIOME}.
@ -478,13 +478,13 @@ public final class BiomeKeys {
}
/**
* Creates a key for {@link Biome} in a registry.
* Creates a key for {@link Biome} in the registry {@code minecraft:worldgen/biome}.
*
* @param key the value's key in the registry
* @return a new typed key
*/
@ApiStatus.Experimental
public static @NotNull TypedKey<Biome> create(final @NotNull Key key) {
public static @NonNull TypedKey<Biome> create(final @NonNull Key key) {
return TypedKey.create(RegistryKey.BIOME, key);
}
}

Datei anzeigen

@ -7,8 +7,8 @@ import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.TypedKey;
import net.kyori.adventure.key.Key;
import org.bukkit.damage.DamageType;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
/**
* Vanilla keys for {@link RegistryKey#DAMAGE_TYPE}.
@ -359,13 +359,13 @@ public final class DamageTypeKeys {
}
/**
* Creates a key for {@link DamageType} in a registry.
* Creates a key for {@link DamageType} in the registry {@code minecraft:damage_type}.
*
* @param key the value's key in the registry
* @return a new typed key
*/
@ApiStatus.Experimental
public static @NotNull TypedKey<DamageType> create(final @NotNull Key key) {
public static @NonNull TypedKey<DamageType> create(final @NonNull Key key) {
return TypedKey.create(RegistryKey.DAMAGE_TYPE, key);
}
}

Datei anzeigen

@ -7,8 +7,8 @@ import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.TypedKey;
import net.kyori.adventure.key.Key;
import org.bukkit.enchantments.Enchantment;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
/**
* Vanilla keys for {@link RegistryKey#ENCHANTMENT}.
@ -323,7 +323,7 @@ public final class EnchantmentKeys {
private EnchantmentKeys() {
}
private static @NotNull TypedKey<Enchantment> create(final @NotNull Key key) {
private static @NonNull TypedKey<Enchantment> create(final @NonNull Key key) {
return TypedKey.create(RegistryKey.ENCHANTMENT, key);
}
}

Datei anzeigen

@ -7,8 +7,8 @@ import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.TypedKey;
import net.kyori.adventure.key.Key;
import org.bukkit.GameEvent;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
/**
* Vanilla keys for {@link RegistryKey#GAME_EVENT}.
@ -449,7 +449,7 @@ public final class GameEventKeys {
private GameEventKeys() {
}
private static @NotNull TypedKey<GameEvent> create(final @NotNull Key key) {
private static @NonNull TypedKey<GameEvent> create(final @NonNull Key key) {
return TypedKey.create(RegistryKey.GAME_EVENT, key);
}
}

Datei anzeigen

@ -7,8 +7,8 @@ import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.TypedKey;
import net.kyori.adventure.key.Key;
import org.bukkit.MusicInstrument;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
/**
* Vanilla keys for {@link RegistryKey#INSTRUMENT}.
@ -85,7 +85,7 @@ public final class InstrumentKeys {
private InstrumentKeys() {
}
private static @NotNull TypedKey<MusicInstrument> create(final @NotNull Key key) {
private static @NonNull TypedKey<MusicInstrument> create(final @NonNull Key key) {
return TypedKey.create(RegistryKey.INSTRUMENT, key);
}
}

Datei anzeigen

@ -7,8 +7,8 @@ import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.TypedKey;
import net.kyori.adventure.key.Key;
import org.bukkit.inventory.ItemType;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
/**
* Vanilla keys for {@link RegistryKey#ITEM}.
@ -9360,7 +9360,7 @@ public final class ItemTypeKeys {
private ItemTypeKeys() {
}
private static @NotNull TypedKey<ItemType> create(final @NotNull Key key) {
private static @NonNull TypedKey<ItemType> create(final @NonNull Key key) {
return TypedKey.create(RegistryKey.ITEM, key);
}
}

Datei anzeigen

@ -7,8 +7,8 @@ import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.TypedKey;
import net.kyori.adventure.key.Key;
import org.bukkit.potion.PotionEffectType;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
/**
* Vanilla keys for {@link RegistryKey#MOB_EFFECT}.
@ -302,7 +302,7 @@ public final class MobEffectKeys {
private MobEffectKeys() {
}
private static @NotNull TypedKey<PotionEffectType> create(final @NotNull Key key) {
private static @NonNull TypedKey<PotionEffectType> create(final @NonNull Key key) {
return TypedKey.create(RegistryKey.MOB_EFFECT, key);
}
}

Datei anzeigen

@ -7,8 +7,8 @@ import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.TypedKey;
import net.kyori.adventure.key.Key;
import org.bukkit.generator.structure.Structure;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
/**
* Vanilla keys for {@link RegistryKey#STRUCTURE}.
@ -268,13 +268,13 @@ public final class StructureKeys {
}
/**
* Creates a key for {@link Structure} in a registry.
* Creates a key for {@link Structure} in the registry {@code minecraft:worldgen/structure}.
*
* @param key the value's key in the registry
* @return a new typed key
*/
@ApiStatus.Experimental
public static @NotNull TypedKey<Structure> create(final @NotNull Key key) {
public static @NonNull TypedKey<Structure> create(final @NonNull Key key) {
return TypedKey.create(RegistryKey.STRUCTURE, key);
}
}

Datei anzeigen

@ -7,8 +7,8 @@ import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.TypedKey;
import net.kyori.adventure.key.Key;
import org.bukkit.generator.structure.StructureType;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
/**
* Vanilla keys for {@link RegistryKey#STRUCTURE_TYPE}.
@ -141,7 +141,7 @@ public final class StructureTypeKeys {
private StructureTypeKeys() {
}
private static @NotNull TypedKey<StructureType> create(final @NotNull Key key) {
private static @NonNull TypedKey<StructureType> create(final @NonNull Key key) {
return TypedKey.create(RegistryKey.STRUCTURE_TYPE, key);
}
}

Datei anzeigen

@ -7,8 +7,8 @@ import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.TypedKey;
import net.kyori.adventure.key.Key;
import org.bukkit.inventory.meta.trim.TrimMaterial;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
/**
* Vanilla keys for {@link RegistryKey#TRIM_MATERIAL}.
@ -100,13 +100,13 @@ public final class TrimMaterialKeys {
}
/**
* Creates a key for {@link TrimMaterial} in a registry.
* Creates a key for {@link TrimMaterial} in the registry {@code minecraft:trim_material}.
*
* @param key the value's key in the registry
* @return a new typed key
*/
@ApiStatus.Experimental
public static @NotNull TypedKey<TrimMaterial> create(final @NotNull Key key) {
public static @NonNull TypedKey<TrimMaterial> create(final @NonNull Key key) {
return TypedKey.create(RegistryKey.TRIM_MATERIAL, key);
}
}

Datei anzeigen

@ -7,8 +7,8 @@ import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.TypedKey;
import net.kyori.adventure.key.Key;
import org.bukkit.inventory.meta.trim.TrimPattern;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
/**
* Vanilla keys for {@link RegistryKey#TRIM_PATTERN}.
@ -156,13 +156,13 @@ public final class TrimPatternKeys {
}
/**
* Creates a key for {@link TrimPattern} in a registry.
* Creates a key for {@link TrimPattern} in the registry {@code minecraft:trim_pattern}.
*
* @param key the value's key in the registry
* @return a new typed key
*/
@ApiStatus.Experimental
public static @NotNull TypedKey<TrimPattern> create(final @NotNull Key key) {
public static @NonNull TypedKey<TrimPattern> create(final @NonNull Key key) {
return TypedKey.create(RegistryKey.TRIM_PATTERN, key);
}
}

Datei anzeigen

@ -7,8 +7,8 @@ import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.TypedKey;
import net.kyori.adventure.key.Key;
import org.bukkit.entity.Wolf;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
/**
* Vanilla keys for {@link RegistryKey#WOLF_VARIANT}.
@ -93,13 +93,13 @@ public final class WolfVariantKeys {
}
/**
* Creates a key for {@link Wolf.Variant} in a registry.
* Creates a key for {@link Wolf.Variant} in the registry {@code minecraft:wolf_variant}.
*
* @param key the value's key in the registry
* @return a new typed key
*/
@ApiStatus.Experimental
public static @NotNull TypedKey<Wolf.Variant> create(final @NotNull Key key) {
public static @NonNull TypedKey<Wolf.Variant> create(final @NonNull Key key) {
return TypedKey.create(RegistryKey.WOLF_VARIANT, key);
}
}

Datei anzeigen

@ -8,8 +8,8 @@ import io.papermc.paper.registry.tag.TagKey;
import net.kyori.adventure.key.Key;
import org.bukkit.MinecraftExperimental;
import org.bukkit.enchantments.Enchantment;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
/**
* Vanilla keys for {@link RegistryKey#ENCHANTMENT}.
@ -28,94 +28,18 @@ import org.jetbrains.annotations.NotNull;
@ApiStatus.Experimental
public final class EnchantmentTagKeys {
/**
* {@code #minecraft:trades/savanna_special}
* {@code #minecraft:curse}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
@ApiStatus.Experimental
@MinecraftExperimental(MinecraftExperimental.Requires.TRADE_REBALANCE)
public static final TagKey<Enchantment> TRADES_SAVANNA_SPECIAL = create(key("trades/savanna_special"));
public static final TagKey<Enchantment> CURSE = create(key("curse"));
/**
* {@code #minecraft:smelts_loot}
* {@code #minecraft:double_trade_price}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Enchantment> SMELTS_LOOT = create(key("smelts_loot"));
/**
* {@code #minecraft:exclusive_set/crossbow}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Enchantment> EXCLUSIVE_SET_CROSSBOW = create(key("exclusive_set/crossbow"));
/**
* {@code #minecraft:tradeable}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Enchantment> TRADEABLE = create(key("tradeable"));
/**
* {@code #minecraft:exclusive_set/damage}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Enchantment> EXCLUSIVE_SET_DAMAGE = create(key("exclusive_set/damage"));
/**
* {@code #minecraft:prevents_bee_spawns_when_mining}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Enchantment> PREVENTS_BEE_SPAWNS_WHEN_MINING = create(key("prevents_bee_spawns_when_mining"));
/**
* {@code #minecraft:in_enchanting_table}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Enchantment> IN_ENCHANTING_TABLE = create(key("in_enchanting_table"));
/**
* {@code #minecraft:treasure}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Enchantment> TREASURE = create(key("treasure"));
/**
* {@code #minecraft:exclusive_set/mining}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Enchantment> EXCLUSIVE_SET_MINING = create(key("exclusive_set/mining"));
/**
* {@code #minecraft:trades/taiga_special}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
@ApiStatus.Experimental
@MinecraftExperimental(MinecraftExperimental.Requires.TRADE_REBALANCE)
public static final TagKey<Enchantment> TRADES_TAIGA_SPECIAL = create(key("trades/taiga_special"));
/**
* {@code #minecraft:trades/plains_common}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
@ApiStatus.Experimental
@MinecraftExperimental(MinecraftExperimental.Requires.TRADE_REBALANCE)
public static final TagKey<Enchantment> TRADES_PLAINS_COMMON = create(key("trades/plains_common"));
/**
* {@code #minecraft:on_mob_spawn_equipment}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Enchantment> ON_MOB_SPAWN_EQUIPMENT = create(key("on_mob_spawn_equipment"));
public static final TagKey<Enchantment> DOUBLE_TRADE_PRICE = create(key("double_trade_price"));
/**
* {@code #minecraft:exclusive_set/armor}
@ -124,6 +48,55 @@ public final class EnchantmentTagKeys {
*/
public static final TagKey<Enchantment> EXCLUSIVE_SET_ARMOR = create(key("exclusive_set/armor"));
/**
* {@code #minecraft:exclusive_set/boots}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Enchantment> EXCLUSIVE_SET_BOOTS = create(key("exclusive_set/boots"));
/**
* {@code #minecraft:exclusive_set/bow}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Enchantment> EXCLUSIVE_SET_BOW = create(key("exclusive_set/bow"));
/**
* {@code #minecraft:exclusive_set/crossbow}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Enchantment> EXCLUSIVE_SET_CROSSBOW = create(key("exclusive_set/crossbow"));
/**
* {@code #minecraft:exclusive_set/damage}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Enchantment> EXCLUSIVE_SET_DAMAGE = create(key("exclusive_set/damage"));
/**
* {@code #minecraft:exclusive_set/mining}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Enchantment> EXCLUSIVE_SET_MINING = create(key("exclusive_set/mining"));
/**
* {@code #minecraft:exclusive_set/riptide}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Enchantment> EXCLUSIVE_SET_RIPTIDE = create(key("exclusive_set/riptide"));
/**
* {@code #minecraft:in_enchanting_table}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Enchantment> IN_ENCHANTING_TABLE = create(key("in_enchanting_table"));
/**
* {@code #minecraft:non_treasure}
*
@ -132,22 +105,92 @@ public final class EnchantmentTagKeys {
public static final TagKey<Enchantment> NON_TREASURE = create(key("non_treasure"));
/**
* {@code #minecraft:trades/snow_special}
* {@code #minecraft:on_mob_spawn_equipment}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
@ApiStatus.Experimental
@MinecraftExperimental(MinecraftExperimental.Requires.TRADE_REBALANCE)
public static final TagKey<Enchantment> TRADES_SNOW_SPECIAL = create(key("trades/snow_special"));
public static final TagKey<Enchantment> ON_MOB_SPAWN_EQUIPMENT = create(key("on_mob_spawn_equipment"));
/**
* {@code #minecraft:trades/plains_special}
* {@code #minecraft:on_random_loot}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Enchantment> ON_RANDOM_LOOT = create(key("on_random_loot"));
/**
* {@code #minecraft:on_traded_equipment}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Enchantment> ON_TRADED_EQUIPMENT = create(key("on_traded_equipment"));
/**
* {@code #minecraft:prevents_bee_spawns_when_mining}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Enchantment> PREVENTS_BEE_SPAWNS_WHEN_MINING = create(key("prevents_bee_spawns_when_mining"));
/**
* {@code #minecraft:prevents_decorated_pot_shattering}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Enchantment> PREVENTS_DECORATED_POT_SHATTERING = create(key("prevents_decorated_pot_shattering"));
/**
* {@code #minecraft:prevents_ice_melting}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Enchantment> PREVENTS_ICE_MELTING = create(key("prevents_ice_melting"));
/**
* {@code #minecraft:prevents_infested_spawns}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Enchantment> PREVENTS_INFESTED_SPAWNS = create(key("prevents_infested_spawns"));
/**
* {@code #minecraft:smelts_loot}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Enchantment> SMELTS_LOOT = create(key("smelts_loot"));
/**
* {@code #minecraft:tooltip_order}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Enchantment> TOOLTIP_ORDER = create(key("tooltip_order"));
/**
* {@code #minecraft:tradeable}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Enchantment> TRADEABLE = create(key("tradeable"));
/**
* {@code #minecraft:trades/desert_common}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
@ApiStatus.Experimental
@MinecraftExperimental(MinecraftExperimental.Requires.TRADE_REBALANCE)
public static final TagKey<Enchantment> TRADES_PLAINS_SPECIAL = create(key("trades/plains_special"));
public static final TagKey<Enchantment> TRADES_DESERT_COMMON = create(key("trades/desert_common"));
/**
* {@code #minecraft:trades/desert_special}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
@ApiStatus.Experimental
@MinecraftExperimental(MinecraftExperimental.Requires.TRADE_REBALANCE)
public static final TagKey<Enchantment> TRADES_DESERT_SPECIAL = create(key("trades/desert_special"));
/**
* {@code #minecraft:trades/jungle_common}
@ -167,6 +210,24 @@ public final class EnchantmentTagKeys {
@MinecraftExperimental(MinecraftExperimental.Requires.TRADE_REBALANCE)
public static final TagKey<Enchantment> TRADES_JUNGLE_SPECIAL = create(key("trades/jungle_special"));
/**
* {@code #minecraft:trades/plains_common}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
@ApiStatus.Experimental
@MinecraftExperimental(MinecraftExperimental.Requires.TRADE_REBALANCE)
public static final TagKey<Enchantment> TRADES_PLAINS_COMMON = create(key("trades/plains_common"));
/**
* {@code #minecraft:trades/plains_special}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
@ApiStatus.Experimental
@MinecraftExperimental(MinecraftExperimental.Requires.TRADE_REBALANCE)
public static final TagKey<Enchantment> TRADES_PLAINS_SPECIAL = create(key("trades/plains_special"));
/**
* {@code #minecraft:trades/savanna_common}
*
@ -177,80 +238,13 @@ public final class EnchantmentTagKeys {
public static final TagKey<Enchantment> TRADES_SAVANNA_COMMON = create(key("trades/savanna_common"));
/**
* {@code #minecraft:curse}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Enchantment> CURSE = create(key("curse"));
/**
* {@code #minecraft:prevents_infested_spawns}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Enchantment> PREVENTS_INFESTED_SPAWNS = create(key("prevents_infested_spawns"));
/**
* {@code #minecraft:exclusive_set/bow}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Enchantment> EXCLUSIVE_SET_BOW = create(key("exclusive_set/bow"));
/**
* {@code #minecraft:on_random_loot}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Enchantment> ON_RANDOM_LOOT = create(key("on_random_loot"));
/**
* {@code #minecraft:exclusive_set/boots}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Enchantment> EXCLUSIVE_SET_BOOTS = create(key("exclusive_set/boots"));
/**
* {@code #minecraft:trades/taiga_common}
* {@code #minecraft:trades/savanna_special}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
@ApiStatus.Experimental
@MinecraftExperimental(MinecraftExperimental.Requires.TRADE_REBALANCE)
public static final TagKey<Enchantment> TRADES_TAIGA_COMMON = create(key("trades/taiga_common"));
/**
* {@code #minecraft:trades/desert_special}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
@ApiStatus.Experimental
@MinecraftExperimental(MinecraftExperimental.Requires.TRADE_REBALANCE)
public static final TagKey<Enchantment> TRADES_DESERT_SPECIAL = create(key("trades/desert_special"));
/**
* {@code #minecraft:exclusive_set/riptide}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Enchantment> EXCLUSIVE_SET_RIPTIDE = create(key("exclusive_set/riptide"));
/**
* {@code #minecraft:trades/swamp_special}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
@ApiStatus.Experimental
@MinecraftExperimental(MinecraftExperimental.Requires.TRADE_REBALANCE)
public static final TagKey<Enchantment> TRADES_SWAMP_SPECIAL = create(key("trades/swamp_special"));
/**
* {@code #minecraft:prevents_ice_melting}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Enchantment> PREVENTS_ICE_MELTING = create(key("prevents_ice_melting"));
public static final TagKey<Enchantment> TRADES_SAVANNA_SPECIAL = create(key("trades/savanna_special"));
/**
* {@code #minecraft:trades/snow_common}
@ -262,18 +256,13 @@ public final class EnchantmentTagKeys {
public static final TagKey<Enchantment> TRADES_SNOW_COMMON = create(key("trades/snow_common"));
/**
* {@code #minecraft:on_traded_equipment}
* {@code #minecraft:trades/snow_special}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Enchantment> ON_TRADED_EQUIPMENT = create(key("on_traded_equipment"));
/**
* {@code #minecraft:double_trade_price}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Enchantment> DOUBLE_TRADE_PRICE = create(key("double_trade_price"));
@ApiStatus.Experimental
@MinecraftExperimental(MinecraftExperimental.Requires.TRADE_REBALANCE)
public static final TagKey<Enchantment> TRADES_SNOW_SPECIAL = create(key("trades/snow_special"));
/**
* {@code #minecraft:trades/swamp_common}
@ -285,39 +274,50 @@ public final class EnchantmentTagKeys {
public static final TagKey<Enchantment> TRADES_SWAMP_COMMON = create(key("trades/swamp_common"));
/**
* {@code #minecraft:trades/desert_common}
* {@code #minecraft:trades/swamp_special}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
@ApiStatus.Experimental
@MinecraftExperimental(MinecraftExperimental.Requires.TRADE_REBALANCE)
public static final TagKey<Enchantment> TRADES_DESERT_COMMON = create(key("trades/desert_common"));
public static final TagKey<Enchantment> TRADES_SWAMP_SPECIAL = create(key("trades/swamp_special"));
/**
* {@code #minecraft:prevents_decorated_pot_shattering}
* {@code #minecraft:trades/taiga_common}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Enchantment> PREVENTS_DECORATED_POT_SHATTERING = create(key("prevents_decorated_pot_shattering"));
@ApiStatus.Experimental
@MinecraftExperimental(MinecraftExperimental.Requires.TRADE_REBALANCE)
public static final TagKey<Enchantment> TRADES_TAIGA_COMMON = create(key("trades/taiga_common"));
/**
* {@code #minecraft:tooltip_order}
* {@code #minecraft:trades/taiga_special}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Enchantment> TOOLTIP_ORDER = create(key("tooltip_order"));
@ApiStatus.Experimental
@MinecraftExperimental(MinecraftExperimental.Requires.TRADE_REBALANCE)
public static final TagKey<Enchantment> TRADES_TAIGA_SPECIAL = create(key("trades/taiga_special"));
/**
* {@code #minecraft:treasure}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Enchantment> TREASURE = create(key("treasure"));
private EnchantmentTagKeys() {
}
/**
* Creates a tag key for {@link Enchantment} in the registry {@code minecraft:root}.
* Creates a tag key for {@link Enchantment} in the registry {@code minecraft:enchantment}.
*
* @param key the tag key's key
* @return a new tag key
*/
@ApiStatus.Experimental
public static @NotNull TagKey<Enchantment> create(final @NotNull Key key) {
public static @NonNull TagKey<Enchantment> create(final @NonNull Key key) {
return TagKey.create(RegistryKey.ENCHANTMENT, key);
}
}

Datei anzeigen

@ -31,8 +31,6 @@ import net.minecraft.core.RegistrySetBuilder;
import net.minecraft.data.registries.VanillaRegistries;
import net.minecraft.resources.ResourceKey;
import net.minecraft.world.flag.FeatureElement;
import net.minecraft.world.flag.FeatureFlags;
import org.bukkit.MinecraftExperimental;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.checkerframework.framework.qual.DefaultQualifier;
@ -72,7 +70,7 @@ public class GeneratedKeyType<T, A> extends SimpleGenerator {
}
private static final String CREATE_JAVADOC = """
Creates a key for {@link $T} in a registry.
Creates a key for {@link $T} in the registry {@code $L}.
@param key the value's key in the registry
@return a new typed key
@ -102,7 +100,7 @@ public class GeneratedKeyType<T, A> extends SimpleGenerator {
.returns(returnType.annotated(NOT_NULL));
if (this.publicCreateKeyMethod) {
create.addAnnotation(EXPERIMENTAL_API_ANNOTATION); // TODO remove once not experimental
create.addJavadoc(CREATE_JAVADOC, this.apiType);
create.addJavadoc(CREATE_JAVADOC, this.apiType, this.registryKey.location().toString());
}
return create;
}
@ -190,8 +188,6 @@ public class GeneratedKeyType<T, A> extends SimpleGenerator {
@Override
protected JavaFile.Builder file(final JavaFile.Builder builder) {
return builder
.skipJavaLangImports(true)
.addStaticImport(Key.class, "key")
.indent(" ");
.addStaticImport(Key.class, "key");
}
}

Datei anzeigen

@ -15,15 +15,11 @@ import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.tag.TagKey;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.stream.Collectors;
import net.kyori.adventure.key.Key;
import net.minecraft.core.Registry;
import net.minecraft.core.RegistrySetBuilder;
import net.minecraft.data.registries.VanillaRegistries;
import net.minecraft.resources.ResourceKey;
import org.bukkit.MinecraftExperimental;
@ -39,11 +35,6 @@ import static javax.lang.model.element.Modifier.STATIC;
public class GeneratedTagKeyType<T, A> extends SimpleGenerator {
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));
private static final Map<ResourceKey<? extends Registry<?>>, RegistrySetBuilder.RegistryBootstrap<?>> EXPERIMENTAL_REGISTRY_ENTRIES = Collections.emptyMap(); // Update for Experimental API
private static final Map<RegistryKey<?>, String> REGISTRY_KEY_FIELD_NAMES;
static {
final Map<RegistryKey<?>, String> map = new HashMap<>();
@ -91,7 +82,7 @@ public class GeneratedTagKeyType<T, A> extends SimpleGenerator {
.returns(returnType.annotated(NOT_NULL));
if (this.publicCreateKeyMethod) {
create.addAnnotation(EXPERIMENTAL_API_ANNOTATION); // TODO remove once not experimental
create.addJavadoc(CREATE_JAVADOC, this.apiType, this.registryKey.registry().toString());
create.addJavadoc(CREATE_JAVADOC, this.apiType, this.registryKey.location().toString());
}
return create;
}
@ -102,8 +93,8 @@ public class GeneratedTagKeyType<T, A> extends SimpleGenerator {
.addJavadoc(Javadocs.getVersionDependentClassHeader("{@link $T#$L}"), RegistryKey.class, REGISTRY_KEY_FIELD_NAMES.get(this.apiRegistryKey))
.addAnnotations(Annotations.CLASS_HEADER)
.addMethod(MethodSpec.constructorBuilder()
.addModifiers(PRIVATE)
.build()
.addModifiers(PRIVATE)
.build()
);
}
@ -117,8 +108,7 @@ public class GeneratedTagKeyType<T, A> extends SimpleGenerator {
final Registry<T> registry = Main.REGISTRY_ACCESS.registryOrThrow(this.registryKey);
final AtomicBoolean allExperimental = new AtomicBoolean(true);
registry.getTags().forEach(pair -> {
final net.minecraft.tags.TagKey<T> nmsTagKey = pair.getFirst();
registry.getTagNames().sorted(Formatting.alphabeticKeyOrder(nmsTagKey -> nmsTagKey.location().getPath())).forEach(nmsTagKey -> {
final String fieldName = Formatting.formatKeyAsField(nmsTagKey.location().getPath());
final FieldSpec.Builder fieldBuilder = FieldSpec.builder(tagKey, fieldName, PUBLIC, STATIC, FINAL)
.initializer("$N(key($S))", createMethod.build(), nmsTagKey.location().getPath())
@ -142,8 +132,6 @@ public class GeneratedTagKeyType<T, A> extends SimpleGenerator {
@Override
protected JavaFile.Builder file(final JavaFile.Builder builder) {
return builder
.skipJavaLangImports(true)
.addStaticImport(Key.class, "key")
.indent(" ");
.addStaticImport(Key.class, "key");
}
}

Datei anzeigen

@ -132,8 +132,7 @@ public class MobGoalGenerator extends SimpleGenerator {
@Override
protected JavaFile.Builder file(JavaFile.Builder builder) {
return builder
.skipJavaLangImports(true);
return builder;
}
record DeprecatedEntry(Class<?> entity, String entryName, @Nullable String removalVersion,

Datei anzeigen

@ -7,8 +7,8 @@ import java.util.List;
import io.papermc.paper.generated.GeneratedFrom;
import net.minecraft.SharedConstants;
import org.bukkit.MinecraftExperimental;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public final class Annotations {
@ -26,10 +26,10 @@ public final class Annotations {
return annotationSpecs;
}
public static AnnotationSpec deprecatedVersioned(final @Nullable String version, boolean forRemoval) {
AnnotationSpec.Builder annotationSpec = AnnotationSpec.builder(Deprecated.class);
public static AnnotationSpec deprecatedVersioned(final @Nullable String version, final boolean forRemoval) {
final AnnotationSpec.Builder annotationSpec = AnnotationSpec.builder(Deprecated.class);
if (forRemoval) {
annotationSpec.addMember("forRemoval", "$L", forRemoval);
annotationSpec.addMember("forRemoval", "$L", true);
}
if (version != null) {
annotationSpec.addMember("since", "$S", version);
@ -46,7 +46,7 @@ public final class Annotations {
@ApiStatus.Experimental
public static final AnnotationSpec EXPERIMENTAL_API_ANNOTATION = AnnotationSpec.builder(ApiStatus.Experimental.class).build();
public static final AnnotationSpec NOT_NULL = AnnotationSpec.builder(NotNull.class).build();
public static final AnnotationSpec NOT_NULL = AnnotationSpec.builder(NonNull.class).build();
private static final AnnotationSpec SUPPRESS_WARNINGS = AnnotationSpec.builder(SuppressWarnings.class)
.addMember("value", "$S", "unused")
.addMember("value", "$S", "SpellCheckingInspection")

Datei anzeigen

@ -2,7 +2,6 @@ package io.papermc.generator.utils;
import com.mojang.serialization.Lifecycle;
import io.papermc.generator.Main;
import java.util.List;
import java.util.Set;
import net.minecraft.core.Holder;
import net.minecraft.core.HolderGetter;

Datei anzeigen

@ -4,7 +4,6 @@ import com.google.common.collect.HashMultimap;
import com.google.common.collect.Multimap;
import com.mojang.logging.LogUtils;
import io.papermc.generator.Main;
import io.papermc.generator.utils.Formatting;
import java.util.Collections;
import java.util.IdentityHashMap;
import java.util.Map;
@ -19,7 +18,6 @@ import net.minecraft.server.packs.PackType;
import net.minecraft.server.packs.repository.BuiltInPackSource;
import net.minecraft.server.packs.resources.MultiPackResourceManager;
import net.minecraft.tags.TagKey;
import net.minecraft.tags.TagManager;
import org.slf4j.Logger;
// collect all the tags by grabbing the json from the data-packs
@ -50,9 +48,9 @@ public final class TagCollector {
}
result.put(entry.value().getTagNames()
.filter(tagKey -> tagKey.location().getPath().equals(path))
.findFirst()
.orElseThrow(), packId);
.filter(tagKey -> tagKey.location().getPath().equals(path))
.findFirst()
.orElseThrow(), packId);
});
});
return Collections.unmodifiableMap(result);

Datei anzeigen

@ -340,7 +340,7 @@ index 0000000000000000000000000000000000000000..18f9463ae23ba2d9c65ffb7531a87c92
+}
diff --git a/src/main/java/io/papermc/paper/registry/data/util/Checks.java b/src/main/java/io/papermc/paper/registry/data/util/Checks.java
new file mode 100644
index 0000000000000000000000000000000000000000..a66cebe2b918a22b84e346127ffb671621050e5f
index 0000000000000000000000000000000000000000..3241a94731fe8163876614efdcf30f8b551535af
--- /dev/null
+++ b/src/main/java/io/papermc/paper/registry/data/util/Checks.java
@@ -0,0 +1,48 @@
@ -370,7 +370,7 @@ index 0000000000000000000000000000000000000000..a66cebe2b918a22b84e346127ffb6716
+
+ public static <T> T asArgument(final @Nullable T value, final String field) {
+ if (value == null) {
+ throw new IllegalArgumentException("argument " + value + " cannot be null");
+ throw new IllegalArgumentException("argument " + field + " cannot be null");
+ }
+ return value;
+ }