mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-25 22:10:21 +01:00
Code Generation for TypedKeys (#9233)
Currently includes generated key holder classes for types used in the Registry Modification API
This commit is contained in:
parent
e1cd9e59e5
commit
96d5e6ca48
456 changed files with 2073 additions and 17 deletions
|
@ -35,3 +35,6 @@ 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 = $*,|,*
|
||||||
|
|
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -72,3 +72,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
|
||||||
|
|
28
paper-api-generator/build.gradle.kts
Normal file
28
paper-api-generator/build.gradle.kts
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
import org.spongepowered.gradle.vanilla.repository.MinecraftPlatform
|
||||||
|
|
||||||
|
plugins {
|
||||||
|
java
|
||||||
|
id("org.spongepowered.gradle.vanilla") version "0.2.1-SNAPSHOT"
|
||||||
|
}
|
||||||
|
|
||||||
|
minecraft {
|
||||||
|
version(property("mcVersion").toString())
|
||||||
|
platform(MinecraftPlatform.SERVER)
|
||||||
|
|
||||||
|
runs {
|
||||||
|
server("generate") {
|
||||||
|
mainClass("io.papermc.generator.Main")
|
||||||
|
accessWideners(projectDir.toPath().resolve("wideners.at"))
|
||||||
|
args(projectDir.toPath().resolve("generated").toString())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation("com.squareup:javapoet:1.13.0")
|
||||||
|
implementation(project(":paper-api"))
|
||||||
|
}
|
||||||
|
|
||||||
|
group = "io.papermc.paper"
|
||||||
|
version = "1.0-SNAPSHOT"
|
||||||
|
|
|
@ -0,0 +1,490 @@
|
||||||
|
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.jetbrains.annotations.ApiStatus;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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.20.2")
|
||||||
|
@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 a registry.
|
||||||
|
*
|
||||||
|
* @param key the value's key in the registry
|
||||||
|
* @return a new typed key
|
||||||
|
*/
|
||||||
|
@ApiStatus.Experimental
|
||||||
|
public static @NotNull TypedKey<Biome> create(final @NotNull Key key) {
|
||||||
|
return TypedKey.create(RegistryKey.BIOME, key);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,462 @@
|
||||||
|
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.GameEvent;
|
||||||
|
import org.jetbrains.annotations.ApiStatus;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Vanilla 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"
|
||||||
|
})
|
||||||
|
@GeneratedFrom("1.20.2")
|
||||||
|
@ApiStatus.Experimental
|
||||||
|
public final class GameEventKeys {
|
||||||
|
/**
|
||||||
|
* {@code minecraft:block_activate}
|
||||||
|
*
|
||||||
|
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||||
|
*/
|
||||||
|
public static final TypedKey<GameEvent> BLOCK_ACTIVATE = create(key("block_activate"));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@code minecraft:block_attach}
|
||||||
|
*
|
||||||
|
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||||
|
*/
|
||||||
|
public static final TypedKey<GameEvent> BLOCK_ATTACH = create(key("block_attach"));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@code minecraft:block_change}
|
||||||
|
*
|
||||||
|
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||||
|
*/
|
||||||
|
public static final TypedKey<GameEvent> BLOCK_CHANGE = create(key("block_change"));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@code minecraft:block_close}
|
||||||
|
*
|
||||||
|
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||||
|
*/
|
||||||
|
public static final TypedKey<GameEvent> BLOCK_CLOSE = create(key("block_close"));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@code minecraft:block_deactivate}
|
||||||
|
*
|
||||||
|
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||||
|
*/
|
||||||
|
public static final TypedKey<GameEvent> BLOCK_DEACTIVATE = create(key("block_deactivate"));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@code minecraft:block_destroy}
|
||||||
|
*
|
||||||
|
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||||
|
*/
|
||||||
|
public static final TypedKey<GameEvent> BLOCK_DESTROY = create(key("block_destroy"));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@code minecraft:block_detach}
|
||||||
|
*
|
||||||
|
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||||
|
*/
|
||||||
|
public static final TypedKey<GameEvent> BLOCK_DETACH = create(key("block_detach"));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@code minecraft:block_open}
|
||||||
|
*
|
||||||
|
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||||
|
*/
|
||||||
|
public static final TypedKey<GameEvent> BLOCK_OPEN = create(key("block_open"));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@code minecraft:block_place}
|
||||||
|
*
|
||||||
|
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||||
|
*/
|
||||||
|
public static final TypedKey<GameEvent> BLOCK_PLACE = create(key("block_place"));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@code minecraft:container_close}
|
||||||
|
*
|
||||||
|
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||||
|
*/
|
||||||
|
public static final TypedKey<GameEvent> CONTAINER_CLOSE = create(key("container_close"));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@code minecraft:container_open}
|
||||||
|
*
|
||||||
|
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||||
|
*/
|
||||||
|
public static final TypedKey<GameEvent> CONTAINER_OPEN = create(key("container_open"));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@code minecraft:drink}
|
||||||
|
*
|
||||||
|
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||||
|
*/
|
||||||
|
public static final TypedKey<GameEvent> DRINK = create(key("drink"));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@code minecraft:eat}
|
||||||
|
*
|
||||||
|
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||||
|
*/
|
||||||
|
public static final TypedKey<GameEvent> EAT = create(key("eat"));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@code minecraft:elytra_glide}
|
||||||
|
*
|
||||||
|
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||||
|
*/
|
||||||
|
public static final TypedKey<GameEvent> ELYTRA_GLIDE = create(key("elytra_glide"));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@code minecraft:entity_damage}
|
||||||
|
*
|
||||||
|
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||||
|
*/
|
||||||
|
public static final TypedKey<GameEvent> ENTITY_DAMAGE = create(key("entity_damage"));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@code minecraft:entity_die}
|
||||||
|
*
|
||||||
|
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||||
|
*/
|
||||||
|
public static final TypedKey<GameEvent> ENTITY_DIE = create(key("entity_die"));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@code minecraft:entity_dismount}
|
||||||
|
*
|
||||||
|
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||||
|
*/
|
||||||
|
public static final TypedKey<GameEvent> ENTITY_DISMOUNT = create(key("entity_dismount"));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@code minecraft:entity_interact}
|
||||||
|
*
|
||||||
|
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||||
|
*/
|
||||||
|
public static final TypedKey<GameEvent> ENTITY_INTERACT = create(key("entity_interact"));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@code minecraft:entity_mount}
|
||||||
|
*
|
||||||
|
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||||
|
*/
|
||||||
|
public static final TypedKey<GameEvent> ENTITY_MOUNT = create(key("entity_mount"));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@code minecraft:entity_place}
|
||||||
|
*
|
||||||
|
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||||
|
*/
|
||||||
|
public static final TypedKey<GameEvent> ENTITY_PLACE = create(key("entity_place"));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@code minecraft:entity_action}
|
||||||
|
*
|
||||||
|
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||||
|
*/
|
||||||
|
public static final TypedKey<GameEvent> ENTITY_ACTION = create(key("entity_action"));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@code minecraft:equip}
|
||||||
|
*
|
||||||
|
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||||
|
*/
|
||||||
|
public static final TypedKey<GameEvent> EQUIP = create(key("equip"));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@code minecraft:explode}
|
||||||
|
*
|
||||||
|
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||||
|
*/
|
||||||
|
public static final TypedKey<GameEvent> EXPLODE = create(key("explode"));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@code minecraft:flap}
|
||||||
|
*
|
||||||
|
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||||
|
*/
|
||||||
|
public static final TypedKey<GameEvent> FLAP = create(key("flap"));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@code minecraft:fluid_pickup}
|
||||||
|
*
|
||||||
|
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||||
|
*/
|
||||||
|
public static final TypedKey<GameEvent> FLUID_PICKUP = create(key("fluid_pickup"));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@code minecraft:fluid_place}
|
||||||
|
*
|
||||||
|
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||||
|
*/
|
||||||
|
public static final TypedKey<GameEvent> FLUID_PLACE = create(key("fluid_place"));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@code minecraft:hit_ground}
|
||||||
|
*
|
||||||
|
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||||
|
*/
|
||||||
|
public static final TypedKey<GameEvent> HIT_GROUND = create(key("hit_ground"));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@code minecraft:instrument_play}
|
||||||
|
*
|
||||||
|
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||||
|
*/
|
||||||
|
public static final TypedKey<GameEvent> INSTRUMENT_PLAY = create(key("instrument_play"));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@code minecraft:item_interact_finish}
|
||||||
|
*
|
||||||
|
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||||
|
*/
|
||||||
|
public static final TypedKey<GameEvent> ITEM_INTERACT_FINISH = create(key("item_interact_finish"));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@code minecraft:item_interact_start}
|
||||||
|
*
|
||||||
|
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||||
|
*/
|
||||||
|
public static final TypedKey<GameEvent> ITEM_INTERACT_START = create(key("item_interact_start"));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@code minecraft:jukebox_play}
|
||||||
|
*
|
||||||
|
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||||
|
*/
|
||||||
|
public static final TypedKey<GameEvent> JUKEBOX_PLAY = create(key("jukebox_play"));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@code minecraft:jukebox_stop_play}
|
||||||
|
*
|
||||||
|
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||||
|
*/
|
||||||
|
public static final TypedKey<GameEvent> JUKEBOX_STOP_PLAY = create(key("jukebox_stop_play"));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@code minecraft:lightning_strike}
|
||||||
|
*
|
||||||
|
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||||
|
*/
|
||||||
|
public static final TypedKey<GameEvent> LIGHTNING_STRIKE = create(key("lightning_strike"));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@code minecraft:note_block_play}
|
||||||
|
*
|
||||||
|
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||||
|
*/
|
||||||
|
public static final TypedKey<GameEvent> NOTE_BLOCK_PLAY = create(key("note_block_play"));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@code minecraft:prime_fuse}
|
||||||
|
*
|
||||||
|
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||||
|
*/
|
||||||
|
public static final TypedKey<GameEvent> PRIME_FUSE = create(key("prime_fuse"));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@code minecraft:projectile_land}
|
||||||
|
*
|
||||||
|
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||||
|
*/
|
||||||
|
public static final TypedKey<GameEvent> PROJECTILE_LAND = create(key("projectile_land"));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@code minecraft:projectile_shoot}
|
||||||
|
*
|
||||||
|
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||||
|
*/
|
||||||
|
public static final TypedKey<GameEvent> PROJECTILE_SHOOT = create(key("projectile_shoot"));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@code minecraft:sculk_sensor_tendrils_clicking}
|
||||||
|
*
|
||||||
|
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||||
|
*/
|
||||||
|
public static final TypedKey<GameEvent> SCULK_SENSOR_TENDRILS_CLICKING = create(key("sculk_sensor_tendrils_clicking"));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@code minecraft:shear}
|
||||||
|
*
|
||||||
|
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||||
|
*/
|
||||||
|
public static final TypedKey<GameEvent> SHEAR = create(key("shear"));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@code minecraft:shriek}
|
||||||
|
*
|
||||||
|
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||||
|
*/
|
||||||
|
public static final TypedKey<GameEvent> SHRIEK = create(key("shriek"));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@code minecraft:splash}
|
||||||
|
*
|
||||||
|
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||||
|
*/
|
||||||
|
public static final TypedKey<GameEvent> SPLASH = create(key("splash"));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@code minecraft:step}
|
||||||
|
*
|
||||||
|
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||||
|
*/
|
||||||
|
public static final TypedKey<GameEvent> STEP = create(key("step"));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@code minecraft:swim}
|
||||||
|
*
|
||||||
|
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||||
|
*/
|
||||||
|
public static final TypedKey<GameEvent> SWIM = create(key("swim"));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@code minecraft:teleport}
|
||||||
|
*
|
||||||
|
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||||
|
*/
|
||||||
|
public static final TypedKey<GameEvent> TELEPORT = create(key("teleport"));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@code minecraft:unequip}
|
||||||
|
*
|
||||||
|
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||||
|
*/
|
||||||
|
public static final TypedKey<GameEvent> UNEQUIP = create(key("unequip"));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@code minecraft:resonate_1}
|
||||||
|
*
|
||||||
|
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||||
|
*/
|
||||||
|
public static final TypedKey<GameEvent> RESONATE_1 = create(key("resonate_1"));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@code minecraft:resonate_2}
|
||||||
|
*
|
||||||
|
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||||
|
*/
|
||||||
|
public static final TypedKey<GameEvent> RESONATE_2 = create(key("resonate_2"));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@code minecraft:resonate_3}
|
||||||
|
*
|
||||||
|
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||||
|
*/
|
||||||
|
public static final TypedKey<GameEvent> RESONATE_3 = create(key("resonate_3"));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@code minecraft:resonate_4}
|
||||||
|
*
|
||||||
|
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||||
|
*/
|
||||||
|
public static final TypedKey<GameEvent> RESONATE_4 = create(key("resonate_4"));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@code minecraft:resonate_5}
|
||||||
|
*
|
||||||
|
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||||
|
*/
|
||||||
|
public static final TypedKey<GameEvent> RESONATE_5 = create(key("resonate_5"));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@code minecraft:resonate_6}
|
||||||
|
*
|
||||||
|
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||||
|
*/
|
||||||
|
public static final TypedKey<GameEvent> RESONATE_6 = create(key("resonate_6"));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@code minecraft:resonate_7}
|
||||||
|
*
|
||||||
|
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||||
|
*/
|
||||||
|
public static final TypedKey<GameEvent> RESONATE_7 = create(key("resonate_7"));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@code minecraft:resonate_8}
|
||||||
|
*
|
||||||
|
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||||
|
*/
|
||||||
|
public static final TypedKey<GameEvent> RESONATE_8 = create(key("resonate_8"));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@code minecraft:resonate_9}
|
||||||
|
*
|
||||||
|
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||||
|
*/
|
||||||
|
public static final TypedKey<GameEvent> RESONATE_9 = create(key("resonate_9"));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@code minecraft:resonate_10}
|
||||||
|
*
|
||||||
|
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||||
|
*/
|
||||||
|
public static final TypedKey<GameEvent> RESONATE_10 = create(key("resonate_10"));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@code minecraft:resonate_11}
|
||||||
|
*
|
||||||
|
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||||
|
*/
|
||||||
|
public static final TypedKey<GameEvent> RESONATE_11 = create(key("resonate_11"));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@code minecraft:resonate_12}
|
||||||
|
*
|
||||||
|
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||||
|
*/
|
||||||
|
public static final TypedKey<GameEvent> RESONATE_12 = create(key("resonate_12"));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@code minecraft:resonate_13}
|
||||||
|
*
|
||||||
|
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||||
|
*/
|
||||||
|
public static final TypedKey<GameEvent> RESONATE_13 = create(key("resonate_13"));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@code minecraft:resonate_14}
|
||||||
|
*
|
||||||
|
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||||
|
*/
|
||||||
|
public static final TypedKey<GameEvent> RESONATE_14 = create(key("resonate_14"));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@code minecraft:resonate_15}
|
||||||
|
*
|
||||||
|
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||||
|
*/
|
||||||
|
public static final TypedKey<GameEvent> RESONATE_15 = create(key("resonate_15"));
|
||||||
|
|
||||||
|
private GameEventKeys() {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a key for {@link GameEvent} in a registry.
|
||||||
|
*
|
||||||
|
* @param key the value's key in the registry
|
||||||
|
* @return a new typed key
|
||||||
|
*/
|
||||||
|
@ApiStatus.Experimental
|
||||||
|
public static @NotNull TypedKey<GameEvent> create(final @NotNull Key key) {
|
||||||
|
return TypedKey.create(RegistryKey.GAME_EVENT, key);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,147 @@
|
||||||
|
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.generator.structure.StructureType;
|
||||||
|
import org.jetbrains.annotations.ApiStatus;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Vanilla keys for {@link RegistryKey#STRUCTURE_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"
|
||||||
|
})
|
||||||
|
@GeneratedFrom("1.20.2")
|
||||||
|
@ApiStatus.Experimental
|
||||||
|
public final class StructureTypeKeys {
|
||||||
|
/**
|
||||||
|
* {@code minecraft:buried_treasure}
|
||||||
|
*
|
||||||
|
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||||
|
*/
|
||||||
|
public static final TypedKey<StructureType> BURIED_TREASURE = create(key("buried_treasure"));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@code minecraft:desert_pyramid}
|
||||||
|
*
|
||||||
|
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||||
|
*/
|
||||||
|
public static final TypedKey<StructureType> DESERT_PYRAMID = create(key("desert_pyramid"));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@code minecraft:end_city}
|
||||||
|
*
|
||||||
|
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||||
|
*/
|
||||||
|
public static final TypedKey<StructureType> END_CITY = create(key("end_city"));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@code minecraft:fortress}
|
||||||
|
*
|
||||||
|
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||||
|
*/
|
||||||
|
public static final TypedKey<StructureType> FORTRESS = create(key("fortress"));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@code minecraft:igloo}
|
||||||
|
*
|
||||||
|
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||||
|
*/
|
||||||
|
public static final TypedKey<StructureType> IGLOO = create(key("igloo"));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@code minecraft:jigsaw}
|
||||||
|
*
|
||||||
|
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||||
|
*/
|
||||||
|
public static final TypedKey<StructureType> JIGSAW = create(key("jigsaw"));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@code minecraft:jungle_temple}
|
||||||
|
*
|
||||||
|
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||||
|
*/
|
||||||
|
public static final TypedKey<StructureType> JUNGLE_TEMPLE = create(key("jungle_temple"));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@code minecraft:mineshaft}
|
||||||
|
*
|
||||||
|
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||||
|
*/
|
||||||
|
public static final TypedKey<StructureType> MINESHAFT = create(key("mineshaft"));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@code minecraft:nether_fossil}
|
||||||
|
*
|
||||||
|
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||||
|
*/
|
||||||
|
public static final TypedKey<StructureType> NETHER_FOSSIL = create(key("nether_fossil"));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@code minecraft:ocean_monument}
|
||||||
|
*
|
||||||
|
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||||
|
*/
|
||||||
|
public static final TypedKey<StructureType> OCEAN_MONUMENT = create(key("ocean_monument"));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@code minecraft:ocean_ruin}
|
||||||
|
*
|
||||||
|
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||||
|
*/
|
||||||
|
public static final TypedKey<StructureType> OCEAN_RUIN = create(key("ocean_ruin"));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@code minecraft:ruined_portal}
|
||||||
|
*
|
||||||
|
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||||
|
*/
|
||||||
|
public static final TypedKey<StructureType> 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 TypedKey<StructureType> SHIPWRECK = create(key("shipwreck"));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@code minecraft:stronghold}
|
||||||
|
*
|
||||||
|
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||||
|
*/
|
||||||
|
public static final TypedKey<StructureType> STRONGHOLD = create(key("stronghold"));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@code minecraft:swamp_hut}
|
||||||
|
*
|
||||||
|
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||||
|
*/
|
||||||
|
public static final TypedKey<StructureType> SWAMP_HUT = create(key("swamp_hut"));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@code minecraft:woodland_mansion}
|
||||||
|
*
|
||||||
|
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||||
|
*/
|
||||||
|
public static final TypedKey<StructureType> WOODLAND_MANSION = create(key("woodland_mansion"));
|
||||||
|
|
||||||
|
private StructureTypeKeys() {
|
||||||
|
}
|
||||||
|
|
||||||
|
private static @NotNull TypedKey<StructureType> create(final @NotNull Key key) {
|
||||||
|
return TypedKey.create(RegistryKey.STRUCTURE_TYPE, key);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,112 @@
|
||||||
|
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.inventory.meta.trim.TrimMaterial;
|
||||||
|
import org.jetbrains.annotations.ApiStatus;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Vanilla keys for {@link RegistryKey#TRIM_MATERIAL}.
|
||||||
|
*
|
||||||
|
* @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.20.2")
|
||||||
|
@ApiStatus.Experimental
|
||||||
|
public final class TrimMaterialKeys {
|
||||||
|
/**
|
||||||
|
* {@code minecraft:amethyst}
|
||||||
|
*
|
||||||
|
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||||
|
*/
|
||||||
|
public static final TypedKey<TrimMaterial> AMETHYST = create(key("amethyst"));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@code minecraft:copper}
|
||||||
|
*
|
||||||
|
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||||
|
*/
|
||||||
|
public static final TypedKey<TrimMaterial> COPPER = create(key("copper"));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@code minecraft:diamond}
|
||||||
|
*
|
||||||
|
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||||
|
*/
|
||||||
|
public static final TypedKey<TrimMaterial> DIAMOND = create(key("diamond"));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@code minecraft:emerald}
|
||||||
|
*
|
||||||
|
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||||
|
*/
|
||||||
|
public static final TypedKey<TrimMaterial> EMERALD = create(key("emerald"));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@code minecraft:gold}
|
||||||
|
*
|
||||||
|
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||||
|
*/
|
||||||
|
public static final TypedKey<TrimMaterial> GOLD = create(key("gold"));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@code minecraft:iron}
|
||||||
|
*
|
||||||
|
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||||
|
*/
|
||||||
|
public static final TypedKey<TrimMaterial> IRON = create(key("iron"));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@code minecraft:lapis}
|
||||||
|
*
|
||||||
|
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||||
|
*/
|
||||||
|
public static final TypedKey<TrimMaterial> LAPIS = create(key("lapis"));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@code minecraft:netherite}
|
||||||
|
*
|
||||||
|
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||||
|
*/
|
||||||
|
public static final TypedKey<TrimMaterial> NETHERITE = create(key("netherite"));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@code minecraft:quartz}
|
||||||
|
*
|
||||||
|
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||||
|
*/
|
||||||
|
public static final TypedKey<TrimMaterial> QUARTZ = create(key("quartz"));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@code minecraft:redstone}
|
||||||
|
*
|
||||||
|
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||||
|
*/
|
||||||
|
public static final TypedKey<TrimMaterial> REDSTONE = create(key("redstone"));
|
||||||
|
|
||||||
|
private TrimMaterialKeys() {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a key for {@link TrimMaterial} in a registry.
|
||||||
|
*
|
||||||
|
* @param key the value's key in the registry
|
||||||
|
* @return a new typed key
|
||||||
|
*/
|
||||||
|
@ApiStatus.Experimental
|
||||||
|
public static @NotNull TypedKey<TrimMaterial> create(final @NotNull Key key) {
|
||||||
|
return TypedKey.create(RegistryKey.TRIM_MATERIAL, key);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,154 @@
|
||||||
|
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.inventory.meta.trim.TrimPattern;
|
||||||
|
import org.jetbrains.annotations.ApiStatus;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Vanilla keys for {@link RegistryKey#TRIM_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"
|
||||||
|
})
|
||||||
|
@GeneratedFrom("1.20.2")
|
||||||
|
@ApiStatus.Experimental
|
||||||
|
public final class TrimPatternKeys {
|
||||||
|
/**
|
||||||
|
* {@code minecraft:coast}
|
||||||
|
*
|
||||||
|
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||||
|
*/
|
||||||
|
public static final TypedKey<TrimPattern> COAST = create(key("coast"));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@code minecraft:dune}
|
||||||
|
*
|
||||||
|
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||||
|
*/
|
||||||
|
public static final TypedKey<TrimPattern> DUNE = create(key("dune"));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@code minecraft:eye}
|
||||||
|
*
|
||||||
|
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||||
|
*/
|
||||||
|
public static final TypedKey<TrimPattern> EYE = create(key("eye"));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@code minecraft:host}
|
||||||
|
*
|
||||||
|
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||||
|
*/
|
||||||
|
public static final TypedKey<TrimPattern> HOST = create(key("host"));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@code minecraft:raiser}
|
||||||
|
*
|
||||||
|
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||||
|
*/
|
||||||
|
public static final TypedKey<TrimPattern> RAISER = create(key("raiser"));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@code minecraft:rib}
|
||||||
|
*
|
||||||
|
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||||
|
*/
|
||||||
|
public static final TypedKey<TrimPattern> RIB = create(key("rib"));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@code minecraft:sentry}
|
||||||
|
*
|
||||||
|
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||||
|
*/
|
||||||
|
public static final TypedKey<TrimPattern> SENTRY = create(key("sentry"));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@code minecraft:shaper}
|
||||||
|
*
|
||||||
|
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||||
|
*/
|
||||||
|
public static final TypedKey<TrimPattern> SHAPER = create(key("shaper"));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@code minecraft:silence}
|
||||||
|
*
|
||||||
|
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||||
|
*/
|
||||||
|
public static final TypedKey<TrimPattern> SILENCE = create(key("silence"));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@code minecraft:snout}
|
||||||
|
*
|
||||||
|
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||||
|
*/
|
||||||
|
public static final TypedKey<TrimPattern> SNOUT = create(key("snout"));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@code minecraft:spire}
|
||||||
|
*
|
||||||
|
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||||
|
*/
|
||||||
|
public static final TypedKey<TrimPattern> SPIRE = create(key("spire"));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@code minecraft:tide}
|
||||||
|
*
|
||||||
|
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||||
|
*/
|
||||||
|
public static final TypedKey<TrimPattern> TIDE = create(key("tide"));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@code minecraft:vex}
|
||||||
|
*
|
||||||
|
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||||
|
*/
|
||||||
|
public static final TypedKey<TrimPattern> VEX = create(key("vex"));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@code minecraft:ward}
|
||||||
|
*
|
||||||
|
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||||
|
*/
|
||||||
|
public static final TypedKey<TrimPattern> WARD = create(key("ward"));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@code minecraft:wayfinder}
|
||||||
|
*
|
||||||
|
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||||
|
*/
|
||||||
|
public static final TypedKey<TrimPattern> WAYFINDER = create(key("wayfinder"));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@code minecraft:wild}
|
||||||
|
*
|
||||||
|
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||||
|
*/
|
||||||
|
public static final TypedKey<TrimPattern> WILD = create(key("wild"));
|
||||||
|
|
||||||
|
private TrimPatternKeys() {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a key for {@link TrimPattern} in a registry.
|
||||||
|
*
|
||||||
|
* @param key the value's key in the registry
|
||||||
|
* @return a new typed key
|
||||||
|
*/
|
||||||
|
@ApiStatus.Experimental
|
||||||
|
public static @NotNull TypedKey<TrimPattern> create(final @NotNull Key key) {
|
||||||
|
return TypedKey.create(RegistryKey.TRIM_PATTERN, key);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,85 @@
|
||||||
|
package io.papermc.generator;
|
||||||
|
|
||||||
|
import com.mojang.logging.LogUtils;
|
||||||
|
import io.papermc.generator.types.GeneratedKeyType;
|
||||||
|
import io.papermc.generator.types.SourceGenerator;
|
||||||
|
import io.papermc.paper.registry.RegistryKey;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.Path;
|
||||||
|
import java.nio.file.Paths;
|
||||||
|
import java.util.List;
|
||||||
|
import net.kyori.adventure.key.Keyed;
|
||||||
|
import net.minecraft.SharedConstants;
|
||||||
|
import net.minecraft.core.LayeredRegistryAccess;
|
||||||
|
import net.minecraft.core.Registry;
|
||||||
|
import net.minecraft.core.RegistryAccess;
|
||||||
|
import net.minecraft.core.registries.Registries;
|
||||||
|
import net.minecraft.resources.RegistryDataLoader;
|
||||||
|
import net.minecraft.resources.ResourceKey;
|
||||||
|
import net.minecraft.server.Bootstrap;
|
||||||
|
import net.minecraft.server.RegistryLayer;
|
||||||
|
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 org.apache.commons.io.file.PathUtils;
|
||||||
|
import org.bukkit.GameEvent;
|
||||||
|
import org.bukkit.block.Biome;
|
||||||
|
import org.bukkit.generator.structure.StructureType;
|
||||||
|
import org.bukkit.inventory.meta.trim.TrimMaterial;
|
||||||
|
import org.bukkit.inventory.meta.trim.TrimPattern;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
|
||||||
|
public final class Main {
|
||||||
|
|
||||||
|
private static final Logger LOGGER = LogUtils.getLogger();
|
||||||
|
public static final RegistryAccess.Frozen REGISTRY_ACCESS;
|
||||||
|
|
||||||
|
static {
|
||||||
|
SharedConstants.tryDetectVersion();
|
||||||
|
Bootstrap.bootStrap();
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final List<SourceGenerator> GENERATORS = List.of(
|
||||||
|
simpleKey("GameEventKeys", GameEvent.class, Registries.GAME_EVENT, RegistryKey.GAME_EVENT, true),
|
||||||
|
simpleKey("BiomeKeys", Biome.class, Registries.BIOME, RegistryKey.BIOME, true),
|
||||||
|
simpleKey("TrimMaterialKeys", TrimMaterial.class, Registries.TRIM_MATERIAL, RegistryKey.TRIM_MATERIAL, true),
|
||||||
|
simpleKey("TrimPatternKeys", TrimPattern.class, Registries.TRIM_PATTERN, RegistryKey.TRIM_PATTERN, true),
|
||||||
|
simpleKey("StructureTypeKeys", StructureType.class, Registries.STRUCTURE_TYPE, RegistryKey.STRUCTURE_TYPE, false)
|
||||||
|
);
|
||||||
|
|
||||||
|
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 Main() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(final String[] args) {
|
||||||
|
final Path output = Paths.get(args[0]);
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,24 @@
|
||||||
|
package io.papermc.generator.types;
|
||||||
|
|
||||||
|
import com.squareup.javapoet.AnnotationSpec;
|
||||||
|
import java.util.List;
|
||||||
|
import org.bukkit.MinecraftExperimental;
|
||||||
|
import org.jetbrains.annotations.ApiStatus;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
public final class Annotations {
|
||||||
|
|
||||||
|
public static final List<AnnotationSpec> EXPERIMENTAL_ANNOTATIONS = List.of(
|
||||||
|
AnnotationSpec.builder(ApiStatus.Experimental.class).build(),
|
||||||
|
AnnotationSpec.builder(MinecraftExperimental.class)
|
||||||
|
.addMember("value", "$S", "update 1.20")
|
||||||
|
.build()
|
||||||
|
);
|
||||||
|
|
||||||
|
@ApiStatus.Experimental
|
||||||
|
public static final AnnotationSpec EXPERIMENTAL_API_ANNOTATION = AnnotationSpec.builder(ApiStatus.Experimental.class).build();
|
||||||
|
public static final AnnotationSpec NOT_NULL = AnnotationSpec.builder(NotNull.class).build();
|
||||||
|
|
||||||
|
private Annotations() {
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,205 @@
|
||||||
|
package io.papermc.generator.types;
|
||||||
|
|
||||||
|
import com.squareup.javapoet.AnnotationSpec;
|
||||||
|
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.CollectingContext;
|
||||||
|
import io.papermc.paper.generated.GeneratedFrom;
|
||||||
|
import io.papermc.paper.registry.RegistryKey;
|
||||||
|
import io.papermc.paper.registry.TypedKey;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
import java.lang.reflect.Modifier;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.Path;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
import java.util.Map;
|
||||||
|
import net.kyori.adventure.key.Key;
|
||||||
|
import net.minecraft.SharedConstants;
|
||||||
|
import net.minecraft.core.Registry;
|
||||||
|
import net.minecraft.core.RegistrySetBuilder;
|
||||||
|
import net.minecraft.resources.ResourceKey;
|
||||||
|
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.types.Annotations.EXPERIMENTAL_ANNOTATIONS;
|
||||||
|
import static io.papermc.generator.types.Annotations.EXPERIMENTAL_API_ANNOTATION;
|
||||||
|
import static io.papermc.generator.types.Annotations.NOT_NULL;
|
||||||
|
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> implements SourceGenerator {
|
||||||
|
|
||||||
|
// don't exist anymore
|
||||||
|
// private static final Map<ResourceKey<? extends Registry<?>>, RegistrySetBuilder.RegistryBootstrap<?>> EXPERIMENTAL_REGISTRY_ENTRIES = UpdateOneTwentyRegistries.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();
|
||||||
|
|
||||||
|
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 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();
|
||||||
|
private static final String TYPE_JAVADOC = """
|
||||||
|
Vanilla keys for {@link $T#$L}.
|
||||||
|
|
||||||
|
@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.
|
||||||
|
""";
|
||||||
|
private static final String FIELD_JAVADOC = """
|
||||||
|
{@code $L}
|
||||||
|
|
||||||
|
@apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||||
|
""";
|
||||||
|
private static final String CREATE_JAVADOC = """
|
||||||
|
Creates a key for {@link $T} in a registry.
|
||||||
|
|
||||||
|
@param key the value's key in the registry
|
||||||
|
@return a new typed key
|
||||||
|
""";
|
||||||
|
|
||||||
|
private final String keysClassName;
|
||||||
|
private final Class<A> apiType;
|
||||||
|
private final String pkg;
|
||||||
|
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) {
|
||||||
|
this.keysClassName = keysClassName;
|
||||||
|
this.apiType = apiType;
|
||||||
|
this.pkg = pkg;
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
return create;
|
||||||
|
}
|
||||||
|
|
||||||
|
private TypeSpec.Builder keyHolderType() {
|
||||||
|
return classBuilder(this.keysClassName)
|
||||||
|
.addModifiers(PUBLIC, FINAL)
|
||||||
|
.addJavadoc(TYPE_JAVADOC, RegistryKey.class, REGISTRY_KEY_FIELD_NAMES.get(this.apiRegistryKey))
|
||||||
|
.addAnnotation(SUPPRESS_WARNINGS).addAnnotation(GENERATED_FROM)
|
||||||
|
.addMethod(MethodSpec.constructorBuilder()
|
||||||
|
.addModifiers(PRIVATE)
|
||||||
|
.build()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected TypeSpec createTypeSpec() {
|
||||||
|
final TypeName typedKey = ParameterizedTypeName.get(TypedKey.class, this.apiType);
|
||||||
|
|
||||||
|
final TypeSpec.Builder typeBuilder = this.keyHolderType();
|
||||||
|
typeBuilder.addAnnotation(EXPERIMENTAL_API_ANNOTATION); // TODO experimental API
|
||||||
|
final MethodSpec.Builder createMethod = this.createMethod(typedKey);
|
||||||
|
|
||||||
|
final Registry<T> registry = Main.REGISTRY_ACCESS.registryOrThrow(this.registryKey);
|
||||||
|
final List<ResourceKey<T>> experimental = this.collectExperimentalKeys(registry);
|
||||||
|
|
||||||
|
boolean allExperimental = true;
|
||||||
|
for (final T value : registry) {
|
||||||
|
final ResourceKey<T> key = registry.getResourceKey(value).orElseThrow();
|
||||||
|
final String keyPath = key.location().getPath();
|
||||||
|
final String fieldName = keyPath.toUpperCase(Locale.ENGLISH).replaceAll("[.-/]", "_"); // replace invalid field name chars
|
||||||
|
final FieldSpec.Builder fieldBuilder = FieldSpec.builder(typedKey, fieldName, PUBLIC, STATIC, FINAL)
|
||||||
|
.initializer("$N(key($S))", createMethod.build(), keyPath)
|
||||||
|
.addJavadoc(FIELD_JAVADOC, key.location().toString());
|
||||||
|
if (experimental.contains(key)) {
|
||||||
|
fieldBuilder.addAnnotations(EXPERIMENTAL_ANNOTATIONS);
|
||||||
|
} else {
|
||||||
|
allExperimental = false;
|
||||||
|
}
|
||||||
|
typeBuilder.addField(fieldBuilder.build());
|
||||||
|
}
|
||||||
|
if (allExperimental) {
|
||||||
|
typeBuilder.addAnnotations(EXPERIMENTAL_ANNOTATIONS);
|
||||||
|
createMethod.addAnnotations(EXPERIMENTAL_ANNOTATIONS);
|
||||||
|
}
|
||||||
|
return typeBuilder.addMethod(createMethod.build()).build();
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
private List<ResourceKey<T>> collectExperimentalKeys(final Registry<T> registry) {
|
||||||
|
final RegistrySetBuilder.@Nullable RegistryBootstrap<T> registryBootstrap = (RegistrySetBuilder.RegistryBootstrap<T>) EXPERIMENTAL_REGISTRY_ENTRIES.get(this.registryKey);
|
||||||
|
if (registryBootstrap == null) {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
final List<ResourceKey<T>> experimental = new ArrayList<>();
|
||||||
|
final CollectingContext<T> context = new CollectingContext<>(experimental, registry);
|
||||||
|
registryBootstrap.run(context);
|
||||||
|
return experimental;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected JavaFile createFile() {
|
||||||
|
return JavaFile.builder(this.pkg, this.createTypeSpec())
|
||||||
|
.skipJavaLangImports(true)
|
||||||
|
.addStaticImport(Key.class, "key")
|
||||||
|
.indent(" ")
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public final String outputString() {
|
||||||
|
return this.createFile().toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeToFile(final Path parent) throws IOException {
|
||||||
|
final Path pkgDir = parent.resolve(this.pkg.replace('.', '/'));
|
||||||
|
Files.createDirectories(pkgDir);
|
||||||
|
Files.writeString(pkgDir.resolve(this.keysClassName + ".java"), this.outputString(), StandardCharsets.UTF_8);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
package io.papermc.generator.types;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.nio.file.Path;
|
||||||
|
|
||||||
|
public interface SourceGenerator {
|
||||||
|
|
||||||
|
String outputString();
|
||||||
|
|
||||||
|
void writeToFile(Path parent) throws IOException;
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
package io.papermc.generator.utils;
|
||||||
|
|
||||||
|
import com.mojang.serialization.Lifecycle;
|
||||||
|
import io.papermc.generator.Main;
|
||||||
|
import java.util.List;
|
||||||
|
import net.minecraft.core.Holder;
|
||||||
|
import net.minecraft.core.HolderGetter;
|
||||||
|
import net.minecraft.core.Registry;
|
||||||
|
import net.minecraft.data.worldgen.BootstapContext;
|
||||||
|
import net.minecraft.resources.ResourceKey;
|
||||||
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||||
|
import org.checkerframework.framework.qual.DefaultQualifier;
|
||||||
|
|
||||||
|
@DefaultQualifier(NonNull.class)
|
||||||
|
public record CollectingContext<T>(List<ResourceKey<T>> registered,
|
||||||
|
Registry<T> registry) implements BootstapContext<T> {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Holder.Reference<T> register(final ResourceKey<T> resourceKey, final @NonNull T t, final Lifecycle lifecycle) {
|
||||||
|
this.registered.add(resourceKey);
|
||||||
|
return Holder.Reference.createStandAlone(this.registry.holderOwner(), resourceKey);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <S> HolderGetter<S> lookup(final ResourceKey<? extends Registry<? extends S>> resourceKey) {
|
||||||
|
return Main.REGISTRY_ACCESS.registryOrThrow(resourceKey).asLookup();
|
||||||
|
}
|
||||||
|
}
|
6
paper-api-generator/wideners.at
Normal file
6
paper-api-generator/wideners.at
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
accessWidener v1 named
|
||||||
|
accessible method 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
|
||||||
|
accessible field net/minecraft/core/RegistrySetBuilder entries Ljava/util/List;
|
||||||
|
accessible class net/minecraft/core/RegistrySetBuilder$RegistryStub
|
251
patches/api/0004-Code-Generation.patch
Normal file
251
patches/api/0004-Code-Generation.patch
Normal file
|
@ -0,0 +1,251 @@
|
||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||||
|
Date: Fri, 26 May 2023 18:14:44 -0700
|
||||||
|
Subject: [PATCH] Code Generation
|
||||||
|
|
||||||
|
Currently includes generated key holder classes for types
|
||||||
|
used in the Registry Modification API
|
||||||
|
|
||||||
|
diff --git a/build.gradle.kts b/build.gradle.kts
|
||||||
|
index 75bfb0ab8049ebbb52240abf661d469de5526767..87e4ee95a8da287b02c13fac5f24f66902bc84c9 100644
|
||||||
|
--- a/build.gradle.kts
|
||||||
|
+++ b/build.gradle.kts
|
||||||
|
@@ -1,6 +1,7 @@
|
||||||
|
plugins {
|
||||||
|
`java-library`
|
||||||
|
`maven-publish`
|
||||||
|
+ idea // Paper
|
||||||
|
}
|
||||||
|
|
||||||
|
java {
|
||||||
|
@@ -46,6 +47,22 @@ dependencies {
|
||||||
|
testImplementation("org.ow2.asm:asm-tree:9.5")
|
||||||
|
}
|
||||||
|
|
||||||
|
+// Paper start
|
||||||
|
+val generatedApiPath: java.nio.file.Path = rootProject.projectDir.toPath().resolve("paper-api-generator/generated")
|
||||||
|
+idea {
|
||||||
|
+ module {
|
||||||
|
+ generatedSourceDirs.add(generatedApiPath.toFile())
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
+sourceSets {
|
||||||
|
+ main {
|
||||||
|
+ java {
|
||||||
|
+ srcDir(generatedApiPath)
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
+// Paper end
|
||||||
|
+
|
||||||
|
configure<PublishingExtension> {
|
||||||
|
publications.create<MavenPublication>("maven") {
|
||||||
|
from(components["java"])
|
||||||
|
@@ -122,3 +139,14 @@ tasks.check {
|
||||||
|
dependsOn(scanJar)
|
||||||
|
}
|
||||||
|
// Paper end
|
||||||
|
+// Paper start
|
||||||
|
+val scanJarForOldGeneratedCode = tasks.register("scanJarForOldGeneratedCode", io.papermc.paperweight.tasks.ScanJarForOldGeneratedCode::class) {
|
||||||
|
+ mcVersion.set(providers.gradleProperty("mcVersion"))
|
||||||
|
+ annotation.set("Lio/papermc/paper/generated/GeneratedFrom;")
|
||||||
|
+ jarToScan.set(tasks.jar.flatMap { it.archiveFile })
|
||||||
|
+ classpath.from(configurations.compileClasspath)
|
||||||
|
+}
|
||||||
|
+tasks.check {
|
||||||
|
+ dependsOn(scanJarForOldGeneratedCode)
|
||||||
|
+}
|
||||||
|
+// Paper end
|
||||||
|
diff --git a/src/main/java/io/papermc/paper/generated/GeneratedFrom.java b/src/main/java/io/papermc/paper/generated/GeneratedFrom.java
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000000000000000000000000000000000000..2512dba27edfdccbc4430815b6cba048e3d93484
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/src/main/java/io/papermc/paper/generated/GeneratedFrom.java
|
||||||
|
@@ -0,0 +1,21 @@
|
||||||
|
+package io.papermc.paper.generated;
|
||||||
|
+
|
||||||
|
+import java.lang.annotation.Documented;
|
||||||
|
+import java.lang.annotation.ElementType;
|
||||||
|
+import java.lang.annotation.Retention;
|
||||||
|
+import java.lang.annotation.RetentionPolicy;
|
||||||
|
+import java.lang.annotation.Target;
|
||||||
|
+import org.jetbrains.annotations.ApiStatus;
|
||||||
|
+
|
||||||
|
+/**
|
||||||
|
+ * Used to mark classes which are generated from
|
||||||
|
+ * a specific version of minecraft.
|
||||||
|
+ */
|
||||||
|
+@ApiStatus.Internal
|
||||||
|
+@Documented
|
||||||
|
+@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
+@Target(ElementType.TYPE)
|
||||||
|
+public @interface GeneratedFrom {
|
||||||
|
+
|
||||||
|
+ String value();
|
||||||
|
+}
|
||||||
|
diff --git a/src/main/java/io/papermc/paper/registry/RegistryKey.java b/src/main/java/io/papermc/paper/registry/RegistryKey.java
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000000000000000000000000000000000000..5251f922d2d14da35f61098c11694371f591cd2a
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/src/main/java/io/papermc/paper/registry/RegistryKey.java
|
||||||
|
@@ -0,0 +1,61 @@
|
||||||
|
+package io.papermc.paper.registry;
|
||||||
|
+
|
||||||
|
+import net.kyori.adventure.key.Keyed;
|
||||||
|
+import org.bukkit.GameEvent;
|
||||||
|
+import org.bukkit.block.Biome;
|
||||||
|
+import org.bukkit.generator.structure.StructureType;
|
||||||
|
+import org.bukkit.inventory.meta.trim.TrimMaterial;
|
||||||
|
+import org.bukkit.inventory.meta.trim.TrimPattern;
|
||||||
|
+import org.jetbrains.annotations.ApiStatus;
|
||||||
|
+
|
||||||
|
+import static io.papermc.paper.registry.RegistryKeyImpl.create;
|
||||||
|
+
|
||||||
|
+/**
|
||||||
|
+ * Identifier for a specific registry. For use with
|
||||||
|
+ * {@link TypedKey} and the registry modification API.
|
||||||
|
+ * <p>
|
||||||
|
+ * There are 2 types of registries, identified as "built-in"
|
||||||
|
+ * or "data-driven". The former are not changeable by datapacks (which
|
||||||
|
+ * doesn't necessarily mean they aren't changeable in the API) and
|
||||||
|
+ * are loaded first. "Data-driven" registries are all created by
|
||||||
|
+ * reading in data from the vanilla and other datapacks.
|
||||||
|
+ *
|
||||||
|
+ * @param <T> the value type
|
||||||
|
+ */
|
||||||
|
+@SuppressWarnings("unused")
|
||||||
|
+@ApiStatus.Experimental
|
||||||
|
+public sealed interface RegistryKey<T> extends Keyed permits RegistryKeyImpl {
|
||||||
|
+
|
||||||
|
+ /* ******************* *
|
||||||
|
+ * Built-in Registries *
|
||||||
|
+ * ******************* */
|
||||||
|
+ /**
|
||||||
|
+ * Built-in registry for game events
|
||||||
|
+ * @see io.papermc.paper.registry.keys.GameEventKeys
|
||||||
|
+ */
|
||||||
|
+ RegistryKey<GameEvent> GAME_EVENT = create("game_event");
|
||||||
|
+ /**
|
||||||
|
+ * Built-in registry for structure types.
|
||||||
|
+ * @see io.papermc.paper.registry.keys.StructureTypeKeys
|
||||||
|
+ */
|
||||||
|
+ RegistryKey<StructureType> STRUCTURE_TYPE = create("worldgen/structure_type");
|
||||||
|
+
|
||||||
|
+ /* ********************** *
|
||||||
|
+ * Data-driven Registries *
|
||||||
|
+ * ********************** */
|
||||||
|
+ /**
|
||||||
|
+ * Data-driven registry for structure types.
|
||||||
|
+ * @see io.papermc.paper.registry.keys.BiomeKeys
|
||||||
|
+ */
|
||||||
|
+ RegistryKey<Biome> BIOME = create("worldgen/biome");
|
||||||
|
+ /**
|
||||||
|
+ * Data-driven registry for structure types.
|
||||||
|
+ * @see io.papermc.paper.registry.keys.TrimMaterialKeys
|
||||||
|
+ */
|
||||||
|
+ RegistryKey<TrimMaterial> TRIM_MATERIAL = create("trim_material");
|
||||||
|
+ /**
|
||||||
|
+ * Data-driven registry for structure types.
|
||||||
|
+ * @see io.papermc.paper.registry.keys.TrimPatternKeys
|
||||||
|
+ */
|
||||||
|
+ RegistryKey<TrimPattern> TRIM_PATTERN = create("trim_pattern");
|
||||||
|
+}
|
||||||
|
diff --git a/src/main/java/io/papermc/paper/registry/RegistryKeyImpl.java b/src/main/java/io/papermc/paper/registry/RegistryKeyImpl.java
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000000000000000000000000000000000000..9ad300fa1668cb59bbd85ff8091591db69b8c9dc
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/src/main/java/io/papermc/paper/registry/RegistryKeyImpl.java
|
||||||
|
@@ -0,0 +1,19 @@
|
||||||
|
+package io.papermc.paper.registry;
|
||||||
|
+
|
||||||
|
+import com.google.common.collect.Sets;
|
||||||
|
+import java.util.Set;
|
||||||
|
+import net.kyori.adventure.key.Key;
|
||||||
|
+import org.intellij.lang.annotations.Subst;
|
||||||
|
+import org.jetbrains.annotations.NotNull;
|
||||||
|
+
|
||||||
|
+record RegistryKeyImpl<T>(@NotNull Key key) implements RegistryKey<T> {
|
||||||
|
+
|
||||||
|
+ static final Set<RegistryKey<?>> REGISTRY_KEYS = Sets.newIdentityHashSet();
|
||||||
|
+
|
||||||
|
+ static <T> RegistryKey<T> create(@Subst("some_key") final String key) {
|
||||||
|
+ final RegistryKey<T> registryKey = new RegistryKeyImpl<>(Key.key(Key.MINECRAFT_NAMESPACE, key));
|
||||||
|
+ REGISTRY_KEYS.add(registryKey);
|
||||||
|
+ return registryKey;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+}
|
||||||
|
diff --git a/src/main/java/io/papermc/paper/registry/TypedKey.java b/src/main/java/io/papermc/paper/registry/TypedKey.java
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000000000000000000000000000000000000..271454cd1b92ada4301025b57348ea77da9116a1
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/src/main/java/io/papermc/paper/registry/TypedKey.java
|
||||||
|
@@ -0,0 +1,44 @@
|
||||||
|
+package io.papermc.paper.registry;
|
||||||
|
+
|
||||||
|
+import net.kyori.adventure.key.Key;
|
||||||
|
+import net.kyori.adventure.key.Keyed;
|
||||||
|
+import org.jetbrains.annotations.ApiStatus;
|
||||||
|
+import org.jetbrains.annotations.NotNull;
|
||||||
|
+
|
||||||
|
+/**
|
||||||
|
+ * Represents a key for a value in a specific registry.
|
||||||
|
+ *
|
||||||
|
+ * @param <T> the value type for the registry
|
||||||
|
+ */
|
||||||
|
+@ApiStatus.Experimental
|
||||||
|
+public sealed interface TypedKey<T> extends Keyed permits TypedKeyImpl {
|
||||||
|
+
|
||||||
|
+ /**
|
||||||
|
+ * Gets the key for the value in the registry.
|
||||||
|
+ *
|
||||||
|
+ * @return the value's key
|
||||||
|
+ */
|
||||||
|
+ @Override
|
||||||
|
+ @NotNull Key key();
|
||||||
|
+
|
||||||
|
+ /**
|
||||||
|
+ * Gets the registry key for the value this key
|
||||||
|
+ * represents.
|
||||||
|
+ *
|
||||||
|
+ * @return the registry key
|
||||||
|
+ */
|
||||||
|
+ @NotNull RegistryKey<T> registryKey();
|
||||||
|
+
|
||||||
|
+ /**
|
||||||
|
+ * Create a typed key from a key and a registry key.
|
||||||
|
+ *
|
||||||
|
+ * @param registryKey the registry this key is for
|
||||||
|
+ * @param key the key for the value in the registry
|
||||||
|
+ * @param <T> value type
|
||||||
|
+ * @return a new key for the value key and registry key
|
||||||
|
+ */
|
||||||
|
+ @ApiStatus.Experimental
|
||||||
|
+ static <T extends Keyed> @NotNull TypedKey<T> create(final @NotNull RegistryKey<T> registryKey, final @NotNull Key key) {
|
||||||
|
+ return new TypedKeyImpl<>(key, registryKey);
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
diff --git a/src/main/java/io/papermc/paper/registry/TypedKeyImpl.java b/src/main/java/io/papermc/paper/registry/TypedKeyImpl.java
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000000000000000000000000000000000000..3c3fd73f7742bb8602e2f9164dd4c1208a412255
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/src/main/java/io/papermc/paper/registry/TypedKeyImpl.java
|
||||||
|
@@ -0,0 +1,8 @@
|
||||||
|
+package io.papermc.paper.registry;
|
||||||
|
+
|
||||||
|
+import net.kyori.adventure.key.Key;
|
||||||
|
+import net.kyori.adventure.key.Keyed;
|
||||||
|
+import org.jetbrains.annotations.NotNull;
|
||||||
|
+
|
||||||
|
+record TypedKeyImpl<T extends Keyed>(@NotNull Key key, @NotNull RegistryKey<T> registryKey) implements TypedKey<T> {
|
||||||
|
+}
|
||||||
|
diff --git a/src/main/java/org/bukkit/MinecraftExperimental.java b/src/main/java/org/bukkit/MinecraftExperimental.java
|
||||||
|
index 2365a8c620be709b280fb08855752bb0995838fc..b63e24b3c4d2f1a08e39434caa527bb2e0edea22 100644
|
||||||
|
--- a/src/main/java/org/bukkit/MinecraftExperimental.java
|
||||||
|
+++ b/src/main/java/org/bukkit/MinecraftExperimental.java
|
||||||
|
@@ -24,4 +24,5 @@ import org.jetbrains.annotations.ApiStatus;
|
||||||
|
})
|
||||||
|
@ApiStatus.Internal
|
||||||
|
public @interface MinecraftExperimental {
|
||||||
|
+ String value() default ""; // Paper
|
||||||
|
}
|
|
@ -9,7 +9,7 @@ diff --git a/build.gradle.kts b/build.gradle.kts
|
||||||
index 75bfb0ab8049ebbb52240abf661d469de5526767..ecba866b84bc5f86a442bf220ab24ed8706aadf9 100644
|
index 75bfb0ab8049ebbb52240abf661d469de5526767..ecba866b84bc5f86a442bf220ab24ed8706aadf9 100644
|
||||||
--- a/build.gradle.kts
|
--- a/build.gradle.kts
|
||||||
+++ b/build.gradle.kts
|
+++ b/build.gradle.kts
|
||||||
@@ -22,6 +22,7 @@ dependencies {
|
@@ -23,6 +23,7 @@ dependencies {
|
||||||
api("com.googlecode.json-simple:json-simple:1.1.1") {
|
api("com.googlecode.json-simple:json-simple:1.1.1") {
|
||||||
isTransitive = false // includes junit
|
isTransitive = false // includes junit
|
||||||
}
|
}
|
|
@ -10,7 +10,7 @@ diff --git a/build.gradle.kts b/build.gradle.kts
|
||||||
index ecba866b84bc5f86a442bf220ab24ed8706aadf9..2377d476aee8c88d26ca715fdb756dc97749aac8 100644
|
index ecba866b84bc5f86a442bf220ab24ed8706aadf9..2377d476aee8c88d26ca715fdb756dc97749aac8 100644
|
||||||
--- a/build.gradle.kts
|
--- a/build.gradle.kts
|
||||||
+++ b/build.gradle.kts
|
+++ b/build.gradle.kts
|
||||||
@@ -10,12 +10,24 @@ java {
|
@@ -11,12 +11,24 @@ java {
|
||||||
|
|
||||||
val annotationsVersion = "24.0.1"
|
val annotationsVersion = "24.0.1"
|
||||||
val bungeeCordChatVersion = "1.20-R0.1"
|
val bungeeCordChatVersion = "1.20-R0.1"
|
||||||
|
@ -36,7 +36,7 @@ index ecba866b84bc5f86a442bf220ab24ed8706aadf9..2377d476aee8c88d26ca715fdb756dc9
|
||||||
api("org.yaml:snakeyaml:2.2")
|
api("org.yaml:snakeyaml:2.2")
|
||||||
api("org.joml:joml:1.10.5")
|
api("org.joml:joml:1.10.5")
|
||||||
// Paper start
|
// Paper start
|
||||||
@@ -23,6 +35,13 @@ dependencies {
|
@@ -24,6 +36,13 @@ dependencies {
|
||||||
isTransitive = false // includes junit
|
isTransitive = false // includes junit
|
||||||
}
|
}
|
||||||
api("it.unimi.dsi:fastutil:8.5.6")
|
api("it.unimi.dsi:fastutil:8.5.6")
|
||||||
|
@ -50,7 +50,7 @@ index ecba866b84bc5f86a442bf220ab24ed8706aadf9..2377d476aee8c88d26ca715fdb756dc9
|
||||||
// Paper end
|
// Paper end
|
||||||
|
|
||||||
compileOnly("org.apache.maven:maven-resolver-provider:3.8.5")
|
compileOnly("org.apache.maven:maven-resolver-provider:3.8.5")
|
||||||
@@ -83,14 +102,30 @@ tasks.withType<Javadoc> {
|
@@ -100,14 +119,30 @@ tasks.withType<Javadoc> {
|
||||||
"https://guava.dev/releases/32.1.2-jre/api/docs/",
|
"https://guava.dev/releases/32.1.2-jre/api/docs/",
|
||||||
"https://javadoc.io/doc/org.yaml/snakeyaml/2.2/",
|
"https://javadoc.io/doc/org.yaml/snakeyaml/2.2/",
|
||||||
"https://javadoc.io/doc/org.jetbrains/annotations/$annotationsVersion/", // Paper - we don't want Java 5 annotations
|
"https://javadoc.io/doc/org.jetbrains/annotations/$annotationsVersion/", // Paper - we don't want Java 5 annotations
|
|
@ -9,7 +9,7 @@ diff --git a/build.gradle.kts b/build.gradle.kts
|
||||||
index 2377d476aee8c88d26ca715fdb756dc97749aac8..0c6e0bb90fe5ea29c467323a179a47ec122ba0f6 100644
|
index 2377d476aee8c88d26ca715fdb756dc97749aac8..0c6e0bb90fe5ea29c467323a179a47ec122ba0f6 100644
|
||||||
--- a/build.gradle.kts
|
--- a/build.gradle.kts
|
||||||
+++ b/build.gradle.kts
|
+++ b/build.gradle.kts
|
||||||
@@ -42,6 +42,9 @@ dependencies {
|
@@ -43,6 +43,9 @@ dependencies {
|
||||||
apiAndDocs("net.kyori:adventure-text-serializer-legacy")
|
apiAndDocs("net.kyori:adventure-text-serializer-legacy")
|
||||||
apiAndDocs("net.kyori:adventure-text-serializer-plain")
|
apiAndDocs("net.kyori:adventure-text-serializer-plain")
|
||||||
apiAndDocs("net.kyori:adventure-text-logger-slf4j")
|
apiAndDocs("net.kyori:adventure-text-logger-slf4j")
|
|
@ -8,7 +8,7 @@ diff --git a/build.gradle.kts b/build.gradle.kts
|
||||||
index 0c6e0bb90fe5ea29c467323a179a47ec122ba0f6..145f6209a984e74da2d2de03cf725c06c77ef8da 100644
|
index 0c6e0bb90fe5ea29c467323a179a47ec122ba0f6..145f6209a984e74da2d2de03cf725c06c77ef8da 100644
|
||||||
--- a/build.gradle.kts
|
--- a/build.gradle.kts
|
||||||
+++ b/build.gradle.kts
|
+++ b/build.gradle.kts
|
||||||
@@ -47,7 +47,7 @@ dependencies {
|
@@ -48,7 +48,7 @@ dependencies {
|
||||||
implementation("org.ow2.asm:asm-commons:9.4")
|
implementation("org.ow2.asm:asm-commons:9.4")
|
||||||
// Paper end
|
// Paper end
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ index 0c6e0bb90fe5ea29c467323a179a47ec122ba0f6..145f6209a984e74da2d2de03cf725c06
|
||||||
compileOnly("org.apache.maven.resolver:maven-resolver-connector-basic:1.7.3")
|
compileOnly("org.apache.maven.resolver:maven-resolver-connector-basic:1.7.3")
|
||||||
compileOnly("org.apache.maven.resolver:maven-resolver-transport-http:1.7.3")
|
compileOnly("org.apache.maven.resolver:maven-resolver-transport-http:1.7.3")
|
||||||
compileOnly("com.google.code.findbugs:jsr305:1.3.9") // Paper
|
compileOnly("com.google.code.findbugs:jsr305:1.3.9") // Paper
|
||||||
@@ -118,6 +118,7 @@ tasks.withType<Javadoc> {
|
@@ -135,6 +135,7 @@ tasks.withType<Javadoc> {
|
||||||
"https://jd.advntr.dev/text-serializer-plain/$adventureVersion/",
|
"https://jd.advntr.dev/text-serializer-plain/$adventureVersion/",
|
||||||
"https://jd.advntr.dev/text-logger-slf4j/$adventureVersion/",
|
"https://jd.advntr.dev/text-logger-slf4j/$adventureVersion/",
|
||||||
// Paper end
|
// Paper end
|
|
@ -17,7 +17,7 @@ diff --git a/build.gradle.kts b/build.gradle.kts
|
||||||
index 145f6209a984e74da2d2de03cf725c06c77ef8da..639651972fddce4dff63a0f0a7e566a15b9e2dd6 100644
|
index 145f6209a984e74da2d2de03cf725c06c77ef8da..639651972fddce4dff63a0f0a7e566a15b9e2dd6 100644
|
||||||
--- a/build.gradle.kts
|
--- a/build.gradle.kts
|
||||||
+++ b/build.gradle.kts
|
+++ b/build.gradle.kts
|
||||||
@@ -11,6 +11,8 @@ java {
|
@@ -12,6 +12,8 @@ java {
|
||||||
val annotationsVersion = "24.0.1"
|
val annotationsVersion = "24.0.1"
|
||||||
val bungeeCordChatVersion = "1.20-R0.1"
|
val bungeeCordChatVersion = "1.20-R0.1"
|
||||||
val adventureVersion = "4.14.0"
|
val adventureVersion = "4.14.0"
|
||||||
|
@ -26,7 +26,7 @@ index 145f6209a984e74da2d2de03cf725c06c77ef8da..639651972fddce4dff63a0f0a7e566a1
|
||||||
val apiAndDocs: Configuration by configurations.creating {
|
val apiAndDocs: Configuration by configurations.creating {
|
||||||
attributes {
|
attributes {
|
||||||
attribute(Category.CATEGORY_ATTRIBUTE, objects.named(Category.DOCUMENTATION))
|
attribute(Category.CATEGORY_ATTRIBUTE, objects.named(Category.DOCUMENTATION))
|
||||||
@@ -42,6 +44,8 @@ dependencies {
|
@@ -43,6 +45,8 @@ dependencies {
|
||||||
apiAndDocs("net.kyori:adventure-text-serializer-legacy")
|
apiAndDocs("net.kyori:adventure-text-serializer-legacy")
|
||||||
apiAndDocs("net.kyori:adventure-text-serializer-plain")
|
apiAndDocs("net.kyori:adventure-text-serializer-plain")
|
||||||
apiAndDocs("net.kyori:adventure-text-logger-slf4j")
|
apiAndDocs("net.kyori:adventure-text-logger-slf4j")
|
||||||
|
@ -35,7 +35,7 @@ index 145f6209a984e74da2d2de03cf725c06c77ef8da..639651972fddce4dff63a0f0a7e566a1
|
||||||
|
|
||||||
implementation("org.ow2.asm:asm:9.4")
|
implementation("org.ow2.asm:asm:9.4")
|
||||||
implementation("org.ow2.asm:asm-commons:9.4")
|
implementation("org.ow2.asm:asm-commons:9.4")
|
||||||
@@ -117,6 +121,8 @@ tasks.withType<Javadoc> {
|
@@ -134,6 +138,8 @@ tasks.withType<Javadoc> {
|
||||||
"https://jd.advntr.dev/text-serializer-legacy/$adventureVersion/",
|
"https://jd.advntr.dev/text-serializer-legacy/$adventureVersion/",
|
||||||
"https://jd.advntr.dev/text-serializer-plain/$adventureVersion/",
|
"https://jd.advntr.dev/text-serializer-plain/$adventureVersion/",
|
||||||
"https://jd.advntr.dev/text-logger-slf4j/$adventureVersion/",
|
"https://jd.advntr.dev/text-logger-slf4j/$adventureVersion/",
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue