Generators

Co-authored-by: Owen1212055 <23108066+Owen1212055@users.noreply.github.com>
This commit is contained in:
Lulu13022002 2024-07-05 18:00:34 +02:00
parent ba3c29b92e
commit 07df94e31e
No known key found for this signature in database
GPG key ID: 491C8F0B8ACDEB01
362 changed files with 40149 additions and 1728 deletions

View file

@ -1,3 +1,5 @@
root = true
[*] [*]
charset=utf-8 charset=utf-8
end_of_line=lf end_of_line=lf
@ -37,6 +39,3 @@ ij_java_use_fq_class_names = false
[Paper-Server/src/main/resources/data/**/*.json] [Paper-Server/src/main/resources/data/**/*.json]
indent_size = 2 indent_size = 2
[paper-api-generator/generated/**/*.java]
ij_java_imports_layout = $*,|,*

2
.gitignore vendored
View file

@ -73,4 +73,4 @@ paperclip.properties
!gradle/wrapper/gradle-wrapper.jar !gradle/wrapper/gradle-wrapper.jar
test-plugin.settings.gradle.kts test-plugin.settings.gradle.kts
paper-api-generator.settings.gradle.kts paper-generator.settings.gradle.kts

View file

@ -1,35 +0,0 @@
import io.papermc.paperweight.PaperweightSourceGeneratorHelper
import io.papermc.paperweight.extension.PaperweightSourceGeneratorExt
plugins {
java
}
plugins.apply(PaperweightSourceGeneratorHelper::class)
extensions.configure(PaperweightSourceGeneratorExt::class) {
atFile.set(projectDir.toPath().resolve("wideners.at").toFile())
}
dependencies {
implementation("com.squareup:javapoet:1.13.0")
implementation(project(":paper-api"))
implementation("io.github.classgraph:classgraph:4.8.47")
implementation("org.jetbrains:annotations:24.0.1")
testImplementation("org.junit.jupiter:junit-jupiter:5.10.2")
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
}
tasks.register<JavaExec>("generate") {
dependsOn(tasks.check)
mainClass.set("io.papermc.generator.Main")
classpath(sourceSets.main.map { it.runtimeClasspath })
args(projectDir.toPath().resolve("generated").toString())
}
tasks.test {
useJUnitPlatform()
}
group = "io.papermc.paper"
version = "1.0-SNAPSHOT"

View file

@ -1,490 +0,0 @@
package io.papermc.paper.registry.keys;
import static net.kyori.adventure.key.Key.key;
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.block.Biome;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.jetbrains.annotations.ApiStatus;
/**
* Vanilla keys for {@link RegistryKey#BIOME}.
*
* @apiNote The fields provided here are a direct representation of
* what is available from the vanilla game source. They may be
* changed (including removals) on any Minecraft version
* bump, so cross-version compatibility is not provided on the
* same level as it is on most of the other API.
*/
@SuppressWarnings({
"unused",
"SpellCheckingInspection"
})
@GeneratedFrom("1.21.1")
@ApiStatus.Experimental
public final class BiomeKeys {
/**
* {@code minecraft:badlands}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> BADLANDS = create(key("badlands"));
/**
* {@code minecraft:bamboo_jungle}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> BAMBOO_JUNGLE = create(key("bamboo_jungle"));
/**
* {@code minecraft:basalt_deltas}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> BASALT_DELTAS = create(key("basalt_deltas"));
/**
* {@code minecraft:beach}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> BEACH = create(key("beach"));
/**
* {@code minecraft:birch_forest}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> BIRCH_FOREST = create(key("birch_forest"));
/**
* {@code minecraft:cherry_grove}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> CHERRY_GROVE = create(key("cherry_grove"));
/**
* {@code minecraft:cold_ocean}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> COLD_OCEAN = create(key("cold_ocean"));
/**
* {@code minecraft:crimson_forest}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> CRIMSON_FOREST = create(key("crimson_forest"));
/**
* {@code minecraft:dark_forest}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> DARK_FOREST = create(key("dark_forest"));
/**
* {@code minecraft:deep_cold_ocean}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> DEEP_COLD_OCEAN = create(key("deep_cold_ocean"));
/**
* {@code minecraft:deep_dark}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> DEEP_DARK = create(key("deep_dark"));
/**
* {@code minecraft:deep_frozen_ocean}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> DEEP_FROZEN_OCEAN = create(key("deep_frozen_ocean"));
/**
* {@code minecraft:deep_lukewarm_ocean}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> DEEP_LUKEWARM_OCEAN = create(key("deep_lukewarm_ocean"));
/**
* {@code minecraft:deep_ocean}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> DEEP_OCEAN = create(key("deep_ocean"));
/**
* {@code minecraft:desert}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> DESERT = create(key("desert"));
/**
* {@code minecraft:dripstone_caves}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> DRIPSTONE_CAVES = create(key("dripstone_caves"));
/**
* {@code minecraft:end_barrens}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> END_BARRENS = create(key("end_barrens"));
/**
* {@code minecraft:end_highlands}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> END_HIGHLANDS = create(key("end_highlands"));
/**
* {@code minecraft:end_midlands}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> END_MIDLANDS = create(key("end_midlands"));
/**
* {@code minecraft:eroded_badlands}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> ERODED_BADLANDS = create(key("eroded_badlands"));
/**
* {@code minecraft:flower_forest}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> FLOWER_FOREST = create(key("flower_forest"));
/**
* {@code minecraft:forest}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> FOREST = create(key("forest"));
/**
* {@code minecraft:frozen_ocean}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> FROZEN_OCEAN = create(key("frozen_ocean"));
/**
* {@code minecraft:frozen_peaks}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> FROZEN_PEAKS = create(key("frozen_peaks"));
/**
* {@code minecraft:frozen_river}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> FROZEN_RIVER = create(key("frozen_river"));
/**
* {@code minecraft:grove}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> GROVE = create(key("grove"));
/**
* {@code minecraft:ice_spikes}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> ICE_SPIKES = create(key("ice_spikes"));
/**
* {@code minecraft:jagged_peaks}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> JAGGED_PEAKS = create(key("jagged_peaks"));
/**
* {@code minecraft:jungle}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> JUNGLE = create(key("jungle"));
/**
* {@code minecraft:lukewarm_ocean}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> LUKEWARM_OCEAN = create(key("lukewarm_ocean"));
/**
* {@code minecraft:lush_caves}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> LUSH_CAVES = create(key("lush_caves"));
/**
* {@code minecraft:mangrove_swamp}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> MANGROVE_SWAMP = create(key("mangrove_swamp"));
/**
* {@code minecraft:meadow}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> MEADOW = create(key("meadow"));
/**
* {@code minecraft:mushroom_fields}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> MUSHROOM_FIELDS = create(key("mushroom_fields"));
/**
* {@code minecraft:nether_wastes}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> NETHER_WASTES = create(key("nether_wastes"));
/**
* {@code minecraft:ocean}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> OCEAN = create(key("ocean"));
/**
* {@code minecraft:old_growth_birch_forest}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> OLD_GROWTH_BIRCH_FOREST = create(key("old_growth_birch_forest"));
/**
* {@code minecraft:old_growth_pine_taiga}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> OLD_GROWTH_PINE_TAIGA = create(key("old_growth_pine_taiga"));
/**
* {@code minecraft:old_growth_spruce_taiga}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> OLD_GROWTH_SPRUCE_TAIGA = create(key("old_growth_spruce_taiga"));
/**
* {@code minecraft:plains}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> PLAINS = create(key("plains"));
/**
* {@code minecraft:river}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> RIVER = create(key("river"));
/**
* {@code minecraft:savanna}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> SAVANNA = create(key("savanna"));
/**
* {@code minecraft:savanna_plateau}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> SAVANNA_PLATEAU = create(key("savanna_plateau"));
/**
* {@code minecraft:small_end_islands}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> SMALL_END_ISLANDS = create(key("small_end_islands"));
/**
* {@code minecraft:snowy_beach}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> SNOWY_BEACH = create(key("snowy_beach"));
/**
* {@code minecraft:snowy_plains}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> SNOWY_PLAINS = create(key("snowy_plains"));
/**
* {@code minecraft:snowy_slopes}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> SNOWY_SLOPES = create(key("snowy_slopes"));
/**
* {@code minecraft:snowy_taiga}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> SNOWY_TAIGA = create(key("snowy_taiga"));
/**
* {@code minecraft:soul_sand_valley}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> SOUL_SAND_VALLEY = create(key("soul_sand_valley"));
/**
* {@code minecraft:sparse_jungle}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> SPARSE_JUNGLE = create(key("sparse_jungle"));
/**
* {@code minecraft:stony_peaks}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> STONY_PEAKS = create(key("stony_peaks"));
/**
* {@code minecraft:stony_shore}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> STONY_SHORE = create(key("stony_shore"));
/**
* {@code minecraft:sunflower_plains}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> SUNFLOWER_PLAINS = create(key("sunflower_plains"));
/**
* {@code minecraft:swamp}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> SWAMP = create(key("swamp"));
/**
* {@code minecraft:taiga}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> TAIGA = create(key("taiga"));
/**
* {@code minecraft:the_end}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> THE_END = create(key("the_end"));
/**
* {@code minecraft:the_void}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> THE_VOID = create(key("the_void"));
/**
* {@code minecraft:warm_ocean}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> WARM_OCEAN = create(key("warm_ocean"));
/**
* {@code minecraft:warped_forest}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> WARPED_FOREST = create(key("warped_forest"));
/**
* {@code minecraft:windswept_forest}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> WINDSWEPT_FOREST = create(key("windswept_forest"));
/**
* {@code minecraft:windswept_gravelly_hills}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> WINDSWEPT_GRAVELLY_HILLS = create(key("windswept_gravelly_hills"));
/**
* {@code minecraft:windswept_hills}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> WINDSWEPT_HILLS = create(key("windswept_hills"));
/**
* {@code minecraft:windswept_savanna}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> WINDSWEPT_SAVANNA = create(key("windswept_savanna"));
/**
* {@code minecraft:wooded_badlands}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> WOODED_BADLANDS = create(key("wooded_badlands"));
private BiomeKeys() {
}
/**
* 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 @NonNull TypedKey<Biome> create(final @NonNull Key key) {
return TypedKey.create(RegistryKey.BIOME, key);
}
}

View file

@ -1,73 +0,0 @@
package io.papermc.generator;
import io.papermc.generator.types.GeneratedKeyType;
import io.papermc.generator.types.GeneratedTagKeyType;
import io.papermc.generator.types.SourceGenerator;
import io.papermc.generator.types.goal.MobGoalGenerator;
import io.papermc.paper.registry.RegistryKey;
import net.minecraft.core.Registry;
import net.minecraft.core.registries.Registries;
import net.minecraft.resources.ResourceKey;
import org.bukkit.GameEvent;
import org.bukkit.JukeboxSong;
import org.bukkit.MusicInstrument;
import org.bukkit.block.Biome;
import org.bukkit.block.BlockType;
import org.bukkit.block.banner.PatternType;
import org.bukkit.damage.DamageType;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Cat;
import org.bukkit.entity.Frog;
import org.bukkit.entity.Villager;
import org.bukkit.entity.Wolf;
import org.bukkit.generator.structure.Structure;
import org.bukkit.generator.structure.StructureType;
import org.bukkit.inventory.ItemType;
import org.bukkit.inventory.MenuType;
import org.bukkit.inventory.meta.trim.TrimMaterial;
import org.bukkit.inventory.meta.trim.TrimPattern;
import org.bukkit.map.MapCursor;
import org.bukkit.potion.PotionEffectType;
public interface Generators {
SourceGenerator[] API = {
// built-ins
simpleKey("GameEventKeys", GameEvent.class, Registries.GAME_EVENT, RegistryKey.GAME_EVENT, false),
simpleKey("StructureTypeKeys", StructureType.class, Registries.STRUCTURE_TYPE, RegistryKey.STRUCTURE_TYPE, false),
simpleKey("InstrumentKeys", MusicInstrument.class, Registries.INSTRUMENT, RegistryKey.INSTRUMENT, false),
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),
simpleKey("MenuTypeKeys", MenuType.class, Registries.MENU, RegistryKey.MENU, false),
// data-driven
simpleKey("BiomeKeys", Biome.class, Registries.BIOME, RegistryKey.BIOME, true),
simpleKey("StructureKeys", Structure.class, Registries.STRUCTURE, RegistryKey.STRUCTURE, true),
simpleKey("TrimMaterialKeys", TrimMaterial.class, Registries.TRIM_MATERIAL, RegistryKey.TRIM_MATERIAL, true),
simpleKey("TrimPatternKeys", TrimPattern.class, Registries.TRIM_PATTERN, RegistryKey.TRIM_PATTERN, true),
simpleKey("DamageTypeKeys", DamageType.class, Registries.DAMAGE_TYPE, RegistryKey.DAMAGE_TYPE, true),
simpleKey("WolfVariantKeys", Wolf.Variant.class, Registries.WOLF_VARIANT, RegistryKey.WOLF_VARIANT, true),
simpleKey("EnchantmentKeys", Enchantment.class, Registries.ENCHANTMENT, RegistryKey.ENCHANTMENT, false),
simpleKey("JukeboxSongKeys", JukeboxSong.class, Registries.JUKEBOX_SONG, RegistryKey.JUKEBOX_SONG, true),
simpleKey("BannerPatternKeys", PatternType.class, Registries.BANNER_PATTERN, RegistryKey.BANNER_PATTERN, true),
// tags
simpleTagKey("EnchantmentTagKeys", Enchantment.class, Registries.ENCHANTMENT, RegistryKey.ENCHANTMENT),
simpleTagKey("ItemTypeTagKeys", ItemType.class, Registries.ITEM, RegistryKey.ITEM),
new MobGoalGenerator("VanillaGoal", "com.destroystokyo.paper.entity.ai")
};
private static <T, A> SourceGenerator simpleKey(final String className, final Class<A> apiType, final ResourceKey<? extends Registry<T>> registryKey, final RegistryKey<A> apiRegistryKey, final boolean publicCreateKeyMethod) {
return new GeneratedKeyType<>(className, apiType, "io.papermc.paper.registry.keys", registryKey, apiRegistryKey, publicCreateKeyMethod);
}
private static <T, A> SourceGenerator simpleTagKey(final String className, final Class<A> apiType, final ResourceKey<? extends Registry<T>> registryKey, final RegistryKey<A> apiRegistryKey) {
return new GeneratedTagKeyType<>(className, apiType, "io.papermc.paper.registry.keys.tags", registryKey, apiRegistryKey, true);
}
}

View file

@ -1,79 +0,0 @@
package io.papermc.generator;
import com.google.common.util.concurrent.MoreExecutors;
import com.mojang.logging.LogUtils;
import io.papermc.generator.types.SourceGenerator;
import io.papermc.generator.utils.TagCollector;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Map;
import net.minecraft.SharedConstants;
import net.minecraft.commands.Commands;
import net.minecraft.core.LayeredRegistryAccess;
import net.minecraft.core.RegistryAccess;
import net.minecraft.resources.RegistryDataLoader;
import net.minecraft.server.Bootstrap;
import net.minecraft.server.RegistryLayer;
import net.minecraft.server.ReloadableServerResources;
import net.minecraft.server.WorldLoader;
import net.minecraft.server.packs.PackType;
import net.minecraft.server.packs.repository.Pack;
import net.minecraft.server.packs.repository.PackRepository;
import net.minecraft.server.packs.repository.ServerPacksSource;
import net.minecraft.server.packs.resources.MultiPackResourceManager;
import net.minecraft.tags.TagKey;
import net.minecraft.world.flag.FeatureFlags;
import org.apache.commons.io.file.PathUtils;
import org.slf4j.Logger;
public final class Main {
private static final Logger LOGGER = LogUtils.getLogger();
public static final RegistryAccess.Frozen REGISTRY_ACCESS;
public static final Map<TagKey<?>, String> EXPERIMENTAL_TAGS;
static {
SharedConstants.tryDetectVersion();
Bootstrap.bootStrap();
Bootstrap.validate();
final PackRepository resourceRepository = ServerPacksSource.createVanillaTrustedRepository();
resourceRepository.reload();
final MultiPackResourceManager resourceManager = new MultiPackResourceManager(PackType.SERVER_DATA, resourceRepository.getAvailablePacks().stream().map(Pack::open).toList());
LayeredRegistryAccess<RegistryLayer> layers = RegistryLayer.createRegistryAccess();
layers = WorldLoader.loadAndReplaceLayer(resourceManager, layers, RegistryLayer.WORLDGEN, RegistryDataLoader.WORLDGEN_REGISTRIES);
REGISTRY_ACCESS = layers.compositeAccess().freeze();
final ReloadableServerResources datapack = ReloadableServerResources.loadResources(resourceManager, layers, FeatureFlags.REGISTRY.allFlags(), Commands.CommandSelection.DEDICATED, 0, MoreExecutors.directExecutor(), MoreExecutors.directExecutor()).join();
datapack.updateRegistryTags();
EXPERIMENTAL_TAGS = TagCollector.grabExperimental(resourceManager);
}
private Main() {
}
public static void main(final String[] args) {
LOGGER.info("Running API generators...");
generate(Paths.get(args[0]), Generators.API);
// LOGGER.info("Running Server generators...");
// generate(Paths.get(args[1]), Generators.SERVER);
}
private static void generate(Path output, SourceGenerator[] generators) {
try {
if (Files.exists(output)) {
PathUtils.deleteDirectory(output);
}
Files.createDirectories(output);
for (final SourceGenerator generator : generators) {
generator.writeToFile(output);
}
LOGGER.info("Files written to {}", output.toAbsolutePath());
} catch (final Exception ex) {
throw new RuntimeException(ex);
}
}
}

View file

@ -1,193 +0,0 @@
package io.papermc.generator.types;
import com.google.common.collect.Sets;
import com.squareup.javapoet.FieldSpec;
import com.squareup.javapoet.JavaFile;
import com.squareup.javapoet.MethodSpec;
import com.squareup.javapoet.ParameterSpec;
import com.squareup.javapoet.ParameterizedTypeName;
import com.squareup.javapoet.TypeName;
import com.squareup.javapoet.TypeSpec;
import io.papermc.generator.Main;
import io.papermc.generator.utils.Annotations;
import io.papermc.generator.utils.CollectingContext;
import io.papermc.generator.utils.Formatting;
import io.papermc.generator.utils.Javadocs;
import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.TypedKey;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.util.Collections;
import java.util.HashMap;
import java.util.IdentityHashMap;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import net.kyori.adventure.key.Key;
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.VanillaRegistries;
import net.minecraft.resources.ResourceKey;
import net.minecraft.world.flag.FeatureElement;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.checkerframework.framework.qual.DefaultQualifier;
import static com.squareup.javapoet.TypeSpec.classBuilder;
import static io.papermc.generator.utils.Annotations.EXPERIMENTAL_API_ANNOTATION;
import static io.papermc.generator.utils.Annotations.NOT_NULL;
import static io.papermc.generator.utils.Annotations.experimentalAnnotations;
import static java.util.Objects.requireNonNull;
import static javax.lang.model.element.Modifier.FINAL;
import static javax.lang.model.element.Modifier.PRIVATE;
import static javax.lang.model.element.Modifier.PUBLIC;
import static javax.lang.model.element.Modifier.STATIC;
@DefaultQualifier(NonNull.class)
public class GeneratedKeyType<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<>();
try {
for (final Field field : RegistryKey.class.getFields()) {
if (!Modifier.isStatic(field.getModifiers()) || !Modifier.isFinal(field.getModifiers()) || field.getType() != RegistryKey.class) {
continue;
}
map.put((RegistryKey<?>) field.get(null), field.getName());
}
REGISTRY_KEY_FIELD_NAMES = Map.copyOf(map);
} catch (final ReflectiveOperationException ex) {
throw new RuntimeException(ex);
}
}
private static final String CREATE_JAVADOC = """
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
""";
private final Class<A> apiType;
private final ResourceKey<? extends Registry<T>> registryKey;
private final RegistryKey<A> apiRegistryKey;
private final boolean publicCreateKeyMethod;
public GeneratedKeyType(final String keysClassName, final Class<A> apiType, final String pkg, final ResourceKey<? extends Registry<T>> registryKey, final RegistryKey<A> apiRegistryKey, final boolean publicCreateKeyMethod) {
super(keysClassName, pkg);
this.apiType = apiType;
this.registryKey = registryKey;
this.apiRegistryKey = apiRegistryKey;
this.publicCreateKeyMethod = publicCreateKeyMethod;
}
private MethodSpec.Builder createMethod(final TypeName returnType) {
final TypeName keyType = TypeName.get(Key.class).annotated(NOT_NULL);
final ParameterSpec keyParam = ParameterSpec.builder(keyType, "key", FINAL).build();
final MethodSpec.Builder create = MethodSpec.methodBuilder("create")
.addModifiers(this.publicCreateKeyMethod ? PUBLIC : PRIVATE, STATIC)
.addParameter(keyParam)
.addCode("return $T.create($T.$L, $N);", TypedKey.class, RegistryKey.class, requireNonNull(REGISTRY_KEY_FIELD_NAMES.get(this.apiRegistryKey), "Missing field for " + this.apiRegistryKey), keyParam)
.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.location().toString());
}
return create;
}
private TypeSpec.Builder keyHolderType() {
return classBuilder(this.className)
.addModifiers(PUBLIC, FINAL)
.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()
);
}
@Override
protected TypeSpec getTypeSpec() {
final TypeName typedKey = ParameterizedTypeName.get(TypedKey.class, this.apiType);
final TypeSpec.Builder typeBuilder = this.keyHolderType();
final MethodSpec.Builder createMethod = this.createMethod(typedKey);
final Registry<T> registry = Main.REGISTRY_ACCESS.registryOrThrow(this.registryKey);
final Set<ResourceKey<T>> experimental = this.collectExperimentalKeys(registry);
boolean allExperimental = true;
for (final Holder.Reference<T> reference : registry.holders().sorted(Formatting.alphabeticKeyOrder(reference -> reference.key().location().getPath())).toList()) {
final ResourceKey<T> key = reference.key();
final String keyPath = key.location().getPath();
final String fieldName = Formatting.formatKeyAsField(keyPath);
final FieldSpec.Builder fieldBuilder = FieldSpec.builder(typedKey, fieldName, PUBLIC, STATIC, FINAL)
.initializer("$N(key($S))", createMethod.build(), keyPath)
.addJavadoc(Javadocs.getVersionDependentField("{@code $L}"), key.location().toString());
if (experimental.contains(key)) {
fieldBuilder.addAnnotations(experimentalAnnotations(null)); // Update for Experimental API
} else {
allExperimental = false;
}
typeBuilder.addField(fieldBuilder.build());
}
if (allExperimental) {
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
}
return typeBuilder.addMethod(createMethod.build()).build();
}
private Set<ResourceKey<T>> collectExperimentalKeys(final Registry<T> registry) {
if (FeatureElement.FILTERED_REGISTRIES.contains(registry.key())) {
return this.collectExperimentalKeysBuiltIn(registry);
} else {
return this.collectExperimentalKeysDataDriven(registry);
}
}
private Set<ResourceKey<T>> collectExperimentalKeysBuiltIn(final Registry<T> registry) {
final HolderLookup.RegistryLookup<T> filteredLookup = registry.asLookup().filterElements(v -> {
return false; // Update for Experimental API
});
return filteredLookup.listElementIds().collect(Collectors.toUnmodifiableSet());
}
@SuppressWarnings("unchecked")
private Set<ResourceKey<T>> collectExperimentalKeysDataDriven(final Registry<T> registry) {
final RegistrySetBuilder.@Nullable RegistryBootstrap<T> experimentalBootstrap = (RegistrySetBuilder.RegistryBootstrap<T>) EXPERIMENTAL_REGISTRY_ENTRIES.get(this.registryKey);
if (experimentalBootstrap == null) {
return Collections.emptySet();
}
final Set<ResourceKey<T>> experimental = Collections.newSetFromMap(new IdentityHashMap<>());
final CollectingContext<T> experimentalCollector = new CollectingContext<>(experimental, registry);
experimentalBootstrap.run(experimentalCollector);
final RegistrySetBuilder.@Nullable RegistryBootstrap<T> vanillaBootstrap = (RegistrySetBuilder.RegistryBootstrap<T>) VANILLA_REGISTRY_ENTRIES.get(this.registryKey);
if (vanillaBootstrap != null) {
final Set<ResourceKey<T>> vanilla = Collections.newSetFromMap(new IdentityHashMap<>());
final CollectingContext<T> vanillaCollector = new CollectingContext<>(vanilla, registry);
vanillaBootstrap.run(vanillaCollector);
return Sets.difference(experimental, vanilla);
}
return experimental;
}
@Override
protected JavaFile.Builder file(final JavaFile.Builder builder) {
return builder
.addStaticImport(Key.class, "key");
}
}

View file

@ -1,137 +0,0 @@
package io.papermc.generator.types;
import com.squareup.javapoet.FieldSpec;
import com.squareup.javapoet.JavaFile;
import com.squareup.javapoet.MethodSpec;
import com.squareup.javapoet.ParameterSpec;
import com.squareup.javapoet.ParameterizedTypeName;
import com.squareup.javapoet.TypeName;
import com.squareup.javapoet.TypeSpec;
import io.papermc.generator.Main;
import io.papermc.generator.utils.Annotations;
import io.papermc.generator.utils.Formatting;
import io.papermc.generator.utils.Javadocs;
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.HashMap;
import java.util.Map;
import java.util.concurrent.atomic.AtomicBoolean;
import net.kyori.adventure.key.Key;
import net.minecraft.core.Registry;
import net.minecraft.resources.ResourceKey;
import org.bukkit.MinecraftExperimental;
import static com.squareup.javapoet.TypeSpec.classBuilder;
import static io.papermc.generator.utils.Annotations.EXPERIMENTAL_API_ANNOTATION;
import static io.papermc.generator.utils.Annotations.NOT_NULL;
import static io.papermc.generator.utils.Annotations.experimentalAnnotations;
import static java.util.Objects.requireNonNull;
import static javax.lang.model.element.Modifier.FINAL;
import static javax.lang.model.element.Modifier.PRIVATE;
import static javax.lang.model.element.Modifier.PUBLIC;
import static javax.lang.model.element.Modifier.STATIC;
public class GeneratedTagKeyType<T, A> extends SimpleGenerator {
private static final Map<RegistryKey<?>, String> REGISTRY_KEY_FIELD_NAMES;
static {
final Map<RegistryKey<?>, String> map = new HashMap<>();
try {
for (final Field field : RegistryKey.class.getFields()) {
if (!Modifier.isStatic(field.getModifiers()) || !Modifier.isFinal(field.getModifiers()) || field.getType() != RegistryKey.class) {
continue;
}
map.put((RegistryKey<?>) field.get(null), field.getName());
}
REGISTRY_KEY_FIELD_NAMES = Map.copyOf(map);
} catch (final ReflectiveOperationException ex) {
throw new RuntimeException(ex);
}
}
private static final String CREATE_JAVADOC = """
Creates a tag key for {@link $T} in the registry {@code $L}.
@param key the tag key's key
@return a new tag key
""";
private final Class<A> apiType;
private final ResourceKey<? extends Registry<T>> registryKey;
private final RegistryKey<A> apiRegistryKey;
private final boolean publicCreateKeyMethod;
public GeneratedTagKeyType(final String keysClassName, final Class<A> apiType, final String pkg, final ResourceKey<? extends Registry<T>> registryKey, final RegistryKey<A> apiRegistryKey, final boolean publicCreateKeyMethod) {
super(keysClassName, pkg);
this.apiType = apiType;
this.registryKey = registryKey;
this.apiRegistryKey = apiRegistryKey;
this.publicCreateKeyMethod = publicCreateKeyMethod;
}
private MethodSpec.Builder createMethod(final TypeName returnType) {
final TypeName keyType = TypeName.get(Key.class).annotated(NOT_NULL);
final ParameterSpec keyParam = ParameterSpec.builder(keyType, "key", FINAL).build();
final MethodSpec.Builder create = MethodSpec.methodBuilder("create")
.addModifiers(this.publicCreateKeyMethod ? PUBLIC : PRIVATE, STATIC)
.addParameter(keyParam)
.addCode("return $T.create($T.$L, $N);", TagKey.class, RegistryKey.class, requireNonNull(REGISTRY_KEY_FIELD_NAMES.get(this.apiRegistryKey), "Missing field for " + this.apiRegistryKey), keyParam)
.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.location().toString());
}
return create;
}
private TypeSpec.Builder keyHolderType() {
return classBuilder(this.className)
.addModifiers(PUBLIC, FINAL)
.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()
);
}
@Override
protected TypeSpec getTypeSpec() {
final TypeName tagKey = ParameterizedTypeName.get(TagKey.class, this.apiType);
final TypeSpec.Builder typeBuilder = this.keyHolderType();
final MethodSpec.Builder createMethod = this.createMethod(tagKey);
final Registry<T> registry = Main.REGISTRY_ACCESS.registryOrThrow(this.registryKey);
final AtomicBoolean allExperimental = new AtomicBoolean(true);
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())
.addJavadoc(Javadocs.getVersionDependentField("{@code $L}"), "#" + nmsTagKey.location());
if (Main.EXPERIMENTAL_TAGS.containsKey(nmsTagKey)) {
fieldBuilder.addAnnotations(experimentalAnnotations(MinecraftExperimental.Requires.TRADE_REBALANCE)); // Update for Experimental API
} else {
allExperimental.set(false);
}
typeBuilder.addField(fieldBuilder.build());
});
if (allExperimental.get()) {
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
}
return typeBuilder.addMethod(createMethod.build()).build();
}
@Override
protected JavaFile.Builder file(final JavaFile.Builder builder) {
return builder
.addStaticImport(Key.class, "key");
}
}

View file

@ -1,64 +0,0 @@
package io.papermc.generator.utils;
import com.squareup.javapoet.AnnotationSpec;
import java.util.ArrayList;
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.Nullable;
public final class Annotations {
public static List<AnnotationSpec> experimentalAnnotations(final MinecraftExperimental.@Nullable Requires requiredFeatureFlag) {
final List<AnnotationSpec> 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());
} else {
annotationSpecs.add(AnnotationSpec.builder(MinecraftExperimental.class).build());
}
return annotationSpecs;
}
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", true);
}
if (version != null) {
annotationSpec.addMember("since", "$S", version);
}
return annotationSpec.build();
}
public static AnnotationSpec scheduledRemoval(final @Nullable String version) {
return AnnotationSpec.builder(ApiStatus.ScheduledForRemoval.class)
.addMember("inVersion", "$S", version)
.build();
}
@ApiStatus.Experimental
public static final AnnotationSpec EXPERIMENTAL_API_ANNOTATION = AnnotationSpec.builder(ApiStatus.Experimental.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")
.build();
private static final AnnotationSpec GENERATED_FROM = AnnotationSpec.builder(GeneratedFrom.class)
.addMember("value", "$S", SharedConstants.getCurrentVersion().getName())
.build();
public static final Iterable<AnnotationSpec> CLASS_HEADER = List.of(
SUPPRESS_WARNINGS,
GENERATED_FROM
);
private Annotations() {
}
}

View file

@ -1,27 +0,0 @@
package io.papermc.generator.utils;
public final class Javadocs {
public static String getVersionDependentClassHeader(String headerIdentifier) {
return """
Vanilla keys for %s.
@apiNote The fields provided here are a direct representation of
what is available from the vanilla game source. They may be
changed (including removals) on any Minecraft version
bump, so cross-version compatibility is not provided on the
same level as it is on most of the other API.
""".formatted(headerIdentifier);
}
public static String getVersionDependentField(String headerIdentifier) {
return """
%s
@apiNote This field is version-dependant and may be removed in future Minecraft versions
""".formatted(headerIdentifier);
}
private Javadocs() {
}
}

View file

@ -1,7 +0,0 @@
public net/minecraft/server/WorldLoader loadAndReplaceLayer(Lnet/minecraft/server/packs/resources/ResourceManager;Lnet/minecraft/core/LayeredRegistryAccess;Lnet/minecraft/server/RegistryLayer;Ljava/util/List;)Lnet/minecraft/core/LayeredRegistryAccess;
# for auto-marking experimental stuff
public net/minecraft/core/RegistrySetBuilder entries
public net/minecraft/core/RegistrySetBuilder$RegistryStub
public net/minecraft/data/registries/UpdateOneTwentyOneRegistries BUILDER
public net/minecraft/data/registries/VanillaRegistries BUILDER

View file

@ -0,0 +1,6 @@
[*.java]
ij_java_generate_final_locals = false
ij_java_generate_final_parameters = false
[generated{Api,Server}/**/*.java]
ij_java_imports_layout = $*,|,*

View file

@ -0,0 +1,55 @@
import io.papermc.paperweight.PaperweightSourceGeneratorHelper
import io.papermc.paperweight.extension.PaperweightSourceGeneratorExt
plugins {
java
}
plugins.apply(PaperweightSourceGeneratorHelper::class)
extensions.configure(PaperweightSourceGeneratorExt::class) {
atFile.set(file("wideners.at"))
}
repositories {
mavenLocal() // todo publish typewriter somewhere
}
dependencies {
implementation("com.squareup:javapoet:1.13.0")
implementation(project(":paper-api"))
implementation("io.github.classgraph:classgraph:4.8.47")
implementation("org.jetbrains:annotations:24.1.0")
implementation("io.papermc.typewriter:typewriter:1.0-SNAPSHOT") {
isTransitive = false // paper-api already have everything
}
testImplementation("org.junit.jupiter:junit-jupiter:5.10.2")
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
}
val generatedApiPath = file("generatedApi")
val generatedServerPath = file("generatedServer")
tasks.register<JavaExec>("generate") {
dependsOn(tasks.check)
mainClass.set("io.papermc.generator.Main")
classpath(sourceSets.main.map { it.runtimeClasspath })
args(generatedApiPath.toString(),
project(":paper-api").sourceSets["main"].java.srcDirs.first().toString(),
generatedServerPath.toString(),
project(":paper-server").sourceSets["main"].java.srcDirs.first().toString())
}
tasks.register<JavaExec>("scanOldGeneratedSourceCode") {
mainClass.set("io.papermc.generator.rewriter.OldGeneratedCodeTest")
classpath(sourceSets.test.map { it.runtimeClasspath })
args(generatedApiPath.toString(),
generatedServerPath.toString())
}
tasks.test {
useJUnitPlatform()
}
group = "io.papermc.paper"
version = "1.0-SNAPSHOT"

View file

@ -51,7 +51,7 @@ import org.bukkit.entity.WanderingTrader;
import org.bukkit.entity.Wither; import org.bukkit.entity.Wither;
import org.bukkit.entity.Wolf; import org.bukkit.entity.Wolf;
import org.bukkit.entity.Zombie; import org.bukkit.entity.Zombie;
import org.checkerframework.checker.nullness.qual.NonNull; import org.jspecify.annotations.NullMarked;
/** /**
* Vanilla keys for Mob Goals. * Vanilla keys for Mob Goals.
@ -66,6 +66,7 @@ import org.checkerframework.checker.nullness.qual.NonNull;
"unused", "unused",
"SpellCheckingInspection" "SpellCheckingInspection"
}) })
@NullMarked
@GeneratedFrom("1.21.1") @GeneratedFrom("1.21.1")
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);
@ -436,8 +437,7 @@ public interface VanillaGoal<T extends Mob> extends Goal<T> {
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);
private static <T extends Mob> @NonNull GoalKey<T> create(final @NonNull String key, private static <T extends Mob> GoalKey<T> create(final String key, final Class<T> type) {
final @NonNull Class<T> type) {
return GoalKey.of(type, NamespacedKey.minecraft(key)); return GoalKey.of(type, NamespacedKey.minecraft(key));
} }
} }

View file

@ -0,0 +1,27 @@
package io.papermc.paper.registry.event;
import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.data.EnchantmentRegistryEntry;
import io.papermc.paper.registry.data.GameEventRegistryEntry;
import org.bukkit.GameEvent;
import org.bukkit.enchantments.Enchantment;
import org.jetbrains.annotations.ApiStatus;
import static io.papermc.paper.registry.event.RegistryEventProviderImpl.create;
/**
* Holds providers for {@link RegistryEntryAddEvent} and {@link RegistryFreezeEvent}
* handlers for each applicable registry.
*/
@ApiStatus.Experimental
public final class RegistryEvents {
// Paper start - Generated/RegistryEvents
// @GeneratedFrom 1.21.1
public static final RegistryEventProvider<GameEvent, GameEventRegistryEntry.Builder> GAME_EVENT = create(RegistryKey.GAME_EVENT);
public static final RegistryEventProvider<Enchantment, EnchantmentRegistryEntry.Builder> ENCHANTMENT = create(RegistryKey.ENCHANTMENT);
// Paper end - Generated/RegistryEvents
private RegistryEvents() {
}
}

View file

@ -7,8 +7,8 @@ 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.block.banner.PatternType; import org.bukkit.block.banner.PatternType;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.ApiStatus;
import org.jspecify.annotations.NullMarked;
/** /**
* Vanilla keys for {@link RegistryKey#BANNER_PATTERN}. * Vanilla keys for {@link RegistryKey#BANNER_PATTERN}.
@ -23,6 +23,7 @@ import org.jetbrains.annotations.ApiStatus;
"unused", "unused",
"SpellCheckingInspection" "SpellCheckingInspection"
}) })
@NullMarked
@GeneratedFrom("1.21.1") @GeneratedFrom("1.21.1")
@ApiStatus.Experimental @ApiStatus.Experimental
public final class BannerPatternKeys { public final class BannerPatternKeys {
@ -331,13 +332,13 @@ public final class BannerPatternKeys {
} }
/** /**
* Creates a key for {@link PatternType} in the registry {@code minecraft:banner_pattern}. * Creates a typed key for {@link PatternType} in the registry {@code minecraft:banner_pattern}.
* *
* @param key the value's key in the registry * @param key the value's key in the registry
* @return a new typed key * @return a new typed key
*/ */
@ApiStatus.Experimental @ApiStatus.Experimental
public static @NonNull TypedKey<PatternType> create(final @NonNull Key key) { public static TypedKey<PatternType> create(final Key key) {
return TypedKey.create(RegistryKey.BANNER_PATTERN, key); return TypedKey.create(RegistryKey.BANNER_PATTERN, key);
} }
} }

View file

@ -7,8 +7,8 @@ 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.block.BlockType; import org.bukkit.block.BlockType;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.ApiStatus;
import org.jspecify.annotations.NullMarked;
/** /**
* Vanilla keys for {@link RegistryKey#BLOCK}. * Vanilla keys for {@link RegistryKey#BLOCK}.
@ -23,6 +23,7 @@ import org.jetbrains.annotations.ApiStatus;
"unused", "unused",
"SpellCheckingInspection" "SpellCheckingInspection"
}) })
@NullMarked
@GeneratedFrom("1.21.1") @GeneratedFrom("1.21.1")
@ApiStatus.Experimental @ApiStatus.Experimental
public final class BlockTypeKeys { public final class BlockTypeKeys {
@ -7449,7 +7450,7 @@ public final class BlockTypeKeys {
private BlockTypeKeys() { private BlockTypeKeys() {
} }
private static @NonNull TypedKey<BlockType> create(final @NonNull Key key) { private static TypedKey<BlockType> create(final Key key) {
return TypedKey.create(RegistryKey.BLOCK, key); return TypedKey.create(RegistryKey.BLOCK, key);
} }
} }

View file

@ -7,8 +7,8 @@ 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.entity.Cat; import org.bukkit.entity.Cat;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.ApiStatus;
import org.jspecify.annotations.NullMarked;
/** /**
* Vanilla keys for {@link RegistryKey#CAT_VARIANT}. * Vanilla keys for {@link RegistryKey#CAT_VARIANT}.
@ -23,6 +23,7 @@ import org.jetbrains.annotations.ApiStatus;
"unused", "unused",
"SpellCheckingInspection" "SpellCheckingInspection"
}) })
@NullMarked
@GeneratedFrom("1.21.1") @GeneratedFrom("1.21.1")
@ApiStatus.Experimental @ApiStatus.Experimental
public final class CatVariantKeys { public final class CatVariantKeys {
@ -106,7 +107,7 @@ public final class CatVariantKeys {
private CatVariantKeys() { private CatVariantKeys() {
} }
private static @NonNull TypedKey<Cat.Type> create(final @NonNull Key key) { private static TypedKey<Cat.Type> create(final Key key) {
return TypedKey.create(RegistryKey.CAT_VARIANT, key); return TypedKey.create(RegistryKey.CAT_VARIANT, key);
} }
} }

View file

@ -7,8 +7,8 @@ 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.damage.DamageType; import org.bukkit.damage.DamageType;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.ApiStatus;
import org.jspecify.annotations.NullMarked;
/** /**
* Vanilla keys for {@link RegistryKey#DAMAGE_TYPE}. * Vanilla keys for {@link RegistryKey#DAMAGE_TYPE}.
@ -23,6 +23,7 @@ import org.jetbrains.annotations.ApiStatus;
"unused", "unused",
"SpellCheckingInspection" "SpellCheckingInspection"
}) })
@NullMarked
@GeneratedFrom("1.21.1") @GeneratedFrom("1.21.1")
@ApiStatus.Experimental @ApiStatus.Experimental
public final class DamageTypeKeys { public final class DamageTypeKeys {
@ -359,13 +360,13 @@ public final class DamageTypeKeys {
} }
/** /**
* Creates a key for {@link DamageType} in the registry {@code minecraft:damage_type}. * Creates a typed key for {@link DamageType} in the registry {@code minecraft:damage_type}.
* *
* @param key the value's key in the registry * @param key the value's key in the registry
* @return a new typed key * @return a new typed key
*/ */
@ApiStatus.Experimental @ApiStatus.Experimental
public static @NonNull TypedKey<DamageType> create(final @NonNull Key key) { public static TypedKey<DamageType> create(final Key key) {
return TypedKey.create(RegistryKey.DAMAGE_TYPE, key); return TypedKey.create(RegistryKey.DAMAGE_TYPE, key);
} }
} }

View file

@ -7,8 +7,8 @@ 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.enchantments.Enchantment; import org.bukkit.enchantments.Enchantment;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.ApiStatus;
import org.jspecify.annotations.NullMarked;
/** /**
* Vanilla keys for {@link RegistryKey#ENCHANTMENT}. * Vanilla keys for {@link RegistryKey#ENCHANTMENT}.
@ -23,6 +23,7 @@ import org.jetbrains.annotations.ApiStatus;
"unused", "unused",
"SpellCheckingInspection" "SpellCheckingInspection"
}) })
@NullMarked
@GeneratedFrom("1.21.1") @GeneratedFrom("1.21.1")
@ApiStatus.Experimental @ApiStatus.Experimental
public final class EnchantmentKeys { public final class EnchantmentKeys {
@ -323,7 +324,14 @@ public final class EnchantmentKeys {
private EnchantmentKeys() { private EnchantmentKeys() {
} }
private static @NonNull TypedKey<Enchantment> create(final @NonNull Key key) { /**
* Creates a typed key for {@link Enchantment} in the registry {@code minecraft:enchantment}.
*
* @param key the value's key in the registry
* @return a new typed key
*/
@ApiStatus.Experimental
public static TypedKey<Enchantment> create(final Key key) {
return TypedKey.create(RegistryKey.ENCHANTMENT, key); return TypedKey.create(RegistryKey.ENCHANTMENT, key);
} }
} }

View file

@ -7,8 +7,8 @@ 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.entity.Frog; import org.bukkit.entity.Frog;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.ApiStatus;
import org.jspecify.annotations.NullMarked;
/** /**
* Vanilla keys for {@link RegistryKey#FROG_VARIANT}. * Vanilla keys for {@link RegistryKey#FROG_VARIANT}.
@ -23,6 +23,7 @@ import org.jetbrains.annotations.ApiStatus;
"unused", "unused",
"SpellCheckingInspection" "SpellCheckingInspection"
}) })
@NullMarked
@GeneratedFrom("1.21.1") @GeneratedFrom("1.21.1")
@ApiStatus.Experimental @ApiStatus.Experimental
public final class FrogVariantKeys { public final class FrogVariantKeys {
@ -50,7 +51,7 @@ public final class FrogVariantKeys {
private FrogVariantKeys() { private FrogVariantKeys() {
} }
private static @NonNull TypedKey<Frog.Variant> create(final @NonNull Key key) { private static TypedKey<Frog.Variant> create(final Key key) {
return TypedKey.create(RegistryKey.FROG_VARIANT, key); return TypedKey.create(RegistryKey.FROG_VARIANT, key);
} }
} }

View file

@ -7,8 +7,8 @@ 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.GameEvent; import org.bukkit.GameEvent;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.ApiStatus;
import org.jspecify.annotations.NullMarked;
/** /**
* Vanilla keys for {@link RegistryKey#GAME_EVENT}. * Vanilla keys for {@link RegistryKey#GAME_EVENT}.
@ -23,6 +23,7 @@ import org.jetbrains.annotations.ApiStatus;
"unused", "unused",
"SpellCheckingInspection" "SpellCheckingInspection"
}) })
@NullMarked
@GeneratedFrom("1.21.1") @GeneratedFrom("1.21.1")
@ApiStatus.Experimental @ApiStatus.Experimental
public final class GameEventKeys { public final class GameEventKeys {
@ -449,7 +450,14 @@ public final class GameEventKeys {
private GameEventKeys() { private GameEventKeys() {
} }
private static @NonNull TypedKey<GameEvent> create(final @NonNull Key key) { /**
* Creates a typed key for {@link GameEvent} in the registry {@code minecraft:game_event}.
*
* @param key the value's key in the registry
* @return a new typed key
*/
@ApiStatus.Experimental
public static TypedKey<GameEvent> create(final Key key) {
return TypedKey.create(RegistryKey.GAME_EVENT, key); return TypedKey.create(RegistryKey.GAME_EVENT, key);
} }
} }

View file

@ -7,8 +7,8 @@ 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.MusicInstrument; import org.bukkit.MusicInstrument;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.ApiStatus;
import org.jspecify.annotations.NullMarked;
/** /**
* Vanilla keys for {@link RegistryKey#INSTRUMENT}. * Vanilla keys for {@link RegistryKey#INSTRUMENT}.
@ -23,6 +23,7 @@ import org.jetbrains.annotations.ApiStatus;
"unused", "unused",
"SpellCheckingInspection" "SpellCheckingInspection"
}) })
@NullMarked
@GeneratedFrom("1.21.1") @GeneratedFrom("1.21.1")
@ApiStatus.Experimental @ApiStatus.Experimental
public final class InstrumentKeys { public final class InstrumentKeys {
@ -85,7 +86,7 @@ public final class InstrumentKeys {
private InstrumentKeys() { private InstrumentKeys() {
} }
private static @NonNull TypedKey<MusicInstrument> create(final @NonNull Key key) { private static TypedKey<MusicInstrument> create(final Key key) {
return TypedKey.create(RegistryKey.INSTRUMENT, key); return TypedKey.create(RegistryKey.INSTRUMENT, key);
} }
} }

View file

@ -7,8 +7,8 @@ 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.inventory.ItemType; import org.bukkit.inventory.ItemType;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.ApiStatus;
import org.jspecify.annotations.NullMarked;
/** /**
* Vanilla keys for {@link RegistryKey#ITEM}. * Vanilla keys for {@link RegistryKey#ITEM}.
@ -23,6 +23,7 @@ import org.jetbrains.annotations.ApiStatus;
"unused", "unused",
"SpellCheckingInspection" "SpellCheckingInspection"
}) })
@NullMarked
@GeneratedFrom("1.21.1") @GeneratedFrom("1.21.1")
@ApiStatus.Experimental @ApiStatus.Experimental
public final class ItemTypeKeys { public final class ItemTypeKeys {
@ -9360,7 +9361,7 @@ public final class ItemTypeKeys {
private ItemTypeKeys() { private ItemTypeKeys() {
} }
private static @NonNull TypedKey<ItemType> create(final @NonNull Key key) { private static TypedKey<ItemType> create(final Key key) {
return TypedKey.create(RegistryKey.ITEM, key); return TypedKey.create(RegistryKey.ITEM, key);
} }
} }

View file

@ -7,8 +7,8 @@ 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.JukeboxSong; import org.bukkit.JukeboxSong;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.ApiStatus;
import org.jspecify.annotations.NullMarked;
/** /**
* Vanilla keys for {@link RegistryKey#JUKEBOX_SONG}. * Vanilla keys for {@link RegistryKey#JUKEBOX_SONG}.
@ -23,6 +23,7 @@ import org.jetbrains.annotations.ApiStatus;
"unused", "unused",
"SpellCheckingInspection" "SpellCheckingInspection"
}) })
@NullMarked
@GeneratedFrom("1.21.1") @GeneratedFrom("1.21.1")
@ApiStatus.Experimental @ApiStatus.Experimental
public final class JukeboxSongKeys { public final class JukeboxSongKeys {
@ -163,13 +164,13 @@ public final class JukeboxSongKeys {
} }
/** /**
* Creates a key for {@link JukeboxSong} in the registry {@code minecraft:jukebox_song}. * Creates a typed key for {@link JukeboxSong} in the registry {@code minecraft:jukebox_song}.
* *
* @param key the value's key in the registry * @param key the value's key in the registry
* @return a new typed key * @return a new typed key
*/ */
@ApiStatus.Experimental @ApiStatus.Experimental
public static @NonNull TypedKey<JukeboxSong> create(final @NonNull Key key) { public static TypedKey<JukeboxSong> create(final Key key) {
return TypedKey.create(RegistryKey.JUKEBOX_SONG, key); return TypedKey.create(RegistryKey.JUKEBOX_SONG, key);
} }
} }

View file

@ -7,8 +7,8 @@ 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.map.MapCursor; import org.bukkit.map.MapCursor;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.ApiStatus;
import org.jspecify.annotations.NullMarked;
/** /**
* Vanilla keys for {@link RegistryKey#MAP_DECORATION_TYPE}. * Vanilla keys for {@link RegistryKey#MAP_DECORATION_TYPE}.
@ -23,6 +23,7 @@ import org.jetbrains.annotations.ApiStatus;
"unused", "unused",
"SpellCheckingInspection" "SpellCheckingInspection"
}) })
@NullMarked
@GeneratedFrom("1.21.1") @GeneratedFrom("1.21.1")
@ApiStatus.Experimental @ApiStatus.Experimental
public final class MapDecorationTypeKeys { public final class MapDecorationTypeKeys {
@ -274,7 +275,7 @@ public final class MapDecorationTypeKeys {
private MapDecorationTypeKeys() { private MapDecorationTypeKeys() {
} }
private static @NonNull TypedKey<MapCursor.Type> create(final @NonNull Key key) { private static TypedKey<MapCursor.Type> create(final Key key) {
return TypedKey.create(RegistryKey.MAP_DECORATION_TYPE, key); return TypedKey.create(RegistryKey.MAP_DECORATION_TYPE, key);
} }
} }

View file

@ -7,8 +7,8 @@ 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.inventory.MenuType; import org.bukkit.inventory.MenuType;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.ApiStatus;
import org.jspecify.annotations.NullMarked;
/** /**
* Vanilla keys for {@link RegistryKey#MENU}. * Vanilla keys for {@link RegistryKey#MENU}.
@ -23,6 +23,7 @@ import org.jetbrains.annotations.ApiStatus;
"unused", "unused",
"SpellCheckingInspection" "SpellCheckingInspection"
}) })
@NullMarked
@GeneratedFrom("1.21.1") @GeneratedFrom("1.21.1")
@ApiStatus.Experimental @ApiStatus.Experimental
public final class MenuTypeKeys { public final class MenuTypeKeys {
@ -204,7 +205,7 @@ public final class MenuTypeKeys {
private MenuTypeKeys() { private MenuTypeKeys() {
} }
private static @NonNull TypedKey<MenuType> create(final @NonNull Key key) { private static TypedKey<MenuType> create(final Key key) {
return TypedKey.create(RegistryKey.MENU, key); return TypedKey.create(RegistryKey.MENU, key);
} }
} }

View file

@ -7,8 +7,8 @@ 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.potion.PotionEffectType; import org.bukkit.potion.PotionEffectType;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.ApiStatus;
import org.jspecify.annotations.NullMarked;
/** /**
* Vanilla keys for {@link RegistryKey#MOB_EFFECT}. * Vanilla keys for {@link RegistryKey#MOB_EFFECT}.
@ -23,6 +23,7 @@ import org.jetbrains.annotations.ApiStatus;
"unused", "unused",
"SpellCheckingInspection" "SpellCheckingInspection"
}) })
@NullMarked
@GeneratedFrom("1.21.1") @GeneratedFrom("1.21.1")
@ApiStatus.Experimental @ApiStatus.Experimental
public final class MobEffectKeys { public final class MobEffectKeys {
@ -302,7 +303,7 @@ public final class MobEffectKeys {
private MobEffectKeys() { private MobEffectKeys() {
} }
private static @NonNull TypedKey<PotionEffectType> create(final @NonNull Key key) { private static TypedKey<PotionEffectType> create(final Key key) {
return TypedKey.create(RegistryKey.MOB_EFFECT, key); return TypedKey.create(RegistryKey.MOB_EFFECT, key);
} }
} }

View file

@ -7,8 +7,8 @@ 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.generator.structure.Structure; import org.bukkit.generator.structure.Structure;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.ApiStatus;
import org.jspecify.annotations.NullMarked;
/** /**
* Vanilla keys for {@link RegistryKey#STRUCTURE}. * Vanilla keys for {@link RegistryKey#STRUCTURE}.
@ -23,6 +23,7 @@ import org.jetbrains.annotations.ApiStatus;
"unused", "unused",
"SpellCheckingInspection" "SpellCheckingInspection"
}) })
@NullMarked
@GeneratedFrom("1.21.1") @GeneratedFrom("1.21.1")
@ApiStatus.Experimental @ApiStatus.Experimental
public final class StructureKeys { public final class StructureKeys {
@ -268,13 +269,13 @@ public final class StructureKeys {
} }
/** /**
* Creates a key for {@link Structure} in the registry {@code minecraft:worldgen/structure}. * Creates a typed key for {@link Structure} in the registry {@code minecraft:worldgen/structure}.
* *
* @param key the value's key in the registry * @param key the value's key in the registry
* @return a new typed key * @return a new typed key
*/ */
@ApiStatus.Experimental @ApiStatus.Experimental
public static @NonNull TypedKey<Structure> create(final @NonNull Key key) { public static TypedKey<Structure> create(final Key key) {
return TypedKey.create(RegistryKey.STRUCTURE, key); return TypedKey.create(RegistryKey.STRUCTURE, key);
} }
} }

View file

@ -7,8 +7,8 @@ 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.generator.structure.StructureType; import org.bukkit.generator.structure.StructureType;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.ApiStatus;
import org.jspecify.annotations.NullMarked;
/** /**
* Vanilla keys for {@link RegistryKey#STRUCTURE_TYPE}. * Vanilla keys for {@link RegistryKey#STRUCTURE_TYPE}.
@ -23,6 +23,7 @@ import org.jetbrains.annotations.ApiStatus;
"unused", "unused",
"SpellCheckingInspection" "SpellCheckingInspection"
}) })
@NullMarked
@GeneratedFrom("1.21.1") @GeneratedFrom("1.21.1")
@ApiStatus.Experimental @ApiStatus.Experimental
public final class StructureTypeKeys { public final class StructureTypeKeys {
@ -141,7 +142,7 @@ public final class StructureTypeKeys {
private StructureTypeKeys() { private StructureTypeKeys() {
} }
private static @NonNull TypedKey<StructureType> create(final @NonNull Key key) { private static TypedKey<StructureType> create(final Key key) {
return TypedKey.create(RegistryKey.STRUCTURE_TYPE, key); return TypedKey.create(RegistryKey.STRUCTURE_TYPE, key);
} }
} }

View file

@ -7,8 +7,8 @@ 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.inventory.meta.trim.TrimMaterial; import org.bukkit.inventory.meta.trim.TrimMaterial;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.ApiStatus;
import org.jspecify.annotations.NullMarked;
/** /**
* Vanilla keys for {@link RegistryKey#TRIM_MATERIAL}. * Vanilla keys for {@link RegistryKey#TRIM_MATERIAL}.
@ -23,6 +23,7 @@ import org.jetbrains.annotations.ApiStatus;
"unused", "unused",
"SpellCheckingInspection" "SpellCheckingInspection"
}) })
@NullMarked
@GeneratedFrom("1.21.1") @GeneratedFrom("1.21.1")
@ApiStatus.Experimental @ApiStatus.Experimental
public final class TrimMaterialKeys { public final class TrimMaterialKeys {
@ -100,13 +101,13 @@ public final class TrimMaterialKeys {
} }
/** /**
* Creates a key for {@link TrimMaterial} in the registry {@code minecraft:trim_material}. * Creates a typed key for {@link TrimMaterial} in the registry {@code minecraft:trim_material}.
* *
* @param key the value's key in the registry * @param key the value's key in the registry
* @return a new typed key * @return a new typed key
*/ */
@ApiStatus.Experimental @ApiStatus.Experimental
public static @NonNull TypedKey<TrimMaterial> create(final @NonNull Key key) { public static TypedKey<TrimMaterial> create(final Key key) {
return TypedKey.create(RegistryKey.TRIM_MATERIAL, key); return TypedKey.create(RegistryKey.TRIM_MATERIAL, key);
} }
} }

View file

@ -7,8 +7,8 @@ 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.inventory.meta.trim.TrimPattern; import org.bukkit.inventory.meta.trim.TrimPattern;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.ApiStatus;
import org.jspecify.annotations.NullMarked;
/** /**
* Vanilla keys for {@link RegistryKey#TRIM_PATTERN}. * Vanilla keys for {@link RegistryKey#TRIM_PATTERN}.
@ -23,6 +23,7 @@ import org.jetbrains.annotations.ApiStatus;
"unused", "unused",
"SpellCheckingInspection" "SpellCheckingInspection"
}) })
@NullMarked
@GeneratedFrom("1.21.1") @GeneratedFrom("1.21.1")
@ApiStatus.Experimental @ApiStatus.Experimental
public final class TrimPatternKeys { public final class TrimPatternKeys {
@ -156,13 +157,13 @@ public final class TrimPatternKeys {
} }
/** /**
* Creates a key for {@link TrimPattern} in the registry {@code minecraft:trim_pattern}. * Creates a typed key for {@link TrimPattern} in the registry {@code minecraft:trim_pattern}.
* *
* @param key the value's key in the registry * @param key the value's key in the registry
* @return a new typed key * @return a new typed key
*/ */
@ApiStatus.Experimental @ApiStatus.Experimental
public static @NonNull TypedKey<TrimPattern> create(final @NonNull Key key) { public static TypedKey<TrimPattern> create(final Key key) {
return TypedKey.create(RegistryKey.TRIM_PATTERN, key); return TypedKey.create(RegistryKey.TRIM_PATTERN, key);
} }
} }

View file

@ -7,8 +7,8 @@ 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.entity.Villager; import org.bukkit.entity.Villager;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.ApiStatus;
import org.jspecify.annotations.NullMarked;
/** /**
* Vanilla keys for {@link RegistryKey#VILLAGER_PROFESSION}. * Vanilla keys for {@link RegistryKey#VILLAGER_PROFESSION}.
@ -23,6 +23,7 @@ import org.jetbrains.annotations.ApiStatus;
"unused", "unused",
"SpellCheckingInspection" "SpellCheckingInspection"
}) })
@NullMarked
@GeneratedFrom("1.21.1") @GeneratedFrom("1.21.1")
@ApiStatus.Experimental @ApiStatus.Experimental
public final class VillagerProfessionKeys { public final class VillagerProfessionKeys {
@ -134,7 +135,7 @@ public final class VillagerProfessionKeys {
private VillagerProfessionKeys() { private VillagerProfessionKeys() {
} }
private static @NonNull TypedKey<Villager.Profession> create(final @NonNull Key key) { private static TypedKey<Villager.Profession> create(final Key key) {
return TypedKey.create(RegistryKey.VILLAGER_PROFESSION, key); return TypedKey.create(RegistryKey.VILLAGER_PROFESSION, key);
} }
} }

View file

@ -7,8 +7,8 @@ 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.entity.Villager; import org.bukkit.entity.Villager;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.ApiStatus;
import org.jspecify.annotations.NullMarked;
/** /**
* Vanilla keys for {@link RegistryKey#VILLAGER_TYPE}. * Vanilla keys for {@link RegistryKey#VILLAGER_TYPE}.
@ -23,6 +23,7 @@ import org.jetbrains.annotations.ApiStatus;
"unused", "unused",
"SpellCheckingInspection" "SpellCheckingInspection"
}) })
@NullMarked
@GeneratedFrom("1.21.1") @GeneratedFrom("1.21.1")
@ApiStatus.Experimental @ApiStatus.Experimental
public final class VillagerTypeKeys { public final class VillagerTypeKeys {
@ -78,7 +79,7 @@ public final class VillagerTypeKeys {
private VillagerTypeKeys() { private VillagerTypeKeys() {
} }
private static @NonNull TypedKey<Villager.Type> create(final @NonNull Key key) { private static TypedKey<Villager.Type> create(final Key key) {
return TypedKey.create(RegistryKey.VILLAGER_TYPE, key); return TypedKey.create(RegistryKey.VILLAGER_TYPE, key);
} }
} }

View file

@ -7,8 +7,8 @@ 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.entity.Wolf; import org.bukkit.entity.Wolf;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.ApiStatus;
import org.jspecify.annotations.NullMarked;
/** /**
* Vanilla keys for {@link RegistryKey#WOLF_VARIANT}. * Vanilla keys for {@link RegistryKey#WOLF_VARIANT}.
@ -23,6 +23,7 @@ import org.jetbrains.annotations.ApiStatus;
"unused", "unused",
"SpellCheckingInspection" "SpellCheckingInspection"
}) })
@NullMarked
@GeneratedFrom("1.21.1") @GeneratedFrom("1.21.1")
@ApiStatus.Experimental @ApiStatus.Experimental
public final class WolfVariantKeys { public final class WolfVariantKeys {
@ -93,13 +94,13 @@ public final class WolfVariantKeys {
} }
/** /**
* Creates a key for {@link Wolf.Variant} in the registry {@code minecraft:wolf_variant}. * Creates a typed key for {@link Wolf.Variant} in the registry {@code minecraft:wolf_variant}.
* *
* @param key the value's key in the registry * @param key the value's key in the registry
* @return a new typed key * @return a new typed key
*/ */
@ApiStatus.Experimental @ApiStatus.Experimental
public static @NonNull TypedKey<Wolf.Variant> create(final @NonNull Key key) { public static TypedKey<Wolf.Variant> create(final Key key) {
return TypedKey.create(RegistryKey.WOLF_VARIANT, key); return TypedKey.create(RegistryKey.WOLF_VARIANT, key);
} }
} }

View file

@ -0,0 +1,106 @@
package io.papermc.paper.registry.keys.tags;
import static net.kyori.adventure.key.Key.key;
import io.papermc.paper.generated.GeneratedFrom;
import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.tag.TagKey;
import net.kyori.adventure.key.Key;
import org.bukkit.block.banner.PatternType;
import org.jetbrains.annotations.ApiStatus;
import org.jspecify.annotations.NullMarked;
/**
* Vanilla tag keys for {@link RegistryKey#BANNER_PATTERN}.
*
* @apiNote The fields provided here are a direct representation of
* what is available from the vanilla game source. They may be
* changed (including removals) on any Minecraft version
* bump, so cross-version compatibility is not provided on the
* same level as it is on most of the other API.
*/
@SuppressWarnings({
"unused",
"SpellCheckingInspection"
})
@NullMarked
@GeneratedFrom("1.21.1")
@ApiStatus.Experimental
public final class BannerPatternTagKeys {
/**
* {@code #minecraft:no_item_required}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<PatternType> NO_ITEM_REQUIRED = create(key("no_item_required"));
/**
* {@code #minecraft:pattern_item/creeper}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<PatternType> PATTERN_ITEM_CREEPER = create(key("pattern_item/creeper"));
/**
* {@code #minecraft:pattern_item/flow}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<PatternType> PATTERN_ITEM_FLOW = create(key("pattern_item/flow"));
/**
* {@code #minecraft:pattern_item/flower}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<PatternType> PATTERN_ITEM_FLOWER = create(key("pattern_item/flower"));
/**
* {@code #minecraft:pattern_item/globe}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<PatternType> PATTERN_ITEM_GLOBE = create(key("pattern_item/globe"));
/**
* {@code #minecraft:pattern_item/guster}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<PatternType> PATTERN_ITEM_GUSTER = create(key("pattern_item/guster"));
/**
* {@code #minecraft:pattern_item/mojang}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<PatternType> PATTERN_ITEM_MOJANG = create(key("pattern_item/mojang"));
/**
* {@code #minecraft:pattern_item/piglin}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<PatternType> PATTERN_ITEM_PIGLIN = create(key("pattern_item/piglin"));
/**
* {@code #minecraft:pattern_item/skull}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<PatternType> PATTERN_ITEM_SKULL = create(key("pattern_item/skull"));
private BannerPatternTagKeys() {
}
/**
* Creates a tag key for {@link PatternType} in the registry {@code minecraft:banner_pattern}.
*
* @param key the tag key's key
* @return a new tag key
*/
@ApiStatus.Experimental
public static TagKey<PatternType> create(final Key key) {
return TagKey.create(RegistryKey.BANNER_PATTERN, key);
}
}

View file

@ -0,0 +1,57 @@
package io.papermc.paper.registry.keys.tags;
import static net.kyori.adventure.key.Key.key;
import io.papermc.paper.generated.GeneratedFrom;
import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.tag.TagKey;
import net.kyori.adventure.key.Key;
import org.bukkit.entity.Cat;
import org.jetbrains.annotations.ApiStatus;
import org.jspecify.annotations.NullMarked;
/**
* Vanilla tag keys for {@link RegistryKey#CAT_VARIANT}.
*
* @apiNote The fields provided here are a direct representation of
* what is available from the vanilla game source. They may be
* changed (including removals) on any Minecraft version
* bump, so cross-version compatibility is not provided on the
* same level as it is on most of the other API.
*/
@SuppressWarnings({
"unused",
"SpellCheckingInspection"
})
@NullMarked
@GeneratedFrom("1.21.1")
@ApiStatus.Experimental
public final class CatVariantTagKeys {
/**
* {@code #minecraft:default_spawns}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Cat.Type> DEFAULT_SPAWNS = create(key("default_spawns"));
/**
* {@code #minecraft:full_moon_spawns}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Cat.Type> FULL_MOON_SPAWNS = create(key("full_moon_spawns"));
private CatVariantTagKeys() {
}
/**
* Creates a tag key for {@link Cat.Type} in the registry {@code minecraft:cat_variant}.
*
* @param key the tag key's key
* @return a new tag key
*/
@ApiStatus.Experimental
public static TagKey<Cat.Type> create(final Key key) {
return TagKey.create(RegistryKey.CAT_VARIANT, key);
}
}

View file

@ -0,0 +1,267 @@
package io.papermc.paper.registry.keys.tags;
import static net.kyori.adventure.key.Key.key;
import io.papermc.paper.generated.GeneratedFrom;
import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.tag.TagKey;
import net.kyori.adventure.key.Key;
import org.bukkit.damage.DamageType;
import org.jetbrains.annotations.ApiStatus;
import org.jspecify.annotations.NullMarked;
/**
* Vanilla tag keys for {@link RegistryKey#DAMAGE_TYPE}.
*
* @apiNote The fields provided here are a direct representation of
* what is available from the vanilla game source. They may be
* changed (including removals) on any Minecraft version
* bump, so cross-version compatibility is not provided on the
* same level as it is on most of the other API.
*/
@SuppressWarnings({
"unused",
"SpellCheckingInspection"
})
@NullMarked
@GeneratedFrom("1.21.1")
@ApiStatus.Experimental
public final class DamageTypeTagKeys {
/**
* {@code #minecraft:always_hurts_ender_dragons}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<DamageType> ALWAYS_HURTS_ENDER_DRAGONS = create(key("always_hurts_ender_dragons"));
/**
* {@code #minecraft:always_kills_armor_stands}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<DamageType> ALWAYS_KILLS_ARMOR_STANDS = create(key("always_kills_armor_stands"));
/**
* {@code #minecraft:always_most_significant_fall}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<DamageType> ALWAYS_MOST_SIGNIFICANT_FALL = create(key("always_most_significant_fall"));
/**
* {@code #minecraft:always_triggers_silverfish}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<DamageType> ALWAYS_TRIGGERS_SILVERFISH = create(key("always_triggers_silverfish"));
/**
* {@code #minecraft:avoids_guardian_thorns}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<DamageType> AVOIDS_GUARDIAN_THORNS = create(key("avoids_guardian_thorns"));
/**
* {@code #minecraft:burn_from_stepping}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<DamageType> BURN_FROM_STEPPING = create(key("burn_from_stepping"));
/**
* {@code #minecraft:burns_armor_stands}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<DamageType> BURNS_ARMOR_STANDS = create(key("burns_armor_stands"));
/**
* {@code #minecraft:bypasses_armor}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<DamageType> BYPASSES_ARMOR = create(key("bypasses_armor"));
/**
* {@code #minecraft:bypasses_effects}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<DamageType> BYPASSES_EFFECTS = create(key("bypasses_effects"));
/**
* {@code #minecraft:bypasses_enchantments}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<DamageType> BYPASSES_ENCHANTMENTS = create(key("bypasses_enchantments"));
/**
* {@code #minecraft:bypasses_invulnerability}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<DamageType> BYPASSES_INVULNERABILITY = create(key("bypasses_invulnerability"));
/**
* {@code #minecraft:bypasses_resistance}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<DamageType> BYPASSES_RESISTANCE = create(key("bypasses_resistance"));
/**
* {@code #minecraft:bypasses_shield}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<DamageType> BYPASSES_SHIELD = create(key("bypasses_shield"));
/**
* {@code #minecraft:bypasses_wolf_armor}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<DamageType> BYPASSES_WOLF_ARMOR = create(key("bypasses_wolf_armor"));
/**
* {@code #minecraft:can_break_armor_stand}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<DamageType> CAN_BREAK_ARMOR_STAND = create(key("can_break_armor_stand"));
/**
* {@code #minecraft:damages_helmet}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<DamageType> DAMAGES_HELMET = create(key("damages_helmet"));
/**
* {@code #minecraft:ignites_armor_stands}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<DamageType> IGNITES_ARMOR_STANDS = create(key("ignites_armor_stands"));
/**
* {@code #minecraft:is_drowning}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<DamageType> IS_DROWNING = create(key("is_drowning"));
/**
* {@code #minecraft:is_explosion}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<DamageType> IS_EXPLOSION = create(key("is_explosion"));
/**
* {@code #minecraft:is_fall}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<DamageType> IS_FALL = create(key("is_fall"));
/**
* {@code #minecraft:is_fire}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<DamageType> IS_FIRE = create(key("is_fire"));
/**
* {@code #minecraft:is_freezing}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<DamageType> IS_FREEZING = create(key("is_freezing"));
/**
* {@code #minecraft:is_lightning}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<DamageType> IS_LIGHTNING = create(key("is_lightning"));
/**
* {@code #minecraft:is_player_attack}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<DamageType> IS_PLAYER_ATTACK = create(key("is_player_attack"));
/**
* {@code #minecraft:is_projectile}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<DamageType> IS_PROJECTILE = create(key("is_projectile"));
/**
* {@code #minecraft:no_anger}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<DamageType> NO_ANGER = create(key("no_anger"));
/**
* {@code #minecraft:no_impact}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<DamageType> NO_IMPACT = create(key("no_impact"));
/**
* {@code #minecraft:no_knockback}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<DamageType> NO_KNOCKBACK = create(key("no_knockback"));
/**
* {@code #minecraft:panic_causes}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<DamageType> PANIC_CAUSES = create(key("panic_causes"));
/**
* {@code #minecraft:panic_environmental_causes}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<DamageType> PANIC_ENVIRONMENTAL_CAUSES = create(key("panic_environmental_causes"));
/**
* {@code #minecraft:witch_resistant_to}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<DamageType> WITCH_RESISTANT_TO = create(key("witch_resistant_to"));
/**
* {@code #minecraft:wither_immune_to}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<DamageType> WITHER_IMMUNE_TO = create(key("wither_immune_to"));
private DamageTypeTagKeys() {
}
/**
* Creates a tag key for {@link DamageType} in the registry {@code minecraft:damage_type}.
*
* @param key the tag key's key
* @return a new tag key
*/
@ApiStatus.Experimental
public static TagKey<DamageType> create(final Key key) {
return TagKey.create(RegistryKey.DAMAGE_TYPE, key);
}
}

View file

@ -8,11 +8,11 @@ import io.papermc.paper.registry.tag.TagKey;
import net.kyori.adventure.key.Key; import net.kyori.adventure.key.Key;
import org.bukkit.MinecraftExperimental; import org.bukkit.MinecraftExperimental;
import org.bukkit.enchantments.Enchantment; import org.bukkit.enchantments.Enchantment;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.ApiStatus;
import org.jspecify.annotations.NullMarked;
/** /**
* Vanilla keys for {@link RegistryKey#ENCHANTMENT}. * Vanilla tag keys for {@link RegistryKey#ENCHANTMENT}.
* *
* @apiNote The fields provided here are a direct representation of * @apiNote The fields provided here are a direct representation of
* what is available from the vanilla game source. They may be * what is available from the vanilla game source. They may be
@ -24,6 +24,7 @@ import org.jetbrains.annotations.ApiStatus;
"unused", "unused",
"SpellCheckingInspection" "SpellCheckingInspection"
}) })
@NullMarked
@GeneratedFrom("1.21.1") @GeneratedFrom("1.21.1")
@ApiStatus.Experimental @ApiStatus.Experimental
public final class EnchantmentTagKeys { public final class EnchantmentTagKeys {
@ -317,7 +318,7 @@ public final class EnchantmentTagKeys {
* @return a new tag key * @return a new tag key
*/ */
@ApiStatus.Experimental @ApiStatus.Experimental
public static @NonNull TagKey<Enchantment> create(final @NonNull Key key) { public static TagKey<Enchantment> create(final Key key) {
return TagKey.create(RegistryKey.ENCHANTMENT, key); return TagKey.create(RegistryKey.ENCHANTMENT, key);
} }
} }

View file

@ -0,0 +1,78 @@
package io.papermc.paper.registry.keys.tags;
import static net.kyori.adventure.key.Key.key;
import io.papermc.paper.generated.GeneratedFrom;
import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.tag.TagKey;
import net.kyori.adventure.key.Key;
import org.bukkit.GameEvent;
import org.jetbrains.annotations.ApiStatus;
import org.jspecify.annotations.NullMarked;
/**
* Vanilla tag keys for {@link RegistryKey#GAME_EVENT}.
*
* @apiNote The fields provided here are a direct representation of
* what is available from the vanilla game source. They may be
* changed (including removals) on any Minecraft version
* bump, so cross-version compatibility is not provided on the
* same level as it is on most of the other API.
*/
@SuppressWarnings({
"unused",
"SpellCheckingInspection"
})
@NullMarked
@GeneratedFrom("1.21.1")
@ApiStatus.Experimental
public final class GameEventTagKeys {
/**
* {@code #minecraft:allay_can_listen}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<GameEvent> ALLAY_CAN_LISTEN = create(key("allay_can_listen"));
/**
* {@code #minecraft:ignore_vibrations_sneaking}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<GameEvent> IGNORE_VIBRATIONS_SNEAKING = create(key("ignore_vibrations_sneaking"));
/**
* {@code #minecraft:shrieker_can_listen}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<GameEvent> SHRIEKER_CAN_LISTEN = create(key("shrieker_can_listen"));
/**
* {@code #minecraft:vibrations}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<GameEvent> VIBRATIONS = create(key("vibrations"));
/**
* {@code #minecraft:warden_can_listen}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<GameEvent> WARDEN_CAN_LISTEN = create(key("warden_can_listen"));
private GameEventTagKeys() {
}
/**
* Creates a tag key for {@link GameEvent} in the registry {@code minecraft:game_event}.
*
* @param key the tag key's key
* @return a new tag key
*/
@ApiStatus.Experimental
public static TagKey<GameEvent> create(final Key key) {
return TagKey.create(RegistryKey.GAME_EVENT, key);
}
}

View file

@ -0,0 +1,64 @@
package io.papermc.paper.registry.keys.tags;
import static net.kyori.adventure.key.Key.key;
import io.papermc.paper.generated.GeneratedFrom;
import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.tag.TagKey;
import net.kyori.adventure.key.Key;
import org.bukkit.MusicInstrument;
import org.jetbrains.annotations.ApiStatus;
import org.jspecify.annotations.NullMarked;
/**
* Vanilla tag keys for {@link RegistryKey#INSTRUMENT}.
*
* @apiNote The fields provided here are a direct representation of
* what is available from the vanilla game source. They may be
* changed (including removals) on any Minecraft version
* bump, so cross-version compatibility is not provided on the
* same level as it is on most of the other API.
*/
@SuppressWarnings({
"unused",
"SpellCheckingInspection"
})
@NullMarked
@GeneratedFrom("1.21.1")
@ApiStatus.Experimental
public final class InstrumentTagKeys {
/**
* {@code #minecraft:goat_horns}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<MusicInstrument> GOAT_HORNS = create(key("goat_horns"));
/**
* {@code #minecraft:regular_goat_horns}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<MusicInstrument> REGULAR_GOAT_HORNS = create(key("regular_goat_horns"));
/**
* {@code #minecraft:screaming_goat_horns}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<MusicInstrument> SCREAMING_GOAT_HORNS = create(key("screaming_goat_horns"));
private InstrumentTagKeys() {
}
/**
* Creates a tag key for {@link MusicInstrument} in the registry {@code minecraft:instrument}.
*
* @param key the tag key's key
* @return a new tag key
*/
@ApiStatus.Experimental
public static TagKey<MusicInstrument> create(final Key key) {
return TagKey.create(RegistryKey.INSTRUMENT, key);
}
}

View file

@ -7,11 +7,11 @@ import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.tag.TagKey; import io.papermc.paper.registry.tag.TagKey;
import net.kyori.adventure.key.Key; import net.kyori.adventure.key.Key;
import org.bukkit.inventory.ItemType; import org.bukkit.inventory.ItemType;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.ApiStatus;
import org.jspecify.annotations.NullMarked;
/** /**
* Vanilla keys for {@link RegistryKey#ITEM}. * Vanilla tag keys for {@link RegistryKey#ITEM}.
* *
* @apiNote The fields provided here are a direct representation of * @apiNote The fields provided here are a direct representation of
* what is available from the vanilla game source. They may be * what is available from the vanilla game source. They may be
@ -23,6 +23,7 @@ import org.jetbrains.annotations.ApiStatus;
"unused", "unused",
"SpellCheckingInspection" "SpellCheckingInspection"
}) })
@NullMarked
@GeneratedFrom("1.21.1") @GeneratedFrom("1.21.1")
@ApiStatus.Experimental @ApiStatus.Experimental
public final class ItemTypeTagKeys { public final class ItemTypeTagKeys {
@ -1065,7 +1066,7 @@ public final class ItemTypeTagKeys {
* @return a new tag key * @return a new tag key
*/ */
@ApiStatus.Experimental @ApiStatus.Experimental
public static @NonNull TagKey<ItemType> create(final @NonNull Key key) { public static TagKey<ItemType> create(final Key key) {
return TagKey.create(RegistryKey.ITEM, key); return TagKey.create(RegistryKey.ITEM, key);
} }
} }

View file

@ -0,0 +1,198 @@
package io.papermc.paper.registry.keys.tags;
import static net.kyori.adventure.key.Key.key;
import io.papermc.paper.generated.GeneratedFrom;
import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.tag.TagKey;
import net.kyori.adventure.key.Key;
import org.bukkit.MinecraftExperimental;
import org.bukkit.generator.structure.Structure;
import org.jetbrains.annotations.ApiStatus;
import org.jspecify.annotations.NullMarked;
/**
* Vanilla tag keys for {@link RegistryKey#STRUCTURE}.
*
* @apiNote The fields provided here are a direct representation of
* what is available from the vanilla game source. They may be
* changed (including removals) on any Minecraft version
* bump, so cross-version compatibility is not provided on the
* same level as it is on most of the other API.
*/
@SuppressWarnings({
"unused",
"SpellCheckingInspection"
})
@NullMarked
@GeneratedFrom("1.21.1")
@ApiStatus.Experimental
public final class StructureTagKeys {
/**
* {@code #minecraft:cats_spawn_as_black}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Structure> CATS_SPAWN_AS_BLACK = create(key("cats_spawn_as_black"));
/**
* {@code #minecraft:cats_spawn_in}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Structure> CATS_SPAWN_IN = create(key("cats_spawn_in"));
/**
* {@code #minecraft:dolphin_located}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Structure> DOLPHIN_LOCATED = create(key("dolphin_located"));
/**
* {@code #minecraft:eye_of_ender_located}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Structure> EYE_OF_ENDER_LOCATED = create(key("eye_of_ender_located"));
/**
* {@code #minecraft:mineshaft}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Structure> MINESHAFT = create(key("mineshaft"));
/**
* {@code #minecraft:ocean_ruin}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Structure> OCEAN_RUIN = create(key("ocean_ruin"));
/**
* {@code #minecraft:on_desert_village_maps}
*
* @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<Structure> ON_DESERT_VILLAGE_MAPS = create(key("on_desert_village_maps"));
/**
* {@code #minecraft:on_jungle_explorer_maps}
*
* @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<Structure> ON_JUNGLE_EXPLORER_MAPS = create(key("on_jungle_explorer_maps"));
/**
* {@code #minecraft:on_ocean_explorer_maps}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Structure> ON_OCEAN_EXPLORER_MAPS = create(key("on_ocean_explorer_maps"));
/**
* {@code #minecraft:on_plains_village_maps}
*
* @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<Structure> ON_PLAINS_VILLAGE_MAPS = create(key("on_plains_village_maps"));
/**
* {@code #minecraft:on_savanna_village_maps}
*
* @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<Structure> ON_SAVANNA_VILLAGE_MAPS = create(key("on_savanna_village_maps"));
/**
* {@code #minecraft:on_snowy_village_maps}
*
* @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<Structure> ON_SNOWY_VILLAGE_MAPS = create(key("on_snowy_village_maps"));
/**
* {@code #minecraft:on_swamp_explorer_maps}
*
* @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<Structure> ON_SWAMP_EXPLORER_MAPS = create(key("on_swamp_explorer_maps"));
/**
* {@code #minecraft:on_taiga_village_maps}
*
* @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<Structure> ON_TAIGA_VILLAGE_MAPS = create(key("on_taiga_village_maps"));
/**
* {@code #minecraft:on_treasure_maps}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Structure> ON_TREASURE_MAPS = create(key("on_treasure_maps"));
/**
* {@code #minecraft:on_trial_chambers_maps}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Structure> ON_TRIAL_CHAMBERS_MAPS = create(key("on_trial_chambers_maps"));
/**
* {@code #minecraft:on_woodland_explorer_maps}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Structure> ON_WOODLAND_EXPLORER_MAPS = create(key("on_woodland_explorer_maps"));
/**
* {@code #minecraft:ruined_portal}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Structure> RUINED_PORTAL = create(key("ruined_portal"));
/**
* {@code #minecraft:shipwreck}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Structure> SHIPWRECK = create(key("shipwreck"));
/**
* {@code #minecraft:village}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Structure> VILLAGE = create(key("village"));
private StructureTagKeys() {
}
/**
* Creates a tag key for {@link Structure} in the registry {@code minecraft:worldgen/structure}.
*
* @param key the tag key's key
* @return a new tag key
*/
@ApiStatus.Experimental
public static TagKey<Structure> create(final Key key) {
return TagKey.create(RegistryKey.STRUCTURE, key);
}
}

View file

@ -0,0 +1,156 @@
package org.bukkit;
import com.google.common.base.Preconditions;
import com.google.common.collect.Maps;
import java.util.HashMap;
import java.util.Locale;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
* Represents the art on a painting
*/
public enum Art implements Keyed {
// Paper start - Generated/Art
// @GeneratedFrom 1.21.1
ALBAN(0, 1, 1),
AZTEC(1, 1, 1),
AZTEC2(2, 1, 1),
BACKYARD(3, 3, 4),
BAROQUE(4, 2, 2),
BOMB(5, 1, 1),
BOUQUET(6, 3, 3),
BURNING_SKULL(7, 4, 4),
BUST(8, 2, 2),
CAVEBIRD(9, 3, 3),
CHANGING(10, 4, 2),
COTAN(11, 3, 3),
COURBET(12, 2, 1),
CREEBET(13, 2, 1),
DONKEY_KONG(14, 4, 3),
EARTH(15, 2, 2),
ENDBOSS(16, 3, 3),
FERN(17, 3, 3),
FIGHTERS(18, 4, 2),
FINDING(19, 4, 2),
FIRE(20, 2, 2),
GRAHAM(21, 1, 2),
HUMBLE(22, 2, 2),
KEBAB(23, 1, 1),
LOWMIST(24, 4, 2),
MATCH(25, 2, 2),
MEDITATIVE(26, 1, 1),
ORB(27, 4, 4),
OWLEMONS(28, 3, 3),
PASSAGE(29, 4, 2),
PIGSCENE(30, 4, 4),
PLANT(31, 1, 1),
POINTER(32, 4, 4),
POND(33, 3, 4),
POOL(34, 2, 1),
PRAIRIE_RIDE(35, 1, 2),
SEA(36, 2, 1),
SKELETON(37, 4, 3),
SKULL_AND_ROSES(38, 2, 2),
STAGE(39, 2, 2),
SUNFLOWERS(40, 3, 3),
SUNSET(41, 2, 1),
TIDES(42, 3, 3),
UNPACKED(43, 4, 4),
VOID(44, 2, 2),
WANDERER(45, 1, 2),
WASTELAND(46, 1, 1),
WATER(47, 2, 2),
WIND(48, 2, 2),
WITHER(49, 2, 2);
// Paper end - Generated/Art
private final int id, width, height;
private final NamespacedKey key;
private static final HashMap<String, Art> BY_NAME = Maps.newHashMap();
private static final HashMap<Integer, Art> BY_ID = Maps.newHashMap();
private Art(int id, int width, int height) {
this.id = id;
this.width = width;
this.height = height;
this.key = NamespacedKey.minecraft(name().toLowerCase(Locale.ROOT));
}
/**
* Gets the width of the painting, in blocks
*
* @return The width of the painting, in blocks
*/
public int getBlockWidth() {
return width;
}
/**
* Gets the height of the painting, in blocks
*
* @return The height of the painting, in blocks
*/
public int getBlockHeight() {
return height;
}
/**
* Get the ID of this painting.
*
* @return The ID of this painting
* @apiNote Internal Use Only
*/
@org.jetbrains.annotations.ApiStatus.Internal // Paper
public int getId() {
return id;
}
// Paper start - deprecate getKey
/**
* @deprecated use {@link Registry#getKey(Keyed)}, {@link io.papermc.paper.registry.RegistryAccess#getRegistry(io.papermc.paper.registry.RegistryKey)},
* and {@link io.papermc.paper.registry.RegistryKey#PAINTING_VARIANT}. Painting variants can exist without a key.
*/
@Deprecated(since = "1.21")
// Paper end - deprecate getKey
@NotNull
@Override
public NamespacedKey getKey() {
return key;
}
/**
* Get a painting by its numeric ID
*
* @param id The ID
* @return The painting
* @apiNote Internal Use Only
*/
@org.jetbrains.annotations.ApiStatus.Internal // Paper
@Nullable
public static Art getById(int id) {
return BY_ID.get(id);
}
/**
* Get a painting by its unique name
* <p>
* This ignores underscores and capitalization
*
* @param name The name
* @return The painting
*/
@Nullable
public static Art getByName(@NotNull String name) {
Preconditions.checkArgument(name != null, "Name cannot be null");
return BY_NAME.get(name.toLowerCase(Locale.ROOT));
}
static {
for (Art art : values()) {
BY_ID.put(art.id, art);
BY_NAME.put(art.toString().toLowerCase(Locale.ROOT), art);
}
}
}

View file

@ -0,0 +1,50 @@
package org.bukkit;
// Paper start - overhaul FeatureFlag API
import com.google.common.base.Preconditions;
import java.util.List;
import net.kyori.adventure.key.Key;
import net.kyori.adventure.util.Index;
import org.intellij.lang.annotations.Subst;
// Paper end - overhaul FeatureFlag API
import org.jetbrains.annotations.ApiStatus;
/**
* This represents a Feature Flag for a {@link io.papermc.paper.world.flag.FeatureFlagSetHolder}.
*/
public interface FeatureFlag extends Keyed {
// Paper start - overhaul FeatureFlag API
// Paper start - Generated/FeatureFlag
// @GeneratedFrom 1.21.1
@ApiStatus.Experimental
FeatureFlag BUNDLE = create("bundle");
@ApiStatus.Experimental
FeatureFlag TRADE_REBALANCE = create("trade_rebalance");
FeatureFlag VANILLA = create("vanilla");
// Paper end - Generated/FeatureFlag
@Deprecated(since = "1.20")
FeatureFlag UPDATE_1_20 = deprecated("update_1_20");
@Deprecated(since = "1.21")
FeatureFlag UPDATE_121 = deprecated("update_1_21");
/**
* An index of all feature flags.
*/
Index<Key, FeatureFlag> ALL_FLAGS = Index.create(FeatureFlag::key, List.copyOf(FeatureFlagImpl.ALL_FLAGS));
private static FeatureFlag create(@Subst("vanilla") final String name) {
final FeatureFlag flag = new FeatureFlagImpl(NamespacedKey.minecraft(name));
Preconditions.checkState(FeatureFlagImpl.ALL_FLAGS.add(flag), "Tried to add duplicate feature flag: " + name);
return flag;
}
private static FeatureFlag deprecated(@Subst("vanilla") final String name) {
return new FeatureFlagImpl.Deprecated(NamespacedKey.minecraft(name));
}
// Paper end - overhaul FeatureFlag API
}

View file

@ -0,0 +1,31 @@
package org.bukkit;
import java.util.Locale;
import org.jetbrains.annotations.NotNull;
/**
* Represents a fluid type.
*/
public enum Fluid implements Keyed {
// Paper start - Generated/Fluid
// @GeneratedFrom 1.21.1
EMPTY,
FLOWING_LAVA,
FLOWING_WATER,
LAVA,
WATER;
// Paper end - Generated/Fluid
private final NamespacedKey key;
private Fluid() {
this.key = NamespacedKey.minecraft(this.name().toLowerCase(Locale.ROOT));
}
@NotNull
@Override
public NamespacedKey getKey() {
return key;
}
}

View file

@ -0,0 +1,230 @@
package org.bukkit;
import com.google.common.base.Preconditions;
import com.google.common.collect.Lists;
import java.util.Collection;
import java.util.Collections;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
* Represents a generic Mojang game event.
*/
public abstract class GameEvent implements Keyed {
// Paper start - Generated/GameEvent
// @GeneratedFrom 1.21.1
public static final GameEvent BLOCK_ACTIVATE = getEvent("block_activate");
public static final GameEvent BLOCK_ATTACH = getEvent("block_attach");
public static final GameEvent BLOCK_CHANGE = getEvent("block_change");
public static final GameEvent BLOCK_CLOSE = getEvent("block_close");
public static final GameEvent BLOCK_DEACTIVATE = getEvent("block_deactivate");
public static final GameEvent BLOCK_DESTROY = getEvent("block_destroy");
public static final GameEvent BLOCK_DETACH = getEvent("block_detach");
public static final GameEvent BLOCK_OPEN = getEvent("block_open");
public static final GameEvent BLOCK_PLACE = getEvent("block_place");
public static final GameEvent CONTAINER_CLOSE = getEvent("container_close");
public static final GameEvent CONTAINER_OPEN = getEvent("container_open");
public static final GameEvent DRINK = getEvent("drink");
public static final GameEvent EAT = getEvent("eat");
public static final GameEvent ELYTRA_GLIDE = getEvent("elytra_glide");
public static final GameEvent ENTITY_ACTION = getEvent("entity_action");
public static final GameEvent ENTITY_DAMAGE = getEvent("entity_damage");
public static final GameEvent ENTITY_DIE = getEvent("entity_die");
public static final GameEvent ENTITY_DISMOUNT = getEvent("entity_dismount");
public static final GameEvent ENTITY_INTERACT = getEvent("entity_interact");
public static final GameEvent ENTITY_MOUNT = getEvent("entity_mount");
public static final GameEvent ENTITY_PLACE = getEvent("entity_place");
public static final GameEvent EQUIP = getEvent("equip");
public static final GameEvent EXPLODE = getEvent("explode");
public static final GameEvent FLAP = getEvent("flap");
public static final GameEvent FLUID_PICKUP = getEvent("fluid_pickup");
public static final GameEvent FLUID_PLACE = getEvent("fluid_place");
public static final GameEvent HIT_GROUND = getEvent("hit_ground");
public static final GameEvent INSTRUMENT_PLAY = getEvent("instrument_play");
public static final GameEvent ITEM_INTERACT_FINISH = getEvent("item_interact_finish");
public static final GameEvent ITEM_INTERACT_START = getEvent("item_interact_start");
public static final GameEvent JUKEBOX_PLAY = getEvent("jukebox_play");
public static final GameEvent JUKEBOX_STOP_PLAY = getEvent("jukebox_stop_play");
public static final GameEvent LIGHTNING_STRIKE = getEvent("lightning_strike");
public static final GameEvent NOTE_BLOCK_PLAY = getEvent("note_block_play");
public static final GameEvent PRIME_FUSE = getEvent("prime_fuse");
public static final GameEvent PROJECTILE_LAND = getEvent("projectile_land");
public static final GameEvent PROJECTILE_SHOOT = getEvent("projectile_shoot");
public static final GameEvent RESONATE_1 = getEvent("resonate_1");
public static final GameEvent RESONATE_2 = getEvent("resonate_2");
public static final GameEvent RESONATE_3 = getEvent("resonate_3");
public static final GameEvent RESONATE_4 = getEvent("resonate_4");
public static final GameEvent RESONATE_5 = getEvent("resonate_5");
public static final GameEvent RESONATE_6 = getEvent("resonate_6");
public static final GameEvent RESONATE_7 = getEvent("resonate_7");
public static final GameEvent RESONATE_8 = getEvent("resonate_8");
public static final GameEvent RESONATE_9 = getEvent("resonate_9");
public static final GameEvent RESONATE_10 = getEvent("resonate_10");
public static final GameEvent RESONATE_11 = getEvent("resonate_11");
public static final GameEvent RESONATE_12 = getEvent("resonate_12");
public static final GameEvent RESONATE_13 = getEvent("resonate_13");
public static final GameEvent RESONATE_14 = getEvent("resonate_14");
public static final GameEvent RESONATE_15 = getEvent("resonate_15");
public static final GameEvent SCULK_SENSOR_TENDRILS_CLICKING = getEvent("sculk_sensor_tendrils_clicking");
public static final GameEvent SHEAR = getEvent("shear");
public static final GameEvent SHRIEK = getEvent("shriek");
public static final GameEvent SPLASH = getEvent("splash");
public static final GameEvent STEP = getEvent("step");
public static final GameEvent SWIM = getEvent("swim");
public static final GameEvent TELEPORT = getEvent("teleport");
public static final GameEvent UNEQUIP = getEvent("unequip");
// Paper end - Generated/GameEvent
@Deprecated
public static final GameEvent BLOCK_PRESS = getEvent("block_activate");
@Deprecated
public static final GameEvent BLOCK_SWITCH = getEvent("block_activate");
@Deprecated
public static final GameEvent BLOCK_UNPRESS = getEvent("block_deactivate");
@Deprecated
public static final GameEvent BLOCK_UNSWITCH = getEvent("block_deactivate");
@Deprecated
public static final GameEvent DISPENSE_FAIL = getEvent("block_activate");
@Deprecated
public static final GameEvent DRINKING_FINISH = getEvent("drink");
@Deprecated
public static final GameEvent ELYTRA_FREE_FALL = getEvent("elytra_glide");
@Deprecated
public static final GameEvent ENTITY_DAMAGED = getEvent("entity_damage");
@Deprecated
public static final GameEvent ENTITY_DYING = getEvent("entity_die");
@Deprecated
public static final GameEvent ENTITY_KILLED = getEvent("entity_die");
@Deprecated
public static final GameEvent ENTITY_ROAR = getEvent("entity_action");
@Deprecated
public static final GameEvent ENTITY_SHAKE = getEvent("entity_action");
@Deprecated
public static final GameEvent MOB_INTERACT = getEvent("entity_interact");
@Deprecated
public static final GameEvent PISTON_CONTRACT = getEvent("block_deactivate");
@Deprecated
public static final GameEvent PISTON_EXTEND = getEvent("block_activate");
@Deprecated
public static final GameEvent RAVAGER_ROAR = getEvent("entity_action");
@Deprecated
public static final GameEvent RING_BELL = getEvent("block_change");
@Deprecated
public static final GameEvent SHULKER_CLOSE = getEvent("container_close");
@Deprecated
public static final GameEvent SHULKER_OPEN = getEvent("container_open");
@Deprecated
public static final GameEvent WOLF_SHAKING = getEvent("entity_action");
/**
* Returns a {@link GameEvent} by a {@link NamespacedKey}.
*
* @param namespacedKey the key
* @return the event or null
* @deprecated Use {@link Registry#get(NamespacedKey)} instead.
*/
@Nullable
@Deprecated
public static GameEvent getByKey(@NotNull NamespacedKey namespacedKey) {
return Registry.GAME_EVENT.get(namespacedKey);
}
/**
* Returns the set of all GameEvents.
*
* @return the memoryKeys
* @deprecated use {@link Registry#iterator()}.
*/
@NotNull
@Deprecated
public static Collection<GameEvent> values() {
return Collections.unmodifiableCollection(Lists.newArrayList(Registry.GAME_EVENT));
}
@NotNull
private static GameEvent getEvent(@NotNull String key) {
NamespacedKey namespacedKey = NamespacedKey.minecraft(key);
GameEvent gameEvent = Registry.GAME_EVENT.get(namespacedKey);
Preconditions.checkNotNull(gameEvent, "No GameEvent found for %s. This is a bug.", namespacedKey);
return gameEvent;
}
// Paper start
/**
* Gets the range of the event which is used to
* notify listeners of the event.
*
* @return the range
*/
public abstract int getRange();
/**
* Gets the vibration level of the game event for vibration listeners.
* Not all events have vibration levels, and a level of 0 means
* it won't cause any vibrations.
*
* @return the vibration level
*/
public abstract int getVibrationLevel();
// Paper end
}

View file

@ -0,0 +1,68 @@
package org.bukkit;
import java.util.Objects;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
/**
* Represents a song which may play in a Jukebox.
*/
@ApiStatus.Experimental
public interface JukeboxSong extends Keyed, Translatable {
// Paper start - Generated/JukeboxSong
// @GeneratedFrom 1.21.1
JukeboxSong ELEVEN = get("11");
JukeboxSong THIRTEEN = get("13");
JukeboxSong FIVE = get("5");
JukeboxSong BLOCKS = get("blocks");
JukeboxSong CAT = get("cat");
JukeboxSong CHIRP = get("chirp");
JukeboxSong CREATOR = get("creator");
JukeboxSong CREATOR_MUSIC_BOX = get("creator_music_box");
JukeboxSong FAR = get("far");
JukeboxSong MALL = get("mall");
JukeboxSong MELLOHI = get("mellohi");
JukeboxSong OTHERSIDE = get("otherside");
JukeboxSong PIGSTEP = get("pigstep");
JukeboxSong PRECIPICE = get("precipice");
JukeboxSong RELIC = get("relic");
JukeboxSong STAL = get("stal");
JukeboxSong STRAD = get("strad");
JukeboxSong WAIT = get("wait");
JukeboxSong WARD = get("ward");
// Paper end - Generated/JukeboxSong
@NotNull
private static JukeboxSong get(@NotNull String s) {
return Objects.requireNonNull(Registry.JUKEBOX_SONG.get(NamespacedKey.minecraft(s)), "Missing song " + s);
}
// Paper start - adventure
/**
* @deprecated this method assumes that jukebox song description will
* always be a translatable component which is not guaranteed.
*/
@Override
@Deprecated(forRemoval = true)
@org.jetbrains.annotations.NotNull String getTranslationKey();
// Paper end - adventure
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,82 @@
package org.bukkit;
import com.google.common.base.Preconditions;
import com.google.common.collect.Lists;
import java.util.Collection;
import java.util.Collections;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public abstract class MusicInstrument implements Keyed, net.kyori.adventure.translation.Translatable { // Paper - translation keys
// Paper start - Generated/MusicInstrument
// @GeneratedFrom 1.21.1
public static final MusicInstrument ADMIRE_GOAT_HORN = getInstrument("admire_goat_horn");
public static final MusicInstrument CALL_GOAT_HORN = getInstrument("call_goat_horn");
public static final MusicInstrument DREAM_GOAT_HORN = getInstrument("dream_goat_horn");
public static final MusicInstrument FEEL_GOAT_HORN = getInstrument("feel_goat_horn");
public static final MusicInstrument PONDER_GOAT_HORN = getInstrument("ponder_goat_horn");
public static final MusicInstrument SEEK_GOAT_HORN = getInstrument("seek_goat_horn");
public static final MusicInstrument SING_GOAT_HORN = getInstrument("sing_goat_horn");
public static final MusicInstrument YEARN_GOAT_HORN = getInstrument("yearn_goat_horn");
// Paper end - Generated/MusicInstrument
/**
* Returns a {@link MusicInstrument} by a {@link NamespacedKey}.
*
* @param namespacedKey the key
* @return the event or null
* @deprecated Use {@link Registry#get(NamespacedKey)} instead.
*/
@Nullable
@Deprecated
public static MusicInstrument getByKey(@NotNull NamespacedKey namespacedKey) {
return Registry.INSTRUMENT.get(namespacedKey);
}
/**
* Returns all known MusicInstruments.
*
* @return the memoryKeys
* @deprecated use {@link Registry#iterator()}.
*/
@NotNull
@Deprecated
public static Collection<MusicInstrument> values() {
return Collections.unmodifiableCollection(Lists.newArrayList(Registry.INSTRUMENT));
}
@NotNull
private static MusicInstrument getInstrument(@NotNull String key) {
NamespacedKey namespacedKey = NamespacedKey.minecraft(key);
MusicInstrument instrument = Registry.INSTRUMENT.get(namespacedKey);
Preconditions.checkNotNull(instrument, "No MusicInstrument found for %s. This is a bug.", namespacedKey);
return instrument;
}
// Paper start - deprecate getKey
/**
* @deprecated use {@link Registry#getKey(Keyed)} and {@link Registry#INSTRUMENT}. MusicInstruments
* can exist without a key.
*/
@Deprecated(forRemoval = true, since = "1.20.5")
@Override
public abstract @NotNull NamespacedKey getKey();
// Paper end - deprecate getKey
// Paper start - translation key
@Override
public @NotNull String translationKey() {
return "instrument.minecraft." + this.getKey().value();
}
// Paper end - translation key
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,180 @@
package org.bukkit;
import java.util.Locale;
import org.jetbrains.annotations.NotNull;
/**
* Represents a countable statistic, which is tracked by the server.
*/
public enum Statistic implements Keyed {
// Paper start - Generated/StatisticCustom
// @GeneratedFrom 1.21.1
ANIMALS_BRED,
AVIATE_ONE_CM,
BELL_RING,
BOAT_ONE_CM,
ARMOR_CLEANED,
BANNER_CLEANED,
CLEAN_SHULKER_BOX,
CLIMB_ONE_CM,
CROUCH_ONE_CM,
DAMAGE_ABSORBED,
DAMAGE_BLOCKED_BY_SHIELD,
DAMAGE_DEALT,
DAMAGE_DEALT_ABSORBED,
DAMAGE_DEALT_RESISTED,
DAMAGE_RESISTED,
DAMAGE_TAKEN,
DEATHS,
DROP_COUNT,
CAKE_SLICES_EATEN,
ITEM_ENCHANTED,
FALL_ONE_CM,
CAULDRON_FILLED,
FISH_CAUGHT,
FLY_ONE_CM,
HORSE_ONE_CM,
DISPENSER_INSPECTED,
DROPPER_INSPECTED,
HOPPER_INSPECTED,
INTERACT_WITH_ANVIL,
BEACON_INTERACTION,
INTERACT_WITH_BLAST_FURNACE,
BREWINGSTAND_INTERACTION,
INTERACT_WITH_CAMPFIRE,
INTERACT_WITH_CARTOGRAPHY_TABLE,
CRAFTING_TABLE_INTERACTION,
FURNACE_INTERACTION,
INTERACT_WITH_GRINDSTONE,
INTERACT_WITH_LECTERN,
INTERACT_WITH_LOOM,
INTERACT_WITH_SMITHING_TABLE,
INTERACT_WITH_SMOKER,
INTERACT_WITH_STONECUTTER,
JUMP,
LEAVE_GAME,
MINECART_ONE_CM,
MOB_KILLS,
OPEN_BARREL,
CHEST_OPENED,
ENDERCHEST_OPENED,
SHULKER_BOX_OPENED,
PIG_ONE_CM,
NOTEBLOCK_PLAYED,
RECORD_PLAYED,
PLAY_ONE_MINUTE,
PLAYER_KILLS,
FLOWER_POTTED,
RAID_TRIGGER,
RAID_WIN,
SLEEP_IN_BED,
SNEAK_TIME,
SPRINT_ONE_CM,
STRIDER_ONE_CM,
SWIM_ONE_CM,
TALKED_TO_VILLAGER,
TARGET_HIT,
TIME_SINCE_DEATH,
TIME_SINCE_REST,
TOTAL_WORLD_TIME,
TRADED_WITH_VILLAGER,
TRAPPED_CHEST_TRIGGERED,
NOTEBLOCK_TUNED,
CAULDRON_USED,
WALK_ON_WATER_ONE_CM,
WALK_ONE_CM,
WALK_UNDER_WATER_ONE_CM,
// Paper end - Generated/StatisticCustom
// Paper start - Generated/StatisticType
// @GeneratedFrom 1.21.1
BREAK_ITEM(Type.ITEM),
CRAFT_ITEM(Type.ITEM),
DROP(Type.ITEM),
KILL_ENTITY(Type.ENTITY),
ENTITY_KILLED_BY(Type.ENTITY),
MINE_BLOCK(Type.BLOCK),
PICKUP(Type.ITEM),
USE_ITEM(Type.ITEM);
// Paper end - Generated/StatisticType
private final Type type;
private final NamespacedKey key;
private Statistic() {
this(Type.UNTYPED);
}
private Statistic(/*@NotNull*/ Type type) {
this.type = type;
this.key = NamespacedKey.minecraft(name().toLowerCase(Locale.ROOT));
}
/**
* Gets the type of this statistic.
*
* @return the type of this statistic
*/
@NotNull
public Type getType() {
return type;
}
/**
* Checks if this is a substatistic.
* <p>
* A substatistic exists en masse for each block, item, or entitytype, depending on
* {@link #getType()}.
* <p>
* This is a redundant method and equivalent to checking
* <code>getType() != Type.UNTYPED</code>
*
* @return true if this is a substatistic
*/
public boolean isSubstatistic() {
return type != Type.UNTYPED;
}
/**
* Checks if this is a substatistic dealing with blocks.
* <p>
* This is a redundant method and equivalent to checking
* <code>getType() == Type.BLOCK</code>
*
* @return true if this deals with blocks
*/
public boolean isBlock() {
return type == Type.BLOCK;
}
@NotNull
@Override
public NamespacedKey getKey() {
return key;
}
/**
* The type of statistic.
*
*/
public enum Type {
/**
* Statistics of this type do not require a qualifier.
*/
UNTYPED,
/**
* Statistics of this type require an Item Material qualifier.
*/
ITEM,
/**
* Statistics of this type require a Block Material qualifier.
*/
BLOCK,
/**
* Statistics of this type require an EntityType qualifier.
*/
ENTITY;
}
}

View file

@ -0,0 +1,836 @@
package org.bukkit;
import java.util.Set;
import org.bukkit.entity.EntityType;
import org.jetbrains.annotations.NotNull;
/**
* Represents a tag that may be defined by the server or a resource pack to
* group like things together.
*
* Note that whilst all tags defined within this interface must be present in
* implementations, their existence is not guaranteed across future versions.
*
* <p>Custom tags defined by Paper are not present (as constants) in this class.
* To access them please refer to {@link com.destroystokyo.paper.MaterialTags}
* and {@link io.papermc.paper.tag.EntityTags}.</p>
*
* @param <T> the type of things grouped by this tag
*/
public interface Tag<T extends Keyed> extends Keyed {
// Paper start - Generated/Tag
// @GeneratedFrom 1.21.1
String REGISTRY_BLOCKS = "blocks";
Tag<Material> ACACIA_LOGS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("acacia_logs"), Material.class);
Tag<Material> AIR = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("air"), Material.class);
Tag<Material> ALL_HANGING_SIGNS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("all_hanging_signs"), Material.class);
Tag<Material> ALL_SIGNS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("all_signs"), Material.class);
Tag<Material> ANCIENT_CITY_REPLACEABLE = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("ancient_city_replaceable"), Material.class);
Tag<Material> ANIMALS_SPAWNABLE_ON = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("animals_spawnable_on"), Material.class);
Tag<Material> ANVIL = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("anvil"), Material.class);
Tag<Material> ARMADILLO_SPAWNABLE_ON = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("armadillo_spawnable_on"), Material.class);
Tag<Material> AXOLOTLS_SPAWNABLE_ON = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("axolotls_spawnable_on"), Material.class);
Tag<Material> AZALEA_GROWS_ON = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("azalea_grows_on"), Material.class);
Tag<Material> AZALEA_ROOT_REPLACEABLE = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("azalea_root_replaceable"), Material.class);
Tag<Material> BADLANDS_TERRACOTTA = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("badlands_terracotta"), Material.class);
Tag<Material> BAMBOO_BLOCKS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("bamboo_blocks"), Material.class);
Tag<Material> BAMBOO_PLANTABLE_ON = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("bamboo_plantable_on"), Material.class);
Tag<Material> BANNERS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("banners"), Material.class);
Tag<Material> BASE_STONE_NETHER = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("base_stone_nether"), Material.class);
Tag<Material> BASE_STONE_OVERWORLD = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("base_stone_overworld"), Material.class);
Tag<Material> BEACON_BASE_BLOCKS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("beacon_base_blocks"), Material.class);
Tag<Material> BEDS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("beds"), Material.class);
Tag<Material> BEE_GROWABLES = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("bee_growables"), Material.class);
Tag<Material> BEEHIVES = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("beehives"), Material.class);
Tag<Material> BIG_DRIPLEAF_PLACEABLE = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("big_dripleaf_placeable"), Material.class);
Tag<Material> BIRCH_LOGS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("birch_logs"), Material.class);
Tag<Material> BLOCKS_WIND_CHARGE_EXPLOSIONS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("blocks_wind_charge_explosions"), Material.class);
Tag<Material> BUTTONS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("buttons"), Material.class);
Tag<Material> CAMEL_SAND_STEP_SOUND_BLOCKS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("camel_sand_step_sound_blocks"), Material.class);
Tag<Material> CAMPFIRES = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("campfires"), Material.class);
Tag<Material> CANDLE_CAKES = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("candle_cakes"), Material.class);
Tag<Material> CANDLES = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("candles"), Material.class);
Tag<Material> CAULDRONS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("cauldrons"), Material.class);
Tag<Material> CAVE_VINES = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("cave_vines"), Material.class);
Tag<Material> CEILING_HANGING_SIGNS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("ceiling_hanging_signs"), Material.class);
Tag<Material> CHERRY_LOGS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("cherry_logs"), Material.class);
Tag<Material> CLIMBABLE = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("climbable"), Material.class);
Tag<Material> COAL_ORES = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("coal_ores"), Material.class);
Tag<Material> COMBINATION_STEP_SOUND_BLOCKS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("combination_step_sound_blocks"), Material.class);
Tag<Material> COMPLETES_FIND_TREE_TUTORIAL = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("completes_find_tree_tutorial"), Material.class);
Tag<Material> CONCRETE_POWDER = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("concrete_powder"), Material.class);
Tag<Material> CONVERTABLE_TO_MUD = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("convertable_to_mud"), Material.class);
Tag<Material> COPPER_ORES = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("copper_ores"), Material.class);
Tag<Material> CORAL_BLOCKS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("coral_blocks"), Material.class);
Tag<Material> CORAL_PLANTS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("coral_plants"), Material.class);
Tag<Material> CORALS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("corals"), Material.class);
Tag<Material> CRIMSON_STEMS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("crimson_stems"), Material.class);
Tag<Material> CROPS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("crops"), Material.class);
Tag<Material> CRYSTAL_SOUND_BLOCKS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("crystal_sound_blocks"), Material.class);
Tag<Material> DAMPENS_VIBRATIONS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("dampens_vibrations"), Material.class);
Tag<Material> DARK_OAK_LOGS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("dark_oak_logs"), Material.class);
Tag<Material> DEAD_BUSH_MAY_PLACE_ON = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("dead_bush_may_place_on"), Material.class);
Tag<Material> DEEPSLATE_ORE_REPLACEABLES = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("deepslate_ore_replaceables"), Material.class);
Tag<Material> DIAMOND_ORES = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("diamond_ores"), Material.class);
Tag<Material> DIRT = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("dirt"), Material.class);
Tag<Material> DOES_NOT_BLOCK_HOPPERS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("does_not_block_hoppers"), Material.class);
Tag<Material> DOORS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("doors"), Material.class);
Tag<Material> DRAGON_IMMUNE = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("dragon_immune"), Material.class);
Tag<Material> DRAGON_TRANSPARENT = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("dragon_transparent"), Material.class);
Tag<Material> DRIPSTONE_REPLACEABLE_BLOCKS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("dripstone_replaceable_blocks"), Material.class);
Tag<Material> EMERALD_ORES = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("emerald_ores"), Material.class);
Tag<Material> ENCHANTMENT_POWER_PROVIDER = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("enchantment_power_provider"), Material.class);
Tag<Material> ENCHANTMENT_POWER_TRANSMITTER = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("enchantment_power_transmitter"), Material.class);
Tag<Material> ENDERMAN_HOLDABLE = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("enderman_holdable"), Material.class);
Tag<Material> FALL_DAMAGE_RESETTING = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("fall_damage_resetting"), Material.class);
Tag<Material> FEATURES_CANNOT_REPLACE = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("features_cannot_replace"), Material.class);
Tag<Material> FENCE_GATES = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("fence_gates"), Material.class);
Tag<Material> FENCES = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("fences"), Material.class);
Tag<Material> FIRE = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("fire"), Material.class);
Tag<Material> FLOWER_POTS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("flower_pots"), Material.class);
Tag<Material> FLOWERS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("flowers"), Material.class);
Tag<Material> FOXES_SPAWNABLE_ON = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("foxes_spawnable_on"), Material.class);
Tag<Material> FROG_PREFER_JUMP_TO = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("frog_prefer_jump_to"), Material.class);
Tag<Material> FROGS_SPAWNABLE_ON = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("frogs_spawnable_on"), Material.class);
Tag<Material> GEODE_INVALID_BLOCKS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("geode_invalid_blocks"), Material.class);
Tag<Material> GOATS_SPAWNABLE_ON = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("goats_spawnable_on"), Material.class);
Tag<Material> GOLD_ORES = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("gold_ores"), Material.class);
Tag<Material> GUARDED_BY_PIGLINS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("guarded_by_piglins"), Material.class);
Tag<Material> HOGLIN_REPELLENTS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("hoglin_repellents"), Material.class);
Tag<Material> ICE = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("ice"), Material.class);
Tag<Material> IMPERMEABLE = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("impermeable"), Material.class);
Tag<Material> INCORRECT_FOR_DIAMOND_TOOL = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("incorrect_for_diamond_tool"), Material.class);
Tag<Material> INCORRECT_FOR_GOLD_TOOL = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("incorrect_for_gold_tool"), Material.class);
Tag<Material> INCORRECT_FOR_IRON_TOOL = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("incorrect_for_iron_tool"), Material.class);
Tag<Material> INCORRECT_FOR_NETHERITE_TOOL = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("incorrect_for_netherite_tool"), Material.class);
Tag<Material> INCORRECT_FOR_STONE_TOOL = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("incorrect_for_stone_tool"), Material.class);
Tag<Material> INCORRECT_FOR_WOODEN_TOOL = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("incorrect_for_wooden_tool"), Material.class);
Tag<Material> INFINIBURN_END = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("infiniburn_end"), Material.class);
Tag<Material> INFINIBURN_NETHER = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("infiniburn_nether"), Material.class);
Tag<Material> INFINIBURN_OVERWORLD = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("infiniburn_overworld"), Material.class);
Tag<Material> INSIDE_STEP_SOUND_BLOCKS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("inside_step_sound_blocks"), Material.class);
Tag<Material> INVALID_SPAWN_INSIDE = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("invalid_spawn_inside"), Material.class);
Tag<Material> IRON_ORES = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("iron_ores"), Material.class);
Tag<Material> JUNGLE_LOGS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("jungle_logs"), Material.class);
Tag<Material> LAPIS_ORES = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("lapis_ores"), Material.class);
Tag<Material> LAVA_POOL_STONE_CANNOT_REPLACE = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("lava_pool_stone_cannot_replace"), Material.class);
Tag<Material> LEAVES = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("leaves"), Material.class);
Tag<Material> LOGS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("logs"), Material.class);
Tag<Material> LOGS_THAT_BURN = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("logs_that_burn"), Material.class);
Tag<Material> LUSH_GROUND_REPLACEABLE = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("lush_ground_replaceable"), Material.class);
Tag<Material> MAINTAINS_FARMLAND = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("maintains_farmland"), Material.class);
Tag<Material> MANGROVE_LOGS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("mangrove_logs"), Material.class);
Tag<Material> MANGROVE_LOGS_CAN_GROW_THROUGH = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("mangrove_logs_can_grow_through"), Material.class);
Tag<Material> MANGROVE_ROOTS_CAN_GROW_THROUGH = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("mangrove_roots_can_grow_through"), Material.class);
Tag<Material> MINEABLE_AXE = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("mineable/axe"), Material.class);
Tag<Material> MINEABLE_HOE = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("mineable/hoe"), Material.class);
Tag<Material> MINEABLE_PICKAXE = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("mineable/pickaxe"), Material.class);
Tag<Material> MINEABLE_SHOVEL = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("mineable/shovel"), Material.class);
Tag<Material> MOB_INTERACTABLE_DOORS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("mob_interactable_doors"), Material.class);
Tag<Material> MOOSHROOMS_SPAWNABLE_ON = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("mooshrooms_spawnable_on"), Material.class);
Tag<Material> MOSS_REPLACEABLE = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("moss_replaceable"), Material.class);
Tag<Material> MUSHROOM_GROW_BLOCK = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("mushroom_grow_block"), Material.class);
Tag<Material> NEEDS_DIAMOND_TOOL = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("needs_diamond_tool"), Material.class);
Tag<Material> NEEDS_IRON_TOOL = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("needs_iron_tool"), Material.class);
Tag<Material> NEEDS_STONE_TOOL = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("needs_stone_tool"), Material.class);
Tag<Material> NETHER_CARVER_REPLACEABLES = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("nether_carver_replaceables"), Material.class);
Tag<Material> NYLIUM = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("nylium"), Material.class);
Tag<Material> OAK_LOGS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("oak_logs"), Material.class);
Tag<Material> OCCLUDES_VIBRATION_SIGNALS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("occludes_vibration_signals"), Material.class);
Tag<Material> OVERWORLD_CARVER_REPLACEABLES = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("overworld_carver_replaceables"), Material.class);
Tag<Material> OVERWORLD_NATURAL_LOGS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("overworld_natural_logs"), Material.class);
Tag<Material> PARROTS_SPAWNABLE_ON = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("parrots_spawnable_on"), Material.class);
Tag<Material> PIGLIN_REPELLENTS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("piglin_repellents"), Material.class);
Tag<Material> PLANKS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("planks"), Material.class);
Tag<Material> POLAR_BEARS_SPAWNABLE_ON_ALTERNATE = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("polar_bears_spawnable_on_alternate"), Material.class);
Tag<Material> PORTALS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("portals"), Material.class);
Tag<Material> PRESSURE_PLATES = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("pressure_plates"), Material.class);
Tag<Material> PREVENT_MOB_SPAWNING_INSIDE = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("prevent_mob_spawning_inside"), Material.class);
Tag<Material> RABBITS_SPAWNABLE_ON = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("rabbits_spawnable_on"), Material.class);
Tag<Material> RAILS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("rails"), Material.class);
Tag<Material> REDSTONE_ORES = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("redstone_ores"), Material.class);
Tag<Material> REPLACEABLE = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("replaceable"), Material.class);
Tag<Material> REPLACEABLE_BY_TREES = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("replaceable_by_trees"), Material.class);
Tag<Material> SAND = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("sand"), Material.class);
Tag<Material> SAPLINGS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("saplings"), Material.class);
Tag<Material> SCULK_REPLACEABLE = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("sculk_replaceable"), Material.class);
Tag<Material> SCULK_REPLACEABLE_WORLD_GEN = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("sculk_replaceable_world_gen"), Material.class);
Tag<Material> SHULKER_BOXES = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("shulker_boxes"), Material.class);
Tag<Material> SIGNS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("signs"), Material.class);
Tag<Material> SLABS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("slabs"), Material.class);
Tag<Material> SMALL_DRIPLEAF_PLACEABLE = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("small_dripleaf_placeable"), Material.class);
Tag<Material> SMALL_FLOWERS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("small_flowers"), Material.class);
Tag<Material> SMELTS_TO_GLASS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("smelts_to_glass"), Material.class);
Tag<Material> SNAPS_GOAT_HORN = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("snaps_goat_horn"), Material.class);
Tag<Material> SNIFFER_DIGGABLE_BLOCK = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("sniffer_diggable_block"), Material.class);
Tag<Material> SNIFFER_EGG_HATCH_BOOST = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("sniffer_egg_hatch_boost"), Material.class);
Tag<Material> SNOW = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("snow"), Material.class);
Tag<Material> SNOW_LAYER_CAN_SURVIVE_ON = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("snow_layer_can_survive_on"), Material.class);
Tag<Material> SNOW_LAYER_CANNOT_SURVIVE_ON = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("snow_layer_cannot_survive_on"), Material.class);
Tag<Material> SOUL_FIRE_BASE_BLOCKS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("soul_fire_base_blocks"), Material.class);
Tag<Material> SOUL_SPEED_BLOCKS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("soul_speed_blocks"), Material.class);
Tag<Material> SPRUCE_LOGS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("spruce_logs"), Material.class);
Tag<Material> STAIRS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("stairs"), Material.class);
Tag<Material> STANDING_SIGNS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("standing_signs"), Material.class);
Tag<Material> STONE_BRICKS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("stone_bricks"), Material.class);
Tag<Material> STONE_BUTTONS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("stone_buttons"), Material.class);
Tag<Material> STONE_ORE_REPLACEABLES = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("stone_ore_replaceables"), Material.class);
Tag<Material> STONE_PRESSURE_PLATES = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("stone_pressure_plates"), Material.class);
Tag<Material> STRIDER_WARM_BLOCKS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("strider_warm_blocks"), Material.class);
Tag<Material> SWORD_EFFICIENT = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("sword_efficient"), Material.class);
Tag<Material> TALL_FLOWERS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("tall_flowers"), Material.class);
Tag<Material> TERRACOTTA = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("terracotta"), Material.class);
Tag<Material> TRAIL_RUINS_REPLACEABLE = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("trail_ruins_replaceable"), Material.class);
Tag<Material> TRAPDOORS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("trapdoors"), Material.class);
Tag<Material> UNDERWATER_BONEMEALS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("underwater_bonemeals"), Material.class);
Tag<Material> UNSTABLE_BOTTOM_CENTER = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("unstable_bottom_center"), Material.class);
Tag<Material> VALID_SPAWN = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("valid_spawn"), Material.class);
Tag<Material> VIBRATION_RESONATORS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("vibration_resonators"), Material.class);
Tag<Material> WALL_CORALS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("wall_corals"), Material.class);
Tag<Material> WALL_HANGING_SIGNS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("wall_hanging_signs"), Material.class);
Tag<Material> WALL_POST_OVERRIDE = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("wall_post_override"), Material.class);
Tag<Material> WALL_SIGNS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("wall_signs"), Material.class);
Tag<Material> WALLS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("walls"), Material.class);
Tag<Material> WARPED_STEMS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("warped_stems"), Material.class);
Tag<Material> WART_BLOCKS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("wart_blocks"), Material.class);
Tag<Material> WITHER_IMMUNE = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("wither_immune"), Material.class);
Tag<Material> WITHER_SUMMON_BASE_BLOCKS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("wither_summon_base_blocks"), Material.class);
Tag<Material> WOLVES_SPAWNABLE_ON = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("wolves_spawnable_on"), Material.class);
Tag<Material> WOODEN_BUTTONS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("wooden_buttons"), Material.class);
Tag<Material> WOODEN_DOORS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("wooden_doors"), Material.class);
Tag<Material> WOODEN_FENCES = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("wooden_fences"), Material.class);
Tag<Material> WOODEN_PRESSURE_PLATES = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("wooden_pressure_plates"), Material.class);
Tag<Material> WOODEN_SLABS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("wooden_slabs"), Material.class);
Tag<Material> WOODEN_STAIRS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("wooden_stairs"), Material.class);
Tag<Material> WOODEN_TRAPDOORS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("wooden_trapdoors"), Material.class);
Tag<Material> WOOL = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("wool"), Material.class);
Tag<Material> WOOL_CARPETS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("wool_carpets"), Material.class);
String REGISTRY_ITEMS = "items";
Tag<Material> ITEMS_ACACIA_LOGS = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("acacia_logs"), Material.class);
Tag<Material> ITEMS_ANVIL = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("anvil"), Material.class);
Tag<Material> ITEMS_ARMADILLO_FOOD = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("armadillo_food"), Material.class);
Tag<Material> ITEMS_ARROWS = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("arrows"), Material.class);
Tag<Material> ITEMS_AXES = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("axes"), Material.class);
Tag<Material> ITEMS_AXOLOTL_FOOD = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("axolotl_food"), Material.class);
Tag<Material> ITEMS_BAMBOO_BLOCKS = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("bamboo_blocks"), Material.class);
Tag<Material> ITEMS_BANNERS = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("banners"), Material.class);
Tag<Material> ITEMS_BEACON_PAYMENT_ITEMS = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("beacon_payment_items"), Material.class);
Tag<Material> ITEMS_BEDS = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("beds"), Material.class);
Tag<Material> ITEMS_BEE_FOOD = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("bee_food"), Material.class);
Tag<Material> ITEMS_BIRCH_LOGS = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("birch_logs"), Material.class);
Tag<Material> ITEMS_BOATS = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("boats"), Material.class);
Tag<Material> ITEMS_BOOKSHELF_BOOKS = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("bookshelf_books"), Material.class);
Tag<Material> ITEMS_BREAKS_DECORATED_POTS = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("breaks_decorated_pots"), Material.class);
Tag<Material> ITEMS_BUTTONS = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("buttons"), Material.class);
Tag<Material> ITEMS_CAMEL_FOOD = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("camel_food"), Material.class);
Tag<Material> ITEMS_CANDLES = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("candles"), Material.class);
Tag<Material> ITEMS_CAT_FOOD = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("cat_food"), Material.class);
Tag<Material> ITEMS_CHERRY_LOGS = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("cherry_logs"), Material.class);
Tag<Material> ITEMS_CHEST_ARMOR = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("chest_armor"), Material.class);
Tag<Material> ITEMS_CHEST_BOATS = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("chest_boats"), Material.class);
Tag<Material> ITEMS_CHICKEN_FOOD = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("chicken_food"), Material.class);
Tag<Material> ITEMS_CLUSTER_MAX_HARVESTABLES = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("cluster_max_harvestables"), Material.class);
Tag<Material> ITEMS_COAL_ORES = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("coal_ores"), Material.class);
Tag<Material> ITEMS_COALS = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("coals"), Material.class);
Tag<Material> ITEMS_COMPASSES = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("compasses"), Material.class);
Tag<Material> ITEMS_COMPLETES_FIND_TREE_TUTORIAL = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("completes_find_tree_tutorial"), Material.class);
Tag<Material> ITEMS_COPPER_ORES = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("copper_ores"), Material.class);
Tag<Material> ITEMS_COW_FOOD = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("cow_food"), Material.class);
Tag<Material> ITEMS_CREEPER_DROP_MUSIC_DISCS = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("creeper_drop_music_discs"), Material.class);
Tag<Material> ITEMS_CREEPER_IGNITERS = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("creeper_igniters"), Material.class);
Tag<Material> ITEMS_CRIMSON_STEMS = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("crimson_stems"), Material.class);
Tag<Material> ITEMS_DAMPENS_VIBRATIONS = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("dampens_vibrations"), Material.class);
Tag<Material> ITEMS_DARK_OAK_LOGS = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("dark_oak_logs"), Material.class);
Tag<Material> ITEMS_DECORATED_POT_INGREDIENTS = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("decorated_pot_ingredients"), Material.class);
Tag<Material> ITEMS_DECORATED_POT_SHERDS = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("decorated_pot_sherds"), Material.class);
Tag<Material> ITEMS_DIAMOND_ORES = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("diamond_ores"), Material.class);
Tag<Material> ITEMS_DIRT = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("dirt"), Material.class);
Tag<Material> ITEMS_DOORS = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("doors"), Material.class);
Tag<Material> ITEMS_DYEABLE = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("dyeable"), Material.class);
Tag<Material> ITEMS_EMERALD_ORES = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("emerald_ores"), Material.class);
Tag<Material> ITEMS_ENCHANTABLE_ARMOR = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("enchantable/armor"), Material.class);
Tag<Material> ITEMS_ENCHANTABLE_BOW = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("enchantable/bow"), Material.class);
Tag<Material> ITEMS_ENCHANTABLE_CHEST_ARMOR = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("enchantable/chest_armor"), Material.class);
Tag<Material> ITEMS_ENCHANTABLE_CROSSBOW = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("enchantable/crossbow"), Material.class);
Tag<Material> ITEMS_ENCHANTABLE_DURABILITY = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("enchantable/durability"), Material.class);
Tag<Material> ITEMS_ENCHANTABLE_EQUIPPABLE = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("enchantable/equippable"), Material.class);
Tag<Material> ITEMS_ENCHANTABLE_FIRE_ASPECT = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("enchantable/fire_aspect"), Material.class);
Tag<Material> ITEMS_ENCHANTABLE_FISHING = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("enchantable/fishing"), Material.class);
Tag<Material> ITEMS_ENCHANTABLE_FOOT_ARMOR = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("enchantable/foot_armor"), Material.class);
Tag<Material> ITEMS_ENCHANTABLE_HEAD_ARMOR = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("enchantable/head_armor"), Material.class);
Tag<Material> ITEMS_ENCHANTABLE_LEG_ARMOR = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("enchantable/leg_armor"), Material.class);
Tag<Material> ITEMS_ENCHANTABLE_MACE = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("enchantable/mace"), Material.class);
Tag<Material> ITEMS_ENCHANTABLE_MINING = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("enchantable/mining"), Material.class);
Tag<Material> ITEMS_ENCHANTABLE_MINING_LOOT = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("enchantable/mining_loot"), Material.class);
Tag<Material> ITEMS_ENCHANTABLE_SHARP_WEAPON = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("enchantable/sharp_weapon"), Material.class);
Tag<Material> ITEMS_ENCHANTABLE_SWORD = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("enchantable/sword"), Material.class);
Tag<Material> ITEMS_ENCHANTABLE_TRIDENT = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("enchantable/trident"), Material.class);
Tag<Material> ITEMS_ENCHANTABLE_VANISHING = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("enchantable/vanishing"), Material.class);
Tag<Material> ITEMS_ENCHANTABLE_WEAPON = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("enchantable/weapon"), Material.class);
Tag<Material> ITEMS_FENCE_GATES = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("fence_gates"), Material.class);
Tag<Material> ITEMS_FENCES = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("fences"), Material.class);
Tag<Material> ITEMS_FISHES = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("fishes"), Material.class);
Tag<Material> ITEMS_FLOWERS = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("flowers"), Material.class);
Tag<Material> ITEMS_FOOT_ARMOR = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("foot_armor"), Material.class);
Tag<Material> ITEMS_FOX_FOOD = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("fox_food"), Material.class);
Tag<Material> ITEMS_FREEZE_IMMUNE_WEARABLES = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("freeze_immune_wearables"), Material.class);
Tag<Material> ITEMS_FROG_FOOD = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("frog_food"), Material.class);
Tag<Material> ITEMS_GOAT_FOOD = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("goat_food"), Material.class);
Tag<Material> ITEMS_GOLD_ORES = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("gold_ores"), Material.class);
Tag<Material> ITEMS_HANGING_SIGNS = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("hanging_signs"), Material.class);
Tag<Material> ITEMS_HEAD_ARMOR = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("head_armor"), Material.class);
Tag<Material> ITEMS_HOES = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("hoes"), Material.class);
Tag<Material> ITEMS_HOGLIN_FOOD = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("hoglin_food"), Material.class);
Tag<Material> ITEMS_HORSE_FOOD = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("horse_food"), Material.class);
Tag<Material> ITEMS_HORSE_TEMPT_ITEMS = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("horse_tempt_items"), Material.class);
Tag<Material> ITEMS_IGNORED_BY_PIGLIN_BABIES = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("ignored_by_piglin_babies"), Material.class);
Tag<Material> ITEMS_IRON_ORES = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("iron_ores"), Material.class);
Tag<Material> ITEMS_JUNGLE_LOGS = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("jungle_logs"), Material.class);
Tag<Material> ITEMS_LAPIS_ORES = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("lapis_ores"), Material.class);
Tag<Material> ITEMS_LEAVES = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("leaves"), Material.class);
Tag<Material> ITEMS_LECTERN_BOOKS = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("lectern_books"), Material.class);
Tag<Material> ITEMS_LEG_ARMOR = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("leg_armor"), Material.class);
Tag<Material> ITEMS_LLAMA_FOOD = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("llama_food"), Material.class);
Tag<Material> ITEMS_LLAMA_TEMPT_ITEMS = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("llama_tempt_items"), Material.class);
Tag<Material> ITEMS_LOGS = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("logs"), Material.class);
Tag<Material> ITEMS_LOGS_THAT_BURN = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("logs_that_burn"), Material.class);
Tag<Material> ITEMS_MANGROVE_LOGS = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("mangrove_logs"), Material.class);
Tag<Material> ITEMS_MEAT = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("meat"), Material.class);
Tag<Material> ITEMS_NON_FLAMMABLE_WOOD = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("non_flammable_wood"), Material.class);
Tag<Material> ITEMS_NOTEBLOCK_TOP_INSTRUMENTS = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("noteblock_top_instruments"), Material.class);
Tag<Material> ITEMS_OAK_LOGS = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("oak_logs"), Material.class);
Tag<Material> ITEMS_OCELOT_FOOD = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("ocelot_food"), Material.class);
Tag<Material> ITEMS_PANDA_FOOD = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("panda_food"), Material.class);
Tag<Material> ITEMS_PARROT_FOOD = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("parrot_food"), Material.class);
Tag<Material> ITEMS_PARROT_POISONOUS_FOOD = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("parrot_poisonous_food"), Material.class);
Tag<Material> ITEMS_PICKAXES = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("pickaxes"), Material.class);
Tag<Material> ITEMS_PIG_FOOD = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("pig_food"), Material.class);
Tag<Material> ITEMS_PIGLIN_FOOD = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("piglin_food"), Material.class);
Tag<Material> ITEMS_PIGLIN_LOVED = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("piglin_loved"), Material.class);
Tag<Material> ITEMS_PIGLIN_REPELLENTS = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("piglin_repellents"), Material.class);
Tag<Material> ITEMS_PLANKS = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("planks"), Material.class);
Tag<Material> ITEMS_RABBIT_FOOD = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("rabbit_food"), Material.class);
Tag<Material> ITEMS_RAILS = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("rails"), Material.class);
Tag<Material> ITEMS_REDSTONE_ORES = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("redstone_ores"), Material.class);
Tag<Material> ITEMS_SAND = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("sand"), Material.class);
Tag<Material> ITEMS_SAPLINGS = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("saplings"), Material.class);
Tag<Material> ITEMS_SHEEP_FOOD = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("sheep_food"), Material.class);
Tag<Material> ITEMS_SHOVELS = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("shovels"), Material.class);
Tag<Material> ITEMS_SIGNS = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("signs"), Material.class);
Tag<Material> ITEMS_SKULLS = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("skulls"), Material.class);
Tag<Material> ITEMS_SLABS = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("slabs"), Material.class);
Tag<Material> ITEMS_SMALL_FLOWERS = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("small_flowers"), Material.class);
Tag<Material> ITEMS_SMELTS_TO_GLASS = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("smelts_to_glass"), Material.class);
Tag<Material> ITEMS_SNIFFER_FOOD = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("sniffer_food"), Material.class);
Tag<Material> ITEMS_SOUL_FIRE_BASE_BLOCKS = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("soul_fire_base_blocks"), Material.class);
Tag<Material> ITEMS_SPRUCE_LOGS = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("spruce_logs"), Material.class);
Tag<Material> ITEMS_STAIRS = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("stairs"), Material.class);
Tag<Material> ITEMS_STONE_BRICKS = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("stone_bricks"), Material.class);
Tag<Material> ITEMS_STONE_BUTTONS = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("stone_buttons"), Material.class);
Tag<Material> ITEMS_STONE_CRAFTING_MATERIALS = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("stone_crafting_materials"), Material.class);
Tag<Material> ITEMS_STONE_TOOL_MATERIALS = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("stone_tool_materials"), Material.class);
Tag<Material> ITEMS_STRIDER_FOOD = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("strider_food"), Material.class);
Tag<Material> ITEMS_STRIDER_TEMPT_ITEMS = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("strider_tempt_items"), Material.class);
Tag<Material> ITEMS_SWORDS = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("swords"), Material.class);
Tag<Material> ITEMS_TALL_FLOWERS = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("tall_flowers"), Material.class);
Tag<Material> ITEMS_TERRACOTTA = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("terracotta"), Material.class);
Tag<Material> ITEMS_TRAPDOORS = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("trapdoors"), Material.class);
Tag<Material> ITEMS_TRIM_MATERIALS = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("trim_materials"), Material.class);
Tag<Material> ITEMS_TRIM_TEMPLATES = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("trim_templates"), Material.class);
Tag<Material> ITEMS_TRIMMABLE_ARMOR = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("trimmable_armor"), Material.class);
Tag<Material> ITEMS_TURTLE_FOOD = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("turtle_food"), Material.class);
Tag<Material> ITEMS_VILLAGER_PLANTABLE_SEEDS = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("villager_plantable_seeds"), Material.class);
Tag<Material> ITEMS_WALLS = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("walls"), Material.class);
Tag<Material> ITEMS_WARPED_STEMS = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("warped_stems"), Material.class);
Tag<Material> ITEMS_WART_BLOCKS = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("wart_blocks"), Material.class);
Tag<Material> ITEMS_WOLF_FOOD = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("wolf_food"), Material.class);
Tag<Material> ITEMS_WOODEN_BUTTONS = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("wooden_buttons"), Material.class);
Tag<Material> ITEMS_WOODEN_DOORS = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("wooden_doors"), Material.class);
Tag<Material> ITEMS_WOODEN_FENCES = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("wooden_fences"), Material.class);
Tag<Material> ITEMS_WOODEN_PRESSURE_PLATES = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("wooden_pressure_plates"), Material.class);
Tag<Material> ITEMS_WOODEN_SLABS = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("wooden_slabs"), Material.class);
Tag<Material> ITEMS_WOODEN_STAIRS = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("wooden_stairs"), Material.class);
Tag<Material> ITEMS_WOODEN_TRAPDOORS = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("wooden_trapdoors"), Material.class);
Tag<Material> ITEMS_WOOL = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("wool"), Material.class);
Tag<Material> ITEMS_WOOL_CARPETS = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("wool_carpets"), Material.class);
String REGISTRY_FLUIDS = "fluids";
Tag<Fluid> FLUIDS_LAVA = Bukkit.getTag(REGISTRY_FLUIDS, NamespacedKey.minecraft("lava"), Fluid.class);
Tag<Fluid> FLUIDS_WATER = Bukkit.getTag(REGISTRY_FLUIDS, NamespacedKey.minecraft("water"), Fluid.class);
String REGISTRY_ENTITY_TYPES = "entity_types";
Tag<EntityType> ENTITY_TYPES_AQUATIC = Bukkit.getTag(REGISTRY_ENTITY_TYPES, NamespacedKey.minecraft("aquatic"), EntityType.class);
Tag<EntityType> ENTITY_TYPES_ARROWS = Bukkit.getTag(REGISTRY_ENTITY_TYPES, NamespacedKey.minecraft("arrows"), EntityType.class);
Tag<EntityType> ENTITY_TYPES_ARTHROPOD = Bukkit.getTag(REGISTRY_ENTITY_TYPES, NamespacedKey.minecraft("arthropod"), EntityType.class);
Tag<EntityType> ENTITY_TYPES_AXOLOTL_ALWAYS_HOSTILES = Bukkit.getTag(REGISTRY_ENTITY_TYPES, NamespacedKey.minecraft("axolotl_always_hostiles"), EntityType.class);
Tag<EntityType> ENTITY_TYPES_AXOLOTL_HUNT_TARGETS = Bukkit.getTag(REGISTRY_ENTITY_TYPES, NamespacedKey.minecraft("axolotl_hunt_targets"), EntityType.class);
Tag<EntityType> ENTITY_TYPES_BEEHIVE_INHABITORS = Bukkit.getTag(REGISTRY_ENTITY_TYPES, NamespacedKey.minecraft("beehive_inhabitors"), EntityType.class);
Tag<EntityType> ENTITY_TYPES_CAN_BREATHE_UNDER_WATER = Bukkit.getTag(REGISTRY_ENTITY_TYPES, NamespacedKey.minecraft("can_breathe_under_water"), EntityType.class);
Tag<EntityType> ENTITY_TYPES_CAN_TURN_IN_BOATS = Bukkit.getTag(REGISTRY_ENTITY_TYPES, NamespacedKey.minecraft("can_turn_in_boats"), EntityType.class);
Tag<EntityType> ENTITY_TYPES_DEFLECTS_PROJECTILES = Bukkit.getTag(REGISTRY_ENTITY_TYPES, NamespacedKey.minecraft("deflects_projectiles"), EntityType.class);
Tag<EntityType> ENTITY_TYPES_DISMOUNTS_UNDERWATER = Bukkit.getTag(REGISTRY_ENTITY_TYPES, NamespacedKey.minecraft("dismounts_underwater"), EntityType.class);
Tag<EntityType> ENTITY_TYPES_FALL_DAMAGE_IMMUNE = Bukkit.getTag(REGISTRY_ENTITY_TYPES, NamespacedKey.minecraft("fall_damage_immune"), EntityType.class);
Tag<EntityType> ENTITY_TYPES_FREEZE_HURTS_EXTRA_TYPES = Bukkit.getTag(REGISTRY_ENTITY_TYPES, NamespacedKey.minecraft("freeze_hurts_extra_types"), EntityType.class);
Tag<EntityType> ENTITY_TYPES_FREEZE_IMMUNE_ENTITY_TYPES = Bukkit.getTag(REGISTRY_ENTITY_TYPES, NamespacedKey.minecraft("freeze_immune_entity_types"), EntityType.class);
Tag<EntityType> ENTITY_TYPES_FROG_FOOD = Bukkit.getTag(REGISTRY_ENTITY_TYPES, NamespacedKey.minecraft("frog_food"), EntityType.class);
Tag<EntityType> ENTITY_TYPES_IGNORES_POISON_AND_REGEN = Bukkit.getTag(REGISTRY_ENTITY_TYPES, NamespacedKey.minecraft("ignores_poison_and_regen"), EntityType.class);
Tag<EntityType> ENTITY_TYPES_ILLAGER = Bukkit.getTag(REGISTRY_ENTITY_TYPES, NamespacedKey.minecraft("illager"), EntityType.class);
Tag<EntityType> ENTITY_TYPES_ILLAGER_FRIENDS = Bukkit.getTag(REGISTRY_ENTITY_TYPES, NamespacedKey.minecraft("illager_friends"), EntityType.class);
Tag<EntityType> ENTITY_TYPES_IMMUNE_TO_INFESTED = Bukkit.getTag(REGISTRY_ENTITY_TYPES, NamespacedKey.minecraft("immune_to_infested"), EntityType.class);
Tag<EntityType> ENTITY_TYPES_IMMUNE_TO_OOZING = Bukkit.getTag(REGISTRY_ENTITY_TYPES, NamespacedKey.minecraft("immune_to_oozing"), EntityType.class);
Tag<EntityType> ENTITY_TYPES_IMPACT_PROJECTILES = Bukkit.getTag(REGISTRY_ENTITY_TYPES, NamespacedKey.minecraft("impact_projectiles"), EntityType.class);
Tag<EntityType> ENTITY_TYPES_INVERTED_HEALING_AND_HARM = Bukkit.getTag(REGISTRY_ENTITY_TYPES, NamespacedKey.minecraft("inverted_healing_and_harm"), EntityType.class);
Tag<EntityType> ENTITY_TYPES_NO_ANGER_FROM_WIND_CHARGE = Bukkit.getTag(REGISTRY_ENTITY_TYPES, NamespacedKey.minecraft("no_anger_from_wind_charge"), EntityType.class);
Tag<EntityType> ENTITY_TYPES_NON_CONTROLLING_RIDER = Bukkit.getTag(REGISTRY_ENTITY_TYPES, NamespacedKey.minecraft("non_controlling_rider"), EntityType.class);
Tag<EntityType> ENTITY_TYPES_NOT_SCARY_FOR_PUFFERFISH = Bukkit.getTag(REGISTRY_ENTITY_TYPES, NamespacedKey.minecraft("not_scary_for_pufferfish"), EntityType.class);
Tag<EntityType> ENTITY_TYPES_POWDER_SNOW_WALKABLE_MOBS = Bukkit.getTag(REGISTRY_ENTITY_TYPES, NamespacedKey.minecraft("powder_snow_walkable_mobs"), EntityType.class);
Tag<EntityType> ENTITY_TYPES_RAIDERS = Bukkit.getTag(REGISTRY_ENTITY_TYPES, NamespacedKey.minecraft("raiders"), EntityType.class);
Tag<EntityType> ENTITY_TYPES_REDIRECTABLE_PROJECTILE = Bukkit.getTag(REGISTRY_ENTITY_TYPES, NamespacedKey.minecraft("redirectable_projectile"), EntityType.class);
Tag<EntityType> ENTITY_TYPES_SENSITIVE_TO_BANE_OF_ARTHROPODS = Bukkit.getTag(REGISTRY_ENTITY_TYPES, NamespacedKey.minecraft("sensitive_to_bane_of_arthropods"), EntityType.class);
Tag<EntityType> ENTITY_TYPES_SENSITIVE_TO_IMPALING = Bukkit.getTag(REGISTRY_ENTITY_TYPES, NamespacedKey.minecraft("sensitive_to_impaling"), EntityType.class);
Tag<EntityType> ENTITY_TYPES_SENSITIVE_TO_SMITE = Bukkit.getTag(REGISTRY_ENTITY_TYPES, NamespacedKey.minecraft("sensitive_to_smite"), EntityType.class);
Tag<EntityType> ENTITY_TYPES_SKELETONS = Bukkit.getTag(REGISTRY_ENTITY_TYPES, NamespacedKey.minecraft("skeletons"), EntityType.class);
Tag<EntityType> ENTITY_TYPES_UNDEAD = Bukkit.getTag(REGISTRY_ENTITY_TYPES, NamespacedKey.minecraft("undead"), EntityType.class);
Tag<EntityType> ENTITY_TYPES_WITHER_FRIENDS = Bukkit.getTag(REGISTRY_ENTITY_TYPES, NamespacedKey.minecraft("wither_friends"), EntityType.class);
Tag<EntityType> ENTITY_TYPES_ZOMBIES = Bukkit.getTag(REGISTRY_ENTITY_TYPES, NamespacedKey.minecraft("zombies"), EntityType.class);
String REGISTRY_GAME_EVENTS = "game_events";
Tag<GameEvent> GAME_EVENT_ALLAY_CAN_LISTEN = Bukkit.getTag(REGISTRY_GAME_EVENTS, NamespacedKey.minecraft("allay_can_listen"), GameEvent.class);
Tag<GameEvent> GAME_EVENT_IGNORE_VIBRATIONS_SNEAKING = Bukkit.getTag(REGISTRY_GAME_EVENTS, NamespacedKey.minecraft("ignore_vibrations_sneaking"), GameEvent.class);
Tag<GameEvent> GAME_EVENT_SHRIEKER_CAN_LISTEN = Bukkit.getTag(REGISTRY_GAME_EVENTS, NamespacedKey.minecraft("shrieker_can_listen"), GameEvent.class);
Tag<GameEvent> GAME_EVENT_VIBRATIONS = Bukkit.getTag(REGISTRY_GAME_EVENTS, NamespacedKey.minecraft("vibrations"), GameEvent.class);
Tag<GameEvent> GAME_EVENT_WARDEN_CAN_LISTEN = Bukkit.getTag(REGISTRY_GAME_EVENTS, NamespacedKey.minecraft("warden_can_listen"), GameEvent.class);
// Paper end - Generated/Tag
/**
* @deprecated {@link #WOOL_CARPETS}.
*/
@Deprecated
Tag<Material> CARPETS = WOOL_CARPETS;
/**
* Vanilla item tag representing all piglin food.
*
* @deprecated use {@link #ITEMS_PIGLIN_FOOD}
*/
@Deprecated
Tag<Material> PIGLIN_FOOD = ITEMS_PIGLIN_FOOD;
/**
* Vanilla item tag representing all fox food.
*
* @deprecated use {@link #ITEMS_FOX_FOOD}
*/
@Deprecated
Tag<Material> FOX_FOOD = ITEMS_FOX_FOOD;
/**
* Vanilla item tag representing all tools.
*
* @deprecated removed in Minecraft 1.20.5. Do not use. Will be removed at a later date. Until then,
* this constant now acts as a reference to {@link #ITEMS_BREAKS_DECORATED_POTS} which largely shares
* the same contents of the old "minecraft:tools" tag.
*/
@Deprecated(forRemoval = true)
Tag<Material> ITEMS_TOOLS = ITEMS_BREAKS_DECORATED_POTS;
/**
* Vanilla item tag representing all items which tempt axolotls.
*
* @deprecated use {@link #ITEMS_AXOLOTL_FOOD}
*/
@Deprecated
Tag<Material> AXOLOTL_TEMPT_ITEMS = ITEMS_AXOLOTL_FOOD;
/**
* Vanilla tag representing entities which deflect arrows.
* @deprecated use {@link #ENTITY_TYPES_DEFLECTS_PROJECTILES}
*/
@Deprecated
Tag<EntityType> ENTITY_TYPES_DEFLECTS_ARROWS = ENTITY_TYPES_DEFLECTS_PROJECTILES;
/**
* Returns whether or not this tag has an entry for the specified item.
*
* @param item to check
* @return if it is tagged
*/
boolean isTagged(@NotNull T item);
/**
* Gets an immutable set of all tagged items.
*
* @return set of tagged items
*/
@NotNull
Set<T> getValues();
}

View file

@ -0,0 +1,74 @@
package org.bukkit.attribute;
import org.bukkit.Bukkit;
import org.bukkit.Keyed;
import org.bukkit.NamespacedKey;
import org.bukkit.Translatable;
import org.jetbrains.annotations.NotNull;
/**
* Types of attributes which may be present on an {@link Attributable}.
*/
public enum Attribute implements Keyed, Translatable, net.kyori.adventure.translation.Translatable { // Paper - Adventure translations
// Paper start - Generated/Attribute
// @GeneratedFrom 1.21.1
GENERIC_ARMOR("generic.armor"),
GENERIC_ARMOR_TOUGHNESS("generic.armor_toughness"),
GENERIC_ATTACK_DAMAGE("generic.attack_damage"),
GENERIC_ATTACK_KNOCKBACK("generic.attack_knockback"),
GENERIC_ATTACK_SPEED("generic.attack_speed"),
GENERIC_BURNING_TIME("generic.burning_time"),
GENERIC_EXPLOSION_KNOCKBACK_RESISTANCE("generic.explosion_knockback_resistance"),
GENERIC_FALL_DAMAGE_MULTIPLIER("generic.fall_damage_multiplier"),
GENERIC_FLYING_SPEED("generic.flying_speed"),
GENERIC_FOLLOW_RANGE("generic.follow_range"),
GENERIC_GRAVITY("generic.gravity"),
GENERIC_JUMP_STRENGTH("generic.jump_strength"),
GENERIC_KNOCKBACK_RESISTANCE("generic.knockback_resistance"),
GENERIC_LUCK("generic.luck"),
GENERIC_MAX_ABSORPTION("generic.max_absorption"),
GENERIC_MAX_HEALTH("generic.max_health"),
GENERIC_MOVEMENT_EFFICIENCY("generic.movement_efficiency"),
GENERIC_MOVEMENT_SPEED("generic.movement_speed"),
GENERIC_OXYGEN_BONUS("generic.oxygen_bonus"),
GENERIC_SAFE_FALL_DISTANCE("generic.safe_fall_distance"),
GENERIC_SCALE("generic.scale"),
GENERIC_STEP_HEIGHT("generic.step_height"),
GENERIC_WATER_MOVEMENT_EFFICIENCY("generic.water_movement_efficiency"),
PLAYER_BLOCK_BREAK_SPEED("player.block_break_speed"),
PLAYER_BLOCK_INTERACTION_RANGE("player.block_interaction_range"),
PLAYER_ENTITY_INTERACTION_RANGE("player.entity_interaction_range"),
PLAYER_MINING_EFFICIENCY("player.mining_efficiency"),
PLAYER_SNEAKING_SPEED("player.sneaking_speed"),
PLAYER_SUBMERGED_MINING_SPEED("player.submerged_mining_speed"),
PLAYER_SWEEPING_DAMAGE_RATIO("player.sweeping_damage_ratio"),
ZOMBIE_SPAWN_REINFORCEMENTS("zombie.spawn_reinforcements");
// Paper end - Generated/Attribute
private final NamespacedKey key;
private Attribute(String key) {
this.key = NamespacedKey.minecraft(key);
}
@NotNull
@Override
public NamespacedKey getKey() {
return key;
}
@NotNull
@Override
public String getTranslationKey() {
return Bukkit.getUnsafe().getTranslationKey(this);
}
// Paper start
@SuppressWarnings("deprecation")
@Override
public @NotNull String translationKey() {
return Bukkit.getUnsafe().getTranslationKey(this);
}
// Paper end
}

View file

@ -0,0 +1,102 @@
package org.bukkit.block;
import java.util.Locale;
import org.bukkit.Keyed;
import org.bukkit.NamespacedKey;
import org.jetbrains.annotations.NotNull;
/**
* Holds all accepted Biomes in the default server
*/
public enum Biome implements Keyed, net.kyori.adventure.translation.Translatable { // Paper
// Paper start - Generated/Biome
// @GeneratedFrom 1.21.1
BADLANDS,
BAMBOO_JUNGLE,
BASALT_DELTAS,
BEACH,
BIRCH_FOREST,
CHERRY_GROVE,
COLD_OCEAN,
CRIMSON_FOREST,
DARK_FOREST,
DEEP_COLD_OCEAN,
DEEP_DARK,
DEEP_FROZEN_OCEAN,
DEEP_LUKEWARM_OCEAN,
DEEP_OCEAN,
DESERT,
DRIPSTONE_CAVES,
END_BARRENS,
END_HIGHLANDS,
END_MIDLANDS,
ERODED_BADLANDS,
FLOWER_FOREST,
FOREST,
FROZEN_OCEAN,
FROZEN_PEAKS,
FROZEN_RIVER,
GROVE,
ICE_SPIKES,
JAGGED_PEAKS,
JUNGLE,
LUKEWARM_OCEAN,
LUSH_CAVES,
MANGROVE_SWAMP,
MEADOW,
MUSHROOM_FIELDS,
NETHER_WASTES,
OCEAN,
OLD_GROWTH_BIRCH_FOREST,
OLD_GROWTH_PINE_TAIGA,
OLD_GROWTH_SPRUCE_TAIGA,
PLAINS,
RIVER,
SAVANNA,
SAVANNA_PLATEAU,
SMALL_END_ISLANDS,
SNOWY_BEACH,
SNOWY_PLAINS,
SNOWY_SLOPES,
SNOWY_TAIGA,
SOUL_SAND_VALLEY,
SPARSE_JUNGLE,
STONY_PEAKS,
STONY_SHORE,
SUNFLOWER_PLAINS,
SWAMP,
TAIGA,
THE_END,
THE_VOID,
WARM_OCEAN,
WARPED_FOREST,
WINDSWEPT_FOREST,
WINDSWEPT_GRAVELLY_HILLS,
WINDSWEPT_HILLS,
WINDSWEPT_SAVANNA,
WOODED_BADLANDS,
// Paper end - Generated/Biome
/**
* Represents a custom Biome
*/
CUSTOM;
private final NamespacedKey key;
private Biome() {
this.key = NamespacedKey.minecraft(name().toLowerCase(Locale.ROOT));
}
@NotNull
@Override
public NamespacedKey getKey() {
return key;
}
// Paper start
@Override
public @NotNull String translationKey() {
return "biome.minecraft." + this.key.getKey();
}
// Paper end
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,184 @@
package org.bukkit.block.banner;
import com.google.common.base.Preconditions;
import com.google.common.collect.Lists;
import java.util.Locale;
import org.bukkit.Keyed;
import org.bukkit.NamespacedKey;
import org.bukkit.Registry;
import org.bukkit.util.OldEnum;
import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public interface PatternType extends OldEnum<PatternType>, Keyed {
// Paper start - Generated/PatternType
// @GeneratedFrom 1.21.1
PatternType BASE = getType("base");
PatternType BORDER = getType("border");
PatternType BRICKS = getType("bricks");
PatternType CIRCLE = getType("circle");
PatternType CREEPER = getType("creeper");
PatternType CROSS = getType("cross");
PatternType CURLY_BORDER = getType("curly_border");
PatternType DIAGONAL_LEFT = getType("diagonal_left");
PatternType DIAGONAL_RIGHT = getType("diagonal_right");
PatternType DIAGONAL_UP_LEFT = getType("diagonal_up_left");
PatternType DIAGONAL_UP_RIGHT = getType("diagonal_up_right");
PatternType FLOW = getType("flow");
PatternType FLOWER = getType("flower");
PatternType GLOBE = getType("globe");
PatternType GRADIENT = getType("gradient");
PatternType GRADIENT_UP = getType("gradient_up");
PatternType GUSTER = getType("guster");
PatternType HALF_HORIZONTAL = getType("half_horizontal");
PatternType HALF_HORIZONTAL_BOTTOM = getType("half_horizontal_bottom");
PatternType HALF_VERTICAL = getType("half_vertical");
PatternType HALF_VERTICAL_RIGHT = getType("half_vertical_right");
PatternType MOJANG = getType("mojang");
PatternType PIGLIN = getType("piglin");
PatternType RHOMBUS = getType("rhombus");
PatternType SKULL = getType("skull");
PatternType SMALL_STRIPES = getType("small_stripes");
PatternType SQUARE_BOTTOM_LEFT = getType("square_bottom_left");
PatternType SQUARE_BOTTOM_RIGHT = getType("square_bottom_right");
PatternType SQUARE_TOP_LEFT = getType("square_top_left");
PatternType SQUARE_TOP_RIGHT = getType("square_top_right");
PatternType STRAIGHT_CROSS = getType("straight_cross");
PatternType STRIPE_BOTTOM = getType("stripe_bottom");
PatternType STRIPE_CENTER = getType("stripe_center");
PatternType STRIPE_DOWNLEFT = getType("stripe_downleft");
PatternType STRIPE_DOWNRIGHT = getType("stripe_downright");
PatternType STRIPE_LEFT = getType("stripe_left");
PatternType STRIPE_MIDDLE = getType("stripe_middle");
PatternType STRIPE_RIGHT = getType("stripe_right");
PatternType STRIPE_TOP = getType("stripe_top");
PatternType TRIANGLE_BOTTOM = getType("triangle_bottom");
PatternType TRIANGLE_TOP = getType("triangle_top");
PatternType TRIANGLES_BOTTOM = getType("triangles_bottom");
PatternType TRIANGLES_TOP = getType("triangles_top");
// Paper end - Generated/PatternType
// Paper start - deprecate getKey
/**
* @deprecated use {@link Registry#getKey(Keyed)}, {@link io.papermc.paper.registry.RegistryAccess#getRegistry(io.papermc.paper.registry.RegistryKey)},
* and {@link io.papermc.paper.registry.RegistryKey#BANNER_PATTERN}. PatternTypes can exist without a key.
*/
@Deprecated(since = "1.20.5")
// Paper end - deprecate getKey
@Override
@NotNull
public NamespacedKey getKey();
/**
* Returns the identifier used to represent
* this pattern type
*
* @return the pattern's identifier
* @see #getKey
* @deprecated magic value
*/
@NotNull
@Deprecated(forRemoval = true)
public String getIdentifier();
/**
* Returns the pattern type which matches the passed
* identifier or null if no matches are found
*
* @param identifier the identifier
* @return the matched pattern type or null
* @see Registry#BANNER_PATTERN
* @deprecated magic value, use {@link Registry#get(NamespacedKey)} instead
*/
@Contract("null -> null")
@Nullable
@Deprecated(forRemoval = true)
public static PatternType getByIdentifier(@Nullable String identifier) {
if (identifier == null) {
return null;
}
for (PatternType type : Registry.BANNER_PATTERN) {
if (identifier.equals(type.getIdentifier())) {
return type;
}
}
return null;
}
@NotNull
private static PatternType getType(@NotNull String key) {
NamespacedKey namespacedKey = NamespacedKey.minecraft(key);
PatternType type = Registry.BANNER_PATTERN.get(namespacedKey);
Preconditions.checkNotNull(type, "No Banner Pattern found for %s. This is a bug.", namespacedKey);
return type;
}
/**
* @param name of the pattern type.
* @return the pattern type with the given name.
* @deprecated only for backwards compatibility, use {@link Registry#get(NamespacedKey)} instead.
*/
@NotNull
@Deprecated(since = "1.21", forRemoval = true) @org.jetbrains.annotations.ApiStatus.ScheduledForRemoval(inVersion = "1.22") // Paper - will be removed via asm-utils
static PatternType valueOf(@NotNull String name) {
PatternType type = Registry.BANNER_PATTERN.get(NamespacedKey.fromString(name.toLowerCase(Locale.ROOT)));
Preconditions.checkArgument(type != null, "No pattern type found with the name %s", name);
return type;
}
/**
* @return an array of all known pattern types.
* @deprecated use {@link Registry#iterator()}.
*/
@NotNull
@Deprecated(since = "1.21", forRemoval = true) @org.jetbrains.annotations.ApiStatus.ScheduledForRemoval(inVersion = "1.22") // Paper - will be removed via asm-utils
static PatternType[] values() {
return Lists.newArrayList(Registry.BANNER_PATTERN).toArray(new PatternType[0]);
}
}

View file

@ -0,0 +1,169 @@
package org.bukkit.damage;
import com.google.common.base.Preconditions;
import org.bukkit.Keyed;
import org.bukkit.NamespacedKey;
import org.bukkit.Registry;
import org.bukkit.Translatable;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
/**
* Represent a type of damage that an entity can receive.
* <p>
* Constants in this class include the base types provided by the vanilla
* server. Data packs are capable of registering more types of damage which may
* be obtained through the {@link Registry#DAMAGE_TYPE}.
*
* @see <a href="https://minecraft.wiki/w/Damage_type">Minecraft Wiki</a>
*/
@ApiStatus.Experimental
public interface DamageType extends Keyed, Translatable {
// Paper start - Generated/DamageType
// @GeneratedFrom 1.21.1
DamageType ARROW = getDamageType("arrow");
DamageType BAD_RESPAWN_POINT = getDamageType("bad_respawn_point");
DamageType CACTUS = getDamageType("cactus");
DamageType CAMPFIRE = getDamageType("campfire");
DamageType CRAMMING = getDamageType("cramming");
DamageType DRAGON_BREATH = getDamageType("dragon_breath");
DamageType DROWN = getDamageType("drown");
DamageType DRY_OUT = getDamageType("dry_out");
DamageType EXPLOSION = getDamageType("explosion");
DamageType FALL = getDamageType("fall");
DamageType FALLING_ANVIL = getDamageType("falling_anvil");
DamageType FALLING_BLOCK = getDamageType("falling_block");
DamageType FALLING_STALACTITE = getDamageType("falling_stalactite");
DamageType FIREBALL = getDamageType("fireball");
DamageType FIREWORKS = getDamageType("fireworks");
DamageType FLY_INTO_WALL = getDamageType("fly_into_wall");
DamageType FREEZE = getDamageType("freeze");
DamageType GENERIC = getDamageType("generic");
DamageType GENERIC_KILL = getDamageType("generic_kill");
DamageType HOT_FLOOR = getDamageType("hot_floor");
DamageType IN_FIRE = getDamageType("in_fire");
DamageType IN_WALL = getDamageType("in_wall");
DamageType INDIRECT_MAGIC = getDamageType("indirect_magic");
DamageType LAVA = getDamageType("lava");
DamageType LIGHTNING_BOLT = getDamageType("lightning_bolt");
DamageType MAGIC = getDamageType("magic");
DamageType MOB_ATTACK = getDamageType("mob_attack");
DamageType MOB_ATTACK_NO_AGGRO = getDamageType("mob_attack_no_aggro");
DamageType MOB_PROJECTILE = getDamageType("mob_projectile");
DamageType ON_FIRE = getDamageType("on_fire");
DamageType OUT_OF_WORLD = getDamageType("out_of_world");
DamageType OUTSIDE_BORDER = getDamageType("outside_border");
DamageType PLAYER_ATTACK = getDamageType("player_attack");
DamageType PLAYER_EXPLOSION = getDamageType("player_explosion");
DamageType SONIC_BOOM = getDamageType("sonic_boom");
DamageType SPIT = getDamageType("spit");
DamageType STALAGMITE = getDamageType("stalagmite");
DamageType STARVE = getDamageType("starve");
DamageType STING = getDamageType("sting");
DamageType SWEET_BERRY_BUSH = getDamageType("sweet_berry_bush");
DamageType THORNS = getDamageType("thorns");
DamageType THROWN = getDamageType("thrown");
DamageType TRIDENT = getDamageType("trident");
DamageType UNATTRIBUTED_FIREBALL = getDamageType("unattributed_fireball");
DamageType WIND_CHARGE = getDamageType("wind_charge");
DamageType WITHER = getDamageType("wither");
DamageType WITHER_SKULL = getDamageType("wither_skull");
// Paper end - Generated/DamageType
@NotNull
private static DamageType getDamageType(@NotNull String key) {
NamespacedKey namespacedKey = NamespacedKey.minecraft(key);
return Preconditions.checkNotNull(Registry.DAMAGE_TYPE.get(namespacedKey), "No DamageType found for %s. This is a bug.", namespacedKey);
}
/**
* {@inheritDoc}
* <p>
* The returned key is that of the death message sent when this damage type
* is responsible for the death of an entity.
* <p>
* <strong>Note</strong> This translation key is only used if
* {@link #getDeathMessageType()} is {@link DeathMessageType#DEFAULT}
*/
@NotNull
@Override
public String getTranslationKey();
/**
* Get the {@link DamageScaling} for this damage type.
*
* @return the damage scaling
*/
@NotNull
public DamageScaling getDamageScaling();
/**
* Get the {@link DamageEffect} for this damage type.
*
* @return the damage effect
*/
@NotNull
public DamageEffect getDamageEffect();
/**
* Get the {@link DeathMessageType} for this damage type.
*
* @return the death message type
*/
@NotNull
public DeathMessageType getDeathMessageType();
/**
* Get the amount of hunger exhaustion caused by this damage type.
*
* @return the exhaustion
*/
public float getExhaustion();
}

View file

@ -0,0 +1,194 @@
package org.bukkit.entity;
import org.bukkit.Material;
import org.bukkit.TreeSpecies;
import org.jetbrains.annotations.NotNull;
/**
* Represents a boat entity.
*/
public interface Boat extends Vehicle, io.papermc.paper.entity.Leashable { // Paper - Leashable API
/**
* Gets the wood type of the boat.
*
* @return the wood type
* @deprecated deprecated in favor of {@link #getBoatType()}
*/
@Deprecated
@NotNull
TreeSpecies getWoodType();
/**
* Sets the wood type of the boat.
*
* @param species the new wood type
* @deprecated deprecated in favor of {@link #setBoatType(Type)}
*/
@Deprecated
void setWoodType(@NotNull TreeSpecies species);
/**
* Gets the type of the boat.
*
* @return the boat type
*/
@NotNull
Type getBoatType();
/**
* Sets the type of the boat.
*
* @param type the new type
*/
void setBoatType(@NotNull Type type);
/**
* Gets the maximum speed of a boat. The speed is unrelated to the
* velocity.
*
* @return The max speed.
* @deprecated boats are complex and many of these methods do not work correctly across multiple versions.
*/
@Deprecated
public double getMaxSpeed();
/**
* Sets the maximum speed of a boat. Must be nonnegative. Default is 0.4D.
*
* @param speed The max speed.
* @deprecated boats are complex and many of these methods do not work correctly across multiple versions.
*/
@Deprecated
public void setMaxSpeed(double speed);
/**
* Gets the deceleration rate (newSpeed = curSpeed * rate) of occupied
* boats. The default is 0.2.
*
* @return The rate of deceleration
* @deprecated boats are complex and many of these methods do not work correctly across multiple versions.
*/
@Deprecated
public double getOccupiedDeceleration();
/**
* Sets the deceleration rate (newSpeed = curSpeed * rate) of occupied
* boats. Setting this to a higher value allows for quicker acceleration.
* The default is 0.2.
*
* @param rate deceleration rate
* @deprecated boats are complex and many of these methods do not work correctly across multiple versions.
*/
@Deprecated
public void setOccupiedDeceleration(double rate);
/**
* Gets the deceleration rate (newSpeed = curSpeed * rate) of unoccupied
* boats. The default is -1. Values below 0 indicate that no additional
* deceleration is imposed.
*
* @return The rate of deceleration
* @deprecated boats are complex and many of these methods do not work correctly across multiple versions.
*/
@Deprecated
public double getUnoccupiedDeceleration();
/**
* Sets the deceleration rate (newSpeed = curSpeed * rate) of unoccupied
* boats. Setting this to a higher value allows for quicker deceleration
* of boats when a player disembarks. The default is -1. Values below 0
* indicate that no additional deceleration is imposed.
*
* @param rate deceleration rate
* @deprecated boats are complex and many of these methods do not work correctly across multiple versions.
*/
@Deprecated
public void setUnoccupiedDeceleration(double rate);
/**
* Get whether boats can work on land.
*
* @return whether boats can work on land
* @deprecated boats are complex and many of these methods do not work correctly across multiple versions.
*/
@Deprecated
public boolean getWorkOnLand();
/**
* Set whether boats can work on land.
*
* @param workOnLand whether boats can work on land
* @deprecated boats are complex and many of these methods do not work correctly across multiple versions.
*/
@Deprecated
public void setWorkOnLand(boolean workOnLand);
/**
* Gets the status of the boat.
*
* @return the status
*/
@NotNull
public Status getStatus();
/**
* Represents the type of boats.
*/
public enum Type {
// Paper start - Generated/BoatType
// @GeneratedFrom 1.21.1
OAK(Material.OAK_PLANKS),
SPRUCE(Material.SPRUCE_PLANKS),
BIRCH(Material.BIRCH_PLANKS),
JUNGLE(Material.JUNGLE_PLANKS),
ACACIA(Material.ACACIA_PLANKS),
CHERRY(Material.CHERRY_PLANKS),
DARK_OAK(Material.DARK_OAK_PLANKS),
MANGROVE(Material.MANGROVE_PLANKS),
BAMBOO(Material.BAMBOO_PLANKS);
// Paper end - Generated/BoatType
private final Material materialBlock;
private Type(Material materialBlock) {
this.materialBlock = materialBlock;
}
/**
* Gets the material of the boat type.
*
* @return a material
*/
@NotNull
public Material getMaterial() {
return this.materialBlock;
}
}
/**
* Represents the status of the boat.
*/
public enum Status {
NOT_IN_WORLD, // Paper
// Paper start - Generated/BoatStatus
// @GeneratedFrom 1.21.1
IN_WATER,
UNDER_WATER,
UNDER_FLOWING_WATER,
ON_LAND,
IN_AIR;
// Paper end - Generated/BoatStatus
}
// Paper start
/**
* Gets the {@link Material} that represents this Boat type.
*
* @return the boat material.
*/
@NotNull
public Material getBoatMaterial();
// Paper end
}

View file

@ -0,0 +1,144 @@
package org.bukkit.entity;
import com.google.common.base.Preconditions;
import com.google.common.collect.Lists;
import java.util.Locale;
import org.bukkit.DyeColor;
import org.bukkit.Keyed;
import org.bukkit.NamespacedKey;
import org.bukkit.Registry;
import org.bukkit.util.OldEnum;
import org.jetbrains.annotations.NotNull;
/**
* Meow.
*/
public interface Cat extends Tameable, Sittable, io.papermc.paper.entity.CollarColorable { // Paper - CollarColorable
/**
* Gets the current type of this cat.
*
* @return Type of the cat.
*/
@NotNull
public Type getCatType();
/**
* Sets the current type of this cat.
*
* @param type New type of this cat.
*/
public void setCatType(@NotNull Type type);
/**
* Get the collar color of this cat
*
* @return the color of the collar
*/
@NotNull
@Override // Paper
public DyeColor getCollarColor();
/**
* Set the collar color of this cat
*
* @param color the color to apply
*/
@Override // Paper
public void setCollarColor(@NotNull DyeColor color);
/**
* Represents the various different cat types there are.
*/
interface Type extends OldEnum<Type>, Keyed {
// Paper start - Generated/CatType
// @GeneratedFrom 1.21.1
Type ALL_BLACK = getType("all_black");
Type BLACK = getType("black");
Type BRITISH_SHORTHAIR = getType("british_shorthair");
Type CALICO = getType("calico");
Type JELLIE = getType("jellie");
Type PERSIAN = getType("persian");
Type RAGDOLL = getType("ragdoll");
Type RED = getType("red");
Type SIAMESE = getType("siamese");
Type TABBY = getType("tabby");
Type WHITE = getType("white");
// Paper end - Generated/CatType
@NotNull
private static Type getType(@NotNull String key) {
NamespacedKey namespacedKey = NamespacedKey.minecraft(key);
Type type = Registry.CAT_VARIANT.get(namespacedKey);
Preconditions.checkNotNull(type, "No cat type found for %s. This is a bug.", namespacedKey);
return type;
}
/**
* @param name of the cat type.
* @return the cat type with the given name.
* @deprecated only for backwards compatibility, use {@link Registry#get(NamespacedKey)} instead.
*/
@NotNull
@Deprecated(since = "1.21", forRemoval = true) @org.jetbrains.annotations.ApiStatus.ScheduledForRemoval(inVersion = "1.22") // Paper - will be removed via asm-utils
static Type valueOf(@NotNull String name) {
Type type = Registry.CAT_VARIANT.get(NamespacedKey.fromString(name.toLowerCase(Locale.ROOT)));
Preconditions.checkArgument(type != null, "No cat type found with the name %s", name);
return type;
}
/**
* @return an array of all known cat types.
* @deprecated use {@link Registry#iterator()}.
*/
@NotNull
@Deprecated(since = "1.21", forRemoval = true) @org.jetbrains.annotations.ApiStatus.ScheduledForRemoval(inVersion = "1.22") // Paper - will be removed via asm-utils
static Type[] values() {
return Lists.newArrayList(Registry.CAT_VARIANT).toArray(new Type[0]);
}
}
// Paper start - More cat api
/**
* Sets if the cat is lying down.
* This is visual and does not affect the behaviour of the cat.
*
* @param lyingDown whether the cat should lie down
*/
public void setLyingDown(boolean lyingDown);
/**
* Gets if the cat is lying down.
*
* @return whether the cat is lying down
*/
public boolean isLyingDown();
/**
* Sets if the cat has its head up.
* This is visual and does not affect the behaviour of the cat.
*
* @param headUp head is up
*/
public void setHeadUp(boolean headUp);
/**
* Gets if the cat has its head up.
*
* @return head is up
*/
public boolean isHeadUp();
// Paper end - More cat api
}

View file

@ -0,0 +1,332 @@
package org.bukkit.entity;
import com.google.common.base.Preconditions;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import org.bukkit.Bukkit;
import org.bukkit.Keyed;
import org.bukkit.Location;
import org.bukkit.NamespacedKey;
import org.bukkit.Translatable;
import org.bukkit.World;
import org.bukkit.entity.minecart.CommandMinecart;
import org.bukkit.entity.minecart.ExplosiveMinecart;
import org.bukkit.entity.minecart.HopperMinecart;
import org.bukkit.entity.minecart.PoweredMinecart;
import org.bukkit.entity.minecart.RideableMinecart;
import org.bukkit.entity.minecart.SpawnerMinecart;
import org.bukkit.entity.minecart.StorageMinecart;
import org.bukkit.inventory.ItemStack;
import org.bukkit.potion.PotionEffectType;
import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public enum EntityType implements Keyed, Translatable, net.kyori.adventure.translation.Translatable, io.papermc.paper.world.flag.FeatureDependant { // Paper - translatable
// These strings MUST match the strings in nms.EntityTypes and are case sensitive.
// Paper start - Generated/EntityType
// @GeneratedFrom 1.21.1
ALLAY("allay", Allay.class, -1),
AREA_EFFECT_CLOUD("area_effect_cloud", AreaEffectCloud.class, 3),
ARMADILLO("armadillo", Armadillo.class, -1),
ARMOR_STAND("armor_stand", ArmorStand.class, 30),
ARROW("arrow", Arrow.class, 10),
AXOLOTL("axolotl", Axolotl.class, -1),
BAT("bat", Bat.class, 65),
BEE("bee", Bee.class, -1),
BLAZE("blaze", Blaze.class, 61),
BLOCK_DISPLAY("block_display", BlockDisplay.class, -1),
BOAT("boat", Boat.class, 41),
BOGGED("bogged", Bogged.class, -1),
BREEZE("breeze", Breeze.class, -1),
BREEZE_WIND_CHARGE("breeze_wind_charge", BreezeWindCharge.class, -1),
CAMEL("camel", Camel.class, -1),
CAT("cat", Cat.class, -1),
CAVE_SPIDER("cave_spider", CaveSpider.class, 59),
CHEST_BOAT("chest_boat", ChestBoat.class, -1),
CHEST_MINECART("chest_minecart", StorageMinecart.class, 43),
CHICKEN("chicken", Chicken.class, 93),
COD("cod", Cod.class, -1),
COMMAND_BLOCK_MINECART("command_block_minecart", CommandMinecart.class, 40),
COW("cow", Cow.class, 92),
CREEPER("creeper", Creeper.class, 50),
DOLPHIN("dolphin", Dolphin.class, -1),
DONKEY("donkey", Donkey.class, 31),
DRAGON_FIREBALL("dragon_fireball", DragonFireball.class, 26),
DROWNED("drowned", Drowned.class, -1),
EGG("egg", Egg.class, 7),
ELDER_GUARDIAN("elder_guardian", ElderGuardian.class, 4),
END_CRYSTAL("end_crystal", EnderCrystal.class, 200),
ENDER_DRAGON("ender_dragon", EnderDragon.class, 63),
ENDER_PEARL("ender_pearl", EnderPearl.class, 14),
ENDERMAN("enderman", Enderman.class, 58),
ENDERMITE("endermite", Endermite.class, 67),
EVOKER("evoker", Evoker.class, 34),
EVOKER_FANGS("evoker_fangs", EvokerFangs.class, 33),
EXPERIENCE_BOTTLE("experience_bottle", ThrownExpBottle.class, 17),
EXPERIENCE_ORB("experience_orb", ExperienceOrb.class, 2),
EYE_OF_ENDER("eye_of_ender", EnderSignal.class, 15),
FALLING_BLOCK("falling_block", FallingBlock.class, 21),
FIREBALL("fireball", Fireball.class, 12),
FIREWORK_ROCKET("firework_rocket", Firework.class, 22),
FISHING_BOBBER("fishing_bobber", FishHook.class, -1, false),
FOX("fox", Fox.class, -1),
FROG("frog", Frog.class, -1),
FURNACE_MINECART("furnace_minecart", PoweredMinecart.class, 44),
GHAST("ghast", Ghast.class, 56),
GIANT("giant", Giant.class, 53),
GLOW_ITEM_FRAME("glow_item_frame", GlowItemFrame.class, -1),
GLOW_SQUID("glow_squid", GlowSquid.class, -1),
GOAT("goat", Goat.class, -1),
GUARDIAN("guardian", Guardian.class, 68),
HOGLIN("hoglin", Hoglin.class, -1),
HOPPER_MINECART("hopper_minecart", HopperMinecart.class, 46),
HORSE("horse", Horse.class, 100),
HUSK("husk", Husk.class, 23),
ILLUSIONER("illusioner", Illusioner.class, 37),
INTERACTION("interaction", Interaction.class, -1),
IRON_GOLEM("iron_golem", IronGolem.class, 99),
ITEM("item", Item.class, 1),
ITEM_DISPLAY("item_display", ItemDisplay.class, -1),
ITEM_FRAME("item_frame", ItemFrame.class, 18),
LEASH_KNOT("leash_knot", LeashHitch.class, 8),
LIGHTNING_BOLT("lightning_bolt", LightningStrike.class, -1),
LLAMA("llama", Llama.class, 103),
LLAMA_SPIT("llama_spit", LlamaSpit.class, 104),
MAGMA_CUBE("magma_cube", MagmaCube.class, 62),
MARKER("marker", Marker.class, -1),
MINECART("minecart", Minecart.class, 42),
MOOSHROOM("mooshroom", MushroomCow.class, 96),
MULE("mule", Mule.class, 32),
OCELOT("ocelot", Ocelot.class, 98),
OMINOUS_ITEM_SPAWNER("ominous_item_spawner", OminousItemSpawner.class, -1),
PAINTING("painting", Painting.class, 9),
PANDA("panda", Panda.class, -1),
PARROT("parrot", Parrot.class, 105),
PHANTOM("phantom", Phantom.class, -1),
PIG("pig", Pig.class, 90),
PIGLIN("piglin", Piglin.class, -1),
PIGLIN_BRUTE("piglin_brute", PiglinBrute.class, -1),
PILLAGER("pillager", Pillager.class, -1),
PLAYER("player", Player.class, -1, false),
POLAR_BEAR("polar_bear", PolarBear.class, 102),
POTION("potion", ThrownPotion.class, 16),
PUFFERFISH("pufferfish", PufferFish.class, -1),
RABBIT("rabbit", Rabbit.class, 101),
RAVAGER("ravager", Ravager.class, -1),
SALMON("salmon", Salmon.class, -1),
SHEEP("sheep", Sheep.class, 91),
SHULKER("shulker", Shulker.class, 69),
SHULKER_BULLET("shulker_bullet", ShulkerBullet.class, 25),
SILVERFISH("silverfish", Silverfish.class, 60),
SKELETON("skeleton", Skeleton.class, 51),
SKELETON_HORSE("skeleton_horse", SkeletonHorse.class, 28),
SLIME("slime", Slime.class, 55),
SMALL_FIREBALL("small_fireball", SmallFireball.class, 13),
SNIFFER("sniffer", Sniffer.class, -1),
SNOW_GOLEM("snow_golem", Snowman.class, 97),
SNOWBALL("snowball", Snowball.class, 11),
SPAWNER_MINECART("spawner_minecart", SpawnerMinecart.class, 47),
SPECTRAL_ARROW("spectral_arrow", SpectralArrow.class, 24),
SPIDER("spider", Spider.class, 52),
SQUID("squid", Squid.class, 94),
STRAY("stray", Stray.class, 6),
STRIDER("strider", Strider.class, -1),
TADPOLE("tadpole", Tadpole.class, -1),
TEXT_DISPLAY("text_display", TextDisplay.class, -1),
TNT("tnt", TNTPrimed.class, 20),
TNT_MINECART("tnt_minecart", ExplosiveMinecart.class, 45),
TRADER_LLAMA("trader_llama", TraderLlama.class, -1),
TRIDENT("trident", Trident.class, -1),
TROPICAL_FISH("tropical_fish", TropicalFish.class, -1),
TURTLE("turtle", Turtle.class, -1),
VEX("vex", Vex.class, 35),
VILLAGER("villager", Villager.class, 120),
VINDICATOR("vindicator", Vindicator.class, 36),
WANDERING_TRADER("wandering_trader", WanderingTrader.class, -1),
WARDEN("warden", Warden.class, -1),
WIND_CHARGE("wind_charge", WindCharge.class, -1),
WITCH("witch", Witch.class, 66),
WITHER("wither", Wither.class, 64),
WITHER_SKELETON("wither_skeleton", WitherSkeleton.class, 5),
WITHER_SKULL("wither_skull", WitherSkull.class, 19),
WOLF("wolf", Wolf.class, 95),
ZOGLIN("zoglin", Zoglin.class, -1),
ZOMBIE("zombie", Zombie.class, 54),
ZOMBIE_HORSE("zombie_horse", ZombieHorse.class, 29),
ZOMBIE_VILLAGER("zombie_villager", ZombieVillager.class, 27),
ZOMBIFIED_PIGLIN("zombified_piglin", PigZombie.class, 57),
// Paper end - Generated/EntityType
/**
* An unknown entity without an Entity Class
*/
UNKNOWN(null, null, -1, false);
private final String name;
private final Class<? extends Entity> clazz;
private final short typeId;
private final boolean independent, living;
private final NamespacedKey key;
private static final Map<String, EntityType> NAME_MAP = new HashMap<String, EntityType>();
private static final Map<Short, EntityType> ID_MAP = new HashMap<Short, EntityType>();
static {
for (EntityType type : values()) {
if (type.name != null) {
NAME_MAP.put(type.name.toLowerCase(Locale.ROOT), type);
}
if (type.typeId > 0) {
ID_MAP.put(type.typeId, type);
}
}
}
private EntityType(/*@Nullable*/ String name, /*@Nullable*/ Class<? extends Entity> clazz, int typeId) {
this(name, clazz, typeId, true);
}
private EntityType(/*@Nullable*/ String name, /*@Nullable*/ Class<? extends Entity> clazz, int typeId, boolean independent) {
this.name = name;
this.clazz = clazz;
this.typeId = (short) typeId;
this.independent = independent;
this.living = clazz != null && LivingEntity.class.isAssignableFrom(clazz);
this.key = (name == null) ? null : NamespacedKey.minecraft(name);
}
/**
* Gets the entity type name.
*
* @return the entity type's name
* @deprecated Magic value
*/
@Deprecated
@Nullable
public String getName() {
return name;
}
@NotNull
@Override
public NamespacedKey getKey() {
Preconditions.checkArgument(key != null, "EntityType doesn't have key! Is it UNKNOWN?");
return key;
}
@Nullable
public Class<? extends Entity> getEntityClass() {
return clazz;
}
/**
* Gets the entity type id.
*
* @return the raw type id
* @deprecated Magic value
*/
@Deprecated
public short getTypeId() {
return typeId;
}
/**
* Gets an entity type from its name.
*
* @param name the entity type's name
* @return the matching entity type or null
* @apiNote Internal Use Only
*/
@org.jetbrains.annotations.ApiStatus.Internal // Paper
@Contract("null -> null")
@Nullable
public static EntityType fromName(@Nullable String name) {
if (name == null) {
return null;
}
return NAME_MAP.get(name.toLowerCase(Locale.ROOT));
}
/**
* Gets an entity from its id.
*
* @param id the raw type id
* @return the matching entity type or null
* @deprecated Magic value
*/
@Deprecated
@Nullable
public static EntityType fromId(int id) {
if (id > Short.MAX_VALUE) {
return null;
}
return ID_MAP.get((short) id);
}
/**
* Some entities cannot be spawned using {@link
* World#spawnEntity(Location, EntityType)} or {@link
* World#spawn(Location, Class)}, usually because they require additional
* information in order to spawn.
*
* @return False if the entity type cannot be spawned
*/
public boolean isSpawnable() {
return independent;
}
public boolean isAlive() {
return living;
}
@Override
@NotNull
@Deprecated(forRemoval = true) // Paper
public String getTranslationKey() {
return Bukkit.getUnsafe().getTranslationKey(this);
}
// Paper start
/**
* @throws IllegalArgumentException if the entity does not have a translation key (is probably a custom entity)
*/
@Override
public @NotNull String translationKey() {
Preconditions.checkArgument(this != UNKNOWN, "UNKNOWN entities do not have translation keys");
return org.bukkit.Bukkit.getUnsafe().getTranslationKey(this);
}
/**
* Checks if the entity has default attributes.
*
* @return true if it has default attributes
*/
public boolean hasDefaultAttributes() {
return org.bukkit.Bukkit.getUnsafe().hasDefaultEntityAttributes(this.key);
}
/**
* Gets the default attributes for the entity.
*
* @return an unmodifiable instance of Attributable for reading default attributes.
* @throws IllegalArgumentException if the entity does not exist of have default attributes (use {@link #hasDefaultAttributes()} first)
*/
public @NotNull org.bukkit.attribute.Attributable getDefaultAttributes() {
return org.bukkit.Bukkit.getUnsafe().getDefaultEntityAttributes(this.key);
}
// Paper end
/**
* Gets if this EntityType is enabled by feature in a world.
*
* @param world the world to check
* @return true if this EntityType can be used to spawn an Entity for this World.
*/
@Deprecated(forRemoval = true, since = "1.20") // Paper
public boolean isEnabledByFeature(@NotNull World world) {
return Bukkit.getDataPackManager().isEnabledByFeature(this, world);
}
}

View file

@ -0,0 +1,149 @@
package org.bukkit.entity;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
* What does the fox say?
*/
public interface Fox extends Animals, Sittable {
/**
* Gets the current type of this fox.
*
* @return Type of the fox.
*/
@NotNull
public Type getFoxType();
/**
* Sets the current type of this fox.
*
* @param type New type of this fox.
*/
public void setFoxType(@NotNull Type type);
/**
* Checks if this animal is crouching
*
* @return true if crouching
*/
boolean isCrouching();
/**
* Sets if this animal is crouching.
*
* @param crouching true if crouching
*/
void setCrouching(boolean crouching);
/**
* Sets if this animal is sleeping.
*
* @param sleeping true if sleeping
*/
void setSleeping(boolean sleeping);
/**
* Gets the first trusted player.
*
* @return the owning AnimalTamer, or null if not owned
*/
@Nullable
public AnimalTamer getFirstTrustedPlayer();
/**
* Set the first trusted player.
* <p>
* The first trusted player may only be removed after the second.
*
* @param player the AnimalTamer to be trusted
*/
public void setFirstTrustedPlayer(@Nullable AnimalTamer player);
/**
* Gets the second trusted player.
*
* @return the owning AnimalTamer, or null if not owned
*/
@Nullable
public AnimalTamer getSecondTrustedPlayer();
/**
* Set the second trusted player.
* <p>
* The second trusted player may only be added after the first.
*
* @param player the AnimalTamer to be trusted
*/
public void setSecondTrustedPlayer(@Nullable AnimalTamer player);
/**
* Gets whether the fox is faceplanting the ground
*
* @return Whether the fox is faceplanting the ground
*/
boolean isFaceplanted();
/**
* Represents the various different fox types there are.
*/
public enum Type {
// Paper start - Generated/FoxType
// @GeneratedFrom 1.21.1
RED,
SNOW;
// Paper end - Generated/FoxType
}
// Paper start - Add more fox behavior API
/**
* Sets if the fox is interested.
*
* @param interested is interested
*/
public void setInterested(boolean interested);
/**
* Gets if the fox is interested.
*
* @return fox is interested
*/
public boolean isInterested();
/**
* Sets if the fox is leaping.
*
* @param leaping is leaping
*/
public void setLeaping(boolean leaping);
/**
* Gets if the fox is leaping.
*
* @return fox is leaping
*/
public boolean isLeaping();
/**
* Sets if the fox is defending.
*
* @param defending is defending
*/
public void setDefending(boolean defending);
/**
* Gets if the fox is defending.
*
* @return fox is defending
*/
public boolean isDefending();
/**
* Sets if the fox face planted.
*
* @param faceplanted face planted
*/
public void setFaceplanted(boolean faceplanted);
// Paper end - Add more fox behavior API
}

View file

@ -0,0 +1,94 @@
package org.bukkit.entity;
import com.google.common.base.Preconditions;
import com.google.common.collect.Lists;
import java.util.Locale;
import org.bukkit.Keyed;
import org.bukkit.NamespacedKey;
import org.bukkit.Registry;
import org.bukkit.util.OldEnum;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
* A Frog.
*/
public interface Frog extends Animals {
/**
* Gets the tongue target of this frog.
*
* @return tongue target or null if not set
*/
@Nullable
Entity getTongueTarget();
/**
* Sets the tongue target of this frog.
*
* @param target tongue target or null to clear
*/
void setTongueTarget(@Nullable Entity target);
/**
* Get the variant of this frog.
*
* @return frog variant
*/
@NotNull
Variant getVariant();
/**
* Set the variant of this frog.
*
* @param variant frog variant
*/
void setVariant(@NotNull Variant variant);
/**
* Represents the variant of a frog - ie its color.
*/
interface Variant extends OldEnum<Variant>, Keyed {
// Paper start - Generated/FrogVariant
// @GeneratedFrom 1.21.1
Variant COLD = getVariant("cold");
Variant TEMPERATE = getVariant("temperate");
Variant WARM = getVariant("warm");
// Paper end - Generated/FrogVariant
@NotNull
private static Variant getVariant(@NotNull String key) {
NamespacedKey namespacedKey = NamespacedKey.minecraft(key);
Variant variant = Registry.FROG_VARIANT.get(namespacedKey);
Preconditions.checkNotNull(variant, "No frog variant found for %s. This is a bug.", namespacedKey);
return variant;
}
/**
* @param name of the frog variant.
* @return the frog variant with the given name.
* @deprecated only for backwards compatibility, use {@link Registry#get(NamespacedKey)} instead.
*/
@NotNull
@Deprecated(since = "1.21", forRemoval = true) @org.jetbrains.annotations.ApiStatus.ScheduledForRemoval(inVersion = "1.22") // Paper - will be removed via asm-utils
static Variant valueOf(@NotNull String name) {
Variant variant = Registry.FROG_VARIANT.get(NamespacedKey.fromString(name.toLowerCase(Locale.ROOT)));
Preconditions.checkArgument(variant != null, "No frog variant found with the name %s", name);
return variant;
}
/**
* @return an array of all known frog variants.
* @deprecated use {@link Registry#iterator()}.
*/
@NotNull
@Deprecated(since = "1.21", forRemoval = true) @org.jetbrains.annotations.ApiStatus.ScheduledForRemoval(inVersion = "1.22") // Paper - will be removed via asm-utils
static Variant[] values() {
return Lists.newArrayList(Registry.FROG_VARIANT).toArray(new Variant[0]);
}
}
}

View file

@ -0,0 +1,231 @@
package org.bukkit.entity;
import org.jetbrains.annotations.NotNull;
/**
* Panda entity.
*/
public interface Panda extends Animals, Sittable {
/**
* Gets this Panda's main gene.
*
* @return main gene
*/
@NotNull
Gene getMainGene();
/**
* Sets this Panda's main gene.
*
* @param gene main gene
*/
void setMainGene(@NotNull Gene gene);
/**
* Gets this Panda's hidden gene.
*
* @return hidden gene
*/
@NotNull
Gene getHiddenGene();
/**
* Sets this Panda's hidden gene.
*
* @param gene hidden gene
*/
void setHiddenGene(@NotNull Gene gene);
/**
* Gets whether the Panda is rolling
*
* @return Whether the Panda is rolling
*/
boolean isRolling();
/**
* Sets whether the Panda is rolling
*
* @param flag Whether the Panda is rolling
*/
void setRolling(boolean flag);
/**
* Gets whether the Panda is sneezing
*
* @return Whether the Panda is sneezing
*/
boolean isSneezing();
/**
* Sets whether the Panda is sneezing
*
* @param flag Whether the Panda is sneezing
*/
void setSneezing(boolean flag);
/**
* Gets whether the Panda is on its back
*
* @return Whether the Panda is on its back
*/
boolean isOnBack();
/**
* Sets whether the Panda is on its back
*
* @param flag Whether the Panda is on its back
*/
void setOnBack(boolean flag);
/**
* Gets whether the Panda is eating
*
* @return Whether the Panda is eating
*/
boolean isEating();
/**
* Sets the Panda's eating status. The panda must be holding food for this to work
*
* @param flag Whether the Panda is eating
*/
void setEating(boolean flag);
/**
* Gets whether the Panda is scared
*
* @return Whether the Panda is scared
*/
boolean isScared();
/**
* Gets how many ticks the panda will be unhappy for
*
* @return The number of ticks the panda will be unhappy for
*/
int getUnhappyTicks();
// Paper start - Panda API
/**
* Sets the sneeze progress in this animation.
* This value counts up only if {@link Panda#isSneezing()} is true
*
* @param ticks sneeze progress
*/
void setSneezeTicks(int ticks);
/**
* Gets the current sneeze progress, or how many ticks this panda will sneeze for.
*
* @return sneeze progress
*/
int getSneezeTicks();
/**
* Sets the eating ticks for this panda.
* <p>
*
* This starts counting up as long as it is greater than 0.
*
* @param ticks eating ticks
*/
void setEatingTicks(int ticks);
/**
* Gets the current eating progress, or how many ticks this panda has been eating for.
*
* @return eating progress
*/
int getEatingTicks();
/**
* Sets the number of ticks this panda will be unhappy for.
* <p>
* This value counts down.
*
* @param ticks unhappy ticks
*/
void setUnhappyTicks(int ticks);
/**
* Sets if this panda is currently on its back.
*
* @param onBack is on its back
* @deprecated use {@link #setOnBack(boolean)}
*/
@Deprecated(forRemoval = true, since = "1.19")
default void setIsOnBack(boolean onBack) {
this.setOnBack(onBack);
}
/**
* Sets if this panda is currently sitting.
*
* @param sitting is currently sitting
* @deprecated use {@link #setSitting(boolean)}
*/
@Deprecated(forRemoval = true, since = "1.19")
default void setIsSitting(boolean sitting) {
this.setSitting(sitting);
}
/**
* Sets if this panda is currently sitting.
*
* @param sitting is currently sitting
*/
@Override
void setSitting(boolean sitting);
/**
* Gets if this panda is sitting.
*
* @return is sitting
*/
@Override
boolean isSitting();
/**
* Gets this Panda's combined gene.
* <p>
* The combined gene can be modified using
* {@link #setMainGene(Gene)} or {@link #setHiddenGene(Gene)}.
*
* @return combined gene
*/
@NotNull
Gene getCombinedGene();
// Paper end - Panda API
public enum Gene {
// Paper start - Generated/PandaGene
// @GeneratedFrom 1.21.1
NORMAL(false),
LAZY(false),
WORRIED(false),
PLAYFUL(false),
BROWN(true),
WEAK(true),
AGGRESSIVE(false);
// Paper end - Generated/PandaGene
private final boolean recessive;
private Gene(boolean recessive) {
this.recessive = recessive;
}
/**
* Gets whether this gene is recessive, i.e. required in both parents to
* propagate to children.
*
* @return recessive status
*/
public boolean isRecessive() {
return recessive;
}
}
}

View file

@ -0,0 +1,88 @@
package org.bukkit.entity;
import java.util.Collection;
import org.bukkit.Location;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
* Represents a Sniffer.
*/
public interface Sniffer extends Animals {
/**
* Gets the locations explored by the sniffer.
*
* @return a collection of locations
*/
@NotNull
public Collection<Location> getExploredLocations();
/**
* Remove a location of the explored locations.
*
* @param location the location to remove
* @see #getExploredLocations()
*/
public void removeExploredLocation(@NotNull Location location);
/**
* Add a location to the explored locations.
* <br>
* <b>Note:</b> the location must be in the sniffer's current world for this
* method to have any effect.
*
* @param location the location to add
* @see #getExploredLocations()
*/
public void addExploredLocation(@NotNull Location location);
/**
* Get the current state of the sniffer.
*
* @return the state of the sniffer
*/
@NotNull
public Sniffer.State getState();
/**
* Set a new state for the sniffer.
* <br>
* This will also make the sniffer make the transition to the new state.
*
* @param state the new state
*/
public void setState(@NotNull Sniffer.State state);
/**
* Try to get a possible location where the sniffer can dig.
*
* @return a {@link Location} if found or null
*/
@Nullable
public Location findPossibleDigLocation();
/**
* Gets whether the sniffer can dig in the current {@link Location} below
* its head.
*
* @return {@code true} if can dig or {@code false} otherwise
*/
public boolean canDig();
/**
* Represents the current state of the Sniffer.
*/
public enum State {
// Paper start - Generated/SnifferState
// @GeneratedFrom 1.21.1
IDLING,
FEELING_HAPPY,
SCENTING,
SNIFFING,
SEARCHING,
DIGGING,
RISING;
// Paper end - Generated/SnifferState
}
}

View file

@ -0,0 +1,79 @@
package org.bukkit.entity;
import org.bukkit.DyeColor;
import org.jetbrains.annotations.NotNull;
/**
* Tropical fish.
*/
public interface TropicalFish extends io.papermc.paper.entity.SchoolableFish { // Paper - Schooling Fish API
/**
* Gets the color of the fish's pattern.
*
* @return pattern color
*/
@NotNull
DyeColor getPatternColor();
/**
* Sets the color of the fish's pattern
*
* @param color pattern color
*/
void setPatternColor(@NotNull DyeColor color);
/**
* Gets the color of the fish's body.
*
* @return pattern color
*/
@NotNull
DyeColor getBodyColor();
/**
* Sets the color of the fish's body
*
* @param color body color
*/
void setBodyColor(@NotNull DyeColor color);
/**
* Gets the fish's pattern.
*
* @return pattern
*/
@NotNull
Pattern getPattern();
/**
* Sets the fish's pattern
*
* @param pattern new pattern
*/
void setPattern(@NotNull Pattern pattern);
/**
* Enumeration of all different fish patterns. Refer to the
* <a href="https://minecraft.wiki/w/Fish">Minecraft Wiki</a>
* for pictures.
*/
public static enum Pattern {
// Paper start - Generated/TropicalFishPattern
// @GeneratedFrom 1.21.1
KOB,
SUNSTREAK,
SNOOPER,
DASHER,
BRINELY,
SPOTTY,
FLOPPER,
STRIPEY,
GLITTER,
BLOCKFISH,
BETTY,
CLAYFISH;
// Paper end - Generated/TropicalFishPattern
}
}

View file

@ -0,0 +1,404 @@
package org.bukkit.entity;
import com.google.common.base.Preconditions;
import com.google.common.collect.Lists;
import java.util.Locale;
import java.util.Map; // Paper
import java.util.UUID; // Paper
import org.bukkit.Keyed;
import org.bukkit.Location;
import org.bukkit.NamespacedKey;
import org.bukkit.Registry;
import org.bukkit.util.OldEnum;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
* Represents a villager NPC
*/
public interface Villager extends AbstractVillager {
/**
* Gets the current profession of this villager.
*
* @return Current profession.
*/
@NotNull
public Profession getProfession();
/**
* Sets the new profession of this villager.
*
* @param profession New profession.
*/
public void setProfession(@NotNull Profession profession);
/**
* Gets the current type of this villager.
*
* @return Current type.
*/
@NotNull
public Type getVillagerType();
/**
* Sets the new type of this villager.
*
* @param type New type.
*/
public void setVillagerType(@NotNull Type type);
/**
* Gets the level of this villager.
*
* A villager with a level of 1 and no experience is liable to lose its
* profession.
*
* @return this villager's level
*/
public int getVillagerLevel();
/**
* Sets the level of this villager.
*
* A villager with a level of 1 and no experience is liable to lose its
* profession.
*
* This doesn't update the trades of this villager.
*
* @param level the new level
* @throws IllegalArgumentException if level not between [1, 5]
* @see #increaseLevel(int)
*/
public void setVillagerLevel(int level);
/**
* Gets the trading experience of this villager.
*
* @return trading experience
*/
public int getVillagerExperience();
/**
* Sets the trading experience of this villager.
*
* @param experience new experience
* @throws IllegalArgumentException if experience &lt; 0
*/
public void setVillagerExperience(int experience);
// Paper start
/**
* Increases the level of this villager.
* The villager will also unlock new recipes unlike the raw
* method {@link #setVillagerLevel(int)}.
* <p>
* A villager with a level of 1 and no experience is liable to lose its
* profession.
* <p>
* A master villager has a level of 5 in its profession and
* will unlock 10 trades (2 per level).
*
* @param amount The amount of level
* @return Whether trades are unlocked
* @throws IllegalArgumentException if current level plus the amount
* isn't between [1, 5] or the amount isn't positive
* @see #setVillagerLevel(int)
*/
boolean increaseLevel(int amount);
/**
* Gives to this villager some potential new trades
* based to its profession and level.
* @param amount The amount of trades to give
* @return Whether trades are added
* @throws IllegalArgumentException if the amount isn't positive
*/
boolean addTrades(int amount);
/**
* Gets the amount of times a villager has restocked their trades today
* @return The amount of trade restocks.
*/
public int getRestocksToday();
/**
* Sets the amount of times a villager has restocked their trades today
* @param restocksToday new restock count
*/
public void setRestocksToday(int restocksToday);
// Paper end
/**
* Attempts to make this villager sleep at the given location.
* <br>
* The location must be in the current world and have a bed placed at the
* location. The villager will put its head on the specified block while
* sleeping.
*
* @param location the location of the bed
* @return whether the sleep was successful
*/
public boolean sleep(@NotNull Location location);
/**
* Causes this villager to wake up if he's currently sleeping.
*
* @throws IllegalStateException if not sleeping
*/
public void wakeup();
/**
* Causes this villager to shake his head.
*/
public void shakeHead();
/**
* Convert this Villager into a ZombieVillager as if it was killed by a
* Zombie.
*
* <b>Note:</b> this will fire a EntityTransformEvent
*
* @return the converted entity {@link ZombieVillager} or null if the
* conversion its cancelled
*/
@Nullable
public ZombieVillager zombify();
/**
* Represents Villager type, usually corresponding to what biome they spawn
* in.
*/
interface Type extends OldEnum<Type>, Keyed {
// Paper start - Generated/VillagerType
// @GeneratedFrom 1.21.1
Type DESERT = getType("desert");
Type JUNGLE = getType("jungle");
Type PLAINS = getType("plains");
Type SAVANNA = getType("savanna");
Type SNOW = getType("snow");
Type SWAMP = getType("swamp");
Type TAIGA = getType("taiga");
// Paper end - Generated/VillagerType
@NotNull
private static Type getType(@NotNull String key) {
NamespacedKey namespacedKey = NamespacedKey.minecraft(key);
Type type = Registry.VILLAGER_TYPE.get(namespacedKey);
Preconditions.checkNotNull(type, "No villager type found for %s. This is a bug.", namespacedKey);
return type;
}
/**
* @param name of the villager type.
* @return the villager type with the given name.
* @deprecated only for backwards compatibility, use {@link Registry#get(NamespacedKey)} instead.
*/
@NotNull
@Deprecated(since = "1.21", forRemoval = true) @org.jetbrains.annotations.ApiStatus.ScheduledForRemoval(inVersion = "1.22") // Paper - will be removed via asm-utils
static Type valueOf(@NotNull String name) {
Type type = Registry.VILLAGER_TYPE.get(NamespacedKey.fromString(name.toLowerCase(Locale.ROOT)));
Preconditions.checkArgument(type != null, "No villager type found with the name %s", name);
return type;
}
/**
* @return an array of all known villager types.
* @deprecated use {@link Registry#iterator()}.
*/
@NotNull
@Deprecated(since = "1.21", forRemoval = true) @org.jetbrains.annotations.ApiStatus.ScheduledForRemoval(inVersion = "1.22") // Paper - will be removed via asm-utils
static Type[] values() {
return Lists.newArrayList(Registry.VILLAGER_TYPE).toArray(new Type[0]);
}
}
/**
* Represents the various different Villager professions there may be.
* Villagers have different trading options depending on their profession,
*/
interface Profession extends OldEnum<Profession>, Keyed, net.kyori.adventure.translation.Translatable {
// Paper start - Generated/VillagerProfession
// @GeneratedFrom 1.21.1
/**
* Armorer profession. Wears a black apron. Armorers primarily trade for
* iron armor, chainmail armor, and sometimes diamond armor.
*/
Profession ARMORER = getProfession("armorer");
/**
* Butcher profession. Wears a white apron. Butchers primarily trade for
* raw and cooked food.
*/
Profession BUTCHER = getProfession("butcher");
/**
* Cartographer profession. Wears a white robe. Cartographers primarily
* trade for explorer maps and some paper.
*/
Profession CARTOGRAPHER = getProfession("cartographer");
/**
* Cleric profession. Wears a purple robe. Clerics primarily trade for
* rotten flesh, gold ingot, redstone, lapis, ender pearl, glowstone,
* and bottle o' enchanting.
*/
Profession CLERIC = getProfession("cleric");
/**
* Farmer profession. Wears a brown robe. Farmers primarily trade for
* food-related items.
*/
Profession FARMER = getProfession("farmer");
/**
* Fisherman profession. Wears a brown robe. Fisherman primarily trade
* for fish, as well as possibly selling string and/or coal.
*/
Profession FISHERMAN = getProfession("fisherman");
/**
* Fletcher profession. Wears a brown robe. Fletchers primarily trade
* for string, bows, and arrows.
*/
Profession FLETCHER = getProfession("fletcher");
/**
* Leatherworker profession. Wears a white apron. Leatherworkers
* primarily trade for leather, and leather armor, as well as saddles.
*/
Profession LEATHERWORKER = getProfession("leatherworker");
/**
* Librarian profession. Wears a white robe. Librarians primarily trade
* for paper, books, and enchanted books.
*/
Profession LIBRARIAN = getProfession("librarian");
/**
* Mason profession.
*/
Profession MASON = getProfession("mason");
/**
* Nitwit profession. Wears a green apron, cannot trade. Nitwit
* villagers do not do anything. They do not have any trades by default.
*/
Profession NITWIT = getProfession("nitwit");
Profession NONE = getProfession("none");
/**
* Shepherd profession. Wears a brown robe. Shepherds primarily trade for
* wool items, and shears.
*/
Profession SHEPHERD = getProfession("shepherd");
/**
* Toolsmith profession. Wears a black apron. Tool smiths primarily
* trade for iron and diamond tools.
*/
Profession TOOLSMITH = getProfession("toolsmith");
/**
* Weaponsmith profession. Wears a black apron. Weapon smiths primarily
* trade for iron and diamond weapons, sometimes enchanted.
*/
Profession WEAPONSMITH = getProfession("weaponsmith");
// Paper end - Generated/VillagerProfession
@NotNull
private static Profession getProfession(@NotNull String key) {
NamespacedKey namespacedKey = NamespacedKey.minecraft(key);
Profession profession = Registry.VILLAGER_PROFESSION.get(namespacedKey);
Preconditions.checkNotNull(profession, "No villager profession found for %s. This is a bug.", namespacedKey);
return profession;
}
/**
* @param name of the villager profession.
* @return the villager profession with the given name.
* @deprecated only for backwards compatibility, use {@link Registry#get(NamespacedKey)} instead.
*/
@NotNull
@Deprecated(since = "1.21", forRemoval = true) @org.jetbrains.annotations.ApiStatus.ScheduledForRemoval(inVersion = "1.22") // Paper - will be removed via asm-utils
static Profession valueOf(@NotNull String name) {
Profession profession = Registry.VILLAGER_PROFESSION.get(NamespacedKey.fromString(name.toLowerCase(Locale.ROOT)));
Preconditions.checkArgument(profession != null, "No villager profession found with the name %s", name);
return profession;
}
/**
* @return an array of all known villager professions.
* @deprecated use {@link Registry#iterator()}.
*/
@NotNull
@Deprecated(since = "1.21", forRemoval = true) @org.jetbrains.annotations.ApiStatus.ScheduledForRemoval(inVersion = "1.22") // Paper - will be removed via asm-utils
static Profession[] values() {
return Lists.newArrayList(Registry.VILLAGER_PROFESSION).toArray(new Profession[0]);
}
// Paper start
@Override
default @NotNull String translationKey() {
return "entity.minecraft.villager." + this.getKey().getKey();
}
// Paper end
}
// Paper start - Add villager reputation API
/**
* Get the {@link com.destroystokyo.paper.entity.villager.Reputation reputation}
* for a specific player by {@link UUID}.
*
* @param uniqueId The {@link UUID} of the player to get the reputation of.
* @return The player's copied reputation with this villager.
*/
@NotNull
public com.destroystokyo.paper.entity.villager.Reputation getReputation(@NotNull UUID uniqueId);
/**
* Get all {@link com.destroystokyo.paper.entity.villager.Reputation reputations}
* for all players mapped by their {@link UUID unique IDs}.
*
* @return All {@link com.destroystokyo.paper.entity.villager.Reputation reputations} for all players
* in a copied map.
*/
@NotNull
public Map<UUID, com.destroystokyo.paper.entity.villager.Reputation> getReputations();
/**
* Set the {@link com.destroystokyo.paper.entity.villager.Reputation reputation}
* for a specific player by {@link UUID}.
*
* @param uniqueId The {@link UUID} of the player to set the reputation of.
* @param reputation The {@link com.destroystokyo.paper.entity.villager.Reputation reputation} to set.
*/
public void setReputation(@NotNull UUID uniqueId, @NotNull com.destroystokyo.paper.entity.villager.Reputation reputation);
/**
* Set all {@link com.destroystokyo.paper.entity.villager.Reputation reputations}
* for all players mapped by their {@link UUID unique IDs}.
*
* @param reputations All {@link com.destroystokyo.paper.entity.villager.Reputation reputations}
* for all players mapped by their {@link UUID unique IDs}.
*/
public void setReputations(@NotNull Map<UUID, com.destroystokyo.paper.entity.villager.Reputation> reputations);
/**
* Clear all reputations from this villager. This removes every single
* reputation regardless of its impact and the player associated.
*/
public void clearReputations();
// Paper end
}

View file

@ -0,0 +1,126 @@
package org.bukkit.entity;
import com.google.common.base.Preconditions;
import org.bukkit.DyeColor;
import org.bukkit.Keyed;
import org.bukkit.NamespacedKey;
import org.bukkit.Registry;
import org.jetbrains.annotations.NotNull;
/**
* Represents a Wolf
*/
public interface Wolf extends Tameable, Sittable, io.papermc.paper.entity.CollarColorable { // Paper - CollarColorable
/**
* Checks if this wolf is angry
*
* @return Anger true if angry
*/
public boolean isAngry();
/**
* Sets the anger of this wolf.
* <p>
* An angry wolf can not be fed or tamed.
*
* @param angry true if angry
* @see #setTarget(org.bukkit.entity.LivingEntity)
*/
public void setAngry(boolean angry);
/**
* Get the collar color of this wolf
*
* @return the color of the collar
*/
@NotNull
@Override // Paper
public DyeColor getCollarColor();
/**
* Set the collar color of this wolf
*
* @param color the color to apply
*/
@Override // Paper
public void setCollarColor(@NotNull DyeColor color);
/**
* Gets whether the wolf is wet
*
* @return Whether the wolf is wet
*/
public boolean isWet();
/**
* Gets the wolf's tail angle in radians
*
* @return The angle of the wolf's tail in radians
*/
public float getTailAngle();
/**
* Gets if the wolf is interested
*
* @return Whether the wolf is interested
*/
public boolean isInterested();
/**
* Set wolf to be interested
*
* @param interested Whether the wolf is interested
*/
public void setInterested(boolean interested);
/**
* Get the variant of this wolf.
*
* @return wolf variant
*/
@NotNull
Variant getVariant();
/**
* Set the variant of this wolf.
*
* @param variant wolf variant
*/
void setVariant(@NotNull Variant variant);
/**
* Represents the variant of a wolf.
*/
interface Variant extends Keyed {
// Paper start - Generated/WolfVariant
// @GeneratedFrom 1.21.1
Variant ASHEN = getVariant("ashen");
Variant BLACK = getVariant("black");
Variant CHESTNUT = getVariant("chestnut");
Variant PALE = getVariant("pale");
Variant RUSTY = getVariant("rusty");
Variant SNOWY = getVariant("snowy");
Variant SPOTTED = getVariant("spotted");
Variant STRIPED = getVariant("striped");
Variant WOODS = getVariant("woods");
// Paper end - Generated/WolfVariant
@NotNull
private static Variant getVariant(@NotNull String key) {
NamespacedKey namespacedKey = NamespacedKey.minecraft(key);
Variant variant = Registry.WOLF_VARIANT.get(namespacedKey);
Preconditions.checkNotNull(variant, "No Wolf Variant found for %s. This is a bug.", namespacedKey);
return variant;
}
}
}

View file

@ -0,0 +1,161 @@
package org.bukkit.entity.memory;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import org.bukkit.Keyed;
import org.bukkit.Location;
import org.bukkit.NamespacedKey;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
* Represents a key used for accessing memory values of a
* {@link org.bukkit.entity.LivingEntity}.
*
* @param <T> the class type of the memory value
*/
public final class MemoryKey<T> implements Keyed {
private final NamespacedKey namespacedKey;
private final Class<T> tClass;
private MemoryKey(NamespacedKey namespacedKey, Class<T> tClass) {
this.namespacedKey = namespacedKey;
this.tClass = tClass;
MEMORY_KEYS.put(namespacedKey, this);
}
@NotNull
@Override
public NamespacedKey getKey() {
return namespacedKey;
}
/**
* Gets the class of values associated with this memory.
*
* @return the class of value objects
*/
@NotNull
public Class<T> getMemoryClass() {
return tClass;
}
private static final Map<NamespacedKey, MemoryKey<?>> MEMORY_KEYS = new HashMap<>();
//
// Paper start - Generated/MemoryKey
// @GeneratedFrom 1.21.1
public static final MemoryKey<Boolean> ADMIRING_DISABLED = new MemoryKey<>(NamespacedKey.minecraft("admiring_disabled"), Boolean.class);
public static final MemoryKey<Boolean> ADMIRING_ITEM = new MemoryKey<>(NamespacedKey.minecraft("admiring_item"), Boolean.class);
public static final MemoryKey<UUID> ANGRY_AT = new MemoryKey<>(NamespacedKey.minecraft("angry_at"), UUID.class);
public static final MemoryKey<Boolean> ATE_RECENTLY = new MemoryKey<>(NamespacedKey.minecraft("ate_recently"), Boolean.class);
public static final MemoryKey<Boolean> ATTACK_COOLING_DOWN = new MemoryKey<>(NamespacedKey.minecraft("attack_cooling_down"), Boolean.class);
public static final MemoryKey<Long> CANT_REACH_WALK_TARGET_SINCE = new MemoryKey<>(NamespacedKey.minecraft("cant_reach_walk_target_since"), Long.class);
public static final MemoryKey<Boolean> DANCING = new MemoryKey<>(NamespacedKey.minecraft("dancing"), Boolean.class);
public static final MemoryKey<Boolean> DANGER_DETECTED_RECENTLY = new MemoryKey<>(NamespacedKey.minecraft("danger_detected_recently"), Boolean.class);
public static final MemoryKey<Boolean> DISABLE_WALK_TO_ADMIRE_ITEM = new MemoryKey<>(NamespacedKey.minecraft("disable_walk_to_admire_item"), Boolean.class);
public static final MemoryKey<Integer> GAZE_COOLDOWN_TICKS = new MemoryKey<>(NamespacedKey.minecraft("gaze_cooldown_ticks"), Integer.class);
public static final MemoryKey<Boolean> GOLEM_DETECTED_RECENTLY = new MemoryKey<>(NamespacedKey.minecraft("golem_detected_recently"), Boolean.class);
public static final MemoryKey<Boolean> HAS_HUNTING_COOLDOWN = new MemoryKey<>(NamespacedKey.minecraft("has_hunting_cooldown"), Boolean.class);
public static final MemoryKey<Long> HEARD_BELL_TIME = new MemoryKey<>(NamespacedKey.minecraft("heard_bell_time"), Long.class);
public static final MemoryKey<Location> HIDING_PLACE = new MemoryKey<>(NamespacedKey.minecraft("hiding_place"), Location.class);
public static final MemoryKey<Location> HOME = new MemoryKey<>(NamespacedKey.minecraft("home"), Location.class);
public static final MemoryKey<Boolean> HUNTED_RECENTLY = new MemoryKey<>(NamespacedKey.minecraft("hunted_recently"), Boolean.class);
public static final MemoryKey<Boolean> IS_PANICKING = new MemoryKey<>(NamespacedKey.minecraft("is_panicking"), Boolean.class);
public static final MemoryKey<Boolean> IS_TEMPTED = new MemoryKey<>(NamespacedKey.minecraft("is_tempted"), Boolean.class);
public static final MemoryKey<Integer> ITEM_PICKUP_COOLDOWN_TICKS = new MemoryKey<>(NamespacedKey.minecraft("item_pickup_cooldown_ticks"), Integer.class);
public static final MemoryKey<Location> JOB_SITE = new MemoryKey<>(NamespacedKey.minecraft("job_site"), Location.class);
public static final MemoryKey<Long> LAST_SLEPT = new MemoryKey<>(NamespacedKey.minecraft("last_slept"), Long.class);
public static final MemoryKey<Long> LAST_WOKEN = new MemoryKey<>(NamespacedKey.minecraft("last_woken"), Long.class);
public static final MemoryKey<Long> LAST_WORKED_AT_POI = new MemoryKey<>(NamespacedKey.minecraft("last_worked_at_poi"), Long.class);
public static final MemoryKey<Location> LIKED_NOTEBLOCK_POSITION = new MemoryKey<>(NamespacedKey.minecraft("liked_noteblock"), Location.class);
public static final MemoryKey<Integer> LIKED_NOTEBLOCK_COOLDOWN_TICKS = new MemoryKey<>(NamespacedKey.minecraft("liked_noteblock_cooldown_ticks"), Integer.class);
public static final MemoryKey<UUID> LIKED_PLAYER = new MemoryKey<>(NamespacedKey.minecraft("liked_player"), UUID.class);
public static final MemoryKey<Integer> LONG_JUMP_COOLING_DOWN = new MemoryKey<>(NamespacedKey.minecraft("long_jump_cooling_down"), Integer.class);
public static final MemoryKey<Boolean> LONG_JUMP_MID_JUMP = new MemoryKey<>(NamespacedKey.minecraft("long_jump_mid_jump"), Boolean.class);
public static final MemoryKey<Location> MEETING_POINT = new MemoryKey<>(NamespacedKey.minecraft("meeting_point"), Location.class);
public static final MemoryKey<Boolean> PACIFIED = new MemoryKey<>(NamespacedKey.minecraft("pacified"), Boolean.class);
public static final MemoryKey<Integer> PLAY_DEAD_TICKS = new MemoryKey<>(NamespacedKey.minecraft("play_dead_ticks"), Integer.class);
public static final MemoryKey<Location> POTENTIAL_JOB_SITE = new MemoryKey<>(NamespacedKey.minecraft("potential_job_site"), Location.class);
public static final MemoryKey<Integer> RAM_COOLDOWN_TICKS = new MemoryKey<>(NamespacedKey.minecraft("ram_cooldown_ticks"), Integer.class);
public static final MemoryKey<Boolean> SNIFFER_DIGGING = new MemoryKey<>(NamespacedKey.minecraft("sniffer_digging"), Boolean.class);
public static final MemoryKey<Boolean> SNIFFER_HAPPY = new MemoryKey<>(NamespacedKey.minecraft("sniffer_happy"), Boolean.class);
public static final MemoryKey<Integer> TEMPTATION_COOLDOWN_TICKS = new MemoryKey<>(NamespacedKey.minecraft("temptation_cooldown_ticks"), Integer.class);
public static final MemoryKey<Integer> TIME_TRYING_TO_REACH_ADMIRE_ITEM = new MemoryKey<>(NamespacedKey.minecraft("time_trying_to_reach_admire_item"), Integer.class);
public static final MemoryKey<Boolean> UNIVERSAL_ANGER = new MemoryKey<>(NamespacedKey.minecraft("universal_anger"), Boolean.class);
public static final MemoryKey<Integer> VISIBLE_ADULT_HOGLIN_COUNT = new MemoryKey<>(NamespacedKey.minecraft("visible_adult_hoglin_count"), Integer.class);
public static final MemoryKey<Integer> VISIBLE_ADULT_PIGLIN_COUNT = new MemoryKey<>(NamespacedKey.minecraft("visible_adult_piglin_count"), Integer.class);
// Paper end - Generated/MemoryKey
/**
* @deprecated this constant uses the wrong generic type, the sniffer now stores different positions
* from possibly different worlds. Use the relevant methods in {@link org.bukkit.entity.Sniffer} directly
* for now.
*/
@Deprecated // Paper
public static final MemoryKey<Location> SNIFFER_EXPLORED_POSITIONS = new MemoryKey<>(NamespacedKey.minecraft("sniffer_explored_positions"), Location.class);
/**
* Returns a {@link MemoryKey} by a {@link NamespacedKey}.
*
* @param namespacedKey the {@link NamespacedKey} referencing a
* {@link MemoryKey}
* @return the {@link MemoryKey} or null when no {@link MemoryKey} is
* available under that key
*/
@Nullable
public static MemoryKey<?> getByKey(@NotNull NamespacedKey namespacedKey) {
return MEMORY_KEYS.get(namespacedKey);
}
/**
* Returns the set of all MemoryKeys.
*
* @return the memoryKeys
*/
@NotNull
public static Set<MemoryKey<?>> values() {
return new HashSet<>(MEMORY_KEYS.values());
}
}

View file

@ -0,0 +1,108 @@
package org.bukkit.generator.structure;
import org.bukkit.Keyed;
import org.bukkit.NamespacedKey;
import org.bukkit.Registry;
import org.jetbrains.annotations.NotNull;
/**
* Represent a Structure from the world.
*
* Listed structures are present in the default server. Depending on the server
* there might be additional structures present (for example structures added by
* data packs), which can be received via {@link Registry#STRUCTURE}.
*/
public abstract class Structure implements Keyed {
// Paper start - Generated/Structure
// @GeneratedFrom 1.21.1
public static final Structure ANCIENT_CITY = getStructure("ancient_city");
public static final Structure BASTION_REMNANT = getStructure("bastion_remnant");
public static final Structure BURIED_TREASURE = getStructure("buried_treasure");
public static final Structure DESERT_PYRAMID = getStructure("desert_pyramid");
public static final Structure END_CITY = getStructure("end_city");
public static final Structure FORTRESS = getStructure("fortress");
public static final Structure IGLOO = getStructure("igloo");
public static final Structure JUNGLE_PYRAMID = getStructure("jungle_pyramid");
public static final Structure MANSION = getStructure("mansion");
public static final Structure MINESHAFT = getStructure("mineshaft");
public static final Structure MINESHAFT_MESA = getStructure("mineshaft_mesa");
public static final Structure MONUMENT = getStructure("monument");
public static final Structure NETHER_FOSSIL = getStructure("nether_fossil");
public static final Structure OCEAN_RUIN_COLD = getStructure("ocean_ruin_cold");
public static final Structure OCEAN_RUIN_WARM = getStructure("ocean_ruin_warm");
public static final Structure PILLAGER_OUTPOST = getStructure("pillager_outpost");
public static final Structure RUINED_PORTAL = getStructure("ruined_portal");
public static final Structure RUINED_PORTAL_DESERT = getStructure("ruined_portal_desert");
public static final Structure RUINED_PORTAL_JUNGLE = getStructure("ruined_portal_jungle");
public static final Structure RUINED_PORTAL_MOUNTAIN = getStructure("ruined_portal_mountain");
public static final Structure RUINED_PORTAL_NETHER = getStructure("ruined_portal_nether");
public static final Structure RUINED_PORTAL_OCEAN = getStructure("ruined_portal_ocean");
public static final Structure RUINED_PORTAL_SWAMP = getStructure("ruined_portal_swamp");
public static final Structure SHIPWRECK = getStructure("shipwreck");
public static final Structure SHIPWRECK_BEACHED = getStructure("shipwreck_beached");
public static final Structure STRONGHOLD = getStructure("stronghold");
public static final Structure SWAMP_HUT = getStructure("swamp_hut");
public static final Structure TRAIL_RUINS = getStructure("trail_ruins");
public static final Structure TRIAL_CHAMBERS = getStructure("trial_chambers");
public static final Structure VILLAGE_DESERT = getStructure("village_desert");
public static final Structure VILLAGE_PLAINS = getStructure("village_plains");
public static final Structure VILLAGE_SAVANNA = getStructure("village_savanna");
public static final Structure VILLAGE_SNOWY = getStructure("village_snowy");
public static final Structure VILLAGE_TAIGA = getStructure("village_taiga");
// Paper end - Generated/Structure
private static Structure getStructure(String name) {
return Registry.STRUCTURE.get(NamespacedKey.minecraft(name));
}
/**
* Returns the type of the structure.
*
* @return the type of structure
*/
@NotNull
public abstract StructureType getStructureType();
// Paper start - deprecate getKey
/**
* @deprecated use {@link Registry#getKey(Keyed)} and {@link Registry#STRUCTURE}. Structures
* can exist without a key.
*/
@Override
@Deprecated(since = "1.20.4")
public abstract @NotNull NamespacedKey getKey();
// Paper end - deprecate getKey
}

View file

@ -0,0 +1,55 @@
package org.bukkit.generator.structure;
import org.bukkit.Keyed;
import org.bukkit.NamespacedKey;
import org.bukkit.Registry;
/**
* Represent a StructureType of a {@link Structure}.
*
* Listed structure types are present in the default server. Depending on the
* server there might be additional structure types present (for example
* structure types added by data packs), which can be received via
* {@link Registry#STRUCTURE_TYPE}.
*/
public abstract class StructureType implements Keyed {
// Paper start - Generated/StructureType
// @GeneratedFrom 1.21.1
public static final StructureType BURIED_TREASURE = getStructureType("buried_treasure");
public static final StructureType DESERT_PYRAMID = getStructureType("desert_pyramid");
public static final StructureType END_CITY = getStructureType("end_city");
public static final StructureType FORTRESS = getStructureType("fortress");
public static final StructureType IGLOO = getStructureType("igloo");
public static final StructureType JIGSAW = getStructureType("jigsaw");
public static final StructureType JUNGLE_TEMPLE = getStructureType("jungle_temple");
public static final StructureType MINESHAFT = getStructureType("mineshaft");
public static final StructureType NETHER_FOSSIL = getStructureType("nether_fossil");
public static final StructureType OCEAN_MONUMENT = getStructureType("ocean_monument");
public static final StructureType OCEAN_RUIN = getStructureType("ocean_ruin");
public static final StructureType RUINED_PORTAL = getStructureType("ruined_portal");
public static final StructureType SHIPWRECK = getStructureType("shipwreck");
public static final StructureType STRONGHOLD = getStructureType("stronghold");
public static final StructureType SWAMP_HUT = getStructureType("swamp_hut");
public static final StructureType WOODLAND_MANSION = getStructureType("woodland_mansion");
// Paper end - Generated/StructureType
private static StructureType getStructureType(String name) {
return Registry.STRUCTURE_TYPE.get(NamespacedKey.minecraft(name));
}
}

View file

@ -0,0 +1,31 @@
package org.bukkit.inventory;
/**
* A item's rarity determines the default color of its name. This enum is
* ordered from least rare to most rare.
*/
public enum ItemRarity {
// Paper start - Generated/ItemRarity
// @GeneratedFrom 1.21.1
COMMON(net.kyori.adventure.text.format.NamedTextColor.WHITE),
UNCOMMON(net.kyori.adventure.text.format.NamedTextColor.YELLOW),
RARE(net.kyori.adventure.text.format.NamedTextColor.AQUA),
EPIC(net.kyori.adventure.text.format.NamedTextColor.LIGHT_PURPLE);
// Paper end - Generated/ItemRarity
// Paper start - improve ItemRarity
private final net.kyori.adventure.text.format.NamedTextColor color;
ItemRarity(final net.kyori.adventure.text.format.NamedTextColor color) {
this.color = color;
}
/**
* Gets the color formatting associated with this rarity.
*
* @return the color
*/
public net.kyori.adventure.text.format.@org.jetbrains.annotations.NotNull TextColor color() {
return this.color;
}
// Paper end
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,68 @@
package org.bukkit.inventory.meta.trim;
import org.bukkit.Keyed;
import org.bukkit.Material;
import org.bukkit.NamespacedKey;
import org.bukkit.Registry;
import org.bukkit.Translatable;
/**
* Represents a material that may be used in an {@link ArmorTrim}.
*/
public interface TrimMaterial extends Keyed, Translatable {
// Paper start - Generated/TrimMaterial
// @GeneratedFrom 1.21.1
TrimMaterial AMETHYST = getTrimMaterial("amethyst");
TrimMaterial COPPER = getTrimMaterial("copper");
TrimMaterial DIAMOND = getTrimMaterial("diamond");
TrimMaterial EMERALD = getTrimMaterial("emerald");
TrimMaterial GOLD = getTrimMaterial("gold");
TrimMaterial IRON = getTrimMaterial("iron");
TrimMaterial LAPIS = getTrimMaterial("lapis");
TrimMaterial NETHERITE = getTrimMaterial("netherite");
TrimMaterial QUARTZ = getTrimMaterial("quartz");
TrimMaterial REDSTONE = getTrimMaterial("redstone");
// Paper end - Generated/TrimMaterial
private static TrimMaterial getTrimMaterial(String name) {
NamespacedKey key = NamespacedKey.minecraft(name);
return io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(io.papermc.paper.registry.RegistryKey.TRIM_MATERIAL).get(key);
}
// Paper start - adventure
/**
* Get the description of this {@link TrimMaterial}.
*
* @return the description
*/
net.kyori.adventure.text.@org.jetbrains.annotations.NotNull Component description();
/**
* @deprecated this method assumes that {@link #description()} will
* always be a translatable component which is not guaranteed.
*/
@Override
@Deprecated(forRemoval = true)
@org.jetbrains.annotations.NotNull String getTranslationKey();
// Paper end - adventure
// Paper start - Registry#getKey
/**
* @deprecated use {@link Registry#getKey(Keyed)}, {@link io.papermc.paper.registry.RegistryAccess#getRegistry(io.papermc.paper.registry.RegistryKey)},
* and {@link io.papermc.paper.registry.RegistryKey#TRIM_MATERIAL}. TrimMaterials can exist without a key.
*/
@Deprecated(forRemoval = true, since = "1.20.4")
@Override
org.bukkit.@org.jetbrains.annotations.NotNull NamespacedKey getKey();
// Paper end - Registry#getKey
}

View file

@ -0,0 +1,84 @@
package org.bukkit.inventory.meta.trim;
import org.bukkit.Keyed;
import org.bukkit.Material;
import org.bukkit.NamespacedKey;
import org.bukkit.Registry;
import org.bukkit.Translatable;
/**
* Represents a pattern that may be used in an {@link ArmorTrim}.
*/
public interface TrimPattern extends Keyed, Translatable {
// Paper start - Generated/TrimPattern
// @GeneratedFrom 1.21.1
TrimPattern BOLT = getTrimPattern("bolt");
TrimPattern COAST = getTrimPattern("coast");
TrimPattern DUNE = getTrimPattern("dune");
TrimPattern EYE = getTrimPattern("eye");
TrimPattern FLOW = getTrimPattern("flow");
TrimPattern HOST = getTrimPattern("host");
TrimPattern RAISER = getTrimPattern("raiser");
TrimPattern RIB = getTrimPattern("rib");
TrimPattern SENTRY = getTrimPattern("sentry");
TrimPattern SHAPER = getTrimPattern("shaper");
TrimPattern SILENCE = getTrimPattern("silence");
TrimPattern SNOUT = getTrimPattern("snout");
TrimPattern SPIRE = getTrimPattern("spire");
TrimPattern TIDE = getTrimPattern("tide");
TrimPattern VEX = getTrimPattern("vex");
TrimPattern WARD = getTrimPattern("ward");
TrimPattern WAYFINDER = getTrimPattern("wayfinder");
TrimPattern WILD = getTrimPattern("wild");
// Paper end - Generated/TrimPattern
private static TrimPattern getTrimPattern(String name) {
NamespacedKey key = NamespacedKey.minecraft(name);
return io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(io.papermc.paper.registry.RegistryKey.TRIM_PATTERN).get(key);
}
// Paper start - adventure
/**
* Get the description of this {@link TrimPattern}.
*
* @return the description
*/
net.kyori.adventure.text.@org.jetbrains.annotations.NotNull Component description();
/**
* @deprecated this method assumes that {@link #description()} will
* always be a translatable component which is not guaranteed.
*/
@Override
@Deprecated(forRemoval = true)
@org.jetbrains.annotations.NotNull String getTranslationKey();
// Paper end - adventure
// Paper start - Registry#getKey
/**
* @deprecated use {@link Registry#getKey(Keyed)}, {@link io.papermc.paper.registry.RegistryAccess#getRegistry(io.papermc.paper.registry.RegistryKey)},
* and {@link io.papermc.paper.registry.RegistryKey#TRIM_PATTERN}. TrimPatterns can exist without a key.
*/
@Deprecated(forRemoval = true, since = "1.20.4")
@Override
org.bukkit.@org.jetbrains.annotations.NotNull NamespacedKey getKey();
// Paper end - Registry#getKey
}

View file

@ -0,0 +1,14 @@
package org.bukkit.inventory.recipe;
/**
* Represents categories within the cooking recipe book.
*/
public enum CookingBookCategory {
// Paper start - Generated/CookingBookCategory
// @GeneratedFrom 1.21.1
FOOD,
BLOCKS,
MISC;
// Paper end - Generated/CookingBookCategory
}

View file

@ -0,0 +1,15 @@
package org.bukkit.inventory.recipe;
/**
* Represents categories within the crafting recipe book.
*/
public enum CraftingBookCategory {
// Paper start - Generated/CraftingBookCategory
// @GeneratedFrom 1.21.1
BUILDING,
REDSTONE,
EQUIPMENT,
MISC;
// Paper end - Generated/CraftingBookCategory
}

View file

@ -0,0 +1,421 @@
package org.bukkit.map;
import com.google.common.base.Preconditions;
import com.google.common.collect.Lists;
import java.util.Locale;
import org.bukkit.Keyed;
import org.bukkit.NamespacedKey;
import org.bukkit.Registry;
import org.bukkit.util.OldEnum;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
* Represents a cursor on a map.
*/
public final class MapCursor {
private byte x, y;
private byte direction;
private boolean visible;
private net.kyori.adventure.text.Component caption; // Paper
private Type type;
/**
* Initialize the map cursor.
*
* @param x The x coordinate, from -128 to 127.
* @param y The y coordinate, from -128 to 127.
* @param direction The facing of the cursor, from 0 to 15.
* @param type The type (color/style) of the map cursor.
* @param visible Whether the cursor is visible by default.
* @deprecated Magic value
*/
@Deprecated
public MapCursor(byte x, byte y, byte direction, byte type, boolean visible) {
this(x, y, direction, type, visible, (String) null); // Paper
}
/**
* Initialize the map cursor.
*
* @param x The x coordinate, from -128 to 127.
* @param y The y coordinate, from -128 to 127.
* @param direction The facing of the cursor, from 0 to 15.
* @param type The type (color/style) of the map cursor.
* @param visible Whether the cursor is visible by default.
*/
public MapCursor(byte x, byte y, byte direction, @NotNull Type type, boolean visible) {
this(x, y, direction, type, visible, (String) null); // Paper
}
/**
* Initialize the map cursor.
*
* @param x The x coordinate, from -128 to 127.
* @param y The y coordinate, from -128 to 127.
* @param direction The facing of the cursor, from 0 to 15.
* @param type The type (color/style) of the map cursor.
* @param visible Whether the cursor is visible by default.
* @param caption cursor caption
* @deprecated Magic value. Use {@link #MapCursor(byte, byte, byte, Type, boolean, net.kyori.adventure.text.Component)}
*/
@Deprecated
public MapCursor(byte x, byte y, byte direction, byte type, boolean visible, @Nullable String caption) {
this.x = x;
this.y = y;
setDirection(direction);
setRawType(type);
this.visible = visible;
this.caption = caption == null ? null : net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(caption); // Paper
}
// Paper start
/**
* Initialize the map cursor.
*
* @param x The x coordinate, from -128 to 127.
* @param y The y coordinate, from -128 to 127.
* @param direction The facing of the cursor, from 0 to 15.
* @param type The type (color/style) of the map cursor.
* @param visible Whether the cursor is visible by default.
* @param caption cursor caption
* @deprecated Magic value
*/
@Deprecated
public MapCursor(byte x, byte y, byte direction, byte type, boolean visible, net.kyori.adventure.text.@Nullable Component caption) {
this.x = x; this.y = y; this.visible = visible; this.caption = caption;
setDirection(direction);
setRawType(type);
}
/**
* Initialize the map cursor.
*
* @param x The x coordinate, from -128 to 127.
* @param y The y coordinate, from -128 to 127.
* @param direction The facing of the cursor, from 0 to 15.
* @param type The type (color/style) of the map cursor.
* @param visible Whether the cursor is visible by default.
* @param caption cursor caption
*/
public MapCursor(byte x, byte y, byte direction, @NotNull Type type, boolean visible, net.kyori.adventure.text.@Nullable Component caption) {
this.x = x; this.y = y; this.visible = visible; this.caption = caption;
setDirection(direction);
setType(type);
}
// Paper end
/**
* Initialize the map cursor.
*
* @param x The x coordinate, from -128 to 127.
* @param y The y coordinate, from -128 to 127.
* @param direction The facing of the cursor, from 0 to 15.
* @param type The type (color/style) of the map cursor.
* @param visible Whether the cursor is visible by default.
* @param caption cursor caption
*/
public MapCursor(byte x, byte y, byte direction, @NotNull Type type, boolean visible, @Nullable String caption) {
this.x = x;
this.y = y;
setDirection(direction);
this.type = type;
this.visible = visible;
this.caption = caption == null ? null : net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(caption); // Paper
}
/**
* Get the X position of this cursor.
*
* @return The X coordinate.
*/
public byte getX() {
return x;
}
/**
* Get the Y position of this cursor.
*
* @return The Y coordinate.
*/
public byte getY() {
return y;
}
/**
* Get the direction of this cursor.
*
* @return The facing of the cursor, from 0 to 15.
*/
public byte getDirection() {
return direction;
}
/**
* Get the type of this cursor.
*
* @return The type (color/style) of the map cursor.
*/
@NotNull
public Type getType() {
return type;
}
/**
* Get the type of this cursor.
*
* @return The type (color/style) of the map cursor.
* @apiNote Internal Use Only
*/
@org.jetbrains.annotations.ApiStatus.Internal // Paper
public byte getRawType() {
return type.getValue();
}
/**
* Get the visibility status of this cursor.
*
* @return True if visible, false otherwise.
*/
public boolean isVisible() {
return visible;
}
/**
* Set the X position of this cursor.
*
* @param x The X coordinate.
*/
public void setX(byte x) {
this.x = x;
}
/**
* Set the Y position of this cursor.
*
* @param y The Y coordinate.
*/
public void setY(byte y) {
this.y = y;
}
/**
* Set the direction of this cursor.
*
* @param direction The facing of the cursor, from 0 to 15.
*/
public void setDirection(byte direction) {
Preconditions.checkArgument(direction >= 0 && direction <= 15, "direction must be between 0 and 15 but is %s", direction);
this.direction = direction;
}
/**
* Set the type of this cursor.
*
* @param type The type (color/style) of the map cursor.
*/
public void setType(@NotNull Type type) {
this.type = type;
}
/**
* Set the type of this cursor.
*
* @param type The type (color/style) of the map cursor.
* @deprecated use {@link #setType(Type)}
*/
@Deprecated(forRemoval = true, since = "1.20.2") // Paper
public void setRawType(byte type) {
Type enumType = Type.byValue(type);
Preconditions.checkArgument(enumType != null, "Unknown type by id %s", type);
this.type = enumType;
}
/**
* Set the visibility status of this cursor.
*
* @param visible True if visible.
*/
public void setVisible(boolean visible) {
this.visible = visible;
}
// Paper start
/**
* Gets the caption on this cursor.
*
* @return caption
*/
public net.kyori.adventure.text.@Nullable Component caption() {
return this.caption;
}
/**
* Sets the caption on this cursor.
*
* @param caption new caption
*/
public void caption(net.kyori.adventure.text.@Nullable Component caption) {
this.caption = caption;
}
// Paper end
/**
* Gets the caption on this cursor.
*
* @return caption
* @deprecated in favour of {@link #caption()}
*/
@Nullable
@Deprecated // Paper
public String getCaption() {
return this.caption == null ? null : net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().serialize(this.caption); // Paper
}
/**
* Sets the caption on this cursor.
*
* @param caption new caption
* @deprecated in favour of {@link #caption(net.kyori.adventure.text.Component)}
*/
@Deprecated // Paper
public void setCaption(@Nullable String caption) {
this.caption = caption == null ? null : net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(caption); // Paper
}
/**
* Represents the standard types of map cursors. More may be made
* available by resource packs - the value is used by the client as an
* index in the file './assets/minecraft/textures/map/map_icons.png' from minecraft.jar or from a
* resource pack.
*/
public interface Type extends OldEnum<Type>, Keyed {
// Paper start - Generated/MapCursorType
// @GeneratedFrom 1.21.1
Type BANNER_BLACK = getType("banner_black");
Type BANNER_BLUE = getType("banner_blue");
Type BANNER_BROWN = getType("banner_brown");
Type BANNER_CYAN = getType("banner_cyan");
Type BANNER_GRAY = getType("banner_gray");
Type BANNER_GREEN = getType("banner_green");
Type BANNER_LIGHT_BLUE = getType("banner_light_blue");
Type BANNER_LIGHT_GRAY = getType("banner_light_gray");
Type BANNER_LIME = getType("banner_lime");
Type BANNER_MAGENTA = getType("banner_magenta");
Type BANNER_ORANGE = getType("banner_orange");
Type BANNER_PINK = getType("banner_pink");
Type BANNER_PURPLE = getType("banner_purple");
Type BANNER_RED = getType("banner_red");
Type BANNER_WHITE = getType("banner_white");
Type BANNER_YELLOW = getType("banner_yellow");
Type BLUE_MARKER = getType("blue_marker");
Type FRAME = getType("frame");
Type JUNGLE_TEMPLE = getType("jungle_temple");
Type MANSION = getType("mansion");
Type MONUMENT = getType("monument");
Type PLAYER = getType("player");
Type PLAYER_OFF_LIMITS = getType("player_off_limits");
Type PLAYER_OFF_MAP = getType("player_off_map");
Type RED_MARKER = getType("red_marker");
Type RED_X = getType("red_x");
Type SWAMP_HUT = getType("swamp_hut");
Type TARGET_POINT = getType("target_point");
Type TARGET_X = getType("target_x");
Type TRIAL_CHAMBERS = getType("trial_chambers");
Type VILLAGE_DESERT = getType("village_desert");
Type VILLAGE_PLAINS = getType("village_plains");
Type VILLAGE_SAVANNA = getType("village_savanna");
Type VILLAGE_SNOWY = getType("village_snowy");
Type VILLAGE_TAIGA = getType("village_taiga");
// Paper end - Generated/MapCursorType
@NotNull
private static Type getType(@NotNull String key) {
NamespacedKey namespacedKey = NamespacedKey.minecraft(key);
Type type = Registry.MAP_DECORATION_TYPE.get(namespacedKey);
Preconditions.checkNotNull(type, "No type found for %s. This is a bug.", namespacedKey);
return type;
}
/**
* Gets the internal value of the cursor.
*
* @return the value
* @apiNote Internal Use Only
*/
@org.jetbrains.annotations.ApiStatus.Internal // Paper
byte getValue();
/**
* Get a cursor by its internal value.
*
* @param value the value
* @return the matching type
* @apiNote Internal Use Only
*/
@org.jetbrains.annotations.ApiStatus.Internal // Paper
@Nullable
static Type byValue(byte value) {
for (Type t : values()) {
if (t.getValue() == value) return t;
}
return null;
}
/**
* @param name of the type.
* @return the type with the given name.
* @deprecated only for backwards compatibility, use {@link Registry#get(NamespacedKey)} instead.
*/
@NotNull
@Deprecated(since = "1.21", forRemoval = true) @org.jetbrains.annotations.ApiStatus.ScheduledForRemoval(inVersion = "1.22") // Paper - will be removed via asm-utils
static Type valueOf(@NotNull String name) {
Type type = Registry.MAP_DECORATION_TYPE.get(NamespacedKey.fromString(name.toLowerCase(Locale.ROOT)));
Preconditions.checkArgument(type != null, "No Type found with the name %s", name);
return type;
}
/**
* @return an array of all known map cursor types.
* @deprecated use {@link Registry#iterator()}.
*/
@NotNull
@Deprecated(since = "1.21", forRemoval = true) @org.jetbrains.annotations.ApiStatus.ScheduledForRemoval(inVersion = "1.22") // Paper - will be removed via asm-utils
static Type[] values() {
return Lists.newArrayList(Registry.MAP_DECORATION_TYPE).toArray(new Type[0]);
}
}
}

View file

@ -0,0 +1,508 @@
package org.bukkit.map;
import com.google.common.base.Preconditions;
import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.image.BufferedImage;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
* Represents the palette that map items use.
* <p>
* These fields are hee base color ranges. Each entry corresponds to four
* colors of varying shades with values entry to entry + 3.
*/
public final class MapPalette {
// Internal mechanisms
private MapPalette() {}
@NotNull
private static Color c(int r, int g, int b) {
return new Color(r, g, b);
}
@NotNull
private static Color c(int r, int g, int b, int a) {
return new Color(r, g, b, a);
}
private static double getDistance(@NotNull Color c1, @NotNull Color c2) {
double rmean = (c1.getRed() + c2.getRed()) / 2.0;
double r = c1.getRed() - c2.getRed();
double g = c1.getGreen() - c2.getGreen();
int b = c1.getBlue() - c2.getBlue();
double weightR = 2 + rmean / 256.0;
double weightG = 4.0;
double weightB = 2 + (255 - rmean) / 256.0;
return weightR * r * r + weightG * g * g + weightB * b * b;
}
@NotNull
static final Color[] colors = {
// Paper start - Generated/MapPalette#colors
// @GeneratedFrom 1.21.1
new Color(0, 0, 0, 0),
new Color(0, 0, 0, 0),
new Color(0, 0, 0, 0),
new Color(0, 0, 0, 0),
new Color(89, 125, 39),
new Color(109, 153, 48),
new Color(127, 178, 56),
new Color(67, 94, 29),
new Color(174, 164, 115),
new Color(213, 201, 140),
new Color(247, 233, 163),
new Color(130, 123, 86),
new Color(140, 140, 140),
new Color(171, 171, 171),
new Color(199, 199, 199),
new Color(105, 105, 105),
new Color(180, 0, 0),
new Color(220, 0, 0),
new Color(255, 0, 0),
new Color(135, 0, 0),
new Color(112, 112, 180),
new Color(138, 138, 220),
new Color(160, 160, 255),
new Color(84, 84, 135),
new Color(117, 117, 117),
new Color(144, 144, 144),
new Color(167, 167, 167),
new Color(88, 88, 88),
new Color(0, 87, 0),
new Color(0, 106, 0),
new Color(0, 124, 0),
new Color(0, 65, 0),
new Color(180, 180, 180),
new Color(220, 220, 220),
new Color(255, 255, 255),
new Color(135, 135, 135),
new Color(115, 118, 129),
new Color(141, 144, 158),
new Color(164, 168, 184),
new Color(86, 88, 97),
new Color(106, 76, 54),
new Color(130, 94, 66),
new Color(151, 109, 77),
new Color(79, 57, 40),
new Color(79, 79, 79),
new Color(96, 96, 96),
new Color(112, 112, 112),
new Color(59, 59, 59),
new Color(45, 45, 180),
new Color(55, 55, 220),
new Color(64, 64, 255),
new Color(33, 33, 135),
new Color(100, 84, 50),
new Color(123, 102, 62),
new Color(143, 119, 72),
new Color(75, 63, 38),
new Color(180, 177, 172),
new Color(220, 217, 211),
new Color(255, 252, 245),
new Color(135, 133, 129),
new Color(152, 89, 36),
new Color(186, 109, 44),
new Color(216, 127, 51),
new Color(114, 67, 27),
new Color(125, 53, 152),
new Color(153, 65, 186),
new Color(178, 76, 216),
new Color(94, 40, 114),
new Color(72, 108, 152),
new Color(88, 132, 186),
new Color(102, 153, 216),
new Color(54, 81, 114),
new Color(161, 161, 36),
new Color(197, 197, 44),
new Color(229, 229, 51),
new Color(121, 121, 27),
new Color(89, 144, 17),
new Color(109, 176, 21),
new Color(127, 204, 25),
new Color(67, 108, 13),
new Color(170, 89, 116),
new Color(208, 109, 142),
new Color(242, 127, 165),
new Color(128, 67, 87),
new Color(53, 53, 53),
new Color(65, 65, 65),
new Color(76, 76, 76),
new Color(40, 40, 40),
new Color(108, 108, 108),
new Color(132, 132, 132),
new Color(153, 153, 153),
new Color(81, 81, 81),
new Color(53, 89, 108),
new Color(65, 109, 132),
new Color(76, 127, 153),
new Color(40, 67, 81),
new Color(89, 44, 125),
new Color(109, 54, 153),
new Color(127, 63, 178),
new Color(67, 33, 94),
new Color(36, 53, 125),
new Color(44, 65, 153),
new Color(51, 76, 178),
new Color(27, 40, 94),
new Color(72, 53, 36),
new Color(88, 65, 44),
new Color(102, 76, 51),
new Color(54, 40, 27),
new Color(72, 89, 36),
new Color(88, 109, 44),
new Color(102, 127, 51),
new Color(54, 67, 27),
new Color(108, 36, 36),
new Color(132, 44, 44),
new Color(153, 51, 51),
new Color(81, 27, 27),
new Color(17, 17, 17),
new Color(21, 21, 21),
new Color(25, 25, 25),
new Color(13, 13, 13),
new Color(176, 168, 54),
new Color(215, 205, 66),
new Color(250, 238, 77),
new Color(132, 126, 40),
new Color(64, 154, 150),
new Color(79, 188, 183),
new Color(92, 219, 213),
new Color(48, 115, 112),
new Color(52, 90, 180),
new Color(63, 110, 220),
new Color(74, 128, 255),
new Color(39, 67, 135),
new Color(0, 153, 40),
new Color(0, 187, 50),
new Color(0, 217, 58),
new Color(0, 114, 30),
new Color(91, 60, 34),
new Color(111, 74, 42),
new Color(129, 86, 49),
new Color(68, 45, 25),
new Color(79, 1, 0),
new Color(96, 1, 0),
new Color(112, 2, 0),
new Color(59, 1, 0),
new Color(147, 124, 113),
new Color(180, 152, 138),
new Color(209, 177, 161),
new Color(110, 93, 85),
new Color(112, 57, 25),
new Color(137, 70, 31),
new Color(159, 82, 36),
new Color(84, 43, 19),
new Color(105, 61, 76),
new Color(128, 75, 93),
new Color(149, 87, 108),
new Color(78, 46, 57),
new Color(79, 76, 97),
new Color(96, 93, 119),
new Color(112, 108, 138),
new Color(59, 57, 73),
new Color(131, 93, 25),
new Color(160, 114, 31),
new Color(186, 133, 36),
new Color(98, 70, 19),
new Color(72, 82, 37),
new Color(88, 100, 45),
new Color(103, 117, 53),
new Color(54, 61, 28),
new Color(112, 54, 55),
new Color(138, 66, 67),
new Color(160, 77, 78),
new Color(84, 40, 41),
new Color(40, 28, 24),
new Color(49, 35, 30),
new Color(57, 41, 35),
new Color(30, 21, 18),
new Color(95, 75, 69),
new Color(116, 92, 84),
new Color(135, 107, 98),
new Color(71, 56, 51),
new Color(61, 64, 64),
new Color(75, 79, 79),
new Color(87, 92, 92),
new Color(46, 48, 48),
new Color(86, 51, 62),
new Color(105, 62, 75),
new Color(122, 73, 88),
new Color(64, 38, 46),
new Color(53, 43, 64),
new Color(65, 53, 79),
new Color(76, 62, 92),
new Color(40, 32, 48),
new Color(53, 35, 24),
new Color(65, 43, 30),
new Color(76, 50, 35),
new Color(40, 26, 18),
new Color(53, 57, 29),
new Color(65, 70, 36),
new Color(76, 82, 42),
new Color(40, 43, 22),
new Color(100, 42, 32),
new Color(122, 51, 39),
new Color(142, 60, 46),
new Color(75, 31, 24),
new Color(26, 15, 11),
new Color(31, 18, 13),
new Color(37, 22, 16),
new Color(19, 11, 8),
new Color(133, 33, 34),
new Color(163, 41, 42),
new Color(189, 48, 49),
new Color(100, 25, 25),
new Color(104, 44, 68),
new Color(127, 54, 83),
new Color(148, 63, 97),
new Color(78, 33, 51),
new Color(64, 17, 20),
new Color(79, 21, 25),
new Color(92, 25, 29),
new Color(48, 13, 15),
new Color(15, 88, 94),
new Color(18, 108, 115),
new Color(22, 126, 134),
new Color(11, 66, 70),
new Color(40, 100, 98),
new Color(50, 122, 120),
new Color(58, 142, 140),
new Color(30, 75, 74),
new Color(60, 31, 43),
new Color(74, 37, 53),
new Color(86, 44, 62),
new Color(45, 23, 32),
new Color(14, 127, 93),
new Color(17, 155, 114),
new Color(20, 180, 133),
new Color(10, 95, 70),
new Color(70, 70, 70),
new Color(86, 86, 86),
new Color(100, 100, 100),
new Color(52, 52, 52),
new Color(152, 123, 103),
new Color(186, 150, 126),
new Color(216, 175, 147),
new Color(114, 92, 77),
new Color(89, 117, 105),
new Color(109, 144, 129),
new Color(127, 167, 150),
new Color(67, 88, 79),
// Paper end - Generated/MapPalette#colors
};
// Interface
/**
* @deprecated Magic value
*/
@Deprecated
public static final byte TRANSPARENT = 0;
/**
* @deprecated Magic value
*/
@Deprecated
public static final byte LIGHT_GREEN = 4;
/**
* @deprecated Magic value
*/
@Deprecated
public static final byte LIGHT_BROWN = 8;
/**
* @deprecated Magic value
*/
@Deprecated
public static final byte GRAY_1 = 12;
/**
* @deprecated Magic value
*/
@Deprecated
public static final byte RED = 16;
/**
* @deprecated Magic value
*/
@Deprecated
public static final byte PALE_BLUE = 20;
/**
* @deprecated Magic value
*/
@Deprecated
public static final byte GRAY_2 = 24;
/**
* @deprecated Magic value
*/
@Deprecated
public static final byte DARK_GREEN = 28;
/**
* @deprecated Magic value
*/
@Deprecated
public static final byte WHITE = 32;
/**
* @deprecated Magic value
*/
@Deprecated
public static final byte LIGHT_GRAY = 36;
/**
* @deprecated Magic value
*/
@Deprecated
public static final byte BROWN = 40;
/**
* @deprecated Magic value
*/
@Deprecated
public static final byte DARK_GRAY = 44;
/**
* @deprecated Magic value
*/
@Deprecated
public static final byte BLUE = 48;
/**
* @deprecated Magic value
*/
@Deprecated
public static final byte DARK_BROWN = 52;
/**
* Resize an image to 128x128.
*
* @param image The image to resize.
* @return The resized image.
*/
@NotNull
public static BufferedImage resizeImage(@Nullable Image image) {
BufferedImage result = new BufferedImage(128, 128, BufferedImage.TYPE_INT_ARGB);
Graphics2D graphics = result.createGraphics();
graphics.drawImage(image, 0, 0, 128, 128, null);
graphics.dispose();
return result;
}
/**
* Convert an Image to a byte[] using the palette.
*
* @param image The image to convert.
* @return A byte[] containing the pixels of the image.
* @deprecated use color-related methods
*/
@Deprecated(forRemoval = true, since = "1.20.2") // Paper
@NotNull
public static byte[] imageToBytes(@NotNull Image image) {
BufferedImage temp = new BufferedImage(image.getWidth(null), image.getHeight(null), BufferedImage.TYPE_INT_ARGB);
Graphics2D graphics = temp.createGraphics();
graphics.drawImage(image, 0, 0, null);
graphics.dispose();
int[] pixels = new int[temp.getWidth() * temp.getHeight()];
temp.getRGB(0, 0, temp.getWidth(), temp.getHeight(), pixels, 0, temp.getWidth());
byte[] result = new byte[temp.getWidth() * temp.getHeight()];
for (int i = 0; i < pixels.length; i++) {
result[i] = matchColor(new Color(pixels[i], true));
}
return result;
}
/**
* Get the index of the closest matching color in the palette to the given
* color.
*
* @param r The red component of the color.
* @param b The blue component of the color.
* @param g The green component of the color.
* @return The index in the palette.
* @deprecated use color-related methods
*/
@Deprecated(forRemoval = true, since = "1.20.2") // Paper
public static byte matchColor(int r, int g, int b) {
return matchColor(new Color(r, g, b));
}
/**
* Get the index of the closest matching color in the palette to the given
* color.
*
* @param color The Color to match.
* @return The index in the palette.
* @deprecated use color-related methods
*/
@Deprecated(forRemoval = true, since = "1.20.2") // Paper
public static byte matchColor(@NotNull Color color) {
if (color.getAlpha() < 128) return 0;
if (mapColorCache != null && mapColorCache.isCached()) {
return mapColorCache.matchColor(color);
}
int index = 0;
double best = -1;
for (int i = 4; i < colors.length; i++) {
double distance = getDistance(color, colors[i]);
if (distance < best || best == -1) {
best = distance;
index = i;
}
}
// Minecraft has 143 colors, some of which have negative byte representations
return (byte) (index < 128 ? index : -129 + (index - 127));
}
/**
* Get the value of the given color in the palette.
*
* @param index The index in the palette.
* @return The Color of the palette entry.
* @deprecated use color directly
*/
@Deprecated(forRemoval = true, since = "1.20.2") // Paper
@NotNull
public static Color getColor(byte index) {
// Minecraft has 143 colors, some of which have negative byte representations
return colors[index >= 0 ? index : index + 256];
}
private static MapColorCache mapColorCache;
/**
* Sets the given MapColorCache.
*
* @param mapColorCache The map color cache to set
*/
public static void setMapColorCache(@NotNull MapColorCache mapColorCache) {
Preconditions.checkState(MapPalette.mapColorCache == null, "Map color cache already set");
MapPalette.mapColorCache = mapColorCache;
}
/**
* Holds cached information for matching map colors of a given RBG color.
*/
public interface MapColorCache {
/**
* Returns true if the MapColorCache has values cached, if not it will
* return false.
* A case where it might return false is when the cache is not build jet.
*
* @return true if this MapColorCache has values cached otherwise false
*/
boolean isCached();
/**
* Get the cached index of the closest matching color in the palette to the given
* color.
*
* @param color The Color to match.
* @return The index in the palette.
* @throws IllegalStateException if {@link #isCached()} returns false
* @apiNote Internal Use Only
*/
@org.jetbrains.annotations.ApiStatus.Internal // Paper
byte matchColor(@NotNull Color color);
}
}

View file

@ -0,0 +1,171 @@
package org.bukkit.potion;
import com.google.common.base.Suppliers;
import java.util.List;
import java.util.function.Supplier;
import org.bukkit.Bukkit;
import org.bukkit.Keyed;
import org.bukkit.NamespacedKey;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
* This enum reflects and matches each potion state that can be obtained from
* the Creative mode inventory
*/
public enum PotionType implements Keyed, io.papermc.paper.world.flag.FeatureDependant { // Paper - feature flag API
// Paper start - Generated/PotionType
// @GeneratedFrom 1.21.1
AWKWARD("awkward"),
FIRE_RESISTANCE("fire_resistance"),
HARMING("harming"),
HEALING("healing"),
INFESTED("infested"),
INVISIBILITY("invisibility"),
LEAPING("leaping"),
LONG_FIRE_RESISTANCE("long_fire_resistance"),
LONG_INVISIBILITY("long_invisibility"),
LONG_LEAPING("long_leaping"),
LONG_NIGHT_VISION("long_night_vision"),
LONG_POISON("long_poison"),
LONG_REGENERATION("long_regeneration"),
LONG_SLOW_FALLING("long_slow_falling"),
LONG_SLOWNESS("long_slowness"),
LONG_STRENGTH("long_strength"),
LONG_SWIFTNESS("long_swiftness"),
LONG_TURTLE_MASTER("long_turtle_master"),
LONG_WATER_BREATHING("long_water_breathing"),
LONG_WEAKNESS("long_weakness"),
LUCK("luck"),
MUNDANE("mundane"),
NIGHT_VISION("night_vision"),
OOZING("oozing"),
POISON("poison"),
REGENERATION("regeneration"),
SLOW_FALLING("slow_falling"),
SLOWNESS("slowness"),
STRENGTH("strength"),
STRONG_HARMING("strong_harming"),
STRONG_HEALING("strong_healing"),
STRONG_LEAPING("strong_leaping"),
STRONG_POISON("strong_poison"),
STRONG_REGENERATION("strong_regeneration"),
STRONG_SLOWNESS("strong_slowness"),
STRONG_STRENGTH("strong_strength"),
STRONG_SWIFTNESS("strong_swiftness"),
STRONG_TURTLE_MASTER("strong_turtle_master"),
SWIFTNESS("swiftness"),
THICK("thick"),
TURTLE_MASTER("turtle_master"),
WATER("water"),
WATER_BREATHING("water_breathing"),
WEAKNESS("weakness"),
WEAVING("weaving"),
WIND_CHARGED("wind_charged");
// Paper end - Generated/PotionType
private final NamespacedKey key;
private final Supplier<InternalPotionData> internalPotionDataSupplier;
PotionType(String key) {
this.key = NamespacedKey.minecraft(key);
this.internalPotionDataSupplier = Suppliers.memoize(() -> Bukkit.getUnsafe().getInternalPotionData(this.key));
}
/**
* @return the potion effect type of this potion type
* @deprecated Potions can have multiple effects use {@link #getPotionEffects()}
*/
@Nullable
@Deprecated
public PotionEffectType getEffectType() {
return internalPotionDataSupplier.get().getEffectType();
}
/**
* @return a list of all effects this potion type has
*/
@NotNull
public List<PotionEffect> getPotionEffects() {
return internalPotionDataSupplier.get().getPotionEffects();
}
/**
* @return if this potion type is instant
* @deprecated PotionType can have multiple effects, some of which can be instant and others not.
* Use {@link PotionEffectType#isInstant()} in combination with {@link #getPotionEffects()} and {@link PotionEffect#getType()}
*/
@Deprecated
public boolean isInstant() {
return internalPotionDataSupplier.get().isInstant();
}
/**
* Checks if the potion type has an upgraded state.
* This refers to whether or not the potion type can be Tier 2,
* such as Potion of Fire Resistance II.
*
* @return true if the potion type can be upgraded;
*/
public boolean isUpgradeable() {
return internalPotionDataSupplier.get().isUpgradeable();
}
/**
* Checks if the potion type has an extended state.
* This refers to the extended duration potions
*
* @return true if the potion type can be extended
*/
public boolean isExtendable() {
return internalPotionDataSupplier.get().isExtendable();
}
public int getMaxLevel() {
return internalPotionDataSupplier.get().getMaxLevel();
}
/**
* @param effectType the effect to get by
* @return the matching potion type
* @deprecated Misleading
*/
@Deprecated
@Nullable
public static PotionType getByEffect(@Nullable PotionEffectType effectType) {
if (effectType == null)
return WATER;
for (PotionType type : PotionType.values()) {
if (effectType.equals(type.getEffectType()))
return type;
}
return null;
}
@NotNull
@Override
public NamespacedKey getKey() {
return key;
}
/**
* @deprecated Do not use, interface will get removed, and the plugin won't run
*/
@Deprecated
@ApiStatus.Internal
public interface InternalPotionData {
PotionEffectType getEffectType();
List<PotionEffect> getPotionEffects();
boolean isInstant();
boolean isUpgradeable();
boolean isExtendable();
int getMaxLevel();
}
}

View file

@ -0,0 +1,58 @@
package org.bukkit.scoreboard;
import net.kyori.adventure.text.format.NamedTextColor; // Paper
/**
* Locations for displaying objectives to the player
*/
public enum DisplaySlot {
// Paper start
// Paper start - Generated/DisplaySlot
// @GeneratedFrom 1.21.1
PLAYER_LIST("list"),
SIDEBAR("sidebar"),
BELOW_NAME("below_name"),
SIDEBAR_TEAM_BLACK("sidebar.team.black"),
SIDEBAR_TEAM_DARK_BLUE("sidebar.team.dark_blue"),
SIDEBAR_TEAM_DARK_GREEN("sidebar.team.dark_green"),
SIDEBAR_TEAM_DARK_AQUA("sidebar.team.dark_aqua"),
SIDEBAR_TEAM_DARK_RED("sidebar.team.dark_red"),
SIDEBAR_TEAM_DARK_PURPLE("sidebar.team.dark_purple"),
SIDEBAR_TEAM_GOLD("sidebar.team.gold"),
SIDEBAR_TEAM_GRAY("sidebar.team.gray"),
SIDEBAR_TEAM_DARK_GRAY("sidebar.team.dark_gray"),
SIDEBAR_TEAM_BLUE("sidebar.team.blue"),
SIDEBAR_TEAM_GREEN("sidebar.team.green"),
SIDEBAR_TEAM_AQUA("sidebar.team.aqua"),
SIDEBAR_TEAM_RED("sidebar.team.red"),
SIDEBAR_TEAM_LIGHT_PURPLE("sidebar.team.light_purple"),
SIDEBAR_TEAM_YELLOW("sidebar.team.yellow"),
SIDEBAR_TEAM_WHITE("sidebar.team.white");
// Paper end - Generated/DisplaySlot
public static final net.kyori.adventure.util.Index<String, DisplaySlot> NAMES = net.kyori.adventure.util.Index.create(DisplaySlot.class, DisplaySlot::getId);
private final String id;
DisplaySlot(@org.jetbrains.annotations.NotNull String id) {
this.id = id;
}
DisplaySlot(@org.jetbrains.annotations.NotNull NamedTextColor color) {
this.id = "sidebar.team." + color;
}
/**
* Get the string id of this display slot.
*
* @return the string id
*/
public @org.jetbrains.annotations.NotNull String getId() {
return id;
}
@Override
public String toString() {
return this.id;
}
// Paper end
}

View file

@ -0,0 +1,162 @@
package io.papermc.paper.registry;
import io.papermc.paper.adventure.PaperAdventure;
import io.papermc.paper.registry.data.PaperEnchantmentRegistryEntry;
import io.papermc.paper.registry.data.PaperGameEventRegistryEntry;
import io.papermc.paper.registry.entry.RegistryEntry;
import io.papermc.paper.registry.tag.TagKey;
import java.util.Collections;
import java.util.IdentityHashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import net.minecraft.core.Registry;
import net.minecraft.core.registries.Registries;
import net.minecraft.resources.ResourceKey;
import org.bukkit.GameEvent;
import org.bukkit.JukeboxSong;
import org.bukkit.Keyed;
import org.bukkit.MusicInstrument;
import org.bukkit.block.BlockType;
import org.bukkit.block.banner.PatternType;
import org.bukkit.craftbukkit.CraftGameEvent;
import org.bukkit.craftbukkit.CraftJukeboxSong;
import org.bukkit.craftbukkit.CraftMusicInstrument;
import org.bukkit.craftbukkit.block.CraftBlockType;
import org.bukkit.craftbukkit.block.banner.CraftPatternType;
import org.bukkit.craftbukkit.damage.CraftDamageType;
import org.bukkit.craftbukkit.enchantments.CraftEnchantment;
import org.bukkit.craftbukkit.entity.CraftCat;
import org.bukkit.craftbukkit.entity.CraftFrog;
import org.bukkit.craftbukkit.entity.CraftVillager;
import org.bukkit.craftbukkit.entity.CraftWolf;
import org.bukkit.craftbukkit.generator.structure.CraftStructure;
import org.bukkit.craftbukkit.generator.structure.CraftStructureType;
import org.bukkit.craftbukkit.inventory.CraftItemType;
import org.bukkit.craftbukkit.inventory.CraftMenuType;
import org.bukkit.craftbukkit.inventory.trim.CraftTrimMaterial;
import org.bukkit.craftbukkit.inventory.trim.CraftTrimPattern;
import org.bukkit.craftbukkit.legacy.FieldRename;
import org.bukkit.craftbukkit.map.CraftMapCursor;
import org.bukkit.craftbukkit.potion.CraftPotionEffectType;
import org.bukkit.craftbukkit.util.CraftNamespacedKey;
import org.bukkit.damage.DamageType;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Cat;
import org.bukkit.entity.Frog;
import org.bukkit.entity.Villager;
import org.bukkit.entity.Wolf;
import org.bukkit.entity.memory.MemoryKey;
import org.bukkit.generator.structure.Structure;
import org.bukkit.generator.structure.StructureType;
import org.bukkit.inventory.ItemType;
import org.bukkit.inventory.MenuType;
import org.bukkit.inventory.meta.trim.TrimMaterial;
import org.bukkit.inventory.meta.trim.TrimPattern;
import org.bukkit.map.MapCursor;
import org.bukkit.potion.PotionEffectType;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.checkerframework.framework.qual.DefaultQualifier;
import static io.papermc.paper.registry.entry.RegistryEntry.apiOnly;
import static io.papermc.paper.registry.entry.RegistryEntry.entry;
import static io.papermc.paper.registry.entry.RegistryEntry.writable;
@DefaultQualifier(NonNull.class)
public final class PaperRegistries {
static final List<RegistryEntry<?, ?>> REGISTRY_ENTRIES;
private static final Map<RegistryKey<?>, RegistryEntry<?, ?>> BY_REGISTRY_KEY;
private static final Map<ResourceKey<?>, RegistryEntry<?, ?>> BY_RESOURCE_KEY;
static {
REGISTRY_ENTRIES = List.of(
// Paper start - Generated/RegistryDefinitions
// @GeneratedFrom 1.21.1
// built-in
writable(Registries.GAME_EVENT, RegistryKey.GAME_EVENT, GameEvent.class, CraftGameEvent::new, PaperGameEventRegistryEntry.PaperBuilder::new),
entry(Registries.STRUCTURE_TYPE, RegistryKey.STRUCTURE_TYPE, StructureType.class, CraftStructureType::new),
entry(Registries.INSTRUMENT, RegistryKey.INSTRUMENT, MusicInstrument.class, CraftMusicInstrument::new),
entry(Registries.MOB_EFFECT, RegistryKey.MOB_EFFECT, PotionEffectType.class, CraftPotionEffectType::new),
entry(Registries.BLOCK, RegistryKey.BLOCK, BlockType.class, CraftBlockType::new),
entry(Registries.ITEM, RegistryKey.ITEM, ItemType.class, CraftItemType::new),
entry(Registries.CAT_VARIANT, RegistryKey.CAT_VARIANT, Cat.Type.class, CraftCat.CraftType::new),
entry(Registries.FROG_VARIANT, RegistryKey.FROG_VARIANT, Frog.Variant.class, CraftFrog.CraftVariant::new),
entry(Registries.VILLAGER_PROFESSION, RegistryKey.VILLAGER_PROFESSION, Villager.Profession.class, CraftVillager.CraftProfession::new),
entry(Registries.VILLAGER_TYPE, RegistryKey.VILLAGER_TYPE, Villager.Type.class, CraftVillager.CraftType::new),
entry(Registries.MAP_DECORATION_TYPE, RegistryKey.MAP_DECORATION_TYPE, MapCursor.Type.class, CraftMapCursor.CraftType::new),
entry(Registries.MENU, RegistryKey.MENU, MenuType.class, CraftMenuType::new),
// data-driven
entry(Registries.STRUCTURE, RegistryKey.STRUCTURE, Structure.class, CraftStructure::new).delayed(),
entry(Registries.TRIM_MATERIAL, RegistryKey.TRIM_MATERIAL, TrimMaterial.class, CraftTrimMaterial::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.WOLF_VARIANT, RegistryKey.WOLF_VARIANT, Wolf.Variant.class, CraftWolf.CraftVariant::new).delayed(),
writable(Registries.ENCHANTMENT, RegistryKey.ENCHANTMENT, Enchantment.class, CraftEnchantment::new, PaperEnchantmentRegistryEntry.PaperBuilder::new).withSerializationUpdater(FieldRename.ENCHANTMENT_RENAME).delayed(),
entry(Registries.JUKEBOX_SONG, RegistryKey.JUKEBOX_SONG, JukeboxSong.class, CraftJukeboxSong::new).delayed(),
entry(Registries.BANNER_PATTERN, RegistryKey.BANNER_PATTERN, PatternType.class, CraftPatternType::new).delayed(),
// api-only
apiOnly(Registries.BIOME, RegistryKey.BIOME, () -> org.bukkit.Registry.BIOME),
apiOnly(Registries.PAINTING_VARIANT, RegistryKey.PAINTING_VARIANT, () -> org.bukkit.Registry.ART),
apiOnly(Registries.ATTRIBUTE, RegistryKey.ATTRIBUTE, () -> org.bukkit.Registry.ATTRIBUTE),
apiOnly(Registries.ENTITY_TYPE, RegistryKey.ENTITY_TYPE, () -> org.bukkit.Registry.ENTITY_TYPE),
apiOnly(Registries.PARTICLE_TYPE, RegistryKey.PARTICLE_TYPE, () -> org.bukkit.Registry.PARTICLE_TYPE),
apiOnly(Registries.POTION, RegistryKey.POTION, () -> org.bukkit.Registry.POTION),
apiOnly(Registries.SOUND_EVENT, RegistryKey.SOUND_EVENT, () -> org.bukkit.Registry.SOUNDS),
apiOnly(Registries.MEMORY_MODULE_TYPE, RegistryKey.MEMORY_MODULE_TYPE, () -> org.bukkit.Registry.MEMORY_MODULE_TYPE),
apiOnly(Registries.FLUID, RegistryKey.FLUID, () -> org.bukkit.Registry.FLUID)
// Paper end - Generated/RegistryDefinitions
);
final Map<RegistryKey<?>, RegistryEntry<?, ?>> byRegistryKey = new IdentityHashMap<>(REGISTRY_ENTRIES.size());
final Map<ResourceKey<?>, RegistryEntry<?, ?>> byResourceKey = new IdentityHashMap<>(REGISTRY_ENTRIES.size());
for (final RegistryEntry<?, ?> entry : REGISTRY_ENTRIES) {
byRegistryKey.put(entry.apiKey(), entry);
byResourceKey.put(entry.mcKey(), entry);
}
BY_REGISTRY_KEY = Collections.unmodifiableMap(byRegistryKey);
BY_RESOURCE_KEY = Collections.unmodifiableMap(byResourceKey);
}
@SuppressWarnings("unchecked")
public static <M, T extends Keyed> @Nullable RegistryEntry<M, T> getEntry(final ResourceKey<? extends Registry<M>> resourceKey) {
return (RegistryEntry<M, T>) BY_RESOURCE_KEY.get(resourceKey);
}
@SuppressWarnings("unchecked")
public static <M, T extends Keyed> @Nullable RegistryEntry<M, T> getEntry(final RegistryKey<? super T> registryKey) {
return (RegistryEntry<M, T>) BY_REGISTRY_KEY.get(registryKey);
}
@SuppressWarnings("unchecked")
public static <M, T> RegistryKey<T> registryFromNms(final ResourceKey<? extends Registry<M>> registryResourceKey) {
return (RegistryKey<T>) Objects.requireNonNull(BY_RESOURCE_KEY.get(registryResourceKey), registryResourceKey + " doesn't have an api RegistryKey").apiKey();
}
@SuppressWarnings("unchecked")
public static <M, T> ResourceKey<? extends Registry<M>> registryToNms(final RegistryKey<T> registryKey) {
return (ResourceKey<? extends Registry<M>>) Objects.requireNonNull(BY_REGISTRY_KEY.get(registryKey), registryKey + " doesn't have an mc registry ResourceKey").mcKey();
}
public static <M, T> TypedKey<T> fromNms(final ResourceKey<M> resourceKey) {
return TypedKey.create(registryFromNms(resourceKey.registryKey()), CraftNamespacedKey.fromMinecraft(resourceKey.location()));
}
@SuppressWarnings({"unchecked", "RedundantCast"})
public static <M, T> ResourceKey<M> toNms(final TypedKey<T> typedKey) {
return ResourceKey.create((ResourceKey<? extends Registry<M>>) PaperRegistries.registryToNms(typedKey.registryKey()), PaperAdventure.asVanilla(typedKey.key()));
}
public static <M, T> TagKey<T> fromNms(final net.minecraft.tags.TagKey<M> tagKey) {
return TagKey.create(registryFromNms(tagKey.registry()), CraftNamespacedKey.fromMinecraft(tagKey.location()));
}
@SuppressWarnings({"unchecked", "RedundantCast"})
public static <M, T> net.minecraft.tags.TagKey<M> toNms(final TagKey<T> tagKey) {
return net.minecraft.tags.TagKey.create((ResourceKey<? extends Registry<M>>) registryToNms(tagKey.registryKey()), PaperAdventure.asVanilla(tagKey.key()));
}
private PaperRegistries() {
}
}

View file

@ -0,0 +1,335 @@
package org.bukkit.craftbukkit;
import com.google.common.base.Preconditions;
import com.google.common.collect.BiMap;
import com.google.common.collect.ImmutableBiMap;
import net.minecraft.core.Registry;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.stats.ServerStatsCounter;
import net.minecraft.stats.Stats;
import net.minecraft.world.item.Item;
import net.minecraft.world.level.block.Block;
import org.bukkit.Material;
import org.bukkit.Statistic;
import org.bukkit.Statistic.Type;
import org.bukkit.craftbukkit.block.CraftBlockType;
import org.bukkit.craftbukkit.entity.CraftEntityType;
import org.bukkit.craftbukkit.inventory.CraftItemType;
import org.bukkit.entity.EntityType;
public enum CraftStatistic {
// Paper start - Generated/CraftStatisticCustom
// @GeneratedFrom 1.21.1
ANIMALS_BRED(Stats.ANIMALS_BRED),
AVIATE_ONE_CM(Stats.AVIATE_ONE_CM),
BELL_RING(Stats.BELL_RING),
BOAT_ONE_CM(Stats.BOAT_ONE_CM),
ARMOR_CLEANED(Stats.CLEAN_ARMOR),
BANNER_CLEANED(Stats.CLEAN_BANNER),
CLEAN_SHULKER_BOX(Stats.CLEAN_SHULKER_BOX),
CLIMB_ONE_CM(Stats.CLIMB_ONE_CM),
CROUCH_ONE_CM(Stats.CROUCH_ONE_CM),
DAMAGE_ABSORBED(Stats.DAMAGE_ABSORBED),
DAMAGE_BLOCKED_BY_SHIELD(Stats.DAMAGE_BLOCKED_BY_SHIELD),
DAMAGE_DEALT(Stats.DAMAGE_DEALT),
DAMAGE_DEALT_ABSORBED(Stats.DAMAGE_DEALT_ABSORBED),
DAMAGE_DEALT_RESISTED(Stats.DAMAGE_DEALT_RESISTED),
DAMAGE_RESISTED(Stats.DAMAGE_RESISTED),
DAMAGE_TAKEN(Stats.DAMAGE_TAKEN),
DEATHS(Stats.DEATHS),
DROP_COUNT(Stats.DROP),
CAKE_SLICES_EATEN(Stats.EAT_CAKE_SLICE),
ITEM_ENCHANTED(Stats.ENCHANT_ITEM),
FALL_ONE_CM(Stats.FALL_ONE_CM),
CAULDRON_FILLED(Stats.FILL_CAULDRON),
FISH_CAUGHT(Stats.FISH_CAUGHT),
FLY_ONE_CM(Stats.FLY_ONE_CM),
HORSE_ONE_CM(Stats.HORSE_ONE_CM),
DISPENSER_INSPECTED(Stats.INSPECT_DISPENSER),
DROPPER_INSPECTED(Stats.INSPECT_DROPPER),
HOPPER_INSPECTED(Stats.INSPECT_HOPPER),
INTERACT_WITH_ANVIL(Stats.INTERACT_WITH_ANVIL),
BEACON_INTERACTION(Stats.INTERACT_WITH_BEACON),
INTERACT_WITH_BLAST_FURNACE(Stats.INTERACT_WITH_BLAST_FURNACE),
BREWINGSTAND_INTERACTION(Stats.INTERACT_WITH_BREWINGSTAND),
INTERACT_WITH_CAMPFIRE(Stats.INTERACT_WITH_CAMPFIRE),
INTERACT_WITH_CARTOGRAPHY_TABLE(Stats.INTERACT_WITH_CARTOGRAPHY_TABLE),
CRAFTING_TABLE_INTERACTION(Stats.INTERACT_WITH_CRAFTING_TABLE),
FURNACE_INTERACTION(Stats.INTERACT_WITH_FURNACE),
INTERACT_WITH_GRINDSTONE(Stats.INTERACT_WITH_GRINDSTONE),
INTERACT_WITH_LECTERN(Stats.INTERACT_WITH_LECTERN),
INTERACT_WITH_LOOM(Stats.INTERACT_WITH_LOOM),
INTERACT_WITH_SMITHING_TABLE(Stats.INTERACT_WITH_SMITHING_TABLE),
INTERACT_WITH_SMOKER(Stats.INTERACT_WITH_SMOKER),
INTERACT_WITH_STONECUTTER(Stats.INTERACT_WITH_STONECUTTER),
JUMP(Stats.JUMP),
LEAVE_GAME(Stats.LEAVE_GAME),
MINECART_ONE_CM(Stats.MINECART_ONE_CM),
MOB_KILLS(Stats.MOB_KILLS),
OPEN_BARREL(Stats.OPEN_BARREL),
CHEST_OPENED(Stats.OPEN_CHEST),
ENDERCHEST_OPENED(Stats.OPEN_ENDERCHEST),
SHULKER_BOX_OPENED(Stats.OPEN_SHULKER_BOX),
PIG_ONE_CM(Stats.PIG_ONE_CM),
NOTEBLOCK_PLAYED(Stats.PLAY_NOTEBLOCK),
RECORD_PLAYED(Stats.PLAY_RECORD),
PLAY_ONE_MINUTE(Stats.PLAY_TIME),
PLAYER_KILLS(Stats.PLAYER_KILLS),
FLOWER_POTTED(Stats.POT_FLOWER),
RAID_TRIGGER(Stats.RAID_TRIGGER),
RAID_WIN(Stats.RAID_WIN),
SLEEP_IN_BED(Stats.SLEEP_IN_BED),
SNEAK_TIME(Stats.CROUCH_TIME),
SPRINT_ONE_CM(Stats.SPRINT_ONE_CM),
STRIDER_ONE_CM(Stats.STRIDER_ONE_CM),
SWIM_ONE_CM(Stats.SWIM_ONE_CM),
TALKED_TO_VILLAGER(Stats.TALKED_TO_VILLAGER),
TARGET_HIT(Stats.TARGET_HIT),
TIME_SINCE_DEATH(Stats.TIME_SINCE_DEATH),
TIME_SINCE_REST(Stats.TIME_SINCE_REST),
TOTAL_WORLD_TIME(Stats.TOTAL_WORLD_TIME),
TRADED_WITH_VILLAGER(Stats.TRADED_WITH_VILLAGER),
TRAPPED_CHEST_TRIGGERED(Stats.TRIGGER_TRAPPED_CHEST),
NOTEBLOCK_TUNED(Stats.TUNE_NOTEBLOCK),
CAULDRON_USED(Stats.USE_CAULDRON),
WALK_ON_WATER_ONE_CM(Stats.WALK_ON_WATER_ONE_CM),
WALK_ONE_CM(Stats.WALK_ONE_CM),
WALK_UNDER_WATER_ONE_CM(Stats.WALK_UNDER_WATER_ONE_CM),
// Paper end - Generated/CraftStatisticCustom
// Paper start - Generated/CraftStatisticType
// @GeneratedFrom 1.21.1
BREAK_ITEM(ResourceLocation.withDefaultNamespace("broken")),
CRAFT_ITEM(ResourceLocation.withDefaultNamespace("crafted")),
DROP(ResourceLocation.withDefaultNamespace("dropped")),
KILL_ENTITY(ResourceLocation.withDefaultNamespace("killed")),
ENTITY_KILLED_BY(ResourceLocation.withDefaultNamespace("killed_by")),
MINE_BLOCK(ResourceLocation.withDefaultNamespace("mined")),
PICKUP(ResourceLocation.withDefaultNamespace("picked_up")),
USE_ITEM(ResourceLocation.withDefaultNamespace("used"));
// Paper end - Generated/CraftStatisticType
private final ResourceLocation minecraftKey;
private final org.bukkit.Statistic bukkit;
private static final BiMap<ResourceLocation, org.bukkit.Statistic> statistics;
static {
ImmutableBiMap.Builder<ResourceLocation, org.bukkit.Statistic> statisticBuilder = ImmutableBiMap.builder();
for (CraftStatistic statistic : CraftStatistic.values()) {
statisticBuilder.put(statistic.minecraftKey, statistic.bukkit);
}
statistics = statisticBuilder.build();
}
private CraftStatistic(ResourceLocation minecraftKey) {
this.minecraftKey = minecraftKey;
this.bukkit = org.bukkit.Statistic.valueOf(this.name());
Preconditions.checkState(this.bukkit != null, "Bukkit statistic %s does not exist", this.name());
}
public static org.bukkit.Statistic getBukkitStatistic(net.minecraft.stats.Stat<?> statistic) {
Preconditions.checkArgument(statistic != null, "NMS Statistic cannot be null");
Registry statRegistry = statistic.getType().getRegistry();
ResourceLocation nmsKey = BuiltInRegistries.STAT_TYPE.getKey(statistic.getType());
if (statRegistry == BuiltInRegistries.CUSTOM_STAT) {
nmsKey = (ResourceLocation) statistic.getValue();
}
return statistics.get(nmsKey);
}
public static net.minecraft.stats.Stat getNMSStatistic(org.bukkit.Statistic bukkit) {
Preconditions.checkArgument(bukkit.getType() == Statistic.Type.UNTYPED, "This method only accepts untyped statistics");
net.minecraft.stats.Stat<ResourceLocation> nms = Stats.CUSTOM.get(statistics.inverse().get(bukkit));
Preconditions.checkArgument(nms != null, "NMS Statistic %s does not exist", bukkit);
return nms;
}
public static net.minecraft.stats.Stat getMaterialStatistic(org.bukkit.Statistic stat, Material material) {
try {
if (stat == Statistic.MINE_BLOCK) {
return Stats.BLOCK_MINED.get(CraftBlockType.bukkitToMinecraft(material));
}
if (stat == Statistic.CRAFT_ITEM) {
return Stats.ITEM_CRAFTED.get(CraftItemType.bukkitToMinecraft(material));
}
if (stat == Statistic.USE_ITEM) {
return Stats.ITEM_USED.get(CraftItemType.bukkitToMinecraft(material));
}
if (stat == Statistic.BREAK_ITEM) {
return Stats.ITEM_BROKEN.get(CraftItemType.bukkitToMinecraft(material));
}
if (stat == Statistic.PICKUP) {
return Stats.ITEM_PICKED_UP.get(CraftItemType.bukkitToMinecraft(material));
}
if (stat == Statistic.DROP) {
return Stats.ITEM_DROPPED.get(CraftItemType.bukkitToMinecraft(material));
}
} catch (ArrayIndexOutOfBoundsException e) {
return null;
}
return null;
}
public static net.minecraft.stats.Stat getEntityStatistic(org.bukkit.Statistic stat, EntityType entity) {
Preconditions.checkArgument(entity != null, "EntityType cannot be null");
if (entity.getName() != null) {
net.minecraft.world.entity.EntityType<?> nmsEntity = CraftEntityType.bukkitToMinecraft(entity);
if (stat == org.bukkit.Statistic.KILL_ENTITY) {
return net.minecraft.stats.Stats.ENTITY_KILLED.get(nmsEntity);
}
if (stat == org.bukkit.Statistic.ENTITY_KILLED_BY) {
return net.minecraft.stats.Stats.ENTITY_KILLED_BY.get(nmsEntity);
}
}
return null;
}
public static EntityType getEntityTypeFromStatistic(net.minecraft.stats.Stat<net.minecraft.world.entity.EntityType<?>> statistic) {
Preconditions.checkArgument(statistic != null, "NMS Statistic cannot be null");
return CraftEntityType.minecraftToBukkit(statistic.getValue());
}
public static Material getMaterialFromStatistic(net.minecraft.stats.Stat<?> statistic) {
if (statistic.getValue() instanceof Item statisticItemValue) {
return CraftItemType.minecraftToBukkit(statisticItemValue);
}
if (statistic.getValue() instanceof Block statisticBlockValue) {
return CraftBlockType.minecraftToBukkit(statisticBlockValue);
}
return null;
}
public static void incrementStatistic(ServerStatsCounter manager, Statistic statistic, ServerPlayer player) {
incrementStatistic(manager, statistic, 1, player);
}
public static void decrementStatistic(ServerStatsCounter manager, Statistic statistic, ServerPlayer player) {
decrementStatistic(manager, statistic, 1, player);
}
public static int getStatistic(ServerStatsCounter manager, Statistic statistic) {
Preconditions.checkArgument(statistic != null, "Statistic cannot be null");
Preconditions.checkArgument(statistic.getType() == Type.UNTYPED, "Must supply additional parameter for this statistic");
return manager.getValue(CraftStatistic.getNMSStatistic(statistic));
}
public static void incrementStatistic(ServerStatsCounter manager, Statistic statistic, int amount, ServerPlayer player) {
Preconditions.checkArgument(amount > 0, "Amount must be greater than 0");
setStatistic(manager, statistic, getStatistic(manager, statistic) + amount, player);
}
public static void decrementStatistic(ServerStatsCounter manager, Statistic statistic, int amount, ServerPlayer player) {
Preconditions.checkArgument(amount > 0, "Amount must be greater than 0");
setStatistic(manager, statistic, getStatistic(manager, statistic) - amount, player);
}
public static void setStatistic(ServerStatsCounter manager, Statistic statistic, int newValue, ServerPlayer player) {
Preconditions.checkArgument(statistic != null, "Statistic cannot be null");
Preconditions.checkArgument(statistic.getType() == Type.UNTYPED, "Must supply additional parameter for this statistic");
Preconditions.checkArgument(newValue >= 0, "Value must be greater than or equal to 0");
net.minecraft.stats.Stat nmsStatistic = CraftStatistic.getNMSStatistic(statistic);
manager.setValue(null, nmsStatistic, newValue);
// Update scoreboards
if (player != null) {
player.level().getCraftServer().getScoreboardManager().forAllObjectives(nmsStatistic, player, score -> {
score.set(newValue);
});
}
}
public static void incrementStatistic(ServerStatsCounter manager, Statistic statistic, Material material, ServerPlayer player) {
incrementStatistic(manager, statistic, material, 1, player);
}
public static void decrementStatistic(ServerStatsCounter manager, Statistic statistic, Material material, ServerPlayer player) {
decrementStatistic(manager, statistic, material, 1, player);
}
public static int getStatistic(ServerStatsCounter manager, Statistic statistic, Material material) {
Preconditions.checkArgument(statistic != null, "Statistic cannot be null");
Preconditions.checkArgument(material != null, "Material cannot be null");
Preconditions.checkArgument(statistic.getType() == Type.BLOCK || statistic.getType() == Type.ITEM, "This statistic does not take a Material parameter");
net.minecraft.stats.Stat nmsStatistic = CraftStatistic.getMaterialStatistic(statistic, material);
Preconditions.checkArgument(nmsStatistic != null, "The supplied Material %s does not have a corresponding statistic", material);
return manager.getValue(nmsStatistic);
}
public static void incrementStatistic(ServerStatsCounter manager, Statistic statistic, Material material, int amount, ServerPlayer player) {
Preconditions.checkArgument(amount > 0, "Amount must be greater than 0");
setStatistic(manager, statistic, material, getStatistic(manager, statistic, material) + amount, player);
}
public static void decrementStatistic(ServerStatsCounter manager, Statistic statistic, Material material, int amount, ServerPlayer player) {
Preconditions.checkArgument(amount > 0, "Amount must be greater than 0");
setStatistic(manager, statistic, material, getStatistic(manager, statistic, material) - amount, player);
}
public static void setStatistic(ServerStatsCounter manager, Statistic statistic, Material material, int newValue, ServerPlayer player) {
Preconditions.checkArgument(statistic != null, "Statistic cannot be null");
Preconditions.checkArgument(material != null, "Material cannot be null");
Preconditions.checkArgument(newValue >= 0, "Value must be greater than or equal to 0");
Preconditions.checkArgument(statistic.getType() == Type.BLOCK || statistic.getType() == Type.ITEM, "This statistic does not take a Material parameter");
net.minecraft.stats.Stat nmsStatistic = CraftStatistic.getMaterialStatistic(statistic, material);
Preconditions.checkArgument(nmsStatistic != null, "The supplied Material %s does not have a corresponding statistic", material);
manager.setValue(null, nmsStatistic, newValue);
// Update scoreboards
if (player != null) {
player.level().getCraftServer().getScoreboardManager().forAllObjectives(nmsStatistic, player, score -> {
score.set(newValue);
});
}
}
public static void incrementStatistic(ServerStatsCounter manager, Statistic statistic, EntityType entityType, ServerPlayer player) {
incrementStatistic(manager, statistic, entityType, 1, player);
}
public static void decrementStatistic(ServerStatsCounter manager, Statistic statistic, EntityType entityType, ServerPlayer player) {
decrementStatistic(manager, statistic, entityType, 1, player);
}
public static int getStatistic(ServerStatsCounter manager, Statistic statistic, EntityType entityType) {
Preconditions.checkArgument(statistic != null, "Statistic cannot be null");
Preconditions.checkArgument(entityType != null, "EntityType cannot be null");
Preconditions.checkArgument(statistic.getType() == Type.ENTITY, "This statistic does not take an EntityType parameter");
net.minecraft.stats.Stat nmsStatistic = CraftStatistic.getEntityStatistic(statistic, entityType);
Preconditions.checkArgument(nmsStatistic != null, "The supplied EntityType %s does not have a corresponding statistic", entityType);
return manager.getValue(nmsStatistic);
}
public static void incrementStatistic(ServerStatsCounter manager, Statistic statistic, EntityType entityType, int amount, ServerPlayer player) {
Preconditions.checkArgument(amount > 0, "Amount must be greater than 0");
setStatistic(manager, statistic, entityType, getStatistic(manager, statistic, entityType) + amount, player);
}
public static void decrementStatistic(ServerStatsCounter manager, Statistic statistic, EntityType entityType, int amount, ServerPlayer player) {
Preconditions.checkArgument(amount > 0, "Amount must be greater than 0");
setStatistic(manager, statistic, entityType, getStatistic(manager, statistic, entityType) - amount, player);
}
public static void setStatistic(ServerStatsCounter manager, Statistic statistic, EntityType entityType, int newValue, ServerPlayer player) {
Preconditions.checkArgument(statistic != null, "Statistic cannot be null");
Preconditions.checkArgument(entityType != null, "EntityType cannot be null");
Preconditions.checkArgument(newValue >= 0, "Value must be greater than or equal to 0");
Preconditions.checkArgument(statistic.getType() == Type.ENTITY, "This statistic does not take an EntityType parameter");
net.minecraft.stats.Stat nmsStatistic = CraftStatistic.getEntityStatistic(statistic, entityType);
Preconditions.checkArgument(nmsStatistic != null, "The supplied EntityType %s does not have a corresponding statistic", entityType);
manager.setValue(null, nmsStatistic, newValue);
// Update scoreboards
if (player != null) {
player.level().getCraftServer().getScoreboardManager().forAllObjectives(nmsStatistic, player, score -> {
score.set(newValue);
});
}
}
}

View file

@ -0,0 +1,334 @@
package org.bukkit.craftbukkit.block;
import com.google.common.base.Preconditions;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.function.BiFunction;
import javax.annotation.Nullable;
import net.minecraft.core.BlockPos;
import net.minecraft.core.RegistryAccess;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.server.MinecraftServer;
import net.minecraft.world.level.LevelAccessor;
import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.block.entity.BannerBlockEntity;
import net.minecraft.world.level.block.entity.BarrelBlockEntity;
import net.minecraft.world.level.block.entity.BeaconBlockEntity;
import net.minecraft.world.level.block.entity.BedBlockEntity;
import net.minecraft.world.level.block.entity.BeehiveBlockEntity;
import net.minecraft.world.level.block.entity.BellBlockEntity;
import net.minecraft.world.level.block.entity.BlastFurnaceBlockEntity;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.entity.BlockEntityType; // Paper
import net.minecraft.world.level.block.entity.BrewingStandBlockEntity;
import net.minecraft.world.level.block.entity.BrushableBlockEntity;
import net.minecraft.world.level.block.entity.CalibratedSculkSensorBlockEntity;
import net.minecraft.world.level.block.entity.CampfireBlockEntity;
import net.minecraft.world.level.block.entity.ChestBlockEntity;
import net.minecraft.world.level.block.entity.ChiseledBookShelfBlockEntity;
import net.minecraft.world.level.block.entity.CommandBlockEntity;
import net.minecraft.world.level.block.entity.ComparatorBlockEntity;
import net.minecraft.world.level.block.entity.ConduitBlockEntity;
import net.minecraft.world.level.block.entity.CrafterBlockEntity;
import net.minecraft.world.level.block.entity.DaylightDetectorBlockEntity;
import net.minecraft.world.level.block.entity.DecoratedPotBlockEntity;
import net.minecraft.world.level.block.entity.DispenserBlockEntity;
import net.minecraft.world.level.block.entity.DropperBlockEntity;
import net.minecraft.world.level.block.entity.EnchantingTableBlockEntity;
import net.minecraft.world.level.block.entity.EnderChestBlockEntity;
import net.minecraft.world.level.block.entity.FurnaceBlockEntity;
import net.minecraft.world.level.block.entity.HangingSignBlockEntity;
import net.minecraft.world.level.block.entity.HopperBlockEntity;
import net.minecraft.world.level.block.entity.JigsawBlockEntity;
import net.minecraft.world.level.block.entity.JukeboxBlockEntity;
import net.minecraft.world.level.block.entity.LecternBlockEntity;
import net.minecraft.world.level.block.entity.SculkCatalystBlockEntity;
import net.minecraft.world.level.block.entity.SculkSensorBlockEntity;
import net.minecraft.world.level.block.entity.SculkShriekerBlockEntity;
import net.minecraft.world.level.block.entity.ShulkerBoxBlockEntity;
import net.minecraft.world.level.block.entity.SignBlockEntity;
import net.minecraft.world.level.block.entity.SkullBlockEntity;
import net.minecraft.world.level.block.entity.SmokerBlockEntity;
import net.minecraft.world.level.block.entity.SpawnerBlockEntity;
import net.minecraft.world.level.block.entity.StructureBlockEntity;
import net.minecraft.world.level.block.entity.TheEndGatewayBlockEntity;
import net.minecraft.world.level.block.entity.TheEndPortalBlockEntity;
import net.minecraft.world.level.block.entity.TrappedChestBlockEntity;
import net.minecraft.world.level.block.entity.TrialSpawnerBlockEntity;
import net.minecraft.world.level.block.entity.vault.VaultBlockEntity;
import net.minecraft.world.level.block.piston.PistonMovingBlockEntity;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.block.BlockState;
import org.bukkit.craftbukkit.CraftWorld;
public final class CraftBlockStates {
private abstract static class BlockStateFactory<B extends CraftBlockState> {
public final Class<B> blockStateType;
public BlockStateFactory(Class<B> blockStateType) {
this.blockStateType = blockStateType;
}
// The given world can be null for unplaced BlockStates.
// If the world is not null and the given block data is a tile entity, the given tile entity is expected to not be null.
// Otherwise, the given tile entity may or may not be null.
// If the given tile entity is not null, its position and block data are expected to match the given block position and block data.
// In some situations, such as during chunk generation, the tile entity's world may be null, even if the given world is not null.
// If the tile entity's world is not null, it is expected to match the given world.
public abstract B createBlockState(World world, BlockPos blockPosition, net.minecraft.world.level.block.state.BlockState blockData, BlockEntity tileEntity);
}
private static class BlockEntityStateFactory<T extends BlockEntity, B extends CraftBlockEntityState<T>> extends BlockStateFactory<B> {
private final BiFunction<World, T, B> blockStateConstructor;
private final BlockEntityType<? extends T> tileEntityConstructor; // Paper
protected BlockEntityStateFactory(Class<B> blockStateType, BiFunction<World, T, B> blockStateConstructor, BlockEntityType<? extends T> tileEntityConstructor) { // Paper
super(blockStateType);
this.blockStateConstructor = blockStateConstructor;
this.tileEntityConstructor = tileEntityConstructor;
}
@Override
public final B createBlockState(World world, BlockPos blockPosition, net.minecraft.world.level.block.state.BlockState blockData, BlockEntity tileEntity) {
if (world != null) {
Preconditions.checkState(tileEntity != null, "Tile is null, asynchronous access? %s", CraftBlock.at(((CraftWorld) world).getHandle(), blockPosition));
} else if (tileEntity == null) {
tileEntity = this.createTileEntity(blockPosition, blockData);
}
return this.createBlockState(world, (T) tileEntity);
}
private T createTileEntity(BlockPos blockPosition, net.minecraft.world.level.block.state.BlockState blockData) {
return this.tileEntityConstructor.create(blockPosition, blockData); // Paper
}
private B createBlockState(World world, T tileEntity) {
return this.blockStateConstructor.apply(world, tileEntity);
}
}
private static final Map<Material, BlockStateFactory<?>> FACTORIES = new HashMap<>();
private static final BlockStateFactory<?> DEFAULT_FACTORY = new BlockStateFactory<CraftBlockState>(CraftBlockState.class) {
@Override
public CraftBlockState createBlockState(World world, BlockPos blockPosition, net.minecraft.world.level.block.state.BlockState blockData, BlockEntity tileEntity) {
// Paper - revert upstream's revert of the block state changes. Block entities that have already had the block type set to AIR are still valid, upstream decided to ignore them
Preconditions.checkState(tileEntity == null, "Unexpected BlockState for %s", CraftBlockType.minecraftToBukkit(blockData.getBlock()));
return new CraftBlockState(world, blockPosition, blockData);
}
};
// Paper start
private static final Map<BlockEntityType<?>, BlockStateFactory<?>> FACTORIES_BY_BLOCK_ENTITY_TYPE = new HashMap<>();
private static void register(BlockEntityType<?> type, BlockStateFactory<?> factory) {
FACTORIES_BY_BLOCK_ENTITY_TYPE.put(type, factory);
}
// Paper end
static {
// Paper start - Generated/CraftBlockEntityStates
// @GeneratedFrom 1.21.1
register(BlockEntityType.BANNER, CraftBanner.class, CraftBanner::new);
register(BlockEntityType.BARREL, CraftBarrel.class, CraftBarrel::new);
register(BlockEntityType.BEACON, CraftBeacon.class, CraftBeacon::new);
register(BlockEntityType.BED, CraftBed.class, CraftBed::new);
register(BlockEntityType.BEEHIVE, CraftBeehive.class, CraftBeehive::new);
register(BlockEntityType.BELL, CraftBell.class, CraftBell::new);
register(BlockEntityType.BLAST_FURNACE, CraftBlastFurnace.class, CraftBlastFurnace::new);
register(BlockEntityType.BREWING_STAND, CraftBrewingStand.class, CraftBrewingStand::new);
register(BlockEntityType.BRUSHABLE_BLOCK, CraftBrushableBlock.class, CraftBrushableBlock::new);
register(BlockEntityType.CALIBRATED_SCULK_SENSOR, CraftCalibratedSculkSensor.class, CraftCalibratedSculkSensor::new);
register(BlockEntityType.CAMPFIRE, CraftCampfire.class, CraftCampfire::new);
register(BlockEntityType.CHEST, CraftChest.class, CraftChest::new);
register(BlockEntityType.CHISELED_BOOKSHELF, CraftChiseledBookshelf.class, CraftChiseledBookshelf::new);
register(BlockEntityType.COMMAND_BLOCK, CraftCommandBlock.class, CraftCommandBlock::new);
register(BlockEntityType.COMPARATOR, CraftComparator.class, CraftComparator::new);
register(BlockEntityType.CONDUIT, CraftConduit.class, CraftConduit::new);
register(BlockEntityType.CRAFTER, CraftCrafter.class, CraftCrafter::new);
register(BlockEntityType.DAYLIGHT_DETECTOR, CraftDaylightDetector.class, CraftDaylightDetector::new);
register(BlockEntityType.DECORATED_POT, CraftDecoratedPot.class, CraftDecoratedPot::new);
register(BlockEntityType.DISPENSER, CraftDispenser.class, CraftDispenser::new);
register(BlockEntityType.DROPPER, CraftDropper.class, CraftDropper::new);
register(BlockEntityType.ENCHANTING_TABLE, CraftEnchantingTable.class, CraftEnchantingTable::new);
register(BlockEntityType.END_GATEWAY, CraftEndGateway.class, CraftEndGateway::new);
register(BlockEntityType.END_PORTAL, CraftEndPortal.class, CraftEndPortal::new);
register(BlockEntityType.ENDER_CHEST, CraftEnderChest.class, CraftEnderChest::new);
register(BlockEntityType.FURNACE, CraftFurnaceFurnace.class, CraftFurnaceFurnace::new);
register(BlockEntityType.HANGING_SIGN, CraftHangingSign.class, CraftHangingSign::new);
register(BlockEntityType.HOPPER, CraftHopper.class, CraftHopper::new);
register(BlockEntityType.JIGSAW, CraftJigsaw.class, CraftJigsaw::new);
register(BlockEntityType.JUKEBOX, CraftJukebox.class, CraftJukebox::new);
register(BlockEntityType.LECTERN, CraftLectern.class, CraftLectern::new);
register(BlockEntityType.MOB_SPAWNER, CraftCreatureSpawner.class, CraftCreatureSpawner::new);
register(BlockEntityType.PISTON, CraftMovingPiston.class, CraftMovingPiston::new);
register(BlockEntityType.SCULK_CATALYST, CraftSculkCatalyst.class, CraftSculkCatalyst::new);
register(BlockEntityType.SCULK_SENSOR, CraftSculkSensor.class, CraftSculkSensor::new);
register(BlockEntityType.SCULK_SHRIEKER, CraftSculkShrieker.class, CraftSculkShrieker::new);
register(BlockEntityType.SHULKER_BOX, CraftShulkerBox.class, CraftShulkerBox::new);
register(BlockEntityType.SIGN, CraftSign.class, CraftSign::new);
register(BlockEntityType.SKULL, CraftSkull.class, CraftSkull::new);
register(BlockEntityType.SMOKER, CraftSmoker.class, CraftSmoker::new);
register(BlockEntityType.STRUCTURE_BLOCK, CraftStructureBlock.class, CraftStructureBlock::new);
register(BlockEntityType.TRAPPED_CHEST, CraftChest.class, CraftChest::new);
register(BlockEntityType.TRIAL_SPAWNER, CraftTrialSpawner.class, CraftTrialSpawner::new);
register(BlockEntityType.VAULT, CraftVault.class, CraftVault::new);
// Paper end - Generated/CraftBlockEntityStates
}
private static void register(Material blockType, BlockStateFactory<?> factory) {
CraftBlockStates.FACTORIES.put(blockType, factory);
}
private static <T extends BlockEntity, B extends CraftBlockEntityState<T>> void register(
net.minecraft.world.level.block.entity.BlockEntityType<? extends T> blockEntityType, // Paper
Class<B> blockStateType,
BiFunction<World, T, B> blockStateConstructor // Paper
) {
// Paper start
BlockStateFactory<B> factory = new BlockEntityStateFactory<>(blockStateType, blockStateConstructor, blockEntityType); // Paper
for (net.minecraft.world.level.block.Block block : blockEntityType.validBlocks) {
CraftBlockStates.register(CraftBlockType.minecraftToBukkit(block), factory);
}
CraftBlockStates.register(blockEntityType, factory);
// Paper end
}
private static BlockStateFactory<?> getFactory(Material material) {
return CraftBlockStates.FACTORIES.getOrDefault(material, CraftBlockStates.DEFAULT_FACTORY);
}
// Paper start
private static BlockStateFactory<?> getFactory(Material material, BlockEntityType<?> type) {
if (type != null) {
return CraftBlockStates.FACTORIES_BY_BLOCK_ENTITY_TYPE.getOrDefault(type, getFactory(material));
} else {
return getFactory(material);
}
}
// Paper end
public static Class<? extends CraftBlockState> getBlockStateType(Material material) {
Preconditions.checkNotNull(material, "material is null");
return CraftBlockStates.getFactory(material).blockStateType;
}
public static BlockEntity createNewTileEntity(Material material) {
BlockStateFactory<?> factory = CraftBlockStates.getFactory(material);
if (factory instanceof BlockEntityStateFactory) {
return ((BlockEntityStateFactory<?, ?>) factory).createTileEntity(BlockPos.ZERO, CraftBlockType.bukkitToMinecraft(material).defaultBlockState());
}
return null;
}
// Paper start
public static Class<? extends CraftBlockState> getBlockStateType(BlockEntityType<?> blockEntityType) {
Preconditions.checkNotNull(blockEntityType, "blockEntityType is null");
return CraftBlockStates.getFactory(null, blockEntityType).blockStateType;
}
// Paper end
public static BlockState getBlockState(Block block) {
// Paper start
return CraftBlockStates.getBlockState(block, true);
}
public static BlockState getBlockState(Block block, boolean useSnapshot) {
// Paper end
Preconditions.checkNotNull(block, "block is null");
CraftBlock craftBlock = (CraftBlock) block;
CraftWorld world = (CraftWorld) block.getWorld();
BlockPos blockPosition = craftBlock.getPosition();
net.minecraft.world.level.block.state.BlockState blockData = craftBlock.getNMS();
BlockEntity tileEntity = craftBlock.getHandle().getBlockEntity(blockPosition);
// Paper start - block state snapshots
boolean prev = CraftBlockEntityState.DISABLE_SNAPSHOT;
CraftBlockEntityState.DISABLE_SNAPSHOT = !useSnapshot;
try {
// Paper end
CraftBlockState blockState = CraftBlockStates.getBlockState(world, blockPosition, blockData, tileEntity);
blockState.setWorldHandle(craftBlock.getHandle()); // Inject the block's generator access
return blockState;
// Paper start
} finally {
CraftBlockEntityState.DISABLE_SNAPSHOT = prev;
}
// Paper end
}
@Deprecated
public static BlockState getBlockState(BlockPos blockPosition, Material material, @Nullable CompoundTag blockEntityTag) {
return CraftBlockStates.getBlockState(MinecraftServer.getDefaultRegistryAccess(), blockPosition, material, blockEntityTag);
}
public static BlockState getBlockState(LevelReader world, BlockPos blockPosition, Material material, @Nullable CompoundTag blockEntityTag) {
return CraftBlockStates.getBlockState(world.registryAccess(), blockPosition, material, blockEntityTag);
}
public static BlockState getBlockState(RegistryAccess registry, BlockPos blockPosition, Material material, @Nullable CompoundTag blockEntityTag) {
Preconditions.checkNotNull(material, "material is null");
net.minecraft.world.level.block.state.BlockState blockData = CraftBlockType.bukkitToMinecraft(material).defaultBlockState();
return CraftBlockStates.getBlockState(registry, blockPosition, blockData, blockEntityTag);
}
@Deprecated
public static BlockState getBlockState(net.minecraft.world.level.block.state.BlockState blockData, @Nullable CompoundTag blockEntityTag) {
return CraftBlockStates.getBlockState(MinecraftServer.getDefaultRegistryAccess(), BlockPos.ZERO, blockData, blockEntityTag);
}
public static BlockState getBlockState(LevelReader world, BlockPos blockPosition, net.minecraft.world.level.block.state.BlockState blockData, @Nullable CompoundTag blockEntityTag) {
return CraftBlockStates.getBlockState(world.registryAccess(), blockPosition, blockData, blockEntityTag);
}
public static BlockState getBlockState(RegistryAccess registry, BlockPos blockPosition, net.minecraft.world.level.block.state.BlockState blockData, @Nullable CompoundTag blockEntityTag) {
Preconditions.checkNotNull(blockPosition, "blockPosition is null");
Preconditions.checkNotNull(blockData, "blockData is null");
BlockEntity tileEntity = (blockEntityTag == null) ? null : BlockEntity.loadStatic(blockPosition, blockData, blockEntityTag, registry);
return CraftBlockStates.getBlockState(null, blockPosition, blockData, tileEntity);
}
// See BlockStateFactory#createBlockState(World, BlockPosition, IBlockData, TileEntity)
public static CraftBlockState getBlockState(World world, BlockPos blockPosition, net.minecraft.world.level.block.state.BlockState blockData, BlockEntity tileEntity) {
Material material = CraftBlockType.minecraftToBukkit(blockData.getBlock());
BlockStateFactory<?> factory;
// For some types of TileEntity blocks (eg. moving pistons), Minecraft may in some situations (eg. when using Block#setType or the
// setBlock command) not create a corresponding TileEntity in the world. We return a normal BlockState in this case.
if (world != null && tileEntity == null && CraftBlockStates.isTileEntityOptional(material)) {
factory = CraftBlockStates.DEFAULT_FACTORY;
} else {
factory = CraftBlockStates.getFactory(material, tileEntity != null ? tileEntity.getType() : null); // Paper
}
return factory.createBlockState(world, blockPosition, blockData, tileEntity);
}
public static boolean isTileEntityOptional(Material material) {
return material == Material.MOVING_PISTON;
}
// This ignores tile entity data.
public static CraftBlockState getBlockState(LevelAccessor world, BlockPos pos) {
return new CraftBlockState(CraftBlock.at(world, pos));
}
// This ignores tile entity data.
public static CraftBlockState getBlockState(LevelAccessor world, BlockPos pos, int flag) {
return new CraftBlockState(CraftBlock.at(world, pos), flag);
}
// Paper start
@Nullable
public static BlockEntityType<?> getBlockEntityType(final Material material) {
final BlockStateFactory<?> factory = org.bukkit.craftbukkit.block.CraftBlockStates.FACTORIES.get(material);
return factory instanceof final BlockEntityStateFactory<?,?> blockEntityStateFactory ? blockEntityStateFactory.tileEntityConstructor : null;
}
// Paper end
private CraftBlockStates() {
}
}

View file

@ -0,0 +1,786 @@
package org.bukkit.craftbukkit.block.data;
import com.google.common.base.Function;
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableSet;
import com.mojang.brigadier.StringReader;
import com.mojang.brigadier.exceptions.CommandSyntaxException;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import net.minecraft.commands.arguments.blocks.BlockStateParser;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.util.StringRepresentable;
import net.minecraft.world.level.EmptyBlockGetter;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Rotation;
import net.minecraft.world.level.block.state.StateHolder;
import net.minecraft.world.level.block.state.properties.BooleanProperty;
import net.minecraft.world.level.block.state.properties.EnumProperty;
import net.minecraft.world.level.block.state.properties.IntegerProperty;
import net.minecraft.world.level.block.state.properties.Property;
import org.bukkit.Color;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.SoundGroup;
import org.bukkit.block.BlockFace;
import org.bukkit.block.BlockState;
import org.bukkit.block.BlockSupport;
import org.bukkit.block.BlockType;
import org.bukkit.block.PistonMoveReaction;
import org.bukkit.block.data.BlockData;
import org.bukkit.block.structure.Mirror;
import org.bukkit.block.structure.StructureRotation;
import org.bukkit.craftbukkit.CraftSoundGroup;
import org.bukkit.craftbukkit.CraftWorld;
import org.bukkit.craftbukkit.block.CraftBlock;
import org.bukkit.craftbukkit.block.CraftBlockStates;
import org.bukkit.craftbukkit.block.CraftBlockSupport;
import org.bukkit.craftbukkit.block.CraftBlockType;
import org.bukkit.craftbukkit.inventory.CraftItemStack;
import org.bukkit.craftbukkit.inventory.CraftItemType;
import org.bukkit.craftbukkit.util.CraftLocation;
import org.bukkit.inventory.ItemStack;
import org.jetbrains.annotations.NotNull;
public class CraftBlockData implements BlockData {
private net.minecraft.world.level.block.state.BlockState state;
private Map<Property<?>, Comparable<?>> parsedStates;
protected CraftBlockData() {
throw new AssertionError("Template Constructor");
}
protected CraftBlockData(net.minecraft.world.level.block.state.BlockState state) {
this.state = state;
}
@Override
public Material getMaterial() {
return this.state.getBukkitMaterial(); // Paper - optimise getType calls
}
public net.minecraft.world.level.block.state.BlockState getState() {
return this.state;
}
/**
* Get a given BlockStateEnum's value as its Bukkit counterpart.
*
* @param nms the NMS state to convert
* @param bukkit the Bukkit class
* @param <B> the type
* @return the matching Bukkit type
*/
protected <B extends Enum<B>> B get(EnumProperty<?> nms, Class<B> bukkit) {
return CraftBlockData.toBukkit(this.state.getValue(nms), bukkit);
}
/**
* Convert all values from the given BlockStateEnum to their appropriate
* Bukkit counterpart.
*
* @param nms the NMS state to get values from
* @param bukkit the bukkit class to convert the values to
* @param <B> the bukkit class type
* @return an immutable Set of values in their appropriate Bukkit type
*/
@SuppressWarnings("unchecked")
protected <B extends Enum<B>> Set<B> getValues(EnumProperty<?> nms, Class<B> bukkit) {
ImmutableSet.Builder<B> values = ImmutableSet.builder();
for (Enum<?> e : nms.getPossibleValues()) {
values.add(CraftBlockData.toBukkit(e, bukkit));
}
return values.build();
}
/**
* Set a given {@link EnumProperty} with the matching enum from Bukkit.
*
* @param nms the NMS BlockStateEnum to set
* @param bukkit the matching Bukkit Enum
* @param <B> the Bukkit type
* @param <N> the NMS type
*/
protected <B extends Enum<B>, N extends Enum<N> & StringRepresentable> void set(EnumProperty<N> nms, Enum<B> bukkit) {
this.parsedStates = null;
this.state = this.state.setValue(nms, CraftBlockData.toNMS(bukkit, nms.getValueClass()));
}
@Override
public BlockData merge(BlockData data) {
CraftBlockData craft = (CraftBlockData) data;
Preconditions.checkArgument(craft.parsedStates != null, "Data not created via string parsing");
Preconditions.checkArgument(this.state.getBlock() == craft.state.getBlock(), "States have different types (got %s, expected %s)", data, this);
CraftBlockData clone = (CraftBlockData) this.clone();
clone.parsedStates = null;
for (Property parsed : craft.parsedStates.keySet()) {
clone.state = clone.state.setValue(parsed, craft.state.getValue(parsed));
}
return clone;
}
@Override
public boolean matches(BlockData data) {
if (data == null) {
return false;
}
if (!(data instanceof CraftBlockData)) {
return false;
}
CraftBlockData craft = (CraftBlockData) data;
if (this.state.getBlock() != craft.state.getBlock()) {
return false;
}
// Fastpath an exact match
boolean exactMatch = this.equals(data);
// If that failed, do a merge and check
if (!exactMatch && craft.parsedStates != null) {
return this.merge(data).equals(this);
}
return exactMatch;
}
private static final Map<Class<? extends Enum<?>>, Enum<?>[]> ENUM_VALUES = new java.util.concurrent.ConcurrentHashMap<>(); // Paper - cache block data strings; make thread safe
/**
* Convert an NMS Enum (usually a BlockStateEnum) to its appropriate Bukkit
* enum from the given class.
*
* @throws IllegalStateException if the Enum could not be converted
*/
@SuppressWarnings("unchecked")
private static <B extends Enum<B>> B toBukkit(Enum<?> nms, Class<B> bukkit) {
if (nms instanceof Direction) {
return (B) CraftBlock.notchToBlockFace((Direction) nms);
}
return (B) CraftBlockData.ENUM_VALUES.computeIfAbsent(bukkit, Class::getEnumConstants)[nms.ordinal()];
}
/**
* Convert a given Bukkit enum to its matching NMS enum type.
*
* @param bukkit the Bukkit enum to convert
* @param nms the NMS class
* @return the matching NMS type
* @throws IllegalStateException if the Enum could not be converted
*/
@SuppressWarnings("unchecked")
public static <N extends Enum<N> & StringRepresentable> N toNMS(Enum<?> bukkit, Class<N> nms) {
if (bukkit instanceof BlockFace) {
return (N) CraftBlock.blockFaceToNotch((BlockFace) bukkit);
}
return (N) CraftBlockData.ENUM_VALUES.computeIfAbsent(nms, Class::getEnumConstants)[bukkit.ordinal()];
}
/**
* Get the current value of a given state.
*
* @param ibs the state to check
* @param <T> the type
* @return the current value of the given state
*/
protected <T extends Comparable<T>> T get(Property<T> ibs) {
// Straight integer or boolean getter
return this.state.getValue(ibs);
}
/**
* Set the specified state's value.
*
* @param ibs the state to set
* @param v the new value
* @param <T> the state's type
* @param <V> the value's type. Must match the state's type.
*/
public <T extends Comparable<T>, V extends T> void set(Property<T> ibs, V v) {
// Straight integer or boolean setter
this.parsedStates = null;
this.state = this.state.setValue(ibs, v);
}
@Override
public String getAsString() {
return this.toString(this.state.getValues());
}
@Override
public String getAsString(boolean hideUnspecified) {
return (hideUnspecified && this.parsedStates != null) ? this.toString(this.parsedStates) : this.getAsString();
}
@Override
public BlockData clone() {
try {
return (BlockData) super.clone();
} catch (CloneNotSupportedException ex) {
throw new AssertionError("Clone not supported", ex);
}
}
@Override
public String toString() {
return "CraftBlockData{" + this.getAsString() + "}";
}
// Mimicked from BlockDataAbstract#toString()
public String toString(Map<Property<?>, Comparable<?>> states) {
StringBuilder stateString = new StringBuilder(BuiltInRegistries.BLOCK.getKey(this.state.getBlock()).toString());
if (!states.isEmpty()) {
stateString.append('[');
stateString.append(states.entrySet().stream().map(StateHolder.PROPERTY_ENTRY_TO_STRING_FUNCTION).collect(Collectors.joining(",")));
stateString.append(']');
}
return stateString.toString();
}
public Map<String, String> toStates() {
Map<String, String> compound = new HashMap<>();
for (Map.Entry<Property<?>, Comparable<?>> entry : this.state.getValues().entrySet()) {
Property iblockstate = (Property) entry.getKey();
compound.put(iblockstate.getName(), iblockstate.getName(entry.getValue()));
}
return compound;
}
@Override
public boolean equals(Object obj) {
return obj instanceof CraftBlockData && this.state.equals(((CraftBlockData) obj).state);
}
@Override
public int hashCode() {
return this.state.hashCode();
}
protected static BooleanProperty getBoolean(String name) {
throw new AssertionError("Template Method");
}
protected static BooleanProperty getBoolean(String name, boolean optional) {
throw new AssertionError("Template Method");
}
protected static EnumProperty<?> getEnum(String name) {
throw new AssertionError("Template Method");
}
protected static IntegerProperty getInteger(String name) {
throw new AssertionError("Template Method");
}
protected static BooleanProperty getBoolean(Class<? extends Block> block, String name) {
return (BooleanProperty) CraftBlockData.getState(block, name, false);
}
protected static BooleanProperty getBoolean(Class<? extends Block> block, String name, boolean optional) {
return (BooleanProperty) CraftBlockData.getState(block, name, optional);
}
protected static EnumProperty<?> getEnum(Class<? extends Block> block, String name) {
return (EnumProperty<?>) CraftBlockData.getState(block, name, false);
}
protected static IntegerProperty getInteger(Class<? extends Block> block, String name) {
return (IntegerProperty) CraftBlockData.getState(block, name, false);
}
/**
* Get a specified {@link Property} from a given block's class with a
* given name
*
* @param block the class to retrieve the state from
* @param name the name of the state to retrieve
* @param optional if the state can be null
* @return the specified state or null
* @throws IllegalStateException if the state is null and {@code optional}
* is false.
*/
private static Property<?> getState(Class<? extends Block> block, String name, boolean optional) {
Property<?> state = null;
for (Block instance : BuiltInRegistries.BLOCK) {
if (instance.getClass() == block) {
if (state == null) {
state = instance.getStateDefinition().getProperty(name);
} else {
Property<?> newState = instance.getStateDefinition().getProperty(name);
Preconditions.checkState(state == newState, "State mistmatch %s,%s", state, newState);
}
}
}
Preconditions.checkState(optional || state != null, "Null state for %s,%s", block, name);
return state;
}
/**
* Get the minimum value allowed by the BlockStateInteger.
*
* @param state the state to check
* @return the minimum value allowed
*/
protected static int getMin(IntegerProperty state) {
return state.min;
}
/**
* Get the maximum value allowed by the BlockStateInteger.
*
* @param state the state to check
* @return the maximum value allowed
*/
protected static int getMax(IntegerProperty state) {
return state.max;
}
public static final BlockFace[] ROTATION_CYCLE = {
BlockFace.SOUTH, BlockFace.SOUTH_SOUTH_WEST, BlockFace.SOUTH_WEST, BlockFace.WEST_SOUTH_WEST,
BlockFace.WEST, BlockFace.WEST_NORTH_WEST, BlockFace.NORTH_WEST, BlockFace.NORTH_NORTH_WEST,
BlockFace.NORTH, BlockFace.NORTH_NORTH_EAST, BlockFace.NORTH_EAST, BlockFace.EAST_NORTH_EAST,
BlockFace.EAST, BlockFace.EAST_SOUTH_EAST, BlockFace.SOUTH_EAST, BlockFace.SOUTH_SOUTH_EAST
};
//
private static final Map<Class<? extends Block>, Function<net.minecraft.world.level.block.state.BlockState, CraftBlockData>> MAP = new HashMap<>();
static {
//<editor-fold desc="CraftBlockData Registration" defaultstate="collapsed">
// Paper start - Generated/CraftBlockData#MAP
// @GeneratedFrom 1.21.1
register(net.minecraft.world.level.block.AmethystClusterBlock.class, org.bukkit.craftbukkit.block.impl.CraftAmethystCluster::new);
register(net.minecraft.world.level.block.AnvilBlock.class, org.bukkit.craftbukkit.block.impl.CraftAnvil::new);
register(net.minecraft.world.level.block.AttachedStemBlock.class, org.bukkit.craftbukkit.block.impl.CraftAttachedStem::new);
register(net.minecraft.world.level.block.BambooStalkBlock.class, org.bukkit.craftbukkit.block.impl.CraftBambooStalk::new);
register(net.minecraft.world.level.block.BannerBlock.class, org.bukkit.craftbukkit.block.impl.CraftBanner::new);
register(net.minecraft.world.level.block.BarrelBlock.class, org.bukkit.craftbukkit.block.impl.CraftBarrel::new);
register(net.minecraft.world.level.block.BarrierBlock.class, org.bukkit.craftbukkit.block.impl.CraftBarrier::new);
register(net.minecraft.world.level.block.BaseCoralFanBlock.class, org.bukkit.craftbukkit.block.impl.CraftBaseCoralFan::new);
register(net.minecraft.world.level.block.BaseCoralPlantBlock.class, org.bukkit.craftbukkit.block.impl.CraftBaseCoralPlant::new);
register(net.minecraft.world.level.block.BaseCoralWallFanBlock.class, org.bukkit.craftbukkit.block.impl.CraftBaseCoralWallFan::new);
register(net.minecraft.world.level.block.BedBlock.class, org.bukkit.craftbukkit.block.impl.CraftBed::new);
register(net.minecraft.world.level.block.BeehiveBlock.class, org.bukkit.craftbukkit.block.impl.CraftBeehive::new);
register(net.minecraft.world.level.block.BeetrootBlock.class, org.bukkit.craftbukkit.block.impl.CraftBeetroot::new);
register(net.minecraft.world.level.block.BellBlock.class, org.bukkit.craftbukkit.block.impl.CraftBell::new);
register(net.minecraft.world.level.block.BigDripleafBlock.class, org.bukkit.craftbukkit.block.impl.CraftBigDripleaf::new);
register(net.minecraft.world.level.block.BigDripleafStemBlock.class, org.bukkit.craftbukkit.block.impl.CraftBigDripleafStem::new);
register(net.minecraft.world.level.block.BlastFurnaceBlock.class, org.bukkit.craftbukkit.block.impl.CraftBlastFurnace::new);
register(net.minecraft.world.level.block.BrewingStandBlock.class, org.bukkit.craftbukkit.block.impl.CraftBrewingStand::new);
register(net.minecraft.world.level.block.BrushableBlock.class, org.bukkit.craftbukkit.block.impl.CraftBrushable::new);
register(net.minecraft.world.level.block.BubbleColumnBlock.class, org.bukkit.craftbukkit.block.impl.CraftBubbleColumn::new);
register(net.minecraft.world.level.block.ButtonBlock.class, org.bukkit.craftbukkit.block.impl.CraftButton::new);
register(net.minecraft.world.level.block.CactusBlock.class, org.bukkit.craftbukkit.block.impl.CraftCactus::new);
register(net.minecraft.world.level.block.CakeBlock.class, org.bukkit.craftbukkit.block.impl.CraftCake::new);
register(net.minecraft.world.level.block.CalibratedSculkSensorBlock.class, org.bukkit.craftbukkit.block.impl.CraftCalibratedSculkSensor::new);
register(net.minecraft.world.level.block.CampfireBlock.class, org.bukkit.craftbukkit.block.impl.CraftCampfire::new);
register(net.minecraft.world.level.block.CandleBlock.class, org.bukkit.craftbukkit.block.impl.CraftCandle::new);
register(net.minecraft.world.level.block.CandleCakeBlock.class, org.bukkit.craftbukkit.block.impl.CraftCandleCake::new);
register(net.minecraft.world.level.block.CarrotBlock.class, org.bukkit.craftbukkit.block.impl.CraftCarrot::new);
register(net.minecraft.world.level.block.CarvedPumpkinBlock.class, org.bukkit.craftbukkit.block.impl.CraftCarvedPumpkin::new);
register(net.minecraft.world.level.block.CaveVinesBlock.class, org.bukkit.craftbukkit.block.impl.CraftCaveVines::new);
register(net.minecraft.world.level.block.CaveVinesPlantBlock.class, org.bukkit.craftbukkit.block.impl.CraftCaveVinesPlant::new);
register(net.minecraft.world.level.block.CeilingHangingSignBlock.class, org.bukkit.craftbukkit.block.impl.CraftCeilingHangingSign::new);
register(net.minecraft.world.level.block.ChainBlock.class, org.bukkit.craftbukkit.block.impl.CraftChain::new);
register(net.minecraft.world.level.block.CherryLeavesBlock.class, org.bukkit.craftbukkit.block.impl.CraftCherryLeaves::new);
register(net.minecraft.world.level.block.ChestBlock.class, org.bukkit.craftbukkit.block.impl.CraftChest::new);
register(net.minecraft.world.level.block.ChiseledBookShelfBlock.class, org.bukkit.craftbukkit.block.impl.CraftChiseledBookShelf::new);
register(net.minecraft.world.level.block.ChorusFlowerBlock.class, org.bukkit.craftbukkit.block.impl.CraftChorusFlower::new);
register(net.minecraft.world.level.block.ChorusPlantBlock.class, org.bukkit.craftbukkit.block.impl.CraftChorusPlant::new);
register(net.minecraft.world.level.block.CocoaBlock.class, org.bukkit.craftbukkit.block.impl.CraftCocoa::new);
register(net.minecraft.world.level.block.CommandBlock.class, org.bukkit.craftbukkit.block.impl.CraftCommandBlock::new);
register(net.minecraft.world.level.block.ComparatorBlock.class, org.bukkit.craftbukkit.block.impl.CraftComparator::new);
register(net.minecraft.world.level.block.ComposterBlock.class, org.bukkit.craftbukkit.block.impl.CraftComposter::new);
register(net.minecraft.world.level.block.ConduitBlock.class, org.bukkit.craftbukkit.block.impl.CraftConduit::new);
register(net.minecraft.world.level.block.CopperBulbBlock.class, org.bukkit.craftbukkit.block.impl.CraftCopperBulb::new);
register(net.minecraft.world.level.block.CoralFanBlock.class, org.bukkit.craftbukkit.block.impl.CraftCoralFan::new);
register(net.minecraft.world.level.block.CoralPlantBlock.class, org.bukkit.craftbukkit.block.impl.CraftCoralPlant::new);
register(net.minecraft.world.level.block.CoralWallFanBlock.class, org.bukkit.craftbukkit.block.impl.CraftCoralWallFan::new);
register(net.minecraft.world.level.block.CrafterBlock.class, org.bukkit.craftbukkit.block.impl.CraftCrafter::new);
register(net.minecraft.world.level.block.CropBlock.class, org.bukkit.craftbukkit.block.impl.CraftCrop::new);
register(net.minecraft.world.level.block.DaylightDetectorBlock.class, org.bukkit.craftbukkit.block.impl.CraftDaylightDetector::new);
register(net.minecraft.world.level.block.DecoratedPotBlock.class, org.bukkit.craftbukkit.block.impl.CraftDecoratedPot::new);
register(net.minecraft.world.level.block.DetectorRailBlock.class, org.bukkit.craftbukkit.block.impl.CraftDetectorRail::new);
register(net.minecraft.world.level.block.DispenserBlock.class, org.bukkit.craftbukkit.block.impl.CraftDispenser::new);
register(net.minecraft.world.level.block.DoorBlock.class, org.bukkit.craftbukkit.block.impl.CraftDoor::new);
register(net.minecraft.world.level.block.DoublePlantBlock.class, org.bukkit.craftbukkit.block.impl.CraftDoublePlant::new);
register(net.minecraft.world.level.block.DropperBlock.class, org.bukkit.craftbukkit.block.impl.CraftDropper::new);
register(net.minecraft.world.level.block.EndPortalFrameBlock.class, org.bukkit.craftbukkit.block.impl.CraftEndPortalFrame::new);
register(net.minecraft.world.level.block.EndRodBlock.class, org.bukkit.craftbukkit.block.impl.CraftEndRod::new);
register(net.minecraft.world.level.block.EnderChestBlock.class, org.bukkit.craftbukkit.block.impl.CraftEnderChest::new);
register(net.minecraft.world.level.block.EquipableCarvedPumpkinBlock.class, org.bukkit.craftbukkit.block.impl.CraftEquipableCarvedPumpkin::new);
register(net.minecraft.world.level.block.FarmBlock.class, org.bukkit.craftbukkit.block.impl.CraftFarm::new);
register(net.minecraft.world.level.block.FenceBlock.class, org.bukkit.craftbukkit.block.impl.CraftFence::new);
register(net.minecraft.world.level.block.FenceGateBlock.class, org.bukkit.craftbukkit.block.impl.CraftFenceGate::new);
register(net.minecraft.world.level.block.FireBlock.class, org.bukkit.craftbukkit.block.impl.CraftFire::new);
register(net.minecraft.world.level.block.FrostedIceBlock.class, org.bukkit.craftbukkit.block.impl.CraftFrostedIce::new);
register(net.minecraft.world.level.block.FurnaceBlock.class, org.bukkit.craftbukkit.block.impl.CraftFurnace::new);
register(net.minecraft.world.level.block.GlazedTerracottaBlock.class, org.bukkit.craftbukkit.block.impl.CraftGlazedTerracotta::new);
register(net.minecraft.world.level.block.GlowLichenBlock.class, org.bukkit.craftbukkit.block.impl.CraftGlowLichen::new);
register(net.minecraft.world.level.block.GrassBlock.class, org.bukkit.craftbukkit.block.impl.CraftGrass::new);
register(net.minecraft.world.level.block.GrindstoneBlock.class, org.bukkit.craftbukkit.block.impl.CraftGrindstone::new);
register(net.minecraft.world.level.block.HangingRootsBlock.class, org.bukkit.craftbukkit.block.impl.CraftHangingRoots::new);
register(net.minecraft.world.level.block.HayBlock.class, org.bukkit.craftbukkit.block.impl.CraftHay::new);
register(net.minecraft.world.level.block.HeavyCoreBlock.class, org.bukkit.craftbukkit.block.impl.CraftHeavyCore::new);
register(net.minecraft.world.level.block.HopperBlock.class, org.bukkit.craftbukkit.block.impl.CraftHopper::new);
register(net.minecraft.world.level.block.HugeMushroomBlock.class, org.bukkit.craftbukkit.block.impl.CraftHugeMushroom::new);
register(net.minecraft.world.level.block.InfestedRotatedPillarBlock.class, org.bukkit.craftbukkit.block.impl.CraftInfestedRotatedPillar::new);
register(net.minecraft.world.level.block.IronBarsBlock.class, org.bukkit.craftbukkit.block.impl.CraftIronBars::new);
register(net.minecraft.world.level.block.JigsawBlock.class, org.bukkit.craftbukkit.block.impl.CraftJigsaw::new);
register(net.minecraft.world.level.block.JukeboxBlock.class, org.bukkit.craftbukkit.block.impl.CraftJukebox::new);
register(net.minecraft.world.level.block.KelpBlock.class, org.bukkit.craftbukkit.block.impl.CraftKelp::new);
register(net.minecraft.world.level.block.LadderBlock.class, org.bukkit.craftbukkit.block.impl.CraftLadder::new);
register(net.minecraft.world.level.block.LanternBlock.class, org.bukkit.craftbukkit.block.impl.CraftLantern::new);
register(net.minecraft.world.level.block.LayeredCauldronBlock.class, org.bukkit.craftbukkit.block.impl.CraftLayeredCauldron::new);
register(net.minecraft.world.level.block.LeavesBlock.class, org.bukkit.craftbukkit.block.impl.CraftLeaves::new);
register(net.minecraft.world.level.block.LecternBlock.class, org.bukkit.craftbukkit.block.impl.CraftLectern::new);
register(net.minecraft.world.level.block.LeverBlock.class, org.bukkit.craftbukkit.block.impl.CraftLever::new);
register(net.minecraft.world.level.block.LightBlock.class, org.bukkit.craftbukkit.block.impl.CraftLight::new);
register(net.minecraft.world.level.block.LightningRodBlock.class, org.bukkit.craftbukkit.block.impl.CraftLightningRod::new);
register(net.minecraft.world.level.block.LiquidBlock.class, org.bukkit.craftbukkit.block.impl.CraftLiquid::new);
register(net.minecraft.world.level.block.LoomBlock.class, org.bukkit.craftbukkit.block.impl.CraftLoom::new);
register(net.minecraft.world.level.block.MangroveLeavesBlock.class, org.bukkit.craftbukkit.block.impl.CraftMangroveLeaves::new);
register(net.minecraft.world.level.block.MangrovePropaguleBlock.class, org.bukkit.craftbukkit.block.impl.CraftMangrovePropagule::new);
register(net.minecraft.world.level.block.MangroveRootsBlock.class, org.bukkit.craftbukkit.block.impl.CraftMangroveRoots::new);
register(net.minecraft.world.level.block.MyceliumBlock.class, org.bukkit.craftbukkit.block.impl.CraftMycelium::new);
register(net.minecraft.world.level.block.NetherPortalBlock.class, org.bukkit.craftbukkit.block.impl.CraftNetherPortal::new);
register(net.minecraft.world.level.block.NetherWartBlock.class, org.bukkit.craftbukkit.block.impl.CraftNetherWart::new);
register(net.minecraft.world.level.block.NoteBlock.class, org.bukkit.craftbukkit.block.impl.CraftNoteBlock::new);
register(net.minecraft.world.level.block.ObserverBlock.class, org.bukkit.craftbukkit.block.impl.CraftObserver::new);
register(net.minecraft.world.level.block.PiglinWallSkullBlock.class, org.bukkit.craftbukkit.block.impl.CraftPiglinWallSkull::new);
register(net.minecraft.world.level.block.PinkPetalsBlock.class, org.bukkit.craftbukkit.block.impl.CraftPinkPetals::new);
register(net.minecraft.world.level.block.PitcherCropBlock.class, org.bukkit.craftbukkit.block.impl.CraftPitcherCrop::new);
register(net.minecraft.world.level.block.PlayerHeadBlock.class, org.bukkit.craftbukkit.block.impl.CraftPlayerHead::new);
register(net.minecraft.world.level.block.PlayerWallHeadBlock.class, org.bukkit.craftbukkit.block.impl.CraftPlayerWallHead::new);
register(net.minecraft.world.level.block.PointedDripstoneBlock.class, org.bukkit.craftbukkit.block.impl.CraftPointedDripstone::new);
register(net.minecraft.world.level.block.PotatoBlock.class, org.bukkit.craftbukkit.block.impl.CraftPotato::new);
register(net.minecraft.world.level.block.PoweredRailBlock.class, org.bukkit.craftbukkit.block.impl.CraftPoweredRail::new);
register(net.minecraft.world.level.block.PressurePlateBlock.class, org.bukkit.craftbukkit.block.impl.CraftPressurePlate::new);
register(net.minecraft.world.level.block.RailBlock.class, org.bukkit.craftbukkit.block.impl.CraftRail::new);
register(net.minecraft.world.level.block.RedStoneOreBlock.class, org.bukkit.craftbukkit.block.impl.CraftRedStoneOre::new);
register(net.minecraft.world.level.block.RedStoneWireBlock.class, org.bukkit.craftbukkit.block.impl.CraftRedStoneWire::new);
register(net.minecraft.world.level.block.RedstoneLampBlock.class, org.bukkit.craftbukkit.block.impl.CraftRedstoneLamp::new);
register(net.minecraft.world.level.block.RedstoneTorchBlock.class, org.bukkit.craftbukkit.block.impl.CraftRedstoneTorch::new);
register(net.minecraft.world.level.block.RedstoneWallTorchBlock.class, org.bukkit.craftbukkit.block.impl.CraftRedstoneWallTorch::new);
register(net.minecraft.world.level.block.RepeaterBlock.class, org.bukkit.craftbukkit.block.impl.CraftRepeater::new);
register(net.minecraft.world.level.block.RespawnAnchorBlock.class, org.bukkit.craftbukkit.block.impl.CraftRespawnAnchor::new);
register(net.minecraft.world.level.block.RotatedPillarBlock.class, org.bukkit.craftbukkit.block.impl.CraftRotatedPillar::new);
register(net.minecraft.world.level.block.SaplingBlock.class, org.bukkit.craftbukkit.block.impl.CraftSapling::new);
register(net.minecraft.world.level.block.ScaffoldingBlock.class, org.bukkit.craftbukkit.block.impl.CraftScaffolding::new);
register(net.minecraft.world.level.block.SculkCatalystBlock.class, org.bukkit.craftbukkit.block.impl.CraftSculkCatalyst::new);
register(net.minecraft.world.level.block.SculkSensorBlock.class, org.bukkit.craftbukkit.block.impl.CraftSculkSensor::new);
register(net.minecraft.world.level.block.SculkShriekerBlock.class, org.bukkit.craftbukkit.block.impl.CraftSculkShrieker::new);
register(net.minecraft.world.level.block.SculkVeinBlock.class, org.bukkit.craftbukkit.block.impl.CraftSculkVein::new);
register(net.minecraft.world.level.block.SeaPickleBlock.class, org.bukkit.craftbukkit.block.impl.CraftSeaPickle::new);
register(net.minecraft.world.level.block.ShulkerBoxBlock.class, org.bukkit.craftbukkit.block.impl.CraftShulkerBox::new);
register(net.minecraft.world.level.block.SkullBlock.class, org.bukkit.craftbukkit.block.impl.CraftSkull::new);
register(net.minecraft.world.level.block.SlabBlock.class, org.bukkit.craftbukkit.block.impl.CraftSlab::new);
register(net.minecraft.world.level.block.SmallDripleafBlock.class, org.bukkit.craftbukkit.block.impl.CraftSmallDripleaf::new);
register(net.minecraft.world.level.block.SmokerBlock.class, org.bukkit.craftbukkit.block.impl.CraftSmoker::new);
register(net.minecraft.world.level.block.SnifferEggBlock.class, org.bukkit.craftbukkit.block.impl.CraftSnifferEgg::new);
register(net.minecraft.world.level.block.SnowLayerBlock.class, org.bukkit.craftbukkit.block.impl.CraftSnowLayer::new);
register(net.minecraft.world.level.block.SnowyDirtBlock.class, org.bukkit.craftbukkit.block.impl.CraftSnowyDirt::new);
register(net.minecraft.world.level.block.StainedGlassPaneBlock.class, org.bukkit.craftbukkit.block.impl.CraftStainedGlassPane::new);
register(net.minecraft.world.level.block.StairBlock.class, org.bukkit.craftbukkit.block.impl.CraftStair::new);
register(net.minecraft.world.level.block.StandingSignBlock.class, org.bukkit.craftbukkit.block.impl.CraftStandingSign::new);
register(net.minecraft.world.level.block.StemBlock.class, org.bukkit.craftbukkit.block.impl.CraftStem::new);
register(net.minecraft.world.level.block.StonecutterBlock.class, org.bukkit.craftbukkit.block.impl.CraftStonecutter::new);
register(net.minecraft.world.level.block.StructureBlock.class, org.bukkit.craftbukkit.block.impl.CraftStructureBlock::new);
register(net.minecraft.world.level.block.SugarCaneBlock.class, org.bukkit.craftbukkit.block.impl.CraftSugarCane::new);
register(net.minecraft.world.level.block.SweetBerryBushBlock.class, org.bukkit.craftbukkit.block.impl.CraftSweetBerryBush::new);
register(net.minecraft.world.level.block.TallFlowerBlock.class, org.bukkit.craftbukkit.block.impl.CraftTallFlower::new);
register(net.minecraft.world.level.block.TallSeagrassBlock.class, org.bukkit.craftbukkit.block.impl.CraftTallSeagrass::new);
register(net.minecraft.world.level.block.TargetBlock.class, org.bukkit.craftbukkit.block.impl.CraftTarget::new);
register(net.minecraft.world.level.block.TntBlock.class, org.bukkit.craftbukkit.block.impl.CraftTnt::new);
register(net.minecraft.world.level.block.TorchflowerCropBlock.class, org.bukkit.craftbukkit.block.impl.CraftTorchflowerCrop::new);
register(net.minecraft.world.level.block.TrapDoorBlock.class, org.bukkit.craftbukkit.block.impl.CraftTrapDoor::new);
register(net.minecraft.world.level.block.TrappedChestBlock.class, org.bukkit.craftbukkit.block.impl.CraftTrappedChest::new);
register(net.minecraft.world.level.block.TrialSpawnerBlock.class, org.bukkit.craftbukkit.block.impl.CraftTrialSpawner::new);
register(net.minecraft.world.level.block.TripWireBlock.class, org.bukkit.craftbukkit.block.impl.CraftTripWire::new);
register(net.minecraft.world.level.block.TripWireHookBlock.class, org.bukkit.craftbukkit.block.impl.CraftTripWireHook::new);
register(net.minecraft.world.level.block.TurtleEggBlock.class, org.bukkit.craftbukkit.block.impl.CraftTurtleEgg::new);
register(net.minecraft.world.level.block.TwistingVinesBlock.class, org.bukkit.craftbukkit.block.impl.CraftTwistingVines::new);
register(net.minecraft.world.level.block.VaultBlock.class, org.bukkit.craftbukkit.block.impl.CraftVault::new);
register(net.minecraft.world.level.block.VineBlock.class, org.bukkit.craftbukkit.block.impl.CraftVine::new);
register(net.minecraft.world.level.block.WallBannerBlock.class, org.bukkit.craftbukkit.block.impl.CraftWallBanner::new);
register(net.minecraft.world.level.block.WallBlock.class, org.bukkit.craftbukkit.block.impl.CraftWall::new);
register(net.minecraft.world.level.block.WallHangingSignBlock.class, org.bukkit.craftbukkit.block.impl.CraftWallHangingSign::new);
register(net.minecraft.world.level.block.WallSignBlock.class, org.bukkit.craftbukkit.block.impl.CraftWallSign::new);
register(net.minecraft.world.level.block.WallSkullBlock.class, org.bukkit.craftbukkit.block.impl.CraftWallSkull::new);
register(net.minecraft.world.level.block.WallTorchBlock.class, org.bukkit.craftbukkit.block.impl.CraftWallTorch::new);
register(net.minecraft.world.level.block.WaterloggedTransparentBlock.class, org.bukkit.craftbukkit.block.impl.CraftWaterloggedTransparent::new);
register(net.minecraft.world.level.block.WeatheringCopperBulbBlock.class, org.bukkit.craftbukkit.block.impl.CraftWeatheringCopperBulb::new);
register(net.minecraft.world.level.block.WeatheringCopperDoorBlock.class, org.bukkit.craftbukkit.block.impl.CraftWeatheringCopperDoor::new);
register(net.minecraft.world.level.block.WeatheringCopperGrateBlock.class, org.bukkit.craftbukkit.block.impl.CraftWeatheringCopperGrate::new);
register(net.minecraft.world.level.block.WeatheringCopperSlabBlock.class, org.bukkit.craftbukkit.block.impl.CraftWeatheringCopperSlab::new);
register(net.minecraft.world.level.block.WeatheringCopperStairBlock.class, org.bukkit.craftbukkit.block.impl.CraftWeatheringCopperStair::new);
register(net.minecraft.world.level.block.WeatheringCopperTrapDoorBlock.class, org.bukkit.craftbukkit.block.impl.CraftWeatheringCopperTrapDoor::new);
register(net.minecraft.world.level.block.WeepingVinesBlock.class, org.bukkit.craftbukkit.block.impl.CraftWeepingVines::new);
register(net.minecraft.world.level.block.WeightedPressurePlateBlock.class, org.bukkit.craftbukkit.block.impl.CraftWeightedPressurePlate::new);
register(net.minecraft.world.level.block.WitherSkullBlock.class, org.bukkit.craftbukkit.block.impl.CraftWitherSkull::new);
register(net.minecraft.world.level.block.WitherWallSkullBlock.class, org.bukkit.craftbukkit.block.impl.CraftWitherWallSkull::new);
register(net.minecraft.world.level.block.piston.MovingPistonBlock.class, org.bukkit.craftbukkit.block.impl.CraftMovingPiston::new);
register(net.minecraft.world.level.block.piston.PistonBaseBlock.class, org.bukkit.craftbukkit.block.impl.CraftPistonBase::new);
register(net.minecraft.world.level.block.piston.PistonHeadBlock.class, org.bukkit.craftbukkit.block.impl.CraftPistonHead::new);
// Paper end - Generated/CraftBlockData#MAP
//</editor-fold>
}
private static void register(Class<? extends Block> nms, Function<net.minecraft.world.level.block.state.BlockState, CraftBlockData> bukkit) {
Preconditions.checkState(CraftBlockData.MAP.put(nms, bukkit) == null, "Duplicate mapping %s->%s", nms, bukkit);
}
// Paper start - cache block data strings
private static Map<String, CraftBlockData> stringDataCache = new java.util.concurrent.ConcurrentHashMap<>();
static {
// cache all of the default states at startup, will not cache ones with the custom states inside of the
// brackets in a different order, though
reloadCache();
}
public static void reloadCache() {
stringDataCache.clear();
Block.BLOCK_STATE_REGISTRY.forEach(blockData -> stringDataCache.put(blockData.toString(), blockData.createCraftBlockData()));
}
// Paper end - cache block data strings
public static CraftBlockData newData(BlockType blockType, String data) {
// Paper start - cache block data strings
if (blockType != null) {
Block block = CraftBlockType.bukkitToMinecraftNew(blockType);
if (block != null) {
net.minecraft.resources.ResourceLocation key = BuiltInRegistries.BLOCK.getKey(block);
data = data == null ? key.toString() : key + data;
}
}
CraftBlockData cached = stringDataCache.computeIfAbsent(data, s -> createNewData(null, s));
return (CraftBlockData) cached.clone();
}
private static CraftBlockData createNewData(BlockType blockType, String data) {
// Paper end - cache block data strings
net.minecraft.world.level.block.state.BlockState blockData;
Block block = blockType == null ? null : ((CraftBlockType<?>) blockType).getHandle();
Map<Property<?>, Comparable<?>> parsed = null;
// Data provided, use it
if (data != null) {
try {
// Material provided, force that material in
if (block != null) {
data = BuiltInRegistries.BLOCK.getKey(block) + data;
}
StringReader reader = new StringReader(data);
BlockStateParser.BlockResult arg = BlockStateParser.parseForBlock(BuiltInRegistries.BLOCK.asLookup(), reader, false);
Preconditions.checkArgument(!reader.canRead(), "Spurious trailing data: " + data);
blockData = arg.blockState();
parsed = arg.properties();
} catch (CommandSyntaxException ex) {
throw new IllegalArgumentException("Could not parse data: " + data, ex);
}
} else {
blockData = block.defaultBlockState();
}
CraftBlockData craft = CraftBlockData.fromData(blockData);
craft.parsedStates = parsed;
return craft;
}
// Paper start - optimize creating BlockData to not need a map lookup
static {
// Initialize cached data for all IBlockData instances after registration
Block.BLOCK_STATE_REGISTRY.iterator().forEachRemaining(net.minecraft.world.level.block.state.BlockState::createCraftBlockData);
}
public static CraftBlockData fromData(net.minecraft.world.level.block.state.BlockState data) {
return data.createCraftBlockData();
}
public static CraftBlockData createData(net.minecraft.world.level.block.state.BlockState data) {
// Paper end
return CraftBlockData.MAP.getOrDefault(data.getBlock().getClass(), CraftBlockData::new).apply(data);
}
@Override
public SoundGroup getSoundGroup() {
return CraftSoundGroup.getSoundGroup(this.state.getSoundType());
}
@Override
public int getLightEmission() {
return this.state.getLightEmission();
}
@Override
public boolean isOccluding() {
return this.state.canOcclude();
}
@Override
public boolean requiresCorrectToolForDrops() {
return this.state.requiresCorrectToolForDrops();
}
@Override
public boolean isPreferredTool(ItemStack tool) {
Preconditions.checkArgument(tool != null, "tool must not be null");
net.minecraft.world.item.ItemStack nms = CraftItemStack.asNMSCopy(tool);
return CraftBlockData.isPreferredTool(this.state, nms);
}
public static boolean isPreferredTool(net.minecraft.world.level.block.state.BlockState iblockdata, net.minecraft.world.item.ItemStack nmsItem) {
return !iblockdata.requiresCorrectToolForDrops() || nmsItem.isCorrectToolForDrops(iblockdata);
}
@Override
public PistonMoveReaction getPistonMoveReaction() {
return PistonMoveReaction.getById(this.state.getPistonPushReaction().ordinal());
}
@Override
public boolean isSupported(org.bukkit.block.Block block) {
Preconditions.checkArgument(block != null, "block must not be null");
CraftBlock craftBlock = (CraftBlock) block;
return this.state.canSurvive(craftBlock.getCraftWorld().getHandle(), craftBlock.getPosition());
}
@Override
public boolean isSupported(Location location) {
Preconditions.checkArgument(location != null, "location must not be null");
CraftWorld world = (CraftWorld) location.getWorld();
Preconditions.checkArgument(world != null, "location must not have a null world");
BlockPos position = CraftLocation.toBlockPosition(location);
return this.state.canSurvive(world.getHandle(), position);
}
@Override
public boolean isFaceSturdy(BlockFace face, BlockSupport support) {
Preconditions.checkArgument(face != null, "face must not be null");
Preconditions.checkArgument(support != null, "support must not be null");
return this.state.isFaceSturdy(EmptyBlockGetter.INSTANCE, BlockPos.ZERO, CraftBlock.blockFaceToNotch(face), CraftBlockSupport.toNMS(support));
}
// Paper start
@Override
public org.bukkit.util.VoxelShape getCollisionShape(Location location) {
Preconditions.checkArgument(location != null, "location must not be null");
CraftWorld world = (CraftWorld) location.getWorld();
Preconditions.checkArgument(world != null, "location must not have a null world");
BlockPos position = CraftLocation.toBlockPosition(location);
net.minecraft.world.phys.shapes.VoxelShape shape = this.state.getCollisionShape(world.getHandle(), position);
return new org.bukkit.craftbukkit.util.CraftVoxelShape(shape);
}
// Paper end
@Override
public Color getMapColor() {
return Color.fromRGB(this.state.getMapColor(null, null).col);
}
@Override
public Material getPlacementMaterial() {
return CraftItemType.minecraftToBukkit(this.state.getBlock().asItem());
}
@Override
public void rotate(StructureRotation rotation) {
this.state = this.state.rotate(Rotation.valueOf(rotation.name()));
}
@Override
public void mirror(Mirror mirror) {
this.state = this.state.mirror(net.minecraft.world.level.block.Mirror.valueOf(mirror.name()));
}
@Override
public void copyTo(BlockData blockData) {
CraftBlockData other = (CraftBlockData) blockData;
net.minecraft.world.level.block.state.BlockState nms = other.state;
for (Property<?> property : this.state.getBlock().getStateDefinition().getProperties()) {
if (nms.hasProperty(property)) {
nms = this.copyProperty(this.state, nms, property);
}
}
other.state = nms;
}
private <T extends Comparable<T>> net.minecraft.world.level.block.state.BlockState copyProperty(net.minecraft.world.level.block.state.BlockState source, net.minecraft.world.level.block.state.BlockState target, Property<T> property) {
return target.setValue(property, source.getValue(property));
}
@NotNull
@Override
public BlockState createBlockState() {
return CraftBlockStates.getBlockState(this.state, null);
}
// Paper start - destroy speed API
@Override
public float getDestroySpeed(final ItemStack itemStack, final boolean considerEnchants) {
net.minecraft.world.item.ItemStack nmsItemStack = CraftItemStack.unwrap(itemStack);
float speed = nmsItemStack.getDestroySpeed(this.state);
if (speed > 1.0F && considerEnchants) {
final net.minecraft.core.Holder<net.minecraft.world.entity.ai.attributes.Attribute> attribute = net.minecraft.world.entity.ai.attributes.Attributes.MINING_EFFICIENCY;
// Logic sourced from AttributeInstance#calculateValue
final double initialBaseValue = attribute.value().getDefaultValue();
final org.apache.commons.lang3.mutable.MutableDouble modifiedBaseValue = new org.apache.commons.lang3.mutable.MutableDouble(initialBaseValue);
final org.apache.commons.lang3.mutable.MutableDouble baseValMul = new org.apache.commons.lang3.mutable.MutableDouble(1);
final org.apache.commons.lang3.mutable.MutableDouble totalValMul = new org.apache.commons.lang3.mutable.MutableDouble(1);
net.minecraft.world.item.enchantment.EnchantmentHelper.forEachModifier(
nmsItemStack, net.minecraft.world.entity.EquipmentSlot.MAINHAND, (attributeHolder, attributeModifier) -> {
switch (attributeModifier.operation()) {
case ADD_VALUE -> modifiedBaseValue.add(attributeModifier.amount());
case ADD_MULTIPLIED_BASE -> baseValMul.add(attributeModifier.amount());
case ADD_MULTIPLIED_TOTAL -> totalValMul.setValue(totalValMul.doubleValue() * (1D + attributeModifier.amount()));
}
}
);
final double actualModifier = modifiedBaseValue.doubleValue() * baseValMul.doubleValue() * totalValMul.doubleValue();
speed += (float) attribute.value().sanitizeValue(actualModifier);
}
return speed;
}
// Paper end - destroy speed API
// Paper start - Block tick API
@Override
public boolean isRandomlyTicked() {
return this.state.isRandomlyTicking();
}
// Paper end - Block tick API
}

View file

@ -0,0 +1,50 @@
package org.bukkit.craftbukkit.block.impl;
import com.google.common.base.Preconditions;
import io.papermc.paper.generated.GeneratedFrom;
import java.util.Set;
import net.minecraft.world.level.block.AmethystClusterBlock;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.properties.BooleanProperty;
import net.minecraft.world.level.block.state.properties.DirectionProperty;
import org.bukkit.block.BlockFace;
import org.bukkit.block.data.type.AmethystCluster;
import org.bukkit.craftbukkit.block.data.CraftBlockData;
@GeneratedFrom("1.21.1")
public class CraftAmethystCluster extends CraftBlockData implements AmethystCluster {
private static final DirectionProperty FACING = AmethystClusterBlock.FACING;
private static final BooleanProperty WATERLOGGED = AmethystClusterBlock.WATERLOGGED;
public CraftAmethystCluster(BlockState state) {
super(state);
}
@Override
public BlockFace getFacing() {
return this.get(FACING, BlockFace.class);
}
@Override
public void setFacing(final BlockFace blockFace) {
Preconditions.checkArgument(blockFace != null, "blockFace cannot be null!");
Preconditions.checkArgument(blockFace.isCartesian(), "Invalid face, only cartesian face are allowed for this property!");
this.set(FACING, blockFace);
}
@Override
public Set<BlockFace> getFaces() {
return this.getValues(FACING, BlockFace.class);
}
@Override
public boolean isWaterlogged() {
return this.get(WATERLOGGED);
}
@Override
public void setWaterlogged(final boolean waterlogged) {
this.set(WATERLOGGED, waterlogged);
}
}

View file

@ -0,0 +1,37 @@
package org.bukkit.craftbukkit.block.impl;
import com.google.common.base.Preconditions;
import io.papermc.paper.generated.GeneratedFrom;
import java.util.Set;
import net.minecraft.world.level.block.AnvilBlock;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.properties.DirectionProperty;
import org.bukkit.block.BlockFace;
import org.bukkit.block.data.Directional;
import org.bukkit.craftbukkit.block.data.CraftBlockData;
@GeneratedFrom("1.21.1")
public class CraftAnvil extends CraftBlockData implements Directional {
private static final DirectionProperty FACING = AnvilBlock.FACING;
public CraftAnvil(BlockState state) {
super(state);
}
@Override
public BlockFace getFacing() {
return this.get(FACING, BlockFace.class);
}
@Override
public void setFacing(final BlockFace blockFace) {
Preconditions.checkArgument(blockFace != null, "blockFace cannot be null!");
Preconditions.checkArgument(blockFace.isCartesian() && blockFace.getModY() == 0, "Invalid face, only cartesian horizontal face are allowed for this property!");
this.set(FACING, blockFace);
}
@Override
public Set<BlockFace> getFaces() {
return this.getValues(FACING, BlockFace.class);
}
}

View file

@ -0,0 +1,37 @@
package org.bukkit.craftbukkit.block.impl;
import com.google.common.base.Preconditions;
import io.papermc.paper.generated.GeneratedFrom;
import java.util.Set;
import net.minecraft.world.level.block.AttachedStemBlock;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.properties.DirectionProperty;
import org.bukkit.block.BlockFace;
import org.bukkit.block.data.Directional;
import org.bukkit.craftbukkit.block.data.CraftBlockData;
@GeneratedFrom("1.21.1")
public class CraftAttachedStem extends CraftBlockData implements Directional {
private static final DirectionProperty FACING = AttachedStemBlock.FACING;
public CraftAttachedStem(BlockState state) {
super(state);
}
@Override
public BlockFace getFacing() {
return this.get(FACING, BlockFace.class);
}
@Override
public void setFacing(final BlockFace blockFace) {
Preconditions.checkArgument(blockFace != null, "blockFace cannot be null!");
Preconditions.checkArgument(blockFace.isCartesian() && blockFace.getModY() == 0, "Invalid face, only cartesian horizontal face are allowed for this property!");
this.set(FACING, blockFace);
}
@Override
public Set<BlockFace> getFaces() {
return this.getValues(FACING, BlockFace.class);
}
}

View file

@ -0,0 +1,65 @@
package org.bukkit.craftbukkit.block.impl;
import com.google.common.base.Preconditions;
import io.papermc.paper.generated.GeneratedFrom;
import net.minecraft.world.level.block.BambooStalkBlock;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.properties.BambooLeaves;
import net.minecraft.world.level.block.state.properties.EnumProperty;
import net.minecraft.world.level.block.state.properties.IntegerProperty;
import org.bukkit.block.data.type.Bamboo;
import org.bukkit.craftbukkit.block.data.CraftBlockData;
@GeneratedFrom("1.21.1")
public class CraftBambooStalk extends CraftBlockData implements Bamboo {
private static final IntegerProperty AGE = BambooStalkBlock.AGE;
private static final EnumProperty<BambooLeaves> LEAVES = BambooStalkBlock.LEAVES;
private static final IntegerProperty STAGE = BambooStalkBlock.STAGE;
public CraftBambooStalk(BlockState state) {
super(state);
}
@Override
public int getAge() {
return this.get(AGE);
}
@Override
public void setAge(final int age) {
this.set(AGE, age);
}
@Override
public int getMaximumAge() {
return AGE.max;
}
@Override
public Bamboo.Leaves getLeaves() {
return this.get(LEAVES, Bamboo.Leaves.class);
}
@Override
public void setLeaves(final Bamboo.Leaves leaves) {
Preconditions.checkArgument(leaves != null, "leaves cannot be null!");
this.set(LEAVES, leaves);
}
@Override
public int getStage() {
return this.get(STAGE);
}
@Override
public void setStage(final int stage) {
this.set(STAGE, stage);
}
@Override
public int getMaximumStage() {
return STAGE.max;
}
}

View file

@ -0,0 +1,35 @@
package org.bukkit.craftbukkit.block.impl;
import com.google.common.base.Preconditions;
import io.papermc.paper.generated.GeneratedFrom;
import net.minecraft.world.level.block.BannerBlock;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.properties.IntegerProperty;
import net.minecraft.world.level.block.state.properties.RotationSegment;
import org.bukkit.block.BlockFace;
import org.bukkit.block.data.Rotatable;
import org.bukkit.craftbukkit.block.data.CraftBlockData;
import org.bukkit.util.Vector;
@GeneratedFrom("1.21.1")
public class CraftBanner extends CraftBlockData implements Rotatable {
private static final IntegerProperty ROTATION = BannerBlock.ROTATION;
public CraftBanner(BlockState state) {
super(state);
}
@Override
public BlockFace getRotation() {
return CraftBlockData.ROTATION_CYCLE[this.get(ROTATION)];
}
@Override
public void setRotation(final BlockFace blockFace) {
Preconditions.checkArgument(blockFace != null, "blockFace cannot be null!");
Preconditions.checkArgument(blockFace != BlockFace.SELF && blockFace.getModY() == 0, "Invalid face, only horizontal face are allowed for this property!");
Vector dir = blockFace.getDirection();
float angle = (float) -Math.toDegrees(Math.atan2(dir.getX(), dir.getZ()));
this.set(ROTATION, RotationSegment.convertToSegment(angle));
}
}

View file

@ -0,0 +1,50 @@
package org.bukkit.craftbukkit.block.impl;
import com.google.common.base.Preconditions;
import io.papermc.paper.generated.GeneratedFrom;
import java.util.Set;
import net.minecraft.world.level.block.BarrelBlock;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.properties.BooleanProperty;
import net.minecraft.world.level.block.state.properties.DirectionProperty;
import org.bukkit.block.BlockFace;
import org.bukkit.block.data.type.Barrel;
import org.bukkit.craftbukkit.block.data.CraftBlockData;
@GeneratedFrom("1.21.1")
public class CraftBarrel extends CraftBlockData implements Barrel {
private static final DirectionProperty FACING = BarrelBlock.FACING;
private static final BooleanProperty OPEN = BarrelBlock.OPEN;
public CraftBarrel(BlockState state) {
super(state);
}
@Override
public BlockFace getFacing() {
return this.get(FACING, BlockFace.class);
}
@Override
public void setFacing(final BlockFace blockFace) {
Preconditions.checkArgument(blockFace != null, "blockFace cannot be null!");
Preconditions.checkArgument(blockFace.isCartesian(), "Invalid face, only cartesian face are allowed for this property!");
this.set(FACING, blockFace);
}
@Override
public Set<BlockFace> getFaces() {
return this.getValues(FACING, BlockFace.class);
}
@Override
public boolean isOpen() {
return this.get(OPEN);
}
@Override
public void setOpen(final boolean open) {
this.set(OPEN, open);
}
}

View file

@ -0,0 +1,27 @@
package org.bukkit.craftbukkit.block.impl;
import io.papermc.paper.generated.GeneratedFrom;
import net.minecraft.world.level.block.BarrierBlock;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.properties.BooleanProperty;
import org.bukkit.block.data.Waterlogged;
import org.bukkit.craftbukkit.block.data.CraftBlockData;
@GeneratedFrom("1.21.1")
public class CraftBarrier extends CraftBlockData implements Waterlogged {
private static final BooleanProperty WATERLOGGED = BarrierBlock.WATERLOGGED;
public CraftBarrier(BlockState state) {
super(state);
}
@Override
public boolean isWaterlogged() {
return this.get(WATERLOGGED);
}
@Override
public void setWaterlogged(final boolean waterlogged) {
this.set(WATERLOGGED, waterlogged);
}
}

View file

@ -0,0 +1,27 @@
package org.bukkit.craftbukkit.block.impl;
import io.papermc.paper.generated.GeneratedFrom;
import net.minecraft.world.level.block.BaseCoralFanBlock;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.properties.BooleanProperty;
import org.bukkit.block.data.Waterlogged;
import org.bukkit.craftbukkit.block.data.CraftBlockData;
@GeneratedFrom("1.21.1")
public class CraftBaseCoralFan extends CraftBlockData implements Waterlogged {
private static final BooleanProperty WATERLOGGED = BaseCoralFanBlock.WATERLOGGED;
public CraftBaseCoralFan(BlockState state) {
super(state);
}
@Override
public boolean isWaterlogged() {
return this.get(WATERLOGGED);
}
@Override
public void setWaterlogged(final boolean waterlogged) {
this.set(WATERLOGGED, waterlogged);
}
}

View file

@ -0,0 +1,27 @@
package org.bukkit.craftbukkit.block.impl;
import io.papermc.paper.generated.GeneratedFrom;
import net.minecraft.world.level.block.BaseCoralPlantBlock;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.properties.BooleanProperty;
import org.bukkit.block.data.Waterlogged;
import org.bukkit.craftbukkit.block.data.CraftBlockData;
@GeneratedFrom("1.21.1")
public class CraftBaseCoralPlant extends CraftBlockData implements Waterlogged {
private static final BooleanProperty WATERLOGGED = BaseCoralPlantBlock.WATERLOGGED;
public CraftBaseCoralPlant(BlockState state) {
super(state);
}
@Override
public boolean isWaterlogged() {
return this.get(WATERLOGGED);
}
@Override
public void setWaterlogged(final boolean waterlogged) {
this.set(WATERLOGGED, waterlogged);
}
}

View file

@ -0,0 +1,50 @@
package org.bukkit.craftbukkit.block.impl;
import com.google.common.base.Preconditions;
import io.papermc.paper.generated.GeneratedFrom;
import java.util.Set;
import net.minecraft.world.level.block.BaseCoralWallFanBlock;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.properties.BooleanProperty;
import net.minecraft.world.level.block.state.properties.DirectionProperty;
import org.bukkit.block.BlockFace;
import org.bukkit.block.data.type.CoralWallFan;
import org.bukkit.craftbukkit.block.data.CraftBlockData;
@GeneratedFrom("1.21.1")
public class CraftBaseCoralWallFan extends CraftBlockData implements CoralWallFan {
private static final DirectionProperty FACING = BaseCoralWallFanBlock.FACING;
private static final BooleanProperty WATERLOGGED = BaseCoralWallFanBlock.WATERLOGGED;
public CraftBaseCoralWallFan(BlockState state) {
super(state);
}
@Override
public BlockFace getFacing() {
return this.get(FACING, BlockFace.class);
}
@Override
public void setFacing(final BlockFace blockFace) {
Preconditions.checkArgument(blockFace != null, "blockFace cannot be null!");
Preconditions.checkArgument(blockFace.isCartesian() && blockFace.getModY() == 0, "Invalid face, only cartesian horizontal face are allowed for this property!");
this.set(FACING, blockFace);
}
@Override
public Set<BlockFace> getFaces() {
return this.getValues(FACING, BlockFace.class);
}
@Override
public boolean isWaterlogged() {
return this.get(WATERLOGGED);
}
@Override
public void setWaterlogged(final boolean waterlogged) {
this.set(WATERLOGGED, waterlogged);
}
}

View file

@ -0,0 +1,65 @@
package org.bukkit.craftbukkit.block.impl;
import com.google.common.base.Preconditions;
import io.papermc.paper.generated.GeneratedFrom;
import java.util.Set;
import net.minecraft.world.level.block.BedBlock;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.properties.BedPart;
import net.minecraft.world.level.block.state.properties.BooleanProperty;
import net.minecraft.world.level.block.state.properties.DirectionProperty;
import net.minecraft.world.level.block.state.properties.EnumProperty;
import org.bukkit.block.BlockFace;
import org.bukkit.block.data.type.Bed;
import org.bukkit.craftbukkit.block.data.CraftBlockData;
@GeneratedFrom("1.21.1")
public class CraftBed extends CraftBlockData implements Bed {
private static final DirectionProperty FACING = BedBlock.FACING;
private static final BooleanProperty OCCUPIED = BedBlock.OCCUPIED;
private static final EnumProperty<BedPart> PART = BedBlock.PART;
public CraftBed(BlockState state) {
super(state);
}
@Override
public BlockFace getFacing() {
return this.get(FACING, BlockFace.class);
}
@Override
public void setFacing(final BlockFace blockFace) {
Preconditions.checkArgument(blockFace != null, "blockFace cannot be null!");
Preconditions.checkArgument(blockFace.isCartesian() && blockFace.getModY() == 0, "Invalid face, only cartesian horizontal face are allowed for this property!");
this.set(FACING, blockFace);
}
@Override
public Set<BlockFace> getFaces() {
return this.getValues(FACING, BlockFace.class);
}
@Override
public boolean isOccupied() {
return this.get(OCCUPIED);
}
@Override
public void setOccupied(final boolean occupied) {
this.set(OCCUPIED, occupied);
}
@Override
public Bed.Part getPart() {
return this.get(PART, Bed.Part.class);
}
@Override
public void setPart(final Bed.Part part) {
Preconditions.checkArgument(part != null, "part cannot be null!");
this.set(PART, part);
}
}

View file

@ -0,0 +1,55 @@
package org.bukkit.craftbukkit.block.impl;
import com.google.common.base.Preconditions;
import io.papermc.paper.generated.GeneratedFrom;
import java.util.Set;
import net.minecraft.world.level.block.BeehiveBlock;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.properties.DirectionProperty;
import net.minecraft.world.level.block.state.properties.IntegerProperty;
import org.bukkit.block.BlockFace;
import org.bukkit.block.data.type.Beehive;
import org.bukkit.craftbukkit.block.data.CraftBlockData;
@GeneratedFrom("1.21.1")
public class CraftBeehive extends CraftBlockData implements Beehive {
private static final DirectionProperty FACING = BeehiveBlock.FACING;
private static final IntegerProperty HONEY_LEVEL = BeehiveBlock.HONEY_LEVEL;
public CraftBeehive(BlockState state) {
super(state);
}
@Override
public BlockFace getFacing() {
return this.get(FACING, BlockFace.class);
}
@Override
public void setFacing(final BlockFace blockFace) {
Preconditions.checkArgument(blockFace != null, "blockFace cannot be null!");
Preconditions.checkArgument(blockFace.isCartesian() && blockFace.getModY() == 0, "Invalid face, only cartesian horizontal face are allowed for this property!");
this.set(FACING, blockFace);
}
@Override
public Set<BlockFace> getFaces() {
return this.getValues(FACING, BlockFace.class);
}
@Override
public int getHoneyLevel() {
return this.get(HONEY_LEVEL);
}
@Override
public void setHoneyLevel(final int honeyLevel) {
this.set(HONEY_LEVEL, honeyLevel);
}
@Override
public int getMaximumHoneyLevel() {
return HONEY_LEVEL.max;
}
}

View file

@ -0,0 +1,32 @@
package org.bukkit.craftbukkit.block.impl;
import io.papermc.paper.generated.GeneratedFrom;
import net.minecraft.world.level.block.BeetrootBlock;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.properties.IntegerProperty;
import org.bukkit.block.data.Ageable;
import org.bukkit.craftbukkit.block.data.CraftBlockData;
@GeneratedFrom("1.21.1")
public class CraftBeetroot extends CraftBlockData implements Ageable {
private static final IntegerProperty AGE = BeetrootBlock.AGE;
public CraftBeetroot(BlockState state) {
super(state);
}
@Override
public int getAge() {
return this.get(AGE);
}
@Override
public void setAge(final int age) {
this.set(AGE, age);
}
@Override
public int getMaximumAge() {
return AGE.max;
}
}

View file

@ -0,0 +1,65 @@
package org.bukkit.craftbukkit.block.impl;
import com.google.common.base.Preconditions;
import io.papermc.paper.generated.GeneratedFrom;
import java.util.Set;
import net.minecraft.world.level.block.BellBlock;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.properties.BellAttachType;
import net.minecraft.world.level.block.state.properties.BooleanProperty;
import net.minecraft.world.level.block.state.properties.DirectionProperty;
import net.minecraft.world.level.block.state.properties.EnumProperty;
import org.bukkit.block.BlockFace;
import org.bukkit.block.data.type.Bell;
import org.bukkit.craftbukkit.block.data.CraftBlockData;
@GeneratedFrom("1.21.1")
public class CraftBell extends CraftBlockData implements Bell {
private static final EnumProperty<BellAttachType> ATTACHMENT = BellBlock.ATTACHMENT;
private static final DirectionProperty FACING = BellBlock.FACING;
private static final BooleanProperty POWERED = BellBlock.POWERED;
public CraftBell(BlockState state) {
super(state);
}
@Override
public Bell.Attachment getAttachment() {
return this.get(ATTACHMENT, Bell.Attachment.class);
}
@Override
public void setAttachment(final Bell.Attachment attachment) {
Preconditions.checkArgument(attachment != null, "attachment cannot be null!");
this.set(ATTACHMENT, attachment);
}
@Override
public BlockFace getFacing() {
return this.get(FACING, BlockFace.class);
}
@Override
public void setFacing(final BlockFace blockFace) {
Preconditions.checkArgument(blockFace != null, "blockFace cannot be null!");
Preconditions.checkArgument(blockFace.isCartesian() && blockFace.getModY() == 0, "Invalid face, only cartesian horizontal face are allowed for this property!");
this.set(FACING, blockFace);
}
@Override
public Set<BlockFace> getFaces() {
return this.getValues(FACING, BlockFace.class);
}
@Override
public boolean isPowered() {
return this.get(POWERED);
}
@Override
public void setPowered(final boolean powered) {
this.set(POWERED, powered);
}
}

Some files were not shown because too many files have changed in this diff Show more