Compare commits

..
44 Commits
Author SHA1 Message Date
NotAlexNoyle 026cc872ed Exclude CODEOWNERS from language statistics 2026-11-01 10:10:01 -05:00
NotAlexNoyle 77b7b8a9a6 Add CODEOWNERS (one staff approval) 2026-11-01 10:10:01 -05:00
Tamion 6ea42025a4 Send all attributes on respawn (#12274) 2025-03-13 12:41:03 +01:00
Nassim Jahnke 310f52293b Add unsupported config option and internal API to simplify remote item matching
This is important for 1.21.5 servers/clients and non-Vanilla clients that may not be able to match 1.21.5 data hashes anymore
2025-03-13 12:32:50 +01:00
Nassim Jahnke c37b890c8b More deferred requireNonNull message creation 2025-03-13 12:27:12 +01:00
Pedro f0388e2f38 Call EntityPushedByEntityAttackEvent for Mace AoE (#12257) 2025-03-12 11:13:47 +01:00
Tamion 102c8bbc54 Add config for updating equipment on player actions (#12275) 2025-03-12 11:09:27 +01:00
Github-Citizen f4f275519f [ci skip] Clarify BlockFadeEvent#getNewState javadocs (#12250) 2025-03-09 21:58:56 +01:00
Spottedleaf 1a7288aa05 Adjust unloaded chunk check for block digging 2025-03-09 11:11:02 -07:00
0x22 743346a5da Force update attributes
See https://github.com/PaperMC/Paper/pull/12241/
2025-03-09 11:11:02 -07:00
Bjarne Koll e5d988df85 Revert "Fix cancelling PlayerInteractEvent at (0, 0, 0) (#12215)"
This reverts commit a2b0ff0644.
2025-03-09 18:39:08 +01:00
Warrior 7afae7f465 Add client tick end event (#12199) 2025-03-09 13:14:44 -04:00
MiniDigger | Martin 3d13b11514 fix: switch back to using a snapshot for velocity-natives
we delete old snapshots (age > 10 days), keeping only the last 5 at minimum
2025-03-09 10:28:05 +01:00
Shane Bee 34c794dc51 ServerTickManager#requestGameToSprint - Silence command like feedback (#12220)
* CraftServerTickManager - silence feedback when sprinting

* CraftServerTickManager - forgot secondary note

* ServerTickRateManager - only set to silent if not already sprinting
2025-03-08 17:09:40 -05:00
Lulu13022002 2565497897 Cancel PlayerLaunchProjectileEvent properly for enderpearls (#12223) 2025-03-08 17:02:10 -05:00
Lulu13022002 df96f8a0fa Correctly handle events for end portal (#12246) 2025-03-08 16:59:43 -05:00
Noah van der AaandWarrior a2b0ff0644 Fix cancelling PlayerInteractEvent at (0, 0, 0) (#12215)
---------

Co-authored-by: Warrior <50800980+warriorrrr@users.noreply.github.com>
2025-03-08 16:52:10 -05:00
Esophose 43f37b1b5e Remove ItemFactory#enchantWithLevels range check for vanilla parity (#12209) 2025-03-08 15:38:14 -05:00
Tamion 20df25d3a5 Don't resync all attributes when updating scaled health (#12232) 2025-03-08 12:31:21 -08:00
TonytheMacaroni 2526fe063a Add type to represent unimplemented data component types (#12222) 2025-03-08 15:20:53 -05:00
Shane Bee 8e69d981fa Player - Expose player score (#12243) 2025-03-08 11:38:50 -08:00
Spottedleaf 4519857817 Set old position / rotation for newly created entities
Set the old pos/rot to be the same as the current pos/rot for new
entities as the default value for the old pos/rot is zero.

Fixes https://github.com/PaperMC/Folia/issues/302
2025-03-08 06:33:29 -08:00
Lulu13022002 ce30016218 Skip alpha channel for custom model data component (#12205) 2025-03-07 23:27:05 -05:00
Lulu13022002 a6ce734fd0 Fix zombie villager not dropping item once cured (#12230) 2025-03-07 23:13:25 -05:00
Lulu13022002 7a3d0c4e98 Fix recipe being always null in PrepareItemCraftEvent from the api (#12237) 2025-03-07 23:11:12 -05:00
0x22 0a4eb8f3bb Send the pong response packet immediately. This packet is similar to the keep alive packet and is processed async. (#12242) 2025-03-07 19:40:58 -08:00
Vincenzo Reina 5538d24d72 Fix "DEFAULT" SpawnReason of fish spawned by bucket (#12227)
* Add SpawnReason "Bucket". Fix "DEFAULT" SpawnReason for entity spawning from mob bucket

* Clarify SpawnReason description for bucket entity spawning
2025-03-05 13:28:25 +01:00
tgbhy a866e366b2 Fix MenuType.SMITHING JavaDocs (#12226) 2025-03-05 10:45:16 +01:00
Dylan 8de7e356fa Add null check to level ref in Entity constructor (#12218) 2025-03-03 17:46:20 +01:00
Warrior 1d5e5a57e9 Document replacement for Skull owner profile methods (#12195) 2025-02-28 20:51:39 +01:00
Warrior b506626824 Remove unused light queue size option (#12201) 2025-02-28 17:58:45 +01:00
okx-code 0a6e7435b3 Fix invulnerability damage and armour (#12190) 2025-02-26 14:06:42 +01:00
Jake Potrebic 9421f22372 Make CustomArgumentType use parse(reader,source) (#12191) 2025-02-26 13:12:23 +01:00
Warrior f63dbeafde Fix cancelled HangingPlaceEvent inventory desync (#12161) 2025-02-25 22:33:35 +01:00
Pedro fc56c728c0 Add methods for Creaking (#12094) 2025-02-25 22:23:47 +01:00
Lulu13022002 9b9f046f41 Remove broken code (#12171) 2025-02-25 22:14:21 +01:00
_Novit_ 7f3d3591de Use MiniMessage#deserialize(String, Pointered) in sendRichMessage for send messages (#12177) 2025-02-25 22:06:20 +01:00
Warrior a501c45918 Deprecate server config getters (#12189) 2025-02-25 22:03:38 +01:00
Warrior ca2610904b Don't process empty rcon commands (#12188) 2025-02-25 22:03:14 +01:00
Glicz b00875f86d Add a method on Registry to get the size (#12182) 2025-02-25 22:02:48 +01:00
Warrior 5f2ee83ed4 Fix first execution of async delayed/repeating tasks being sync (#12166) 2025-02-25 21:45:33 +01:00
Warrior 1d9b399427 Add config option for failed beehive release cooldowns (#12186) 2025-02-25 21:45:18 +01:00
Nassim Jahnke f12d33f04e Track codec writing 2025-02-25 21:45:02 +01:00
Bjarne Koll 9be4e07a3e Pin snapshot dependencies (#12185)
Additionally pins configurate-core as a transitive dependency of
configurate-yml, as the yaml snapshot depends on a snapshot itself.
2025-02-25 21:44:42 +01:00
748 changed files with 26511 additions and 27263 deletions

No files matched your search

+1 -3
View File
@@ -1,5 +1,3 @@
root = true
[*]
charset = utf-8
end_of_line = lf
@@ -42,5 +40,5 @@ ij_java_use_fq_class_names = true
[paper-server/src/minecraft/resources/data/**/*.json]
indent_size = 2
[paper-{server,api}/src/generated/java/**/*.java]
[paper-api/src/generated/java/**/*.java]
ij_java_imports_layout = $*, |, *
+1
View File
@@ -5,3 +5,4 @@ gradlew text eol=lf
*.bat text eol=crlf
*.jar binary
.gitea/CODEOWNERS linguist-detectable=false
+3
View File
@@ -0,0 +1,3 @@
# Pull requests request review from the eligible staff team(s).
# One approval from either an Admin or Developer satisfies branch protection.
* @trueog/Admins @trueog/Developers
+1 -1
View File
@@ -45,7 +45,7 @@ logs/
!gradle/wrapper/gradle-wrapper.jar
test-plugin.settings.gradle.kts
paper-generator.settings.gradle.kts
paper-api-generator.settings.gradle.kts
# Don't track patched vanilla submodules
paper-server/src/minecraft/
+37
View File
@@ -0,0 +1,37 @@
import io.papermc.paperweight.util.defaultJavaLauncher
plugins {
java
id("io.papermc.paperweight.source-generator")
}
paperweight {
atFile.set(layout.projectDirectory.file("wideners.at"))
}
dependencies {
minecraftJar(project(":paper-server", "mappedJarOutgoing"))
implementation(project(":paper-server", "macheMinecraftLibraries"))
implementation("com.squareup:javapoet:1.13.0")
implementation(project(":paper-api"))
implementation("io.github.classgraph:classgraph:4.8.47")
implementation("org.jetbrains:annotations:26.0.1")
testImplementation("org.junit.jupiter:junit-jupiter:5.10.2")
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
}
tasks.register<JavaExec>("generate") {
dependsOn(tasks.check)
mainClass.set("io.papermc.generator.Main")
classpath(sourceSets.main.map { it.runtimeClasspath })
args(rootProject.layout.projectDirectory.dir("paper-api/src/generated/java").asFile.absolutePath)
javaLauncher = javaToolchains.defaultJavaLauncher(project)
}
tasks.test {
useJUnitPlatform()
}
group = "io.papermc.paper"
version = "1.0-SNAPSHOT"
@@ -0,0 +1,96 @@
package io.papermc.generator;
import io.papermc.generator.types.GeneratedKeyType;
import io.papermc.generator.types.GeneratedTagKeyType;
import io.papermc.generator.types.SourceGenerator;
import io.papermc.generator.types.goal.MobGoalGenerator;
import io.papermc.paper.registry.RegistryKey;
import net.minecraft.core.Registry;
import net.minecraft.core.registries.Registries;
import net.minecraft.resources.ResourceKey;
import org.bukkit.Art;
import org.bukkit.Fluid;
import org.bukkit.GameEvent;
import org.bukkit.JukeboxSong;
import org.bukkit.MusicInstrument;
import org.bukkit.Sound;
import org.bukkit.attribute.Attribute;
import org.bukkit.block.Biome;
import org.bukkit.block.BlockType;
import org.bukkit.block.banner.PatternType;
import org.bukkit.damage.DamageType;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Cat;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Frog;
import org.bukkit.entity.Villager;
import org.bukkit.entity.Wolf;
import org.bukkit.generator.structure.Structure;
import org.bukkit.generator.structure.StructureType;
import org.bukkit.inventory.ItemType;
import org.bukkit.inventory.MenuType;
import org.bukkit.inventory.meta.trim.TrimMaterial;
import org.bukkit.inventory.meta.trim.TrimPattern;
import org.bukkit.map.MapCursor;
import org.bukkit.potion.PotionEffectType;
public interface Generators {
SourceGenerator[] API = {
// built-ins
simpleKey("GameEventKeys", GameEvent.class, Registries.GAME_EVENT, RegistryKey.GAME_EVENT, true),
simpleKey("StructureTypeKeys", StructureType.class, Registries.STRUCTURE_TYPE, RegistryKey.STRUCTURE_TYPE, false),
simpleKey("MobEffectKeys", PotionEffectType.class, Registries.MOB_EFFECT, RegistryKey.MOB_EFFECT, false),
simpleKey("BlockTypeKeys", BlockType.class, Registries.BLOCK, RegistryKey.BLOCK, false),
simpleKey("ItemTypeKeys", ItemType.class, Registries.ITEM, RegistryKey.ITEM, false),
simpleKey("CatVariantKeys", Cat.Type.class, Registries.CAT_VARIANT, RegistryKey.CAT_VARIANT, false),
simpleKey("FrogVariantKeys", Frog.Variant.class, Registries.FROG_VARIANT, RegistryKey.FROG_VARIANT, false),
simpleKey("VillagerProfessionKeys", Villager.Profession.class, Registries.VILLAGER_PROFESSION, RegistryKey.VILLAGER_PROFESSION, false),
simpleKey("VillagerTypeKeys", Villager.Type.class, Registries.VILLAGER_TYPE, RegistryKey.VILLAGER_TYPE, false),
simpleKey("MapDecorationTypeKeys", MapCursor.Type.class, Registries.MAP_DECORATION_TYPE, RegistryKey.MAP_DECORATION_TYPE, false),
simpleKey("MenuTypeKeys", MenuType.class, Registries.MENU, RegistryKey.MENU, false),
simpleKey("AttributeKeys", Attribute.class, Registries.ATTRIBUTE, RegistryKey.ATTRIBUTE, false),
simpleKey("FluidKeys", Fluid.class, Registries.FLUID, RegistryKey.FLUID, false),
simpleKey("SoundEventKeys", Sound.class, Registries.SOUND_EVENT, RegistryKey.SOUND_EVENT, false),
// data-driven
simpleKey("BiomeKeys", Biome.class, Registries.BIOME, RegistryKey.BIOME, true),
simpleKey("StructureKeys", Structure.class, Registries.STRUCTURE, RegistryKey.STRUCTURE, true),
simpleKey("TrimMaterialKeys", TrimMaterial.class, Registries.TRIM_MATERIAL, RegistryKey.TRIM_MATERIAL, true),
simpleKey("TrimPatternKeys", TrimPattern.class, Registries.TRIM_PATTERN, RegistryKey.TRIM_PATTERN, true),
simpleKey("DamageTypeKeys", DamageType.class, Registries.DAMAGE_TYPE, RegistryKey.DAMAGE_TYPE, true),
simpleKey("WolfVariantKeys", Wolf.Variant.class, Registries.WOLF_VARIANT, RegistryKey.WOLF_VARIANT, true),
simpleKey("EnchantmentKeys", Enchantment.class, Registries.ENCHANTMENT, RegistryKey.ENCHANTMENT, true),
simpleKey("JukeboxSongKeys", JukeboxSong.class, Registries.JUKEBOX_SONG, RegistryKey.JUKEBOX_SONG, true),
simpleKey("BannerPatternKeys", PatternType.class, Registries.BANNER_PATTERN, RegistryKey.BANNER_PATTERN, true),
simpleKey("PaintingVariantKeys", Art.class, Registries.PAINTING_VARIANT, RegistryKey.PAINTING_VARIANT, true),
simpleKey("InstrumentKeys", MusicInstrument.class, Registries.INSTRUMENT, RegistryKey.INSTRUMENT, true),
// tags
simpleTagKey("GameEventTagKeys", GameEvent.class, Registries.GAME_EVENT, RegistryKey.GAME_EVENT),
simpleTagKey("BlockTypeTagKeys", BlockType.class, Registries.BLOCK, RegistryKey.BLOCK),
simpleTagKey("ItemTypeTagKeys", ItemType.class, Registries.ITEM, RegistryKey.ITEM),
simpleTagKey("CatVariantTagKeys", Cat.Type.class, Registries.CAT_VARIANT, RegistryKey.CAT_VARIANT),
simpleTagKey("FluidTagKeys", Fluid.class, Registries.FLUID, RegistryKey.FLUID),
simpleTagKey("BiomeTagKeys", Biome.class, Registries.BIOME, RegistryKey.BIOME),
simpleTagKey("StructureTagKeys", Structure.class, Registries.STRUCTURE, RegistryKey.STRUCTURE),
simpleTagKey("DamageTypeTagKeys", DamageType.class, Registries.DAMAGE_TYPE, RegistryKey.DAMAGE_TYPE),
simpleTagKey("EnchantmentTagKeys", Enchantment.class, Registries.ENCHANTMENT, RegistryKey.ENCHANTMENT),
simpleTagKey("BannerPatternTagKeys", PatternType.class, Registries.BANNER_PATTERN, RegistryKey.BANNER_PATTERN),
simpleTagKey("PaintingVariantTagKeys", Art.class, Registries.PAINTING_VARIANT, RegistryKey.PAINTING_VARIANT),
simpleTagKey("InstrumentTagKeys", MusicInstrument.class, Registries.INSTRUMENT, RegistryKey.INSTRUMENT),
// api only
simpleTagKey("EntityTypeTagKeys", EntityType.class, Registries.ENTITY_TYPE, RegistryKey.ENTITY_TYPE),
new MobGoalGenerator("VanillaGoal", "com.destroystokyo.paper.entity.ai")
};
private static <T, A> SourceGenerator simpleKey(final String className, final Class<A> apiType, final ResourceKey<? extends Registry<T>> registryKey, final RegistryKey<A> apiRegistryKey, final boolean publicCreateKeyMethod) {
return new GeneratedKeyType<>(className, apiType, "io.papermc.paper.registry.keys", registryKey, apiRegistryKey, publicCreateKeyMethod);
}
private static <T, A> SourceGenerator simpleTagKey(final String className, final Class<A> apiType, final ResourceKey<? extends Registry<T>> registryKey, final RegistryKey<A> apiRegistryKey) {
return new GeneratedTagKeyType<>(className, apiType, "io.papermc.paper.registry.keys.tags", registryKey, apiRegistryKey, true);
}
}
@@ -0,0 +1,93 @@
package io.papermc.generator;
import com.google.common.util.concurrent.MoreExecutors;
import com.mojang.logging.LogUtils;
import io.papermc.generator.types.SourceGenerator;
import io.papermc.generator.utils.TagCollector;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.List;
import java.util.Map;
import net.minecraft.SharedConstants;
import net.minecraft.commands.Commands;
import net.minecraft.core.HolderLookup;
import net.minecraft.core.LayeredRegistryAccess;
import net.minecraft.core.Registry;
import net.minecraft.core.RegistryAccess;
import net.minecraft.resources.RegistryDataLoader;
import net.minecraft.server.Bootstrap;
import net.minecraft.server.RegistryLayer;
import net.minecraft.server.ReloadableServerResources;
import net.minecraft.server.packs.PackType;
import net.minecraft.server.packs.repository.Pack;
import net.minecraft.server.packs.repository.PackRepository;
import net.minecraft.server.packs.repository.ServerPacksSource;
import net.minecraft.server.packs.resources.MultiPackResourceManager;
import net.minecraft.tags.TagKey;
import net.minecraft.tags.TagLoader;
import net.minecraft.world.flag.FeatureFlags;
import org.apache.commons.io.file.PathUtils;
import org.slf4j.Logger;
public final class Main {
private static final Logger LOGGER = LogUtils.getLogger();
public static final RegistryAccess.Frozen REGISTRY_ACCESS;
public static final Map<TagKey<?>, String> EXPERIMENTAL_TAGS;
static {
SharedConstants.tryDetectVersion();
Bootstrap.bootStrap();
Bootstrap.validate();
final PackRepository resourceRepository = ServerPacksSource.createVanillaTrustedRepository();
resourceRepository.reload();
final MultiPackResourceManager resourceManager = new MultiPackResourceManager(PackType.SERVER_DATA, resourceRepository.getAvailablePacks().stream().map(Pack::open).toList());
LayeredRegistryAccess<RegistryLayer> layers = RegistryLayer.createRegistryAccess();
final List<Registry.PendingTags<?>> pendingTags = TagLoader.loadTagsForExistingRegistries(resourceManager, layers.getLayer(RegistryLayer.STATIC));
final List<HolderLookup.RegistryLookup<?>> worldGenLayer = TagLoader.buildUpdatedLookups(layers.getAccessForLoading(RegistryLayer.WORLDGEN), pendingTags);
final RegistryAccess.Frozen frozenWorldgenRegistries = RegistryDataLoader.load(resourceManager, worldGenLayer, RegistryDataLoader.WORLDGEN_REGISTRIES);
layers = layers.replaceFrom(RegistryLayer.WORLDGEN, frozenWorldgenRegistries);
REGISTRY_ACCESS = layers.compositeAccess().freeze();
final ReloadableServerResources reloadableServerResources = ReloadableServerResources.loadResources(
resourceManager,
layers,
pendingTags,
FeatureFlags.VANILLA_SET,
Commands.CommandSelection.DEDICATED,
0,
MoreExecutors.directExecutor(),
MoreExecutors.directExecutor()
).join();
reloadableServerResources.updateStaticRegistryTags();
EXPERIMENTAL_TAGS = TagCollector.grabExperimental(resourceManager);
}
private Main() {
}
public static void main(final String[] args) {
LOGGER.info("Running API generators...");
generate(Paths.get(args[0]), Generators.API);
// LOGGER.info("Running Server generators...");
// generate(Paths.get(args[1]), Generators.SERVER);
}
private static void generate(Path output, SourceGenerator[] generators) {
try {
if (Files.exists(output)) {
PathUtils.deleteDirectory(output);
}
Files.createDirectories(output);
for (final SourceGenerator generator : generators) {
generator.writeToFile(output);
}
LOGGER.info("Files written to {}", output.toAbsolutePath());
} catch (final Exception ex) {
throw new RuntimeException(ex);
}
}
}
@@ -0,0 +1,204 @@
package io.papermc.generator.types;
import com.google.common.collect.Sets;
import com.squareup.javapoet.FieldSpec;
import com.squareup.javapoet.JavaFile;
import com.squareup.javapoet.MethodSpec;
import com.squareup.javapoet.ParameterSpec;
import com.squareup.javapoet.ParameterizedTypeName;
import com.squareup.javapoet.TypeName;
import com.squareup.javapoet.TypeSpec;
import io.papermc.generator.Main;
import io.papermc.generator.utils.Annotations;
import io.papermc.generator.utils.CollectingContext;
import io.papermc.generator.utils.Formatting;
import io.papermc.generator.utils.Javadocs;
import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.TypedKey;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.util.Collections;
import java.util.HashMap;
import java.util.IdentityHashMap;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import javax.lang.model.SourceVersion;
import net.kyori.adventure.key.Key;
import net.minecraft.core.Holder;
import net.minecraft.core.HolderLookup;
import net.minecraft.core.Registry;
import net.minecraft.core.RegistrySetBuilder;
import net.minecraft.core.registries.Registries;
import net.minecraft.data.registries.VanillaRegistries;
import net.minecraft.resources.ResourceKey;
import net.minecraft.world.flag.FeatureElement;
import net.minecraft.world.flag.FeatureFlags;
import org.bukkit.MinecraftExperimental;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.checkerframework.framework.qual.DefaultQualifier;
import static com.squareup.javapoet.TypeSpec.classBuilder;
import static io.papermc.generator.utils.Annotations.EXPERIMENTAL_API_ANNOTATION;
import static io.papermc.generator.utils.Annotations.experimentalAnnotations;
import static java.util.Objects.requireNonNull;
import static javax.lang.model.element.Modifier.FINAL;
import static javax.lang.model.element.Modifier.PRIVATE;
import static javax.lang.model.element.Modifier.PUBLIC;
import static javax.lang.model.element.Modifier.STATIC;
@DefaultQualifier(NonNull.class)
public class GeneratedKeyType<T, A> extends SimpleGenerator {
private static final Map<ResourceKey<? extends Registry<?>>, RegistrySetBuilder.RegistryBootstrap<?>> VANILLA_REGISTRY_ENTRIES = VanillaRegistries.BUILDER.entries.stream()
.collect(Collectors.toMap(RegistrySetBuilder.RegistryStub::key, RegistrySetBuilder.RegistryStub::bootstrap));
private static final Map<ResourceKey<? extends Registry<?>>, RegistrySetBuilder.RegistryBootstrap<?>> EXPERIMENTAL_REGISTRY_ENTRIES = Map.of(); // Update for Experimental API
private static final Map<RegistryKey<?>, String> REGISTRY_KEY_FIELD_NAMES;
static {
final Map<RegistryKey<?>, String> map = new HashMap<>();
try {
for (final Field field : RegistryKey.class.getFields()) {
if (!Modifier.isStatic(field.getModifiers()) || !Modifier.isFinal(field.getModifiers()) || field.getType() != RegistryKey.class) {
continue;
}
map.put((RegistryKey<?>) field.get(null), field.getName());
}
REGISTRY_KEY_FIELD_NAMES = Map.copyOf(map);
} catch (final ReflectiveOperationException ex) {
throw new RuntimeException(ex);
}
}
private static final String CREATE_JAVADOC = """
Creates a key for {@link $T} in the registry {@code $L}.
@param key the value's key in the registry
@return a new typed key
""";
private final Class<A> apiType;
private final ResourceKey<? extends Registry<T>> registryKey;
private final RegistryKey<A> apiRegistryKey;
private final boolean publicCreateKeyMethod;
public GeneratedKeyType(final String keysClassName, final Class<A> apiType, final String pkg, final ResourceKey<? extends Registry<T>> registryKey, final RegistryKey<A> apiRegistryKey, final boolean publicCreateKeyMethod) {
super(keysClassName, pkg);
this.apiType = apiType;
this.registryKey = registryKey;
this.apiRegistryKey = apiRegistryKey;
this.publicCreateKeyMethod = publicCreateKeyMethod;
}
private MethodSpec.Builder createMethod(final TypeName returnType) {
final TypeName keyType = TypeName.get(Key.class);
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);
if (this.publicCreateKeyMethod) {
create.addJavadoc(CREATE_JAVADOC, this.apiType, this.registryKey.location().toString());
}
return create;
}
private TypeSpec.Builder keyHolderType() {
return classBuilder(this.className)
.addModifiers(PUBLIC, FINAL)
.addJavadoc(Javadocs.getVersionDependentClassHeader("{@link $T#$L}"), RegistryKey.class, REGISTRY_KEY_FIELD_NAMES.get(this.apiRegistryKey))
.addAnnotations(Annotations.CLASS_HEADER)
.addMethod(MethodSpec.constructorBuilder()
.addModifiers(PRIVATE)
.build()
);
}
@Deprecated
private static final Map<String, String> JUKEBOX_SONG_NAMES = Map.of(
"5", "FIVE",
"11", "ELEVEN",
"13", "THIRTEEN"
);
@Override
protected TypeSpec getTypeSpec() {
final TypeName typedKey = ParameterizedTypeName.get(TypedKey.class, this.apiType);
final TypeSpec.Builder typeBuilder = this.keyHolderType();
final MethodSpec.Builder createMethod = this.createMethod(typedKey);
final Registry<T> registry = Main.REGISTRY_ACCESS.lookupOrThrow(this.registryKey);
final Set<ResourceKey<T>> experimental = this.collectExperimentalKeys(registry);
boolean allExperimental = true;
for (final Holder.Reference<T> reference : registry.listElements().sorted(Formatting.alphabeticKeyOrder(reference -> reference.key().location().getPath())).toList()) {
final ResourceKey<T> key = reference.key();
final String keyPath = key.location().getPath();
String fieldName = Formatting.formatKeyAsField(keyPath);
if (!SourceVersion.isIdentifier(fieldName) && this.registryKey.equals(Registries.JUKEBOX_SONG) && JUKEBOX_SONG_NAMES.containsKey(fieldName)) {
fieldName = JUKEBOX_SONG_NAMES.get(fieldName);
}
final FieldSpec.Builder fieldBuilder = FieldSpec.builder(typedKey, fieldName, PUBLIC, STATIC, FINAL)
.initializer("$N(key($S))", createMethod.build(), keyPath)
.addJavadoc(Javadocs.getVersionDependentField("{@code $L}"), key.location().toString());
if (experimental.contains(key)) {
fieldBuilder.addAnnotations(experimentalAnnotations(null)); // Update for Experimental API
} else {
allExperimental = false;
}
typeBuilder.addField(fieldBuilder.build());
}
if (allExperimental) {
typeBuilder.addAnnotations(experimentalAnnotations(null)); // Update for Experimental API
createMethod.addAnnotations(experimentalAnnotations(null)); // Update for Experimental API
}
return typeBuilder.addMethod(createMethod.build()).build();
}
// todo at some point this should be per feature data pack not all merged
private Set<ResourceKey<T>> collectExperimentalKeys(final Registry<T> registry) {
if (FeatureElement.FILTERED_REGISTRIES.contains(registry.key())) {
return this.collectExperimentalKeysBuiltIn(registry);
} else {
return this.collectExperimentalKeysDataDriven(registry);
}
}
private Set<ResourceKey<T>> collectExperimentalKeysBuiltIn(final Registry<T> registry) {
final HolderLookup.RegistryLookup<T> filteredLookup = registry.filterElements(v -> {
return v instanceof final FeatureElement featureElement && FeatureFlags.isExperimental(featureElement.requiredFeatures()); // Update for Experimental API
});
return filteredLookup.listElementIds().collect(Collectors.toUnmodifiableSet());
}
@SuppressWarnings("unchecked")
private Set<ResourceKey<T>> collectExperimentalKeysDataDriven(final Registry<T> registry) {
final RegistrySetBuilder.@Nullable RegistryBootstrap<T> experimentalBootstrap = (RegistrySetBuilder.RegistryBootstrap<T>) EXPERIMENTAL_REGISTRY_ENTRIES.get(this.registryKey);
if (experimentalBootstrap == null) {
return Collections.emptySet();
}
final Set<ResourceKey<T>> experimental = Collections.newSetFromMap(new IdentityHashMap<>());
final CollectingContext<T> experimentalCollector = new CollectingContext<>(experimental, registry);
experimentalBootstrap.run(experimentalCollector);
final RegistrySetBuilder.@Nullable RegistryBootstrap<T> vanillaBootstrap = (RegistrySetBuilder.RegistryBootstrap<T>) VANILLA_REGISTRY_ENTRIES.get(this.registryKey);
if (vanillaBootstrap != null) {
final Set<ResourceKey<T>> vanilla = Collections.newSetFromMap(new IdentityHashMap<>());
final CollectingContext<T> vanillaCollector = new CollectingContext<>(vanilla, registry);
vanillaBootstrap.run(vanillaCollector);
return Sets.difference(experimental, vanilla);
}
return experimental;
}
@Override
protected JavaFile.Builder file(final JavaFile.Builder builder) {
return builder
.addStaticImport(Key.class, "key");
}
}
@@ -0,0 +1,138 @@
package io.papermc.generator.types;
import com.squareup.javapoet.FieldSpec;
import com.squareup.javapoet.JavaFile;
import com.squareup.javapoet.MethodSpec;
import com.squareup.javapoet.ParameterSpec;
import com.squareup.javapoet.ParameterizedTypeName;
import com.squareup.javapoet.TypeName;
import com.squareup.javapoet.TypeSpec;
import io.papermc.generator.Main;
import io.papermc.generator.utils.Annotations;
import io.papermc.generator.utils.Formatting;
import io.papermc.generator.utils.Javadocs;
import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.tag.TagKey;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import java.util.concurrent.atomic.AtomicBoolean;
import net.kyori.adventure.key.Key;
import net.minecraft.core.Registry;
import net.minecraft.resources.ResourceKey;
import org.bukkit.MinecraftExperimental;
import static com.squareup.javapoet.TypeSpec.classBuilder;
import static io.papermc.generator.utils.Annotations.EXPERIMENTAL_API_ANNOTATION;
import static io.papermc.generator.utils.Annotations.experimentalAnnotations;
import static java.util.Objects.requireNonNull;
import static javax.lang.model.element.Modifier.FINAL;
import static javax.lang.model.element.Modifier.PRIVATE;
import static javax.lang.model.element.Modifier.PUBLIC;
import static javax.lang.model.element.Modifier.STATIC;
public class GeneratedTagKeyType<T, A> extends SimpleGenerator {
private static final Map<RegistryKey<?>, String> REGISTRY_KEY_FIELD_NAMES;
static {
final Map<RegistryKey<?>, String> map = new HashMap<>();
try {
for (final Field field : RegistryKey.class.getFields()) {
if (!Modifier.isStatic(field.getModifiers()) || !Modifier.isFinal(field.getModifiers()) || field.getType() != RegistryKey.class) {
continue;
}
map.put((RegistryKey<?>) field.get(null), field.getName());
}
REGISTRY_KEY_FIELD_NAMES = Map.copyOf(map);
} catch (final ReflectiveOperationException ex) {
throw new RuntimeException(ex);
}
}
private static final String CREATE_JAVADOC = """
Creates a tag key for {@link $T} in the registry {@code $L}.
@param key the tag key's key
@return a new tag key
""";
private final Class<A> apiType;
private final ResourceKey<? extends Registry<T>> registryKey;
private final RegistryKey<A> apiRegistryKey;
private final boolean publicCreateKeyMethod;
public GeneratedTagKeyType(final String keysClassName, final Class<A> apiType, final String pkg, final ResourceKey<? extends Registry<T>> registryKey, final RegistryKey<A> apiRegistryKey, final boolean publicCreateKeyMethod) {
super(keysClassName, pkg);
this.apiType = apiType;
this.registryKey = registryKey;
this.apiRegistryKey = apiRegistryKey;
this.publicCreateKeyMethod = publicCreateKeyMethod;
}
private MethodSpec.Builder createMethod(final TypeName returnType) {
final TypeName keyType = TypeName.get(Key.class);
final ParameterSpec keyParam = ParameterSpec.builder(keyType, "key", FINAL).build();
final MethodSpec.Builder create = MethodSpec.methodBuilder("create")
.addModifiers(this.publicCreateKeyMethod ? PUBLIC : PRIVATE, STATIC)
.addParameter(keyParam)
.addCode("return $T.create($T.$L, $N);", TagKey.class, RegistryKey.class, requireNonNull(REGISTRY_KEY_FIELD_NAMES.get(this.apiRegistryKey), "Missing field for " + this.apiRegistryKey), keyParam)
.returns(returnType);
if (this.publicCreateKeyMethod) {
create.addAnnotation(EXPERIMENTAL_API_ANNOTATION); // TODO remove once not experimental
create.addJavadoc(CREATE_JAVADOC, this.apiType, this.registryKey.location().toString());
}
return create;
}
private TypeSpec.Builder keyHolderType() {
return classBuilder(this.className)
.addModifiers(PUBLIC, FINAL)
.addJavadoc(Javadocs.getVersionDependentClassHeader("{@link $T#$L}"), RegistryKey.class, REGISTRY_KEY_FIELD_NAMES.get(this.apiRegistryKey))
.addAnnotations(Annotations.CLASS_HEADER)
.addMethod(MethodSpec.constructorBuilder()
.addModifiers(PRIVATE)
.build()
);
}
@Override
protected TypeSpec getTypeSpec() {
final TypeName tagKey = ParameterizedTypeName.get(TagKey.class, this.apiType);
final TypeSpec.Builder typeBuilder = this.keyHolderType();
final MethodSpec.Builder createMethod = this.createMethod(tagKey);
final Registry<T> registry = Main.REGISTRY_ACCESS.lookupOrThrow(this.registryKey);
final AtomicBoolean allExperimental = new AtomicBoolean(true);
registry.listTagIds().sorted(Formatting.alphabeticKeyOrder(nmsTagKey -> nmsTagKey.location().getPath())).forEach(nmsTagKey -> {
final String fieldName = Formatting.formatKeyAsField(nmsTagKey.location().getPath());
final FieldSpec.Builder fieldBuilder = FieldSpec.builder(tagKey, fieldName, PUBLIC, STATIC, FINAL)
.initializer("$N(key($S))", createMethod.build(), nmsTagKey.location().getPath())
.addJavadoc(Javadocs.getVersionDependentField("{@code $L}"), "#" + nmsTagKey.location());
final String featureFlagName = Main.EXPERIMENTAL_TAGS.get(nmsTagKey);
if (featureFlagName != null) {
fieldBuilder.addAnnotations(experimentalAnnotations(MinecraftExperimental.Requires.valueOf(featureFlagName.toUpperCase(Locale.ENGLISH)))); // Update for Experimental API
} else {
allExperimental.set(false);
}
typeBuilder.addField(fieldBuilder.build());
});
if (allExperimental.get()) {
typeBuilder.addAnnotations(experimentalAnnotations(null)); // Update for Experimental API
createMethod.addAnnotations(experimentalAnnotations(null)); // Update for Experimental API
} else {
typeBuilder.addAnnotation(EXPERIMENTAL_API_ANNOTATION); // TODO experimental API
}
return typeBuilder.addMethod(createMethod.build()).build();
}
@Override
protected JavaFile.Builder file(final JavaFile.Builder builder) {
return builder
.addStaticImport(Key.class, "key");
}
}
@@ -2,16 +2,13 @@ package io.papermc.generator.types;
import com.squareup.javapoet.JavaFile;
import com.squareup.javapoet.TypeSpec;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Path;
import org.jspecify.annotations.NullMarked;
@NullMarked
public abstract class SimpleGenerator implements SourceGenerator {
public static final String INDENT_UNIT = " ";
protected final String className;
protected final String packageName;
@@ -22,15 +19,14 @@ public abstract class SimpleGenerator implements SourceGenerator {
protected abstract TypeSpec getTypeSpec();
protected JavaFile.Builder file(JavaFile.Builder builder) {
return builder;
}
protected abstract JavaFile.Builder file(JavaFile.Builder builder);
@Override
public void writeToFile(Path parent) throws IOException {
JavaFile.Builder builder = JavaFile.builder(this.packageName, this.getTypeSpec());
this.file(builder)
.indent(INDENT_UNIT)
.indent(" ")
.skipJavaLangImports(true);
builder.build().writeTo(parent, StandardCharsets.UTF_8);
@@ -2,9 +2,7 @@ package io.papermc.generator.types;
import java.io.IOException;
import java.nio.file.Path;
import org.jspecify.annotations.NullMarked;
@NullMarked
public interface SourceGenerator {
void writeToFile(Path parent) throws IOException;
@@ -3,6 +3,7 @@ package io.papermc.generator.types.goal;
import com.destroystokyo.paper.entity.ai.GoalKey;
import com.squareup.javapoet.ClassName;
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;
@@ -15,29 +16,28 @@ import io.papermc.generator.types.SimpleGenerator;
import io.papermc.generator.utils.Annotations;
import io.papermc.generator.utils.Formatting;
import io.papermc.generator.utils.Javadocs;
import io.papermc.typewriter.util.ClassHelper;
import java.util.Comparator;
import java.util.List;
import java.util.stream.Stream;
import net.minecraft.world.entity.ai.goal.Goal;
import net.minecraft.world.entity.ai.goal.GoalSelector;
import net.minecraft.world.entity.ai.goal.WrappedGoal;
import org.bukkit.NamespacedKey;
import org.bukkit.entity.Mob;
import org.jspecify.annotations.NullMarked;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.framework.qual.DefaultQualifier;
import org.jetbrains.annotations.Nullable;
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;
@NullMarked
@DefaultQualifier(NonNull.class)
public class MobGoalGenerator extends SimpleGenerator {
private static final String CLASS_HEADER = Javadocs.getVersionDependentClassHeader("keys", "Mob Goals");
private static final String CLASS_HEADER = Javadocs.getVersionDependentClassHeader("Mob Goals");
public MobGoalGenerator(String className, String packageName) {
super(className, packageName);
public MobGoalGenerator(final String keysClassName, final String pkg) {
super(keysClassName, pkg);
}
@Override
@@ -51,8 +51,9 @@ public class MobGoalGenerator extends SimpleGenerator {
.addJavadoc(CLASS_HEADER);
TypeName mobType = ParameterizedTypeName.get(ClassName.get(Class.class), type);
TypeName keyType = TypeName.get(String.class);
ParameterSpec keyParam = ParameterSpec.builder(String.class, "key", FINAL).build();
ParameterSpec keyParam = ParameterSpec.builder(keyType, "key", FINAL).build();
ParameterSpec typeParam = ParameterSpec.builder(mobType, "type", FINAL).build();
MethodSpec.Builder createMethod = MethodSpec.methodBuilder("create")
.addModifiers(PRIVATE, STATIC)
@@ -67,25 +68,33 @@ public class MobGoalGenerator extends SimpleGenerator {
classes = scanResult.getSubclasses(Goal.class.getName()).loadClasses(Goal.class);
}
Stream<GoalKey<Mob>> vanillaGoals = classes.stream()
List<GoalKey<Mob>> vanillaNames = classes.stream()
.filter(clazz -> !java.lang.reflect.Modifier.isAbstract(clazz.getModifiers()))
.filter(clazz -> !clazz.isAnonymousClass() || ClassHelper.getTopLevelClass(clazz) != GoalSelector.class)
.filter(clazz -> !WrappedGoal.class.equals(clazz)) // TODO - properly fix
.map(MobGoalNames::getKey)
.map(goalClass -> MobGoalNames.getKey(goalClass.getName(), goalClass))
.filter((key) -> !MobGoalNames.isIgnored(key.getNamespacedKey().getKey()))
.sorted(Comparator.<GoalKey<?>, String>comparing(o -> o.getEntityClass().getSimpleName())
.thenComparing(vanillaGoalKey -> vanillaGoalKey.getNamespacedKey().getKey())
);
)
.toList();
vanillaGoals.forEach(goalKey -> {
String keyPath = goalKey.getNamespacedKey().getKey();
String fieldName = Formatting.formatKeyAsField(keyPath);
for (final GoalKey<?> goalKey : vanillaNames) {
TypeName typedKey = ParameterizedTypeName.get(GoalKey.class, goalKey.getEntityClass());
NamespacedKey key = goalKey.getNamespacedKey();
String keyPath = key.getKey();
String fieldName = Formatting.formatKeyAsField(keyPath);
FieldSpec.Builder fieldBuilder = FieldSpec.builder(typedKey, fieldName, PUBLIC, STATIC, FINAL)
.initializer("$N($S, $T.class)", createMethod.build(), keyPath, goalKey.getEntityClass());
typeBuilder.addField(fieldBuilder.build());
});
}
return typeBuilder.addMethod(createMethod.build()).build();
}
@Override
protected JavaFile.Builder file(JavaFile.Builder builder) {
return builder;
}
}
@@ -2,32 +2,140 @@ package io.papermc.generator.types.goal;
import com.destroystokyo.paper.entity.RangedEntity;
import com.destroystokyo.paper.entity.ai.GoalKey;
import com.google.common.base.CaseFormat;
import io.papermc.generator.utils.Formatting;
import io.papermc.paper.entity.SchoolableFish;
import com.google.common.collect.BiMap;
import com.google.common.collect.HashBiMap;
import net.minecraft.world.entity.FlyingMob;
import net.minecraft.world.entity.PathfinderMob;
import net.minecraft.world.entity.TamableAnimal;
import net.minecraft.world.entity.ai.goal.Goal;
import net.minecraft.world.entity.ambient.AmbientCreature;
import net.minecraft.world.entity.animal.AbstractFish;
import net.minecraft.world.entity.animal.AbstractGolem;
import net.minecraft.world.entity.animal.AbstractSchoolingFish;
import net.minecraft.world.entity.animal.Animal;
import net.minecraft.world.entity.animal.Pufferfish;
import net.minecraft.world.entity.animal.ShoulderRidingEntity;
import net.minecraft.world.entity.animal.SnowGolem;
import net.minecraft.world.entity.animal.WaterAnimal;
import net.minecraft.world.entity.animal.horse.AbstractChestedHorse;
import net.minecraft.world.entity.boss.wither.WitherBoss;
import net.minecraft.world.entity.monster.AbstractIllager;
import net.minecraft.world.entity.monster.EnderMan;
import net.minecraft.world.entity.monster.PatrollingMonster;
import net.minecraft.world.entity.monster.RangedAttackMob;
import net.minecraft.world.entity.monster.SpellcasterIllager;
import net.minecraft.world.entity.monster.ZombifiedPiglin;
import net.minecraft.world.entity.monster.piglin.AbstractPiglin;
import org.bukkit.NamespacedKey;
import org.bukkit.entity.AbstractHorse;
import org.bukkit.entity.AbstractSkeleton;
import org.bukkit.entity.AbstractVillager;
import org.bukkit.entity.Ageable;
import org.bukkit.entity.Ambient;
import org.bukkit.entity.Animals;
import org.bukkit.entity.Bat;
import org.bukkit.entity.Bee;
import org.bukkit.entity.Blaze;
import org.bukkit.entity.Cat;
import org.bukkit.entity.CaveSpider;
import org.bukkit.entity.ChestedHorse;
import org.bukkit.entity.Chicken;
import org.bukkit.entity.Cod;
import org.bukkit.entity.Cow;
import org.bukkit.entity.Creature;
import org.bukkit.entity.Creeper;
import org.bukkit.entity.Dolphin;
import org.bukkit.entity.Donkey;
import org.bukkit.entity.Drowned;
import org.bukkit.entity.ElderGuardian;
import org.bukkit.entity.EnderDragon;
import org.bukkit.entity.Enderman;
import org.bukkit.entity.Endermite;
import org.bukkit.entity.Evoker;
import org.bukkit.entity.Fish;
import org.bukkit.entity.Flying;
import org.bukkit.entity.Fox;
import org.bukkit.entity.Ghast;
import org.bukkit.entity.Giant;
import org.bukkit.entity.Golem;
import org.bukkit.entity.Guardian;
import org.bukkit.entity.Hoglin;
import org.bukkit.entity.Horse;
import org.bukkit.entity.Husk;
import org.bukkit.entity.Illager;
import org.bukkit.entity.Illusioner;
import org.bukkit.entity.IronGolem;
import org.bukkit.entity.Llama;
import org.bukkit.entity.MagmaCube;
import org.bukkit.entity.Mob;
import org.bukkit.entity.Monster;
import org.bukkit.entity.Mule;
import org.bukkit.entity.MushroomCow;
import org.bukkit.entity.Ocelot;
import org.bukkit.entity.Panda;
import org.bukkit.entity.Parrot;
import org.bukkit.entity.Phantom;
import org.bukkit.entity.Pig;
import org.bukkit.entity.PigZombie;
import org.bukkit.entity.Piglin;
import org.bukkit.entity.PiglinAbstract;
import org.bukkit.entity.PiglinBrute;
import org.bukkit.entity.Pillager;
import org.bukkit.entity.PolarBear;
import org.bukkit.entity.PufferFish;
import org.bukkit.entity.Rabbit;
import org.bukkit.entity.Raider;
import org.bukkit.entity.Ravager;
import org.bukkit.entity.Salmon;
import org.bukkit.entity.Sheep;
import org.bukkit.entity.Shulker;
import org.bukkit.entity.Silverfish;
import org.bukkit.entity.Skeleton;
import org.bukkit.entity.SkeletonHorse;
import org.bukkit.entity.Slime;
import org.bukkit.entity.Snowman;
import org.bukkit.entity.Spellcaster;
import org.bukkit.entity.Spider;
import org.bukkit.entity.Squid;
import org.bukkit.entity.Stray;
import org.bukkit.entity.Strider;
import org.bukkit.entity.Tameable;
import org.bukkit.entity.TraderLlama;
import org.bukkit.entity.TropicalFish;
import org.bukkit.entity.Turtle;
import org.bukkit.entity.Vex;
import org.bukkit.entity.Villager;
import org.bukkit.entity.Vindicator;
import org.bukkit.entity.WanderingTrader;
import org.bukkit.entity.WaterMob;
import org.bukkit.entity.Witch;
import org.bukkit.entity.Wither;
import org.bukkit.entity.WitherSkeleton;
import org.bukkit.entity.Wolf;
import org.bukkit.entity.Zoglin;
import org.bukkit.entity.Zombie;
import org.bukkit.entity.ZombieHorse;
import org.bukkit.entity.ZombieVillager;
import java.lang.reflect.Constructor;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.HashSet;
import java.util.Locale;
import java.util.Map;
import net.minecraft.world.entity.ai.goal.Goal;
import net.minecraft.world.entity.monster.RangedAttackMob;
import org.apache.commons.lang3.math.NumberUtils;
import org.bukkit.NamespacedKey;
import org.bukkit.entity.*;
import org.jspecify.annotations.NullMarked;
import java.util.Set;
@NullMarked
public final class MobGoalNames { // todo sync with MobGoalHelper ideally this should not be duplicated
public class MobGoalNames {
private static final Map<Class<? extends Goal>, Class<? extends Mob>> entityClassCache = new HashMap<>();
public static final Map<Class<? extends net.minecraft.world.entity.Mob>, Class<? extends Mob>> bukkitMap = new LinkedHashMap<>();
public static final Map<Class<? extends net.minecraft.world.entity.Mob>, Class<? extends Mob>> bukkitMap = new HashMap<>();
static {
//<editor-fold defaultstate="collapsed" desc="bukkitMap Entities">
bukkitMap.put(net.minecraft.world.entity.Mob.class, Mob.class);
bukkitMap.put(net.minecraft.world.entity.AgeableMob.class, Ageable.class);
bukkitMap.put(net.minecraft.world.entity.ambient.AmbientCreature.class, Ambient.class);
bukkitMap.put(net.minecraft.world.entity.animal.Animal.class, Animals.class);
bukkitMap.put(AmbientCreature.class, Ambient.class);
bukkitMap.put(Animal.class, Animals.class);
bukkitMap.put(net.minecraft.world.entity.ambient.Bat.class, Bat.class);
bukkitMap.put(net.minecraft.world.entity.animal.Bee.class, Bee.class);
bukkitMap.put(net.minecraft.world.entity.monster.Blaze.class, Blaze.class);
@@ -36,51 +144,51 @@ public final class MobGoalNames { // todo sync with MobGoalHelper ideally this s
bukkitMap.put(net.minecraft.world.entity.animal.Chicken.class, Chicken.class);
bukkitMap.put(net.minecraft.world.entity.animal.Cod.class, Cod.class);
bukkitMap.put(net.minecraft.world.entity.animal.Cow.class, Cow.class);
bukkitMap.put(net.minecraft.world.entity.PathfinderMob.class, Creature.class);
bukkitMap.put(PathfinderMob.class, Creature.class);
bukkitMap.put(net.minecraft.world.entity.monster.Creeper.class, Creeper.class);
bukkitMap.put(net.minecraft.world.entity.animal.Dolphin.class, Dolphin.class);
bukkitMap.put(net.minecraft.world.entity.monster.Drowned.class, Drowned.class);
bukkitMap.put(net.minecraft.world.entity.boss.enderdragon.EnderDragon.class, EnderDragon.class);
bukkitMap.put(net.minecraft.world.entity.monster.EnderMan.class, Enderman.class);
bukkitMap.put(EnderMan.class, Enderman.class);
bukkitMap.put(net.minecraft.world.entity.monster.Endermite.class, Endermite.class);
bukkitMap.put(net.minecraft.world.entity.monster.Evoker.class, Evoker.class);
bukkitMap.put(net.minecraft.world.entity.animal.AbstractFish.class, Fish.class);
bukkitMap.put(net.minecraft.world.entity.animal.AbstractSchoolingFish.class, SchoolableFish.class);
bukkitMap.put(net.minecraft.world.entity.FlyingMob.class, Flying.class);
bukkitMap.put(AbstractFish.class, Fish.class);
bukkitMap.put(AbstractSchoolingFish.class, io.papermc.paper.entity.SchoolableFish.class);
bukkitMap.put(FlyingMob.class, Flying.class);
bukkitMap.put(net.minecraft.world.entity.animal.Fox.class, Fox.class);
bukkitMap.put(net.minecraft.world.entity.monster.Ghast.class, Ghast.class);
bukkitMap.put(net.minecraft.world.entity.monster.Giant.class, Giant.class);
bukkitMap.put(net.minecraft.world.entity.animal.AbstractGolem.class, Golem.class);
bukkitMap.put(AbstractGolem.class, Golem.class);
bukkitMap.put(net.minecraft.world.entity.monster.Guardian.class, Guardian.class);
bukkitMap.put(net.minecraft.world.entity.monster.ElderGuardian.class, ElderGuardian.class);
bukkitMap.put(net.minecraft.world.entity.animal.horse.Horse.class, Horse.class);
bukkitMap.put(net.minecraft.world.entity.animal.horse.AbstractHorse.class, AbstractHorse.class);
bukkitMap.put(net.minecraft.world.entity.animal.horse.AbstractChestedHorse.class, ChestedHorse.class);
bukkitMap.put(AbstractChestedHorse.class, ChestedHorse.class);
bukkitMap.put(net.minecraft.world.entity.animal.horse.Donkey.class, Donkey.class);
bukkitMap.put(net.minecraft.world.entity.animal.horse.Mule.class, Mule.class);
bukkitMap.put(net.minecraft.world.entity.animal.horse.SkeletonHorse.class, SkeletonHorse.class);
bukkitMap.put(net.minecraft.world.entity.animal.horse.ZombieHorse.class, ZombieHorse.class);
bukkitMap.put(net.minecraft.world.entity.animal.camel.Camel.class, org.bukkit.entity.Camel.class);
bukkitMap.put(net.minecraft.world.entity.monster.AbstractIllager.class, Illager.class);
bukkitMap.put(AbstractIllager.class, Illager.class);
bukkitMap.put(net.minecraft.world.entity.monster.Illusioner.class, Illusioner.class);
bukkitMap.put(net.minecraft.world.entity.monster.SpellcasterIllager.class, Spellcaster.class);
bukkitMap.put(SpellcasterIllager.class, Spellcaster.class);
bukkitMap.put(net.minecraft.world.entity.animal.IronGolem.class, IronGolem.class);
bukkitMap.put(net.minecraft.world.entity.animal.horse.Llama.class, Llama.class);
bukkitMap.put(net.minecraft.world.entity.animal.horse.TraderLlama.class, TraderLlama.class);
bukkitMap.put(net.minecraft.world.entity.monster.MagmaCube.class, MagmaCube.class);
bukkitMap.put(net.minecraft.world.entity.monster.Monster.class, Monster.class);
bukkitMap.put(net.minecraft.world.entity.monster.PatrollingMonster.class, Raider.class); // close enough
bukkitMap.put(PatrollingMonster.class, Raider.class); // close enough
bukkitMap.put(net.minecraft.world.entity.animal.MushroomCow.class, MushroomCow.class);
bukkitMap.put(net.minecraft.world.entity.animal.Ocelot.class, Ocelot.class);
bukkitMap.put(net.minecraft.world.entity.animal.Panda.class, Panda.class);
bukkitMap.put(net.minecraft.world.entity.animal.Parrot.class, Parrot.class);
bukkitMap.put(net.minecraft.world.entity.animal.ShoulderRidingEntity.class, Parrot.class); // close enough
bukkitMap.put(ShoulderRidingEntity.class, Parrot.class); // close enough
bukkitMap.put(net.minecraft.world.entity.monster.Phantom.class, Phantom.class);
bukkitMap.put(net.minecraft.world.entity.animal.Pig.class, Pig.class);
bukkitMap.put(net.minecraft.world.entity.monster.ZombifiedPiglin.class, PigZombie.class);
bukkitMap.put(ZombifiedPiglin.class, PigZombie.class);
bukkitMap.put(net.minecraft.world.entity.monster.Pillager.class, Pillager.class);
bukkitMap.put(net.minecraft.world.entity.animal.PolarBear.class, PolarBear.class);
bukkitMap.put(net.minecraft.world.entity.animal.Pufferfish.class, PufferFish.class);
bukkitMap.put(Pufferfish.class, PufferFish.class);
bukkitMap.put(net.minecraft.world.entity.animal.Rabbit.class, Rabbit.class);
bukkitMap.put(net.minecraft.world.entity.raid.Raider.class, Raider.class);
bukkitMap.put(net.minecraft.world.entity.monster.Ravager.class, Ravager.class);
@@ -93,10 +201,10 @@ public final class MobGoalNames { // todo sync with MobGoalHelper ideally this s
bukkitMap.put(net.minecraft.world.entity.monster.Stray.class, Stray.class);
bukkitMap.put(net.minecraft.world.entity.monster.WitherSkeleton.class, WitherSkeleton.class);
bukkitMap.put(net.minecraft.world.entity.monster.Slime.class, Slime.class);
bukkitMap.put(net.minecraft.world.entity.animal.SnowGolem.class, Snowman.class);
bukkitMap.put(SnowGolem.class, Snowman.class);
bukkitMap.put(net.minecraft.world.entity.monster.Spider.class, Spider.class);
bukkitMap.put(net.minecraft.world.entity.animal.Squid.class, Squid.class);
bukkitMap.put(net.minecraft.world.entity.TamableAnimal.class, Tameable.class);
bukkitMap.put(TamableAnimal.class, Tameable.class);
bukkitMap.put(net.minecraft.world.entity.animal.TropicalFish.class, TropicalFish.class);
bukkitMap.put(net.minecraft.world.entity.animal.Turtle.class, Turtle.class);
bukkitMap.put(net.minecraft.world.entity.monster.Vex.class, Vex.class);
@@ -104,85 +212,108 @@ public final class MobGoalNames { // todo sync with MobGoalHelper ideally this s
bukkitMap.put(net.minecraft.world.entity.npc.AbstractVillager.class, AbstractVillager.class);
bukkitMap.put(net.minecraft.world.entity.npc.WanderingTrader.class, WanderingTrader.class);
bukkitMap.put(net.minecraft.world.entity.monster.Vindicator.class, Vindicator.class);
bukkitMap.put(net.minecraft.world.entity.animal.WaterAnimal.class, WaterMob.class);
bukkitMap.put(WaterAnimal.class, WaterMob.class);
bukkitMap.put(net.minecraft.world.entity.monster.Witch.class, Witch.class);
bukkitMap.put(net.minecraft.world.entity.boss.wither.WitherBoss.class, Wither.class);
bukkitMap.put(WitherBoss.class, Wither.class);
bukkitMap.put(net.minecraft.world.entity.animal.Wolf.class, Wolf.class);
bukkitMap.put(net.minecraft.world.entity.monster.Zombie.class, Zombie.class);
bukkitMap.put(net.minecraft.world.entity.monster.Husk.class, Husk.class);
bukkitMap.put(net.minecraft.world.entity.monster.ZombieVillager.class, ZombieVillager.class);
bukkitMap.put(net.minecraft.world.entity.monster.hoglin.Hoglin.class, Hoglin.class);
bukkitMap.put(net.minecraft.world.entity.monster.piglin.Piglin.class, Piglin.class);
bukkitMap.put(net.minecraft.world.entity.monster.piglin.AbstractPiglin.class, PiglinAbstract.class);
bukkitMap.put(AbstractPiglin.class, PiglinAbstract.class);
bukkitMap.put(net.minecraft.world.entity.monster.piglin.PiglinBrute.class, PiglinBrute.class);
bukkitMap.put(net.minecraft.world.entity.monster.Strider.class, Strider.class);
bukkitMap.put(net.minecraft.world.entity.monster.Zoglin.class, Zoglin.class);
bukkitMap.put(net.minecraft.world.entity.GlowSquid.class, GlowSquid.class);
bukkitMap.put(net.minecraft.world.entity.animal.axolotl.Axolotl.class, Axolotl.class);
bukkitMap.put(net.minecraft.world.entity.animal.goat.Goat.class, Goat.class);
bukkitMap.put(net.minecraft.world.entity.animal.frog.Frog.class, Frog.class);
bukkitMap.put(net.minecraft.world.entity.animal.frog.Tadpole.class, Tadpole.class);
bukkitMap.put(net.minecraft.world.entity.monster.warden.Warden.class, Warden.class);
bukkitMap.put(net.minecraft.world.entity.animal.allay.Allay.class, Allay.class);
bukkitMap.put(net.minecraft.world.entity.animal.sniffer.Sniffer.class, Sniffer.class);
bukkitMap.put(net.minecraft.world.entity.monster.breeze.Breeze.class, Breeze.class);
bukkitMap.put(net.minecraft.world.entity.animal.armadillo.Armadillo.class, Armadillo.class);
bukkitMap.put(net.minecraft.world.entity.monster.Bogged.class, Bogged.class);
bukkitMap.put(net.minecraft.world.entity.monster.creaking.Creaking.class, Creaking.class);
bukkitMap.put(net.minecraft.world.entity.animal.AgeableWaterCreature.class, Squid.class); // close enough
bukkitMap.put(net.minecraft.world.entity.GlowSquid.class, org.bukkit.entity.GlowSquid.class);
bukkitMap.put(net.minecraft.world.entity.animal.axolotl.Axolotl.class, org.bukkit.entity.Axolotl.class);
bukkitMap.put(net.minecraft.world.entity.animal.goat.Goat.class, org.bukkit.entity.Goat.class);
bukkitMap.put(net.minecraft.world.entity.animal.frog.Frog.class, org.bukkit.entity.Frog.class);
bukkitMap.put(net.minecraft.world.entity.animal.frog.Tadpole.class, org.bukkit.entity.Tadpole.class);
bukkitMap.put(net.minecraft.world.entity.monster.warden.Warden.class, org.bukkit.entity.Warden.class);
bukkitMap.put(net.minecraft.world.entity.animal.allay.Allay.class, org.bukkit.entity.Allay.class);
bukkitMap.put(net.minecraft.world.entity.animal.sniffer.Sniffer.class, org.bukkit.entity.Sniffer.class);
bukkitMap.put(net.minecraft.world.entity.monster.breeze.Breeze.class, org.bukkit.entity.Breeze.class);
bukkitMap.put(net.minecraft.world.entity.animal.armadillo.Armadillo.class, org.bukkit.entity.Armadillo.class);
bukkitMap.put(net.minecraft.world.entity.monster.Bogged.class, org.bukkit.entity.Bogged.class);
bukkitMap.put(net.minecraft.world.entity.monster.creaking.Creaking.class, org.bukkit.entity.Creaking.class);
bukkitMap.put(net.minecraft.world.entity.animal.AgeableWaterCreature.class, org.bukkit.entity.Squid.class); // close enough
//</editor-fold>
}
private static final Map<String, String> deobfuscationMap = new HashMap<>();
private static final BiMap<String, String> deobfuscationMap = HashBiMap.create();
static final Set<String> ignored = new HashSet<>();
static {
// TODO these kinda should be checked on each release, in case obfuscation changes
deobfuscationMap.put("abstract_skeleton_1", "abstract_skeleton_melee");
ignored.add("goal_selector_1");
ignored.add("goal_selector_2");
ignored.add("selector_1");
ignored.add("selector_2");
ignored.add("wrapped");
}
private static String getPathName(String name) {
String pathName = name.substring(name.lastIndexOf('.') + 1);
boolean needDeobfMap = false;
public static String getUsableName(String name) {
final String original = name;
name = name.substring(name.lastIndexOf(".") + 1);
boolean flag = false;
// inner classes
int firstInnerDelimiter = pathName.indexOf('$');
if (firstInnerDelimiter != -1) {
String innerClassName = pathName.substring(firstInnerDelimiter + 1);
for (String nestedClass : innerClassName.split("\\$")) {
if (NumberUtils.isDigits(nestedClass)) {
needDeobfMap = true;
break;
}
if (name.contains("$")) {
String cut = name.substring(name.indexOf("$") + 1);
if (cut.length() <= 2) {
name = name.replace("Entity", "");
name = name.replace("$", "_");
flag = true;
} else {
// mapped, wooo
name = cut;
}
if (!needDeobfMap) {
pathName = innerClassName;
}
pathName = pathName.replace('$', '_');
// mapped, wooo!
}
pathName = Formatting.stripWordOfCamelCaseName(pathName, "TargetGoal", true); // replace last? reverse search?
pathName = Formatting.stripWordOfCamelCaseName(pathName, "Goal", true);
pathName = CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, pathName);
name = name.replace("PathfinderGoal", "");
name = name.replace("TargetGoal", "");
name = name.replace("Goal", "");
StringBuilder sb = new StringBuilder();
for (char c : name.toCharArray()) {
if (c >= 'A' && c <= 'Z') {
sb.append("_");
sb.append(Character.toLowerCase(c));
} else {
sb.append(c);
}
}
name = sb.toString();
name = name.replaceFirst("_", "");
if (needDeobfMap && !deobfuscationMap.containsKey(pathName)) {
System.err.println("need to map " + name + " (" + pathName + ")");
if (flag && !deobfuscationMap.containsKey(name.toLowerCase(Locale.ROOT)) && !ignored.contains(name)) {
System.out.println("need to map " + original + " (" + name.toLowerCase(Locale.ROOT) + ")");
}
// did we rename this key?
return deobfuscationMap.getOrDefault(pathName, pathName);
return deobfuscationMap.getOrDefault(name, name);
}
public static <T extends Mob> GoalKey<T> getKey(Class<? extends Goal> goalClass) {
String name = getPathName(goalClass.getName());
public static boolean isIgnored(String name) {
return ignored.contains(name);
}
public static <T extends Mob> GoalKey<T> getKey(String clazzName, Class<? extends Goal> goalClass) {
String name = getUsableName(clazzName);
if (MobGoalNames.isIgnored(name)) {
//noinspection unchecked
return (GoalKey<T>) GoalKey.of(Mob.class, NamespacedKey.minecraft(name));
}
return GoalKey.of(getEntity(goalClass), NamespacedKey.minecraft(name));
}
private static <T extends Mob> Class<T> getEntity(Class<? extends Goal> goalClass) {
public static <T extends Mob> Class<T> getEntity(Class<? extends Goal> goalClass) {
//noinspection unchecked
return (Class<T>) entityClassCache.computeIfAbsent(goalClass, key -> {
for (Constructor<?> ctor : key.getDeclaredConstructors()) {
for (Class<?> param : ctor.getParameterTypes()) {
for (int i = 0; i < ctor.getParameterCount(); i++) {
Class<?> param = ctor.getParameterTypes()[i];
if (net.minecraft.world.entity.Mob.class.isAssignableFrom(param)) {
//noinspection unchecked
return toBukkitClass((Class<? extends net.minecraft.world.entity.Mob>) param);
@@ -191,11 +322,11 @@ public final class MobGoalNames { // todo sync with MobGoalHelper ideally this s
}
}
}
throw new RuntimeException("Can't figure out applicable entity for mob goal " + goalClass); // maybe just return Mob?
throw new RuntimeException("Can't figure out applicable entity for mob goal " + goalClass); // maybe just return EntityInsentient?
});
}
private static Class<? extends Mob> toBukkitClass(Class<? extends net.minecraft.world.entity.Mob> nmsClass) {
public static Class<? extends Mob> toBukkitClass(Class<? extends net.minecraft.world.entity.Mob> nmsClass) {
Class<? extends Mob> bukkitClass = bukkitMap.get(nmsClass);
if (bukkitClass == null) {
throw new RuntimeException("Can't figure out applicable bukkit entity for nms entity " + nmsClass); // maybe just return Mob?
@@ -0,0 +1,65 @@
package io.papermc.generator.utils;
import com.squareup.javapoet.AnnotationSpec;
import java.util.ArrayList;
import java.util.List;
import io.papermc.paper.generated.GeneratedFrom;
import net.minecraft.SharedConstants;
import org.bukkit.MinecraftExperimental;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.Nullable;
import org.jspecify.annotations.NullMarked;
public final class Annotations {
public static List<AnnotationSpec> experimentalAnnotations(final MinecraftExperimental.@Nullable Requires requiredFeatureFlag) {
final List<AnnotationSpec> annotationSpecs = new ArrayList<>();
annotationSpecs.add(AnnotationSpec.builder(ApiStatus.Experimental.class).build());
if (requiredFeatureFlag != null) {
annotationSpecs.add(AnnotationSpec.builder(MinecraftExperimental.class)
.addMember("value", "$T.$L", MinecraftExperimental.Requires.class, requiredFeatureFlag.name())
.build());
} else {
annotationSpecs.add(AnnotationSpec.builder(MinecraftExperimental.class).build());
}
return annotationSpecs;
}
public static AnnotationSpec deprecatedVersioned(final @Nullable String version, final boolean forRemoval) {
final AnnotationSpec.Builder annotationSpec = AnnotationSpec.builder(Deprecated.class);
if (forRemoval) {
annotationSpec.addMember("forRemoval", "$L", true);
}
if (version != null) {
annotationSpec.addMember("since", "$S", version);
}
return annotationSpec.build();
}
public static AnnotationSpec scheduledRemoval(final @Nullable String version) {
return AnnotationSpec.builder(ApiStatus.ScheduledForRemoval.class)
.addMember("inVersion", "$S", version)
.build();
}
@ApiStatus.Experimental
public static final AnnotationSpec EXPERIMENTAL_API_ANNOTATION = AnnotationSpec.builder(ApiStatus.Experimental.class).build();
public static final AnnotationSpec NULL_MARKED = AnnotationSpec.builder(NullMarked.class).build();
private static final AnnotationSpec SUPPRESS_WARNINGS = AnnotationSpec.builder(SuppressWarnings.class)
.addMember("value", "$S", "unused")
.addMember("value", "$S", "SpellCheckingInspection")
.build();
private static final AnnotationSpec GENERATED_FROM = AnnotationSpec.builder(GeneratedFrom.class)
.addMember("value", "$S", SharedConstants.getCurrentVersion().getName())
.build();
public static final Iterable<AnnotationSpec> CLASS_HEADER = List.of(
SUPPRESS_WARNINGS,
GENERATED_FROM,
NULL_MARKED
);
private Annotations() {
}
}
@@ -1,4 +1,4 @@
package io.papermc.generator.utils.experimental;
package io.papermc.generator.utils;
import com.mojang.serialization.Lifecycle;
import io.papermc.generator.Main;
@@ -8,20 +8,21 @@ import net.minecraft.core.HolderGetter;
import net.minecraft.core.Registry;
import net.minecraft.data.worldgen.BootstrapContext;
import net.minecraft.resources.ResourceKey;
import org.jspecify.annotations.NullMarked;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.framework.qual.DefaultQualifier;
@NullMarked
@DefaultQualifier(NonNull.class)
public record CollectingContext<T>(Set<ResourceKey<T>> registered,
Registry<T> registry) implements BootstrapContext<T> {
@Override
public Holder.Reference<T> register(ResourceKey<T> key, T value, Lifecycle lifecycle) {
this.registered.add(key);
return Holder.Reference.createStandAlone(this.registry, key);
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, resourceKey);
}
@Override
public <S> HolderGetter<S> lookup(ResourceKey<? extends Registry<? extends S>> key) {
return Main.REGISTRY_ACCESS.lookupOrThrow(key);
public <S> HolderGetter<S> lookup(final ResourceKey<? extends Registry<? extends S>> resourceKey) {
return Main.REGISTRY_ACCESS.lookupOrThrow(resourceKey);
}
}
@@ -0,0 +1,59 @@
package io.papermc.generator.utils;
import java.util.Optional;
import org.apache.commons.lang3.math.NumberUtils;
import java.util.Comparator;
import java.util.Locale;
import java.util.OptionalInt;
import java.util.function.Function;
import java.util.regex.Pattern;
public final class Formatting {
private static final Pattern ILLEGAL_FIELD_CHARACTERS = Pattern.compile("[.-/]");
public static String formatKeyAsField(String path) {
return ILLEGAL_FIELD_CHARACTERS.matcher(path.toUpperCase(Locale.ROOT)).replaceAll("_");
}
public static Optional<String> formatTagKey(String tagDir, String resourcePath) {
int tagsIndex = resourcePath.indexOf(tagDir);
int dotIndex = resourcePath.lastIndexOf('.');
if (tagsIndex == -1 || dotIndex == -1) {
return Optional.empty();
}
return Optional.of(resourcePath.substring(tagsIndex + tagDir.length() + 1, dotIndex)); // namespace/tags/registry_key/[tag_key].json
}
public static Comparator<String> ALPHABETIC_KEY_ORDER = alphabeticKeyOrder(path -> path);
public static <T> Comparator<T> alphabeticKeyOrder(Function<T, String> mapper) {
return (o1, o2) -> {
String path1 = mapper.apply(o1);
String path2 = mapper.apply(o2);
OptionalInt trailingInt1 = tryParseTrailingInt(path1);
OptionalInt trailingInt2 = tryParseTrailingInt(path2);
if (trailingInt1.isPresent() && trailingInt2.isPresent()) {
return Integer.compare(trailingInt1.getAsInt(), trailingInt2.getAsInt());
}
return path1.compareTo(path2);
};
}
private static OptionalInt tryParseTrailingInt(String path) {
int delimiterIndex = path.lastIndexOf('_');
if (delimiterIndex != -1) {
String score = path.substring(delimiterIndex + 1);
if (NumberUtils.isDigits(score)) {
return OptionalInt.of(Integer.parseInt(score));
}
}
return OptionalInt.empty();
}
private Formatting() {
}
}
@@ -0,0 +1,27 @@
package io.papermc.generator.utils;
public final class Javadocs {
public static String getVersionDependentClassHeader(String headerIdentifier) {
return """
Vanilla keys for %s.
@apiNote The fields provided here are a direct representation of
what is available from the vanilla game source. They may be
changed (including removals) on any Minecraft version
bump, so cross-version compatibility is not provided on the
same level as it is on most of the other API.
""".formatted(headerIdentifier);
}
public static String getVersionDependentField(String headerIdentifier) {
return """
%s
@apiNote This field is version-dependant and may be removed in future Minecraft versions
""".formatted(headerIdentifier);
}
private Javadocs() {
}
}
@@ -0,0 +1,79 @@
package io.papermc.generator.utils;
import com.google.common.collect.HashMultimap;
import com.google.common.collect.Multimap;
import com.mojang.logging.LogUtils;
import io.papermc.generator.Main;
import java.util.Collections;
import java.util.IdentityHashMap;
import java.util.Map;
import java.util.Set;
import java.util.function.BiConsumer;
import net.minecraft.core.Registry;
import net.minecraft.core.RegistryAccess;
import net.minecraft.core.registries.Registries;
import net.minecraft.resources.ResourceKey;
import net.minecraft.server.packs.PackResources;
import net.minecraft.server.packs.PackType;
import net.minecraft.server.packs.repository.BuiltInPackSource;
import net.minecraft.server.packs.resources.MultiPackResourceManager;
import net.minecraft.tags.TagKey;
import org.slf4j.Logger;
// collect all the tags by grabbing the json from the data-packs
// another (probably) way is to hook into the data generator like the typed keys generator
public final class TagCollector {
private static final Logger LOGGER = LogUtils.getLogger();
public static Map<TagKey<?>, String> grabExperimental(final MultiPackResourceManager resourceManager) {
Map<TagKey<?>, String> result = new IdentityHashMap<>();
// collect all vanilla tags
Multimap<ResourceKey<? extends Registry<?>>, String> vanillaTags = HashMultimap.create();
PackResources vanillaPack = resourceManager.listPacks()
.filter(packResources -> packResources.packId().equals(BuiltInPackSource.VANILLA_ID))
.findFirst()
.orElseThrow();
collectFromPack(vanillaPack, (entry, path) -> vanillaTags.put(entry.key(), path));
// then distinct with other data-pack tags to know for sure newly created tags and so experimental one
resourceManager.listPacks().forEach(pack -> {
String packId = pack.packId();
if (packId.equals(BuiltInPackSource.VANILLA_ID)) return;
collectFromPack(pack, (entry, path) -> {
if (vanillaTags.get(entry.key()).contains(path)) {
return;
}
result.put(entry.value().listTagIds()
.filter(tagKey -> tagKey.location().getPath().equals(path))
.findFirst()
.orElseThrow(), packId);
});
});
return Collections.unmodifiableMap(result);
}
private static void collectFromPack(PackResources pack, BiConsumer<RegistryAccess.RegistryEntry<?>, String> output) {
Set<String> namespaces = pack.getNamespaces(PackType.SERVER_DATA);
for (String namespace : namespaces) {
Main.REGISTRY_ACCESS.registries().forEach(entry -> {
// this is probably expensive but can't find another way around and data-pack loader has similar logic
// the issue is that registry key can have parent/key (and custom folder too) but tag key can also have parent/key so parsing become a mess
// without having at least one of the two values
String tagDir = Registries.tagsDirPath(entry.key());
pack.listResources(PackType.SERVER_DATA, namespace, tagDir, (id, supplier) -> {
Formatting.formatTagKey(tagDir, id.getPath()).ifPresentOrElse(path -> output.accept(entry, path), () -> {
LOGGER.warn("Unable to parse the path: {}/{}/{}.json in the data-pack {} into a tag key", namespace, tagDir, id.getPath(), pack.packId());
});
});
});
}
}
private TagCollector() {
}
}
@@ -3,21 +3,21 @@ package io.papermc.generator;
import io.github.classgraph.ClassGraph;
import io.github.classgraph.ScanResult;
import io.papermc.generator.types.goal.MobGoalNames;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.Mob;
import org.junit.jupiter.api.Test;
import java.util.ArrayList;
import java.util.List;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.fail;
public class MobGoalConverterTest {
@Test
public void testBukkitMap() {
final List<Class<Mob>> classes;
try (ScanResult scanResult = new ClassGraph().enableClassInfo().whitelistPackages(Entity.class.getPackageName()).scan()) {
try (ScanResult scanResult = new ClassGraph().enableAllInfo().whitelistPackages(Entity.class.getPackageName()).scan()) {
classes = scanResult.getSubclasses(Mob.class.getName()).loadClasses(Mob.class);
}
@@ -30,6 +30,8 @@ public class MobGoalConverterTest {
}
}
assertTrue(missingClasses.isEmpty(), () -> "Missing some entity classes in the bukkit map: " + String.join(", ", missingClasses));
if (!missingClasses.isEmpty()) {
fail("Missing some entity classes in the bukkit map: " + String.join(", ", missingClasses));
}
}
}
@@ -1,10 +1,6 @@
public net/minecraft/world/level/material/MapColor MATERIAL_COLORS
public net/minecraft/world/level/block/state/properties/IntegerProperty min
# for auto-marking experimental stuff
public net/minecraft/core/RegistrySetBuilder entries
public net/minecraft/core/RegistrySetBuilder$RegistryStub
public net/minecraft/data/registries/VanillaRegistries BUILDER
public net/minecraft/data/registries/WinterDropRegistries BUILDER
public net/minecraft/data/registries/TradeRebalanceRegistries BUILDER
public net/minecraft/world/flag/FeatureFlagRegistry names
public net/minecraft/world/flag/FeatureFlagSet mask
+13 -15
View File
@@ -93,16 +93,16 @@ dependencies {
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
}
val generatedDir: java.nio.file.Path = layout.projectDirectory.dir("src/generated/java").asFile.toPath()
val generatedApiPath: java.nio.file.Path = layout.projectDirectory.dir("src/generated/java").asFile.toPath()
idea {
module {
generatedSourceDirs.add(generatedDir.toFile())
generatedSourceDirs.add(generatedApiPath.toFile())
}
}
sourceSets {
main {
java {
srcDir(generatedDir)
srcDir(generatedApiPath)
}
}
}
@@ -228,23 +228,21 @@ tasks.compileTestJava {
options.compilerArgs.add("-parameters")
}
val scanJarForBadCalls by tasks.registering(io.papermc.paperweight.tasks.ScanJarForBadCalls::class) {
val scanJar = tasks.register("scanJarForBadCalls", io.papermc.paperweight.tasks.ScanJarForBadCalls::class) {
badAnnotations.add("Lio/papermc/paper/annotation/DoNotUse;")
jarToScan.set(tasks.jar.flatMap { it.archiveFile })
classpath.from(configurations.compileClasspath)
}
tasks.check {
dependsOn(scanJarForBadCalls)
dependsOn(scanJar)
}
if (providers.gradleProperty("updatingMinecraft").getOrElse("false").toBoolean()) {
val scanJarForOldGeneratedCode by tasks.registering(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)
}
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)
}
@@ -66,8 +66,8 @@ import org.jspecify.annotations.NullMarked;
"unused",
"SpellCheckingInspection"
})
@NullMarked
@GeneratedFrom("1.21.4")
@NullMarked
public interface VanillaGoal<T extends Mob> extends Goal<T> {
GoalKey<AbstractHorse> RANDOM_STAND = create("random_stand", AbstractHorse.class);
@@ -22,8 +22,8 @@ import org.jspecify.annotations.NullMarked;
"unused",
"SpellCheckingInspection"
})
@NullMarked
@GeneratedFrom("1.21.4")
@NullMarked
public final class AttributeKeys {
/**
* {@code minecraft:armor}
@@ -22,8 +22,8 @@ import org.jspecify.annotations.NullMarked;
"unused",
"SpellCheckingInspection"
})
@NullMarked
@GeneratedFrom("1.21.4")
@NullMarked
public final class BannerPatternKeys {
/**
* {@code minecraft:base}
@@ -330,7 +330,7 @@ public final class BannerPatternKeys {
}
/**
* Creates a typed key for {@link PatternType} in the registry {@code minecraft:banner_pattern}.
* Creates a key for {@link PatternType} in the registry {@code minecraft:banner_pattern}.
*
* @param key the value's key in the registry
* @return a new typed key
@@ -22,8 +22,8 @@ import org.jspecify.annotations.NullMarked;
"unused",
"SpellCheckingInspection"
})
@NullMarked
@GeneratedFrom("1.21.4")
@NullMarked
public final class BiomeKeys {
/**
* {@code minecraft:badlands}
@@ -484,7 +484,7 @@ public final class BiomeKeys {
}
/**
* Creates a typed key for {@link Biome} in the registry {@code minecraft:worldgen/biome}.
* Creates a key for {@link Biome} in the registry {@code minecraft:worldgen/biome}.
*
* @param key the value's key in the registry
* @return a new typed key
@@ -22,8 +22,8 @@ import org.jspecify.annotations.NullMarked;
"unused",
"SpellCheckingInspection"
})
@NullMarked
@GeneratedFrom("1.21.4")
@NullMarked
public final class BlockTypeKeys {
/**
* {@code minecraft:acacia_button}
@@ -22,8 +22,8 @@ import org.jspecify.annotations.NullMarked;
"unused",
"SpellCheckingInspection"
})
@NullMarked
@GeneratedFrom("1.21.4")
@NullMarked
public final class CatVariantKeys {
/**
* {@code minecraft:all_black}
@@ -22,8 +22,8 @@ import org.jspecify.annotations.NullMarked;
"unused",
"SpellCheckingInspection"
})
@NullMarked
@GeneratedFrom("1.21.4")
@NullMarked
public final class DamageTypeKeys {
/**
* {@code minecraft:arrow}
@@ -372,7 +372,7 @@ public final class DamageTypeKeys {
}
/**
* Creates a typed key for {@link DamageType} in the registry {@code minecraft:damage_type}.
* Creates a key for {@link DamageType} in the registry {@code minecraft:damage_type}.
*
* @param key the value's key in the registry
* @return a new typed key
@@ -1,503 +0,0 @@
package io.papermc.paper.registry.keys;
import static net.kyori.adventure.key.Key.key;
import io.papermc.paper.datacomponent.DataComponentType;
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.jspecify.annotations.NullMarked;
/**
* Vanilla keys for {@link RegistryKey#DATA_COMPONENT_TYPE}.
*
* @apiNote The fields provided here are a direct representation of
* what is available from the vanilla game source. They may be
* changed (including removals) on any Minecraft version
* bump, so cross-version compatibility is not provided on the
* same level as it is on most of the other API.
*/
@SuppressWarnings({
"unused",
"SpellCheckingInspection"
})
@NullMarked
@GeneratedFrom("1.21.4")
public final class DataComponentTypeKeys {
/**
* {@code minecraft:attribute_modifiers}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DataComponentType> ATTRIBUTE_MODIFIERS = create(key("attribute_modifiers"));
/**
* {@code minecraft:banner_patterns}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DataComponentType> BANNER_PATTERNS = create(key("banner_patterns"));
/**
* {@code minecraft:base_color}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DataComponentType> BASE_COLOR = create(key("base_color"));
/**
* {@code minecraft:bees}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DataComponentType> BEES = create(key("bees"));
/**
* {@code minecraft:block_entity_data}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DataComponentType> BLOCK_ENTITY_DATA = create(key("block_entity_data"));
/**
* {@code minecraft:block_state}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DataComponentType> BLOCK_STATE = create(key("block_state"));
/**
* {@code minecraft:bucket_entity_data}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DataComponentType> BUCKET_ENTITY_DATA = create(key("bucket_entity_data"));
/**
* {@code minecraft:bundle_contents}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DataComponentType> BUNDLE_CONTENTS = create(key("bundle_contents"));
/**
* {@code minecraft:can_break}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DataComponentType> CAN_BREAK = create(key("can_break"));
/**
* {@code minecraft:can_place_on}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DataComponentType> CAN_PLACE_ON = create(key("can_place_on"));
/**
* {@code minecraft:charged_projectiles}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DataComponentType> CHARGED_PROJECTILES = create(key("charged_projectiles"));
/**
* {@code minecraft:consumable}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DataComponentType> CONSUMABLE = create(key("consumable"));
/**
* {@code minecraft:container}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DataComponentType> CONTAINER = create(key("container"));
/**
* {@code minecraft:container_loot}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DataComponentType> CONTAINER_LOOT = create(key("container_loot"));
/**
* {@code minecraft:creative_slot_lock}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DataComponentType> CREATIVE_SLOT_LOCK = create(key("creative_slot_lock"));
/**
* {@code minecraft:custom_data}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DataComponentType> CUSTOM_DATA = create(key("custom_data"));
/**
* {@code minecraft:custom_model_data}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DataComponentType> CUSTOM_MODEL_DATA = create(key("custom_model_data"));
/**
* {@code minecraft:custom_name}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DataComponentType> CUSTOM_NAME = create(key("custom_name"));
/**
* {@code minecraft:damage}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DataComponentType> DAMAGE = create(key("damage"));
/**
* {@code minecraft:damage_resistant}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DataComponentType> DAMAGE_RESISTANT = create(key("damage_resistant"));
/**
* {@code minecraft:death_protection}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DataComponentType> DEATH_PROTECTION = create(key("death_protection"));
/**
* {@code minecraft:debug_stick_state}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DataComponentType> DEBUG_STICK_STATE = create(key("debug_stick_state"));
/**
* {@code minecraft:dyed_color}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DataComponentType> DYED_COLOR = create(key("dyed_color"));
/**
* {@code minecraft:enchantable}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DataComponentType> ENCHANTABLE = create(key("enchantable"));
/**
* {@code minecraft:enchantment_glint_override}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DataComponentType> ENCHANTMENT_GLINT_OVERRIDE = create(key("enchantment_glint_override"));
/**
* {@code minecraft:enchantments}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DataComponentType> ENCHANTMENTS = create(key("enchantments"));
/**
* {@code minecraft:entity_data}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DataComponentType> ENTITY_DATA = create(key("entity_data"));
/**
* {@code minecraft:equippable}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DataComponentType> EQUIPPABLE = create(key("equippable"));
/**
* {@code minecraft:firework_explosion}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DataComponentType> FIREWORK_EXPLOSION = create(key("firework_explosion"));
/**
* {@code minecraft:fireworks}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DataComponentType> FIREWORKS = create(key("fireworks"));
/**
* {@code minecraft:food}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DataComponentType> FOOD = create(key("food"));
/**
* {@code minecraft:glider}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DataComponentType> GLIDER = create(key("glider"));
/**
* {@code minecraft:hide_additional_tooltip}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DataComponentType> HIDE_ADDITIONAL_TOOLTIP = create(key("hide_additional_tooltip"));
/**
* {@code minecraft:hide_tooltip}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DataComponentType> HIDE_TOOLTIP = create(key("hide_tooltip"));
/**
* {@code minecraft:instrument}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DataComponentType> INSTRUMENT = create(key("instrument"));
/**
* {@code minecraft:intangible_projectile}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DataComponentType> INTANGIBLE_PROJECTILE = create(key("intangible_projectile"));
/**
* {@code minecraft:item_model}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DataComponentType> ITEM_MODEL = create(key("item_model"));
/**
* {@code minecraft:item_name}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DataComponentType> ITEM_NAME = create(key("item_name"));
/**
* {@code minecraft:jukebox_playable}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DataComponentType> JUKEBOX_PLAYABLE = create(key("jukebox_playable"));
/**
* {@code minecraft:lock}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DataComponentType> LOCK = create(key("lock"));
/**
* {@code minecraft:lodestone_tracker}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DataComponentType> LODESTONE_TRACKER = create(key("lodestone_tracker"));
/**
* {@code minecraft:lore}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DataComponentType> LORE = create(key("lore"));
/**
* {@code minecraft:map_color}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DataComponentType> MAP_COLOR = create(key("map_color"));
/**
* {@code minecraft:map_decorations}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DataComponentType> MAP_DECORATIONS = create(key("map_decorations"));
/**
* {@code minecraft:map_id}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DataComponentType> MAP_ID = create(key("map_id"));
/**
* {@code minecraft:map_post_processing}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DataComponentType> MAP_POST_PROCESSING = create(key("map_post_processing"));
/**
* {@code minecraft:max_damage}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DataComponentType> MAX_DAMAGE = create(key("max_damage"));
/**
* {@code minecraft:max_stack_size}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DataComponentType> MAX_STACK_SIZE = create(key("max_stack_size"));
/**
* {@code minecraft:note_block_sound}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DataComponentType> NOTE_BLOCK_SOUND = create(key("note_block_sound"));
/**
* {@code minecraft:ominous_bottle_amplifier}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DataComponentType> OMINOUS_BOTTLE_AMPLIFIER = create(key("ominous_bottle_amplifier"));
/**
* {@code minecraft:pot_decorations}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DataComponentType> POT_DECORATIONS = create(key("pot_decorations"));
/**
* {@code minecraft:potion_contents}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DataComponentType> POTION_CONTENTS = create(key("potion_contents"));
/**
* {@code minecraft:profile}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DataComponentType> PROFILE = create(key("profile"));
/**
* {@code minecraft:rarity}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DataComponentType> RARITY = create(key("rarity"));
/**
* {@code minecraft:recipes}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DataComponentType> RECIPES = create(key("recipes"));
/**
* {@code minecraft:repair_cost}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DataComponentType> REPAIR_COST = create(key("repair_cost"));
/**
* {@code minecraft:repairable}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DataComponentType> REPAIRABLE = create(key("repairable"));
/**
* {@code minecraft:stored_enchantments}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DataComponentType> STORED_ENCHANTMENTS = create(key("stored_enchantments"));
/**
* {@code minecraft:suspicious_stew_effects}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DataComponentType> SUSPICIOUS_STEW_EFFECTS = create(key("suspicious_stew_effects"));
/**
* {@code minecraft:tool}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DataComponentType> TOOL = create(key("tool"));
/**
* {@code minecraft:tooltip_style}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DataComponentType> TOOLTIP_STYLE = create(key("tooltip_style"));
/**
* {@code minecraft:trim}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DataComponentType> TRIM = create(key("trim"));
/**
* {@code minecraft:unbreakable}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DataComponentType> UNBREAKABLE = create(key("unbreakable"));
/**
* {@code minecraft:use_cooldown}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DataComponentType> USE_COOLDOWN = create(key("use_cooldown"));
/**
* {@code minecraft:use_remainder}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DataComponentType> USE_REMAINDER = create(key("use_remainder"));
/**
* {@code minecraft:writable_book_content}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DataComponentType> WRITABLE_BOOK_CONTENT = create(key("writable_book_content"));
/**
* {@code minecraft:written_book_content}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DataComponentType> WRITTEN_BOOK_CONTENT = create(key("written_book_content"));
private DataComponentTypeKeys() {
}
private static TypedKey<DataComponentType> create(final Key key) {
return TypedKey.create(RegistryKey.DATA_COMPONENT_TYPE, key);
}
}
@@ -22,8 +22,8 @@ import org.jspecify.annotations.NullMarked;
"unused",
"SpellCheckingInspection"
})
@NullMarked
@GeneratedFrom("1.21.4")
@NullMarked
public final class EnchantmentKeys {
/**
* {@code minecraft:aqua_affinity}
@@ -323,7 +323,7 @@ public final class EnchantmentKeys {
}
/**
* Creates a typed key for {@link Enchantment} in the registry {@code minecraft:enchantment}.
* Creates a key for {@link Enchantment} in the registry {@code minecraft:enchantment}.
*
* @param key the value's key in the registry
* @return a new typed key
@@ -22,8 +22,8 @@ import org.jspecify.annotations.NullMarked;
"unused",
"SpellCheckingInspection"
})
@NullMarked
@GeneratedFrom("1.21.4")
@NullMarked
public final class FluidKeys {
/**
* {@code minecraft:empty}
@@ -22,8 +22,8 @@ import org.jspecify.annotations.NullMarked;
"unused",
"SpellCheckingInspection"
})
@NullMarked
@GeneratedFrom("1.21.4")
@NullMarked
public final class FrogVariantKeys {
/**
* {@code minecraft:cold}
@@ -22,8 +22,8 @@ import org.jspecify.annotations.NullMarked;
"unused",
"SpellCheckingInspection"
})
@NullMarked
@GeneratedFrom("1.21.4")
@NullMarked
public final class GameEventKeys {
/**
* {@code minecraft:block_activate}
@@ -449,7 +449,7 @@ public final class GameEventKeys {
}
/**
* Creates a typed key for {@link GameEvent} in the registry {@code minecraft:game_event}.
* Creates a key for {@link GameEvent} in the registry {@code minecraft:game_event}.
*
* @param key the value's key in the registry
* @return a new typed key
@@ -22,8 +22,8 @@ import org.jspecify.annotations.NullMarked;
"unused",
"SpellCheckingInspection"
})
@NullMarked
@GeneratedFrom("1.21.4")
@NullMarked
public final class InstrumentKeys {
/**
* {@code minecraft:admire_goat_horn}
@@ -85,7 +85,7 @@ public final class InstrumentKeys {
}
/**
* Creates a typed key for {@link MusicInstrument} in the registry {@code minecraft:instrument}.
* Creates a key for {@link MusicInstrument} in the registry {@code minecraft:instrument}.
*
* @param key the value's key in the registry
* @return a new typed key
@@ -22,8 +22,8 @@ import org.jspecify.annotations.NullMarked;
"unused",
"SpellCheckingInspection"
})
@NullMarked
@GeneratedFrom("1.21.4")
@NullMarked
public final class ItemTypeKeys {
/**
* {@code minecraft:acacia_boat}
@@ -22,8 +22,8 @@ import org.jspecify.annotations.NullMarked;
"unused",
"SpellCheckingInspection"
})
@NullMarked
@GeneratedFrom("1.21.4")
@NullMarked
public final class JukeboxSongKeys {
/**
* {@code minecraft:11}
@@ -162,7 +162,7 @@ public final class JukeboxSongKeys {
}
/**
* Creates a typed key for {@link JukeboxSong} in the registry {@code minecraft:jukebox_song}.
* Creates a key for {@link JukeboxSong} in the registry {@code minecraft:jukebox_song}.
*
* @param key the value's key in the registry
* @return a new typed key
@@ -22,8 +22,8 @@ import org.jspecify.annotations.NullMarked;
"unused",
"SpellCheckingInspection"
})
@NullMarked
@GeneratedFrom("1.21.4")
@NullMarked
public final class MapDecorationTypeKeys {
/**
* {@code minecraft:banner_black}
@@ -22,8 +22,8 @@ import org.jspecify.annotations.NullMarked;
"unused",
"SpellCheckingInspection"
})
@NullMarked
@GeneratedFrom("1.21.4")
@NullMarked
public final class MenuTypeKeys {
/**
* {@code minecraft:anvil}
@@ -22,8 +22,8 @@ import org.jspecify.annotations.NullMarked;
"unused",
"SpellCheckingInspection"
})
@NullMarked
@GeneratedFrom("1.21.4")
@NullMarked
public final class MobEffectKeys {
/**
* {@code minecraft:absorption}
@@ -22,8 +22,8 @@ import org.jspecify.annotations.NullMarked;
"unused",
"SpellCheckingInspection"
})
@NullMarked
@GeneratedFrom("1.21.4")
@NullMarked
public final class PaintingVariantKeys {
/**
* {@code minecraft:alban}
@@ -379,7 +379,7 @@ public final class PaintingVariantKeys {
}
/**
* Creates a typed key for {@link Art} in the registry {@code minecraft:painting_variant}.
* Creates a key for {@link Art} in the registry {@code minecraft:painting_variant}.
*
* @param key the value's key in the registry
* @return a new typed key
@@ -22,8 +22,8 @@ import org.jspecify.annotations.NullMarked;
"unused",
"SpellCheckingInspection"
})
@NullMarked
@GeneratedFrom("1.21.4")
@NullMarked
public final class SoundEventKeys {
/**
* {@code minecraft:ambient.basalt_deltas.additions}
@@ -22,8 +22,8 @@ import org.jspecify.annotations.NullMarked;
"unused",
"SpellCheckingInspection"
})
@NullMarked
@GeneratedFrom("1.21.4")
@NullMarked
public final class StructureKeys {
/**
* {@code minecraft:ancient_city}
@@ -267,7 +267,7 @@ public final class StructureKeys {
}
/**
* Creates a typed key for {@link Structure} in the registry {@code minecraft:worldgen/structure}.
* Creates a key for {@link Structure} in the registry {@code minecraft:worldgen/structure}.
*
* @param key the value's key in the registry
* @return a new typed key
@@ -22,8 +22,8 @@ import org.jspecify.annotations.NullMarked;
"unused",
"SpellCheckingInspection"
})
@NullMarked
@GeneratedFrom("1.21.4")
@NullMarked
public final class StructureTypeKeys {
/**
* {@code minecraft:buried_treasure}
@@ -22,8 +22,8 @@ import org.jspecify.annotations.NullMarked;
"unused",
"SpellCheckingInspection"
})
@NullMarked
@GeneratedFrom("1.21.4")
@NullMarked
public final class TrimMaterialKeys {
/**
* {@code minecraft:amethyst}
@@ -106,7 +106,7 @@ public final class TrimMaterialKeys {
}
/**
* Creates a typed key for {@link TrimMaterial} in the registry {@code minecraft:trim_material}.
* Creates a key for {@link TrimMaterial} in the registry {@code minecraft:trim_material}.
*
* @param key the value's key in the registry
* @return a new typed key
@@ -22,8 +22,8 @@ import org.jspecify.annotations.NullMarked;
"unused",
"SpellCheckingInspection"
})
@NullMarked
@GeneratedFrom("1.21.4")
@NullMarked
public final class TrimPatternKeys {
/**
* {@code minecraft:bolt}
@@ -155,7 +155,7 @@ public final class TrimPatternKeys {
}
/**
* Creates a typed key for {@link TrimPattern} in the registry {@code minecraft:trim_pattern}.
* Creates a key for {@link TrimPattern} in the registry {@code minecraft:trim_pattern}.
*
* @param key the value's key in the registry
* @return a new typed key
@@ -22,8 +22,8 @@ import org.jspecify.annotations.NullMarked;
"unused",
"SpellCheckingInspection"
})
@NullMarked
@GeneratedFrom("1.21.4")
@NullMarked
public final class VillagerProfessionKeys {
/**
* {@code minecraft:armorer}
@@ -22,8 +22,8 @@ import org.jspecify.annotations.NullMarked;
"unused",
"SpellCheckingInspection"
})
@NullMarked
@GeneratedFrom("1.21.4")
@NullMarked
public final class VillagerTypeKeys {
/**
* {@code minecraft:desert}
@@ -22,8 +22,8 @@ import org.jspecify.annotations.NullMarked;
"unused",
"SpellCheckingInspection"
})
@NullMarked
@GeneratedFrom("1.21.4")
@NullMarked
public final class WolfVariantKeys {
/**
* {@code minecraft:ashen}
@@ -92,7 +92,7 @@ public final class WolfVariantKeys {
}
/**
* Creates a typed key for {@link Wolf.Variant} in the registry {@code minecraft:wolf_variant}.
* Creates a key for {@link Wolf.Variant} in the registry {@code minecraft:wolf_variant}.
*
* @param key the value's key in the registry
* @return a new typed key
@@ -11,7 +11,7 @@ import org.jetbrains.annotations.ApiStatus;
import org.jspecify.annotations.NullMarked;
/**
* Vanilla tag keys for {@link RegistryKey#BANNER_PATTERN}.
* Vanilla keys for {@link RegistryKey#BANNER_PATTERN}.
*
* @apiNote The fields provided here are a direct representation of
* what is available from the vanilla game source. They may be
@@ -23,8 +23,8 @@ import org.jspecify.annotations.NullMarked;
"unused",
"SpellCheckingInspection"
})
@NullMarked
@GeneratedFrom("1.21.4")
@NullMarked
@ApiStatus.Experimental
public final class BannerPatternTagKeys {
/**
@@ -11,7 +11,7 @@ import org.jetbrains.annotations.ApiStatus;
import org.jspecify.annotations.NullMarked;
/**
* Vanilla tag keys for {@link RegistryKey#BIOME}.
* 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
@@ -23,8 +23,8 @@ import org.jspecify.annotations.NullMarked;
"unused",
"SpellCheckingInspection"
})
@NullMarked
@GeneratedFrom("1.21.4")
@NullMarked
@ApiStatus.Experimental
public final class BiomeTagKeys {
/**
@@ -11,7 +11,7 @@ import org.jetbrains.annotations.ApiStatus;
import org.jspecify.annotations.NullMarked;
/**
* Vanilla tag keys for {@link RegistryKey#BLOCK}.
* Vanilla keys for {@link RegistryKey#BLOCK}.
*
* @apiNote The fields provided here are a direct representation of
* what is available from the vanilla game source. They may be
@@ -23,8 +23,8 @@ import org.jspecify.annotations.NullMarked;
"unused",
"SpellCheckingInspection"
})
@NullMarked
@GeneratedFrom("1.21.4")
@NullMarked
@ApiStatus.Experimental
public final class BlockTypeTagKeys {
/**
@@ -11,7 +11,7 @@ import org.jetbrains.annotations.ApiStatus;
import org.jspecify.annotations.NullMarked;
/**
* Vanilla tag keys for {@link RegistryKey#CAT_VARIANT}.
* Vanilla keys for {@link RegistryKey#CAT_VARIANT}.
*
* @apiNote The fields provided here are a direct representation of
* what is available from the vanilla game source. They may be
@@ -23,8 +23,8 @@ import org.jspecify.annotations.NullMarked;
"unused",
"SpellCheckingInspection"
})
@NullMarked
@GeneratedFrom("1.21.4")
@NullMarked
@ApiStatus.Experimental
public final class CatVariantTagKeys {
/**
@@ -11,7 +11,7 @@ import org.jetbrains.annotations.ApiStatus;
import org.jspecify.annotations.NullMarked;
/**
* Vanilla tag keys for {@link RegistryKey#DAMAGE_TYPE}.
* Vanilla keys for {@link RegistryKey#DAMAGE_TYPE}.
*
* @apiNote The fields provided here are a direct representation of
* what is available from the vanilla game source. They may be
@@ -23,8 +23,8 @@ import org.jspecify.annotations.NullMarked;
"unused",
"SpellCheckingInspection"
})
@NullMarked
@GeneratedFrom("1.21.4")
@NullMarked
@ApiStatus.Experimental
public final class DamageTypeTagKeys {
/**
@@ -12,7 +12,7 @@ import org.jetbrains.annotations.ApiStatus;
import org.jspecify.annotations.NullMarked;
/**
* Vanilla tag keys for {@link RegistryKey#ENCHANTMENT}.
* Vanilla keys for {@link RegistryKey#ENCHANTMENT}.
*
* @apiNote The fields provided here are a direct representation of
* what is available from the vanilla game source. They may be
@@ -24,8 +24,8 @@ import org.jspecify.annotations.NullMarked;
"unused",
"SpellCheckingInspection"
})
@NullMarked
@GeneratedFrom("1.21.4")
@NullMarked
@ApiStatus.Experimental
public final class EnchantmentTagKeys {
/**
@@ -11,7 +11,7 @@ import org.jetbrains.annotations.ApiStatus;
import org.jspecify.annotations.NullMarked;
/**
* Vanilla tag keys for {@link RegistryKey#ENTITY_TYPE}.
* Vanilla keys for {@link RegistryKey#ENTITY_TYPE}.
*
* @apiNote The fields provided here are a direct representation of
* what is available from the vanilla game source. They may be
@@ -23,8 +23,8 @@ import org.jspecify.annotations.NullMarked;
"unused",
"SpellCheckingInspection"
})
@NullMarked
@GeneratedFrom("1.21.4")
@NullMarked
@ApiStatus.Experimental
public final class EntityTypeTagKeys {
/**
@@ -11,7 +11,7 @@ import org.jetbrains.annotations.ApiStatus;
import org.jspecify.annotations.NullMarked;
/**
* Vanilla tag keys for {@link RegistryKey#FLUID}.
* Vanilla keys for {@link RegistryKey#FLUID}.
*
* @apiNote The fields provided here are a direct representation of
* what is available from the vanilla game source. They may be
@@ -23,8 +23,8 @@ import org.jspecify.annotations.NullMarked;
"unused",
"SpellCheckingInspection"
})
@NullMarked
@GeneratedFrom("1.21.4")
@NullMarked
@ApiStatus.Experimental
public final class FluidTagKeys {
/**
@@ -11,7 +11,7 @@ import org.jetbrains.annotations.ApiStatus;
import org.jspecify.annotations.NullMarked;
/**
* Vanilla tag keys for {@link RegistryKey#GAME_EVENT}.
* 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
@@ -23,8 +23,8 @@ import org.jspecify.annotations.NullMarked;
"unused",
"SpellCheckingInspection"
})
@NullMarked
@GeneratedFrom("1.21.4")
@NullMarked
@ApiStatus.Experimental
public final class GameEventTagKeys {
/**
@@ -11,7 +11,7 @@ import org.jetbrains.annotations.ApiStatus;
import org.jspecify.annotations.NullMarked;
/**
* Vanilla tag keys for {@link RegistryKey#INSTRUMENT}.
* Vanilla keys for {@link RegistryKey#INSTRUMENT}.
*
* @apiNote The fields provided here are a direct representation of
* what is available from the vanilla game source. They may be
@@ -23,8 +23,8 @@ import org.jspecify.annotations.NullMarked;
"unused",
"SpellCheckingInspection"
})
@NullMarked
@GeneratedFrom("1.21.4")
@NullMarked
@ApiStatus.Experimental
public final class InstrumentTagKeys {
/**
@@ -11,7 +11,7 @@ import org.jetbrains.annotations.ApiStatus;
import org.jspecify.annotations.NullMarked;
/**
* Vanilla tag keys for {@link RegistryKey#ITEM}.
* Vanilla keys for {@link RegistryKey#ITEM}.
*
* @apiNote The fields provided here are a direct representation of
* what is available from the vanilla game source. They may be
@@ -23,8 +23,8 @@ import org.jspecify.annotations.NullMarked;
"unused",
"SpellCheckingInspection"
})
@NullMarked
@GeneratedFrom("1.21.4")
@NullMarked
@ApiStatus.Experimental
public final class ItemTypeTagKeys {
/**
@@ -11,7 +11,7 @@ import org.jetbrains.annotations.ApiStatus;
import org.jspecify.annotations.NullMarked;
/**
* Vanilla tag keys for {@link RegistryKey#PAINTING_VARIANT}.
* Vanilla keys for {@link RegistryKey#PAINTING_VARIANT}.
*
* @apiNote The fields provided here are a direct representation of
* what is available from the vanilla game source. They may be
@@ -23,8 +23,8 @@ import org.jspecify.annotations.NullMarked;
"unused",
"SpellCheckingInspection"
})
@NullMarked
@GeneratedFrom("1.21.4")
@NullMarked
@ApiStatus.Experimental
public final class PaintingVariantTagKeys {
/**
@@ -12,7 +12,7 @@ import org.jetbrains.annotations.ApiStatus;
import org.jspecify.annotations.NullMarked;
/**
* Vanilla tag keys for {@link RegistryKey#STRUCTURE}.
* Vanilla keys for {@link RegistryKey#STRUCTURE}.
*
* @apiNote The fields provided here are a direct representation of
* what is available from the vanilla game source. They may be
@@ -24,8 +24,8 @@ import org.jspecify.annotations.NullMarked;
"unused",
"SpellCheckingInspection"
})
@NullMarked
@GeneratedFrom("1.21.4")
@NullMarked
@ApiStatus.Experimental
public final class StructureTagKeys {
/**
@@ -63,76 +63,21 @@ import static java.util.Objects.requireNonNull;
@ApiStatus.Experimental
public final class DataComponentTypes {
// Start generate - DataComponentTypes
// @GeneratedFrom 1.21.4
/**
* Holds attribute modifiers applied to any item,
* if not set, has an implicit default value based on the item type's
* default attributes (e.g. attack damage for weapons).
* Controls the maximum stacking size of this item.
* <br>
* Values greater than 1 are mutually exclusive with the {@link #MAX_DAMAGE} component.
*/
public static final DataComponentType.Valued<ItemAttributeModifiers> ATTRIBUTE_MODIFIERS = valued("attribute_modifiers");
public static final DataComponentType.Valued<@IntRange(from = 1, to = 99) Integer> MAX_STACK_SIZE = valued("max_stack_size");
/**
* Stores the additional patterns applied to a Banner or Shield.
*/
public static final DataComponentType.Valued<BannerPatternLayers> BANNER_PATTERNS = valued("banner_patterns");
/**
* Stores the base color for a Shield.
*/
public static final DataComponentType.Valued<DyeColor> BASE_COLOR = valued("base_color");
/**
* Holds block state properties to apply when placing a block.
*/
public static final DataComponentType.Valued<BlockItemDataProperties> BLOCK_DATA = valued("block_state");
/**
* Holds all items stored inside a Bundle.
* If removed, items cannot be added to the Bundle.
*/
public static final DataComponentType.Valued<BundleContents> BUNDLE_CONTENTS = valued("bundle_contents");
/**
* Controls which blocks a player in Adventure mode can break with this item.
*/
public static final DataComponentType.Valued<ItemAdventurePredicate> CAN_BREAK = valued("can_break");
/**
* Controls which blocks a player in Adventure mode can place on with this item.
*/
public static final DataComponentType.Valued<ItemAdventurePredicate> CAN_PLACE_ON = valued("can_place_on");
/**
* Holds all projectiles that have been loaded into a Crossbow.
* If not present, the Crossbow is not charged.
*/
public static final DataComponentType.Valued<ChargedProjectiles> CHARGED_PROJECTILES = valued("charged_projectiles");
public static final DataComponentType.Valued<Consumable> CONSUMABLE = valued("consumable");
/**
* Holds the contents of container blocks (Chests, Shulker Boxes) in item form.
*/
public static final DataComponentType.Valued<ItemContainerContents> CONTAINER = valued("container");
/**
* Holds the unresolved loot table and seed of a container-like block.
*/
public static final DataComponentType.Valued<SeededContainerLoot> CONTAINER_LOOT = valued("container_loot");
/**
* Controls the minecraft:custom_model_data property in the item model.
*/
public static final DataComponentType.Valued<CustomModelData> CUSTOM_MODEL_DATA = valued("custom_model_data");
/**
* Custom name override for an item (as set by renaming with an Anvil).
* Controls the maximum amount of damage than an item can take,
* if not present, the item cannot be damaged.
* <br>
* Mutually exclusive with the {@link #MAX_STACK_SIZE} component greater than 1.
*
* @see #ITEM_NAME
* @see #DAMAGE
*/
public static final DataComponentType.Valued<Component> CUSTOM_NAME = valued("custom_name");
public static final DataComponentType.Valued<@Positive Integer> MAX_DAMAGE = valued("max_damage");
/**
* The amount of durability removed from an item,
* for damageable items (with the {@link #MAX_DAMAGE} component), has an implicit default value of: {@code 0}.
@@ -140,80 +85,16 @@ public final class DataComponentTypes {
* @see #MAX_DAMAGE
*/
public static final DataComponentType.Valued<@NonNegative Integer> DAMAGE = valued("damage");
/**
* If present, this item will not take damage from the specified damage types.
* If set, the item will not lose any durability when used.
*/
public static final DataComponentType.Valued<DamageResistant> DAMAGE_RESISTANT = valued("damage_resistant");
public static final DataComponentType.Valued<DeathProtection> DEATH_PROTECTION = valued("death_protection");
public static final DataComponentType.Valued<Unbreakable> UNBREAKABLE = valued("unbreakable");
/**
* Represents a color applied to a dyeable item (in the {@link io.papermc.paper.registry.keys.tags.ItemTypeTagKeys#DYEABLE} item tag).
*/
public static final DataComponentType.Valued<DyedItemColor> DYED_COLOR = valued("dyed_color");
public static final DataComponentType.Valued<Enchantable> ENCHANTABLE = valued("enchantable");
/**
* Overrides the enchantment glint effect on an item.
* If not present, default behaviour is used.
*/
public static final DataComponentType.Valued<Boolean> ENCHANTMENT_GLINT_OVERRIDE = valued("enchantment_glint_override");
/**
* Controls the enchantments on an item.
* <br>
* If not present on a non-enchantment book, this item will not work in an anvil.
* Custom name override for an item (as set by renaming with an Anvil).
*
* @see #STORED_ENCHANTMENTS
* @see #ITEM_NAME
*/
public static final DataComponentType.Valued<ItemEnchantments> ENCHANTMENTS = valued("enchantments");
public static final DataComponentType.Valued<Equippable> EQUIPPABLE = valued("equippable");
/**
* Stores the explosion crafted in a Firework Star.
*/
public static final DataComponentType.Valued<FireworkEffect> FIREWORK_EXPLOSION = valued("firework_explosion");
/**
* Stores all explosions crafted into a Firework Rocket, as well as flight duration.
*/
public static final DataComponentType.Valued<Fireworks> FIREWORKS = valued("fireworks");
/**
* Controls potential food benefits gained when consuming the item the component is applied on.
* Requires the {@link #CONSUMABLE} component to allow consumption in the first place.
*/
public static final DataComponentType.Valued<FoodProperties> FOOD = valued("food");
public static final DataComponentType.NonValued GLIDER = unvalued("glider");
/**
* If set, disables 'additional' tooltip part which comes from the item type
* (e.g. content of a shulker).
*/
public static final DataComponentType.NonValued HIDE_ADDITIONAL_TOOLTIP = unvalued("hide_additional_tooltip");
/**
* If set, it will completely hide whole item tooltip (that includes item name).
*/
public static final DataComponentType.NonValued HIDE_TOOLTIP = unvalued("hide_tooltip");
/**
* Holds the instrument type used by a Goat Horn.
*/
public static final DataComponentType.Valued<MusicInstrument> INSTRUMENT = valued("instrument");
/**
* Marks that a projectile item would be intangible when fired
* (i.e. can only be picked up by a creative mode player).
*/
public static final DataComponentType.NonValued INTANGIBLE_PROJECTILE = unvalued("intangible_projectile");
public static final DataComponentType.Valued<Key> ITEM_MODEL = valued("item_model");
public static final DataComponentType.Valued<Component> CUSTOM_NAME = valued("custom_name");
/**
* When present, replaces default item name with contained chat component.
* <p>
@@ -228,100 +109,91 @@ public final class DataComponentTypes {
* @see #CUSTOM_NAME
*/
public static final DataComponentType.Valued<Component> ITEM_NAME = valued("item_name");
public static final DataComponentType.Valued<JukeboxPlayable> JUKEBOX_PLAYABLE = valued("jukebox_playable");
/**
* If present, specifies that the Compass is a Lodestone Compass.
*/
public static final DataComponentType.Valued<LodestoneTracker> LODESTONE_TRACKER = valued("lodestone_tracker");
public static final DataComponentType.Valued<Key> ITEM_MODEL = valued("item_model");
/**
* Additional lines to include in an item's tooltip.
*/
public static final DataComponentType.Valued<ItemLore> LORE = valued("lore");
/**
* Represents the tint of the decorations on the {@link org.bukkit.inventory.ItemType#FILLED_MAP} item.
*/
public static final DataComponentType.Valued<MapItemColor> MAP_COLOR = valued("map_color");
/**
* Holds a list of markers to be placed on a {@link org.bukkit.inventory.ItemType#FILLED_MAP} (used for Explorer Maps).
*/
public static final DataComponentType.Valued<MapDecorations> MAP_DECORATIONS = valued("map_decorations");
/**
* References the shared map state holding map contents and markers for a {@link org.bukkit.inventory.ItemType#FILLED_MAP}.
*/
public static final DataComponentType.Valued<MapId> MAP_ID = valued("map_id");
/**
* Internal map item state used in the map crafting recipe.
*/
public static final DataComponentType.Valued<MapPostProcessing> MAP_POST_PROCESSING = valued("map_post_processing");
/**
* Controls the maximum amount of damage than an item can take,
* if not present, the item cannot be damaged.
* <br>
* Mutually exclusive with the {@link #MAX_STACK_SIZE} component greater than 1.
*
* @see #DAMAGE
*/
public static final DataComponentType.Valued<@Positive Integer> MAX_DAMAGE = valued("max_damage");
/**
* Controls the maximum stacking size of this item.
* <br>
* Values greater than 1 are mutually exclusive with the {@link #MAX_DAMAGE} component.
*/
public static final DataComponentType.Valued<Integer> MAX_STACK_SIZE = valued("max_stack_size");
/**
* Controls the sound played by a Player Head when placed on a Note Block.
*/
public static final DataComponentType.Valued<Key> NOTE_BLOCK_SOUND = valued("note_block_sound");
/**
* Controls the amplifier amount for an Ominous Bottle's Bad Omen effect.
*/
public static final DataComponentType.Valued<OminousBottleAmplifier> OMINOUS_BOTTLE_AMPLIFIER = valued("ominous_bottle_amplifier");
/**
* Stores the Sherds applied to each side of a Decorated Pot.
*/
public static final DataComponentType.Valued<PotDecorations> POT_DECORATIONS = valued("pot_decorations");
/**
* Holds the contents of a potion (Potion, Splash Potion, Lingering Potion),
* or potion applied to a Tipped Arrow.
*/
public static final DataComponentType.Valued<PotionContents> POTION_CONTENTS = valued("potion_contents");
/**
* Controls the skin displayed on a Player Head.
*/
public static final DataComponentType.Valued<ResolvableProfile> PROFILE = valued("profile");
/**
* Controls the color of the item name.
*/
public static final DataComponentType.Valued<ItemRarity> RARITY = valued("rarity");
/**
* List of recipes that should be unlocked when using the Knowledge Book item.
* Controls the enchantments on an item.
* <br>
* If not present on a non-enchantment book, this item will not work in an anvil.
*
* @see #STORED_ENCHANTMENTS
*/
public static final DataComponentType.Valued<List<Key>> RECIPES = valued("recipes");
public static final DataComponentType.Valued<ItemEnchantments> ENCHANTMENTS = valued("enchantments");
/**
* Controls which blocks a player in Adventure mode can place on with this item.
*/
public static final DataComponentType.Valued<ItemAdventurePredicate> CAN_PLACE_ON = valued("can_place_on");
/**
* Controls which blocks a player in Adventure mode can break with this item.
*/
public static final DataComponentType.Valued<ItemAdventurePredicate> CAN_BREAK = valued("can_break");
/**
* Holds attribute modifiers applied to any item,
* if not set, has an implicit default value based on the item type's
* default attributes (e.g. attack damage for weapons).
*/
public static final DataComponentType.Valued<ItemAttributeModifiers> ATTRIBUTE_MODIFIERS = valued("attribute_modifiers");
/**
* Controls the minecraft:custom_model_data property in the item model.
*/
public static final DataComponentType.Valued<CustomModelData> CUSTOM_MODEL_DATA = valued("custom_model_data");
/**
* If set, disables 'additional' tooltip part which comes from the item type
* (e.g. content of a shulker).
*/
public static final DataComponentType.NonValued HIDE_ADDITIONAL_TOOLTIP = unvalued("hide_additional_tooltip");
/**
* If set, it will completely hide whole item tooltip (that includes item name).
*/
public static final DataComponentType.NonValued HIDE_TOOLTIP = unvalued("hide_tooltip");
/**
* The additional experience cost required to modify an item in an Anvil.
* If not present, has an implicit default value of: {@code 0}.
*/
public static final DataComponentType.Valued<@NonNegative Integer> REPAIR_COST = valued("repair_cost");
// /**
// * Causes an item to not be pickable in the creative menu, currently not very useful.
// */
// public static final DataComponentType.NonValued CREATIVE_SLOT_LOCK = unvalued("creative_slot_lock");
/**
* Overrides the enchantment glint effect on an item.
* If not present, default behaviour is used.
*/
public static final DataComponentType.Valued<Boolean> ENCHANTMENT_GLINT_OVERRIDE = valued("enchantment_glint_override");
/**
* Marks that a projectile item would be intangible when fired
* (i.e. can only be picked up by a creative mode player).
*/
public static final DataComponentType.NonValued INTANGIBLE_PROJECTILE = unvalued("intangible_projectile");
/**
* Controls potential food benefits gained when consuming the item the component is applied on.
* Requires the {@link #CONSUMABLE} component to allow consumption in the first place.
*/
public static final DataComponentType.Valued<FoodProperties> FOOD = valued("food");
public static final DataComponentType.Valued<Consumable> CONSUMABLE = valued("consumable");
public static final DataComponentType.Valued<UseRemainder> USE_REMAINDER = valued("use_remainder");
public static final DataComponentType.Valued<UseCooldown> USE_COOLDOWN = valued("use_cooldown");
/**
* If present, this item will not take damage from the specified damage types.
*/
public static final DataComponentType.Valued<DamageResistant> DAMAGE_RESISTANT = valued("damage_resistant");
/**
* Controls the behavior of the item as a tool.
*/
public static final DataComponentType.Valued<Tool> TOOL = valued("tool");
public static final DataComponentType.Valued<Enchantable> ENCHANTABLE = valued("enchantable");
public static final DataComponentType.Valued<Equippable> EQUIPPABLE = valued("equippable");
public static final DataComponentType.Valued<Repairable> REPAIRABLE = valued("repairable");
public static final DataComponentType.NonValued GLIDER = unvalued("glider");
public static final DataComponentType.Valued<Key> TOOLTIP_STYLE = valued("tooltip_style");
public static final DataComponentType.Valued<DeathProtection> DEATH_PROTECTION = valued("death_protection");
/**
* Stores list of enchantments and their levels for an Enchanted Book.
* Unlike {@link #ENCHANTMENTS}, the effects provided by enchantments
@@ -336,51 +208,114 @@ public final class DataComponentTypes {
* @see #ENCHANTMENTS
*/
public static final DataComponentType.Valued<ItemEnchantments> STORED_ENCHANTMENTS = valued("stored_enchantments");
/**
* Represents a color applied to a dyeable item (in the {@link io.papermc.paper.registry.keys.tags.ItemTypeTagKeys#DYEABLE} item tag).
*/
public static final DataComponentType.Valued<DyedItemColor> DYED_COLOR = valued("dyed_color");
/**
* Represents the tint of the decorations on the {@link org.bukkit.inventory.ItemType#FILLED_MAP} item.
*/
public static final DataComponentType.Valued<MapItemColor> MAP_COLOR = valued("map_color");
/**
* References the shared map state holding map contents and markers for a {@link org.bukkit.inventory.ItemType#FILLED_MAP}.
*/
public static final DataComponentType.Valued<MapId> MAP_ID = valued("map_id");
/**
* Holds a list of markers to be placed on a {@link org.bukkit.inventory.ItemType#FILLED_MAP} (used for Explorer Maps).
*/
public static final DataComponentType.Valued<MapDecorations> MAP_DECORATIONS = valued("map_decorations");
/**
* Internal map item state used in the map crafting recipe.
*/
public static final DataComponentType.Valued<MapPostProcessing> MAP_POST_PROCESSING = valued("map_post_processing");
/**
* Holds all projectiles that have been loaded into a Crossbow.
* If not present, the Crossbow is not charged.
*/
public static final DataComponentType.Valued<ChargedProjectiles> CHARGED_PROJECTILES = valued("charged_projectiles");
/**
* Holds all items stored inside a Bundle.
* If removed, items cannot be added to the Bundle.
*/
public static final DataComponentType.Valued<BundleContents> BUNDLE_CONTENTS = valued("bundle_contents");
/**
* Holds the contents of a potion (Potion, Splash Potion, Lingering Potion),
* or potion applied to a Tipped Arrow.
*/
public static final DataComponentType.Valued<PotionContents> POTION_CONTENTS = valued("potion_contents");
/**
* Holds the effects that will be applied when consuming Suspicious Stew.
*/
public static final DataComponentType.Valued<SuspiciousStewEffects> SUSPICIOUS_STEW_EFFECTS = valued("suspicious_stew_effects");
/**
* Controls the behavior of the item as a tool.
*/
public static final DataComponentType.Valued<Tool> TOOL = valued("tool");
public static final DataComponentType.Valued<Key> TOOLTIP_STYLE = valued("tooltip_style");
/**
* Holds the trims applied to an item in recipes
*/
public static final DataComponentType.Valued<ItemArmorTrim> TRIM = valued("trim");
/**
* If set, the item will not lose any durability when used.
*/
public static final DataComponentType.Valued<Unbreakable> UNBREAKABLE = valued("unbreakable");
public static final DataComponentType.Valued<UseCooldown> USE_COOLDOWN = valued("use_cooldown");
public static final DataComponentType.Valued<UseRemainder> USE_REMAINDER = valued("use_remainder");
/**
* Holds the contents in a Book and Quill.
*/
public static final DataComponentType.Valued<WritableBookContent> WRITABLE_BOOK_CONTENT = valued("writable_book_content");
/**
* Holds the contents and metadata of a Written Book.
*/
public static final DataComponentType.Valued<WrittenBookContent> WRITTEN_BOOK_CONTENT = valued("written_book_content");
// End generate - DataComponentTypes
// /**
// * Causes an item to not be pickable in the creative menu, currently not very useful.
// */
// public static final DataComponentType.NonValued CREATIVE_SLOT_LOCK = unvalued("creative_slot_lock");
/**
* Holds the trims applied to an item in recipes
*/
public static final DataComponentType.Valued<ItemArmorTrim> TRIM = valued("trim");
// debug_stick_state - Block Property API
// entity_data
// bucket_entity_data
// block_entity_data
/**
* Holds the instrument type used by a Goat Horn.
*/
public static final DataComponentType.Valued<MusicInstrument> INSTRUMENT = valued("instrument");
/**
* Controls the amplifier amount for an Ominous Bottle's Bad Omen effect.
*/
public static final DataComponentType.Valued<OminousBottleAmplifier> OMINOUS_BOTTLE_AMPLIFIER = valued("ominous_bottle_amplifier");
public static final DataComponentType.Valued<JukeboxPlayable> JUKEBOX_PLAYABLE = valued("jukebox_playable");
/**
* List of recipes that should be unlocked when using the Knowledge Book item.
*/
public static final DataComponentType.Valued<List<Key>> RECIPES = valued("recipes");
/**
* If present, specifies that the Compass is a Lodestone Compass.
*/
public static final DataComponentType.Valued<LodestoneTracker> LODESTONE_TRACKER = valued("lodestone_tracker");
/**
* Stores the explosion crafted in a Firework Star.
*/
public static final DataComponentType.Valued<FireworkEffect> FIREWORK_EXPLOSION = valued("firework_explosion");
/**
* Stores all explosions crafted into a Firework Rocket, as well as flight duration.
*/
public static final DataComponentType.Valued<Fireworks> FIREWORKS = valued("fireworks");
/**
* Controls the skin displayed on a Player Head.
*/
public static final DataComponentType.Valued<ResolvableProfile> PROFILE = valued("profile");
/**
* Controls the sound played by a Player Head when placed on a Note Block.
*/
public static final DataComponentType.Valued<Key> NOTE_BLOCK_SOUND = valued("note_block_sound");
/**
* Stores the additional patterns applied to a Banner or Shield.
*/
public static final DataComponentType.Valued<BannerPatternLayers> BANNER_PATTERNS = valued("banner_patterns");
/**
* Stores the base color for a Shield.
*/
public static final DataComponentType.Valued<DyeColor> BASE_COLOR = valued("base_color");
/**
* Stores the Sherds applied to each side of a Decorated Pot.
*/
public static final DataComponentType.Valued<PotDecorations> POT_DECORATIONS = valued("pot_decorations");
/**
* Holds the contents of container blocks (Chests, Shulker Boxes) in item form.
*/
public static final DataComponentType.Valued<ItemContainerContents> CONTAINER = valued("container");
/**
* Holds block state properties to apply when placing a block.
*/
public static final DataComponentType.Valued<BlockItemDataProperties> BLOCK_DATA = valued("block_state");
// bees
// /**
// * Holds the lock state of a container-like block,
@@ -390,6 +325,10 @@ public final class DataComponentTypes {
// * to open this container.
// */
// public static final DataComponentType.Valued<LockCode> LOCK = valued("lock");
/**
* Holds the unresolved loot table and seed of a container-like block.
*/
public static final DataComponentType.Valued<SeededContainerLoot> CONTAINER_LOOT = valued("container_loot");
private static DataComponentType.NonValued unvalued(final String name) {
return (DataComponentType.NonValued) requireNonNull(Registry.DATA_COMPONENT_TYPE.get(NamespacedKey.minecraft(name)), name + " unvalued data component type couldn't be found, this is a bug.");
@@ -4,8 +4,6 @@ package io.papermc.paper.datacomponent.item.consumable;
* Represents the hand animation that is used when a player is consuming this item.
*/
public enum ItemUseAnimation {
// Start generate - ItemUseAnimation
// @GeneratedFrom 1.21.4
NONE,
EAT,
DRINK,
@@ -16,6 +14,5 @@ public enum ItemUseAnimation {
SPYGLASS,
TOOT_HORN,
BRUSH,
BUNDLE;
// End generate - ItemUseAnimation
BUNDLE
}
@@ -0,0 +1,29 @@
package io.papermc.paper.event.packet;
import org.bukkit.entity.Player;
import org.bukkit.event.HandlerList;
import org.bukkit.event.player.PlayerEvent;
import org.jetbrains.annotations.ApiStatus;
import org.jspecify.annotations.NullMarked;
/**
* Called when a {@code minecraft:client_tick_end} packet is received by the server.
*/
@NullMarked
public class ClientTickEndEvent extends PlayerEvent {
private static final HandlerList HANDLER_LIST = new HandlerList();
@ApiStatus.Internal
public ClientTickEndEvent(final Player player) {
super(player);
}
@Override
public HandlerList getHandlers() {
return HANDLER_LIST;
}
public static HandlerList getHandlerList() {
return HANDLER_LIST;
}
}
@@ -24,14 +24,11 @@ import static io.papermc.paper.registry.event.RegistryEventProviderImpl.create;
@NullMarked
public final class RegistryEvents {
// Start generate - RegistryEvents
// @GeneratedFrom 1.21.4
public static final RegistryEventProvider<GameEvent, GameEventRegistryEntry.Builder> GAME_EVENT = create(RegistryKey.GAME_EVENT);
public static final RegistryEventProvider<DamageType, DamageTypeRegistryEntry.Builder> DAMAGE_TYPE = create(RegistryKey.DAMAGE_TYPE);
public static final RegistryEventProvider<Enchantment, EnchantmentRegistryEntry.Builder> ENCHANTMENT = create(RegistryKey.ENCHANTMENT);
public static final RegistryEventProvider<PatternType, BannerPatternRegistryEntry.Builder> BANNER_PATTERN = create(RegistryKey.BANNER_PATTERN);
public static final RegistryEventProvider<Art, PaintingVariantRegistryEntry.Builder> PAINTING_VARIANT = create(RegistryKey.PAINTING_VARIANT);
// End generate - RegistryEvents
public static final RegistryEventProvider<PatternType, BannerPatternRegistryEntry.Builder> BANNER_PATTERN = create(RegistryKey.BANNER_PATTERN);
public static final RegistryEventProvider<DamageType, DamageTypeRegistryEntry.Builder> DAMAGE_TYPE = create(RegistryKey.DAMAGE_TYPE);
private RegistryEvents() {
}
+46 -98
View File
@@ -35,108 +35,56 @@ public interface Art extends OldEnum<Art>, Keyed {
return InlinedRegistryBuilderProvider.instance().createPaintingVariant(value);
}
// Start generate - Art
// @GeneratedFrom 1.21.4
Art ALBAN = getArt("alban");
Art AZTEC = getArt("aztec");
Art AZTEC2 = getArt("aztec2");
Art BACKYARD = getArt("backyard");
Art BAROQUE = getArt("baroque");
Art BOMB = getArt("bomb");
Art BOUQUET = getArt("bouquet");
Art BURNING_SKULL = getArt("burning_skull");
Art BUST = getArt("bust");
Art CAVEBIRD = getArt("cavebird");
Art CHANGING = getArt("changing");
Art COTAN = getArt("cotan");
Art COURBET = getArt("courbet");
Art CREEBET = getArt("creebet");
Art DONKEY_KONG = getArt("donkey_kong");
Art EARTH = getArt("earth");
Art ENDBOSS = getArt("endboss");
Art FERN = getArt("fern");
Art FIGHTERS = getArt("fighters");
Art FINDING = getArt("finding");
Art FIRE = getArt("fire");
Art GRAHAM = getArt("graham");
Art HUMBLE = getArt("humble");
Art KEBAB = getArt("kebab");
Art LOWMIST = getArt("lowmist");
Art MATCH = getArt("match");
Art MEDITATIVE = getArt("meditative");
Art ORB = getArt("orb");
Art OWLEMONS = getArt("owlemons");
Art PASSAGE = getArt("passage");
Art PIGSCENE = getArt("pigscene");
Art AZTEC = getArt("aztec");
Art ALBAN = getArt("alban");
Art AZTEC2 = getArt("aztec2");
Art BOMB = getArt("bomb");
Art PLANT = getArt("plant");
Art POINTER = getArt("pointer");
Art POND = getArt("pond");
Art POOL = getArt("pool");
Art PRAIRIE_RIDE = getArt("prairie_ride");
Art SEA = getArt("sea");
Art SKELETON = getArt("skeleton");
Art SKULL_AND_ROSES = getArt("skull_and_roses");
Art STAGE = getArt("stage");
Art SUNFLOWERS = getArt("sunflowers");
Art SUNSET = getArt("sunset");
Art TIDES = getArt("tides");
Art UNPACKED = getArt("unpacked");
Art VOID = getArt("void");
Art WANDERER = getArt("wanderer");
Art WASTELAND = getArt("wasteland");
Art WATER = getArt("water");
Art WIND = getArt("wind");
Art POOL = getArt("pool");
Art COURBET = getArt("courbet");
Art SEA = getArt("sea");
Art SUNSET = getArt("sunset");
Art CREEBET = getArt("creebet");
Art WANDERER = getArt("wanderer");
Art GRAHAM = getArt("graham");
Art MATCH = getArt("match");
Art BUST = getArt("bust");
Art STAGE = getArt("stage");
Art VOID = getArt("void");
Art SKULL_AND_ROSES = getArt("skull_and_roses");
Art WITHER = getArt("wither");
// End generate - Art
Art FIGHTERS = getArt("fighters");
Art POINTER = getArt("pointer");
Art PIGSCENE = getArt("pigscene");
Art BURNING_SKULL = getArt("burning_skull");
Art SKELETON = getArt("skeleton");
Art DONKEY_KONG = getArt("donkey_kong");
Art EARTH = getArt("earth");
Art WIND = getArt("wind");
Art WATER = getArt("water");
Art FIRE = getArt("fire");
Art BAROQUE = getArt("baroque");
Art HUMBLE = getArt("humble");
Art MEDITATIVE = getArt("meditative");
Art PRAIRIE_RIDE = getArt("prairie_ride");
Art UNPACKED = getArt("unpacked");
Art BACKYARD = getArt("backyard");
Art BOUQUET = getArt("bouquet");
Art CAVEBIRD = getArt("cavebird");
Art CHANGING = getArt("changing");
Art COTAN = getArt("cotan");
Art ENDBOSS = getArt("endboss");
Art FERN = getArt("fern");
Art FINDING = getArt("finding");
Art LOWMIST = getArt("lowmist");
Art ORB = getArt("orb");
Art OWLEMONS = getArt("owlemons");
Art PASSAGE = getArt("passage");
Art POND = getArt("pond");
Art SUNFLOWERS = getArt("sunflowers");
Art TIDES = getArt("tides");
@NotNull
private static Art getArt(@NotNull String key) {
@@ -2980,8 +2980,19 @@ public final class Bukkit {
}
// Paper end - Folia region threading API
/**
* @deprecated All methods on this class have been deprecated, see the individual methods for replacements.
*/
@Deprecated(since = "1.21.4", forRemoval = true)
@NotNull
public static Server.Spigot spigot() {
return server.spigot();
}
/**
* Restarts the server. If the server administrator has not configured restarting, the server will stop.
*/
public static void restart() {
server.restart();
}
}
@@ -14,36 +14,11 @@ import org.jetbrains.annotations.ApiStatus;
*/
public interface FeatureFlag extends Keyed {
// Start generate - FeatureFlag
// @GeneratedFrom 1.21.4
@ApiStatus.Experimental
FeatureFlag MINECART_IMPROVEMENTS = create("minecart_improvements");
@ApiStatus.Experimental
FeatureFlag REDSTONE_EXPERIMENTS = create("redstone_experiments");
@ApiStatus.Experimental
FeatureFlag TRADE_REBALANCE = create("trade_rebalance");
// Paper start - overhaul FeatureFlag API
/**
* The {@code vanilla} feature flag.
*/
FeatureFlag VANILLA = create("vanilla");
// End generate - FeatureFlag
/**
* <strong>AVAILABLE BETWEEN VERSIONS:</strong> 1.19 - 1.19.4
*
* @deprecated not available since 1.20
* The {@code trade_rebalance} feature flag.
*/
@Deprecated(since = "1.20")
FeatureFlag UPDATE_1_20 = deprecated("update_1_20");
/**
* <strong>AVAILABLE BETWEEN VERSIONS:</strong> 1.20.5 - 1.20.6
*
* @deprecated not available since 1.21
*/
@Deprecated(since = "1.21")
FeatureFlag UPDATE_121 = deprecated("update_1_21");
/**
* <strong>AVAILABLE BETWEEN VERSIONS:</strong> 1.19.3 - 1.21.1
@@ -53,6 +28,26 @@ public interface FeatureFlag extends Keyed {
@Deprecated(since = "1.21.2")
FeatureFlag BUNDLE = deprecated("bundle");
/**
* <strong>AVAILABLE BETWEEN VERSIONS:</strong> 1.19 - 1.19.4
*
* @deprecated not available since 1.20
* The {@code trade_rebalance} feature flag.
*/
@Deprecated(since = "1.20")
FeatureFlag UPDATE_1_20 = deprecated("update_1_20");
@ApiStatus.Experimental // Paper - add missing annotation
FeatureFlag TRADE_REBALANCE = create("trade_rebalance");
/**
* <strong>AVAILABLE BETWEEN VERSIONS:</strong> 1.20.5 - 1.20.6
*
* @deprecated not available since 1.21
*/
@Deprecated(since = "1.21")
FeatureFlag UPDATE_121 = deprecated("update_1_21");
/**
* <strong>AVAILABLE BETWEEN VERSIONS:</strong> 1.21.2 - 1.21.3
*
@@ -61,6 +56,12 @@ public interface FeatureFlag extends Keyed {
@Deprecated(since = "1.21.4")
FeatureFlag WINTER_DROP = deprecated("winter_drop");
@ApiStatus.Experimental // Paper - add missing annotation
FeatureFlag REDSTONE_EXPERIMENTS = create("redstone_experiments");
@ApiStatus.Experimental // Paper - add missing annotation
FeatureFlag MINECART_IMPROVEMENTS = create("minecart_improvements");
/**
* An index of all feature flags.
*/
+18 -10
View File
@@ -12,18 +12,26 @@ import org.jetbrains.annotations.NotNull;
*/
public interface Fluid extends OldEnum<Fluid>, Keyed {
// Start generate - Fluid
// @GeneratedFrom 1.21.4
/**
* No fluid.
*/
Fluid EMPTY = getFluid("empty");
Fluid FLOWING_LAVA = getFluid("flowing_lava");
Fluid FLOWING_WATER = getFluid("flowing_water");
Fluid LAVA = getFluid("lava");
/**
* Stationary water.
*/
Fluid WATER = getFluid("water");
// End generate - Fluid
/**
* Flowing water.
*/
Fluid FLOWING_WATER = getFluid("flowing_water");
/**
* Stationary lava.
*/
Fluid LAVA = getFluid("lava");
/**
* Flowing lava.
*/
Fluid FLOWING_LAVA = getFluid("flowing_lava");
@NotNull
private static Fluid getFluid(@NotNull String key) {
+55 -177
View File
@@ -11,228 +11,106 @@ import org.jetbrains.annotations.Nullable;
*/
public abstract class GameEvent implements Keyed {
// Start generate - GameEvent
// @GeneratedFrom 1.21.4
public static final GameEvent BLOCK_ACTIVATE = getEvent("block_activate");
public static final GameEvent BLOCK_ATTACH = getEvent("block_attach");
public static final GameEvent BLOCK_CHANGE = getEvent("block_change");
public static final GameEvent BLOCK_CLOSE = getEvent("block_close");
public static final GameEvent BLOCK_DEACTIVATE = getEvent("block_deactivate");
public static final GameEvent BLOCK_DESTROY = getEvent("block_destroy");
public static final GameEvent BLOCK_DETACH = getEvent("block_detach");
public static final GameEvent BLOCK_OPEN = getEvent("block_open");
public static final GameEvent BLOCK_PLACE = getEvent("block_place");
@Deprecated(since = "1.19")
public static final GameEvent BLOCK_PRESS = getEvent("block_activate");
@Deprecated(since = "1.19")
public static final GameEvent BLOCK_SWITCH = getEvent("block_activate");
@Deprecated(since = "1.19")
public static final GameEvent BLOCK_UNPRESS = getEvent("block_deactivate");
@Deprecated(since = "1.19")
public static final GameEvent BLOCK_UNSWITCH = getEvent("block_deactivate");
public static final GameEvent CONTAINER_CLOSE = getEvent("container_close");
public static final GameEvent CONTAINER_OPEN = getEvent("container_open");
@Deprecated(since = "1.20")
public static final GameEvent DISPENSE_FAIL = getEvent("block_activate");
public static final GameEvent DRINK = getEvent("drink");
@Deprecated(since = "1.19")
public static final GameEvent DRINKING_FINISH = getEvent("drink");
public static final GameEvent EAT = getEvent("eat");
@Deprecated(since = "1.19")
public static final GameEvent ELYTRA_FREE_FALL = getEvent("elytra_glide");
public static final GameEvent ELYTRA_GLIDE = getEvent("elytra_glide");
public static final GameEvent ENTITY_ACTION = getEvent("entity_action");
public static final GameEvent ENTITY_DAMAGE = getEvent("entity_damage");
@Deprecated(since = "1.19")
public static final GameEvent ENTITY_DAMAGED = getEvent("entity_damage");
public static final GameEvent ENTITY_DIE = getEvent("entity_die");
public static final GameEvent ENTITY_DISMOUNT = getEvent("entity_dismount");
@Deprecated(since = "1.19")
public static final GameEvent ENTITY_DYING = getEvent("entity_die");
public static final GameEvent ENTITY_INTERACT = getEvent("entity_interact");
public static final GameEvent ENTITY_MOUNT = getEvent("entity_mount");
@Deprecated(since = "1.19")
public static final GameEvent ENTITY_KILLED = getEvent("entity_die");
public static final GameEvent ENTITY_PLACE = getEvent("entity_place");
public static final GameEvent ENTITY_ACTION = getEvent("entity_action");
@Deprecated(since = "1.20.2")
public static final GameEvent ENTITY_ROAR = getEvent("entity_action");
@Deprecated(since = "1.20.2")
public static final GameEvent ENTITY_SHAKE = getEvent("entity_action");
public static final GameEvent EQUIP = getEvent("equip");
public static final GameEvent EXPLODE = getEvent("explode");
public static final GameEvent FLAP = getEvent("flap");
public static final GameEvent FLUID_PICKUP = getEvent("fluid_pickup");
public static final GameEvent FLUID_PLACE = getEvent("fluid_place");
public static final GameEvent HIT_GROUND = getEvent("hit_ground");
public static final GameEvent INSTRUMENT_PLAY = getEvent("instrument_play");
public static final GameEvent ITEM_INTERACT_FINISH = getEvent("item_interact_finish");
public static final GameEvent ITEM_INTERACT_START = getEvent("item_interact_start");
public static final GameEvent JUKEBOX_PLAY = getEvent("jukebox_play");
public static final GameEvent JUKEBOX_STOP_PLAY = getEvent("jukebox_stop_play");
public static final GameEvent LIGHTNING_STRIKE = getEvent("lightning_strike");
@Deprecated(since = "1.19")
public static final GameEvent MOB_INTERACT = getEvent("entity_interact");
public static final GameEvent NOTE_BLOCK_PLAY = getEvent("note_block_play");
@Deprecated(since = "1.20")
public static final GameEvent PISTON_CONTRACT = getEvent("block_deactivate");
@Deprecated(since = "1.20")
public static final GameEvent PISTON_EXTEND = getEvent("block_activate");
public static final GameEvent PRIME_FUSE = getEvent("prime_fuse");
public static final GameEvent PROJECTILE_LAND = getEvent("projectile_land");
public static final GameEvent PROJECTILE_SHOOT = getEvent("projectile_shoot");
public static final GameEvent RESONATE_1 = getEvent("resonate_1");
public static final GameEvent RESONATE_2 = getEvent("resonate_2");
public static final GameEvent RESONATE_3 = getEvent("resonate_3");
public static final GameEvent RESONATE_4 = getEvent("resonate_4");
public static final GameEvent RESONATE_5 = getEvent("resonate_5");
public static final GameEvent RESONATE_6 = getEvent("resonate_6");
public static final GameEvent RESONATE_7 = getEvent("resonate_7");
public static final GameEvent RESONATE_8 = getEvent("resonate_8");
public static final GameEvent RESONATE_9 = getEvent("resonate_9");
public static final GameEvent RESONATE_10 = getEvent("resonate_10");
public static final GameEvent RESONATE_11 = getEvent("resonate_11");
public static final GameEvent RESONATE_12 = getEvent("resonate_12");
public static final GameEvent RESONATE_13 = getEvent("resonate_13");
public static final GameEvent RESONATE_14 = getEvent("resonate_14");
public static final GameEvent RESONATE_15 = getEvent("resonate_15");
@Deprecated(since = "1.19")
public static final GameEvent RAVAGER_ROAR = getEvent("entity_action");
@Deprecated(since = "1.19")
public static final GameEvent RING_BELL = getEvent("block_change");
public static final GameEvent SCULK_SENSOR_TENDRILS_CLICKING = getEvent("sculk_sensor_tendrils_clicking");
public static final GameEvent SHEAR = getEvent("shear");
public static final GameEvent SHRIEK = getEvent("shriek");
@Deprecated(since = "1.19")
public static final GameEvent SHULKER_CLOSE = getEvent("container_close");
@Deprecated(since = "1.19")
public static final GameEvent SHULKER_OPEN = getEvent("container_open");
public static final GameEvent SPLASH = getEvent("splash");
public static final GameEvent STEP = getEvent("step");
public static final GameEvent SWIM = getEvent("swim");
public static final GameEvent TELEPORT = getEvent("teleport");
public static final GameEvent UNEQUIP = getEvent("unequip");
// End generate - GameEvent
/**
* @deprecated in favor of {@link #BLOCK_ACTIVATE}
*/
@Deprecated(since = "1.19")
public static final GameEvent BLOCK_PRESS = BLOCK_ACTIVATE;
/**
* @deprecated in favor of {@link #BLOCK_ACTIVATE}
*/
@Deprecated(since = "1.19")
public static final GameEvent BLOCK_SWITCH = BLOCK_ACTIVATE;
/**
* @deprecated in favor of {@link #BLOCK_DEACTIVATE}
*/
@Deprecated(since = "1.19")
public static final GameEvent BLOCK_UNPRESS = BLOCK_DEACTIVATE;
/**
* @deprecated in favor of {@link #BLOCK_DEACTIVATE}
*/
@Deprecated(since = "1.19")
public static final GameEvent BLOCK_UNSWITCH = BLOCK_DEACTIVATE;
/**
* @deprecated in favor of {@link #BLOCK_ACTIVATE}
*/
@Deprecated(since = "1.20")
public static final GameEvent DISPENSE_FAIL = BLOCK_ACTIVATE;
/**
* @deprecated in favor of {@link #DRINK}
*/
@Deprecated(since = "1.19")
public static final GameEvent DRINKING_FINISH = DRINK;
/**
* @deprecated in favor of {@link #ELYTRA_GLIDE}
*/
@Deprecated(since = "1.19")
public static final GameEvent ELYTRA_FREE_FALL = ELYTRA_GLIDE;
/**
* @deprecated in favor of {@link #ENTITY_DAMAGE}
*/
@Deprecated(since = "1.19")
public static final GameEvent ENTITY_DAMAGED = ENTITY_DAMAGE;
/**
* @deprecated in favor of {@link #ENTITY_DIE}
*/
@Deprecated(since = "1.19")
public static final GameEvent ENTITY_DYING = ENTITY_DIE;
/**
* @deprecated in favor of {@link #ENTITY_DIE}
*/
@Deprecated(since = "1.19")
public static final GameEvent ENTITY_KILLED = ENTITY_DIE;
/**
* @deprecated in favor of {@link #ENTITY_ACTION}
*/
@Deprecated(since = "1.20.2")
public static final GameEvent ENTITY_ROAR = ENTITY_ACTION;
/**
* @deprecated in favor of {@link #ENTITY_ACTION}
*/
@Deprecated(since = "1.20.2")
public static final GameEvent ENTITY_SHAKE = ENTITY_ACTION;
/**
* @deprecated in favor of {@link #ENTITY_INTERACT}
*/
@Deprecated(since = "1.19")
public static final GameEvent MOB_INTERACT = ENTITY_INTERACT;
/**
* @deprecated in favor of {@link #BLOCK_DEACTIVATE}
*/
@Deprecated(since = "1.20")
public static final GameEvent PISTON_CONTRACT = BLOCK_DEACTIVATE;
/**
* @deprecated in favor of {@link #BLOCK_ACTIVATE}
*/
@Deprecated(since = "1.20")
public static final GameEvent PISTON_EXTEND = BLOCK_ACTIVATE;
/**
* @deprecated in favor of {@link #ENTITY_ACTION}
*/
@Deprecated(since = "1.19")
public static final GameEvent RAVAGER_ROAR = ENTITY_ACTION;
/**
* @deprecated in favor of {@link #BLOCK_CHANGE}
*/
@Deprecated(since = "1.19")
public static final GameEvent RING_BELL = BLOCK_CHANGE;
/**
* @deprecated in favor of {@link #CONTAINER_CLOSE}
*/
@Deprecated(since = "1.19")
public static final GameEvent SHULKER_CLOSE = CONTAINER_CLOSE;
/**
* @deprecated in favor of {@link #CONTAINER_OPEN}
*/
@Deprecated(since = "1.19")
public static final GameEvent SHULKER_OPEN = CONTAINER_OPEN;
/**
* @deprecated in favor of {@link #ENTITY_ACTION}
*/
@Deprecated(since = "1.19")
public static final GameEvent WOLF_SHAKING = ENTITY_ACTION;
public static final GameEvent WOLF_SHAKING = getEvent("entity_action");
public static final GameEvent RESONATE_1 = getEvent("resonate_1");
public static final GameEvent RESONATE_2 = getEvent("resonate_2");
public static final GameEvent RESONATE_3 = getEvent("resonate_3");
public static final GameEvent RESONATE_4 = getEvent("resonate_4");
public static final GameEvent RESONATE_5 = getEvent("resonate_5");
public static final GameEvent RESONATE_6 = getEvent("resonate_6");
public static final GameEvent RESONATE_7 = getEvent("resonate_7");
public static final GameEvent RESONATE_8 = getEvent("resonate_8");
public static final GameEvent RESONATE_9 = getEvent("resonate_9");
public static final GameEvent RESONATE_10 = getEvent("resonate_10");
public static final GameEvent RESONATE_11 = getEvent("resonate_11");
public static final GameEvent RESONATE_12 = getEvent("resonate_12");
public static final GameEvent RESONATE_13 = getEvent("resonate_13");
public static final GameEvent RESONATE_14 = getEvent("resonate_14");
public static final GameEvent RESONATE_15 = getEvent("resonate_15");
/**
* Returns a {@link GameEvent} by a {@link NamespacedKey}.
@@ -11,46 +11,25 @@ import org.jetbrains.annotations.NotNull;
@ApiStatus.Experimental
public interface JukeboxSong extends Keyed, Translatable {
// Start generate - JukeboxSong
// @GeneratedFrom 1.21.4
JukeboxSong ELEVEN = get("11");
JukeboxSong THIRTEEN = get("13");
JukeboxSong FIVE = get("5");
JukeboxSong BLOCKS = get("blocks");
JukeboxSong CAT = get("cat");
JukeboxSong CHIRP = get("chirp");
JukeboxSong CREATOR = get("creator");
JukeboxSong CREATOR_MUSIC_BOX = get("creator_music_box");
JukeboxSong FAR = get("far");
JukeboxSong MALL = get("mall");
JukeboxSong MELLOHI = get("mellohi");
JukeboxSong OTHERSIDE = get("otherside");
JukeboxSong PIGSTEP = get("pigstep");
JukeboxSong PRECIPICE = get("precipice");
JukeboxSong RELIC = get("relic");
JukeboxSong STAL = get("stal");
JukeboxSong STRAD = get("strad");
JukeboxSong WAIT = get("wait");
JukeboxSong WARD = get("ward");
// End generate - JukeboxSong
public static final JukeboxSong THIRTEEN = get("13");
public static final JukeboxSong CAT = get("cat");
public static final JukeboxSong BLOCKS = get("blocks");
public static final JukeboxSong CHIRP = get("chirp");
public static final JukeboxSong FAR = get("far");
public static final JukeboxSong MALL = get("mall");
public static final JukeboxSong MELLOHI = get("mellohi");
public static final JukeboxSong STAL = get("stal");
public static final JukeboxSong STRAD = get("strad");
public static final JukeboxSong WARD = get("ward");
public static final JukeboxSong ELEVEN = get("11");
public static final JukeboxSong WAIT = get("wait");
public static final JukeboxSong PIGSTEP = get("pigstep");
public static final JukeboxSong OTHERSIDE = get("otherside");
public static final JukeboxSong FIVE = get("5");
public static final JukeboxSong RELIC = get("relic");
public static final JukeboxSong PRECIPICE = get("precipice");
public static final JukeboxSong CREATOR = get("creator");
public static final JukeboxSong CREATOR_MUSIC_BOX = get("creator_music_box");
@NotNull
private static JukeboxSong get(@NotNull String key) {
File diff suppressed because it is too large. Load diff
@@ -10,24 +10,14 @@ import org.jetbrains.annotations.Nullable;
public abstract class MusicInstrument implements Keyed, net.kyori.adventure.translation.Translatable { // Paper - translation keys
// Start generate - MusicInstrument
// @GeneratedFrom 1.21.4
public static final MusicInstrument ADMIRE_GOAT_HORN = getInstrument("admire_goat_horn");
public static final MusicInstrument CALL_GOAT_HORN = getInstrument("call_goat_horn");
public static final MusicInstrument DREAM_GOAT_HORN = getInstrument("dream_goat_horn");
public static final MusicInstrument FEEL_GOAT_HORN = getInstrument("feel_goat_horn");
public static final MusicInstrument PONDER_GOAT_HORN = getInstrument("ponder_goat_horn");
public static final MusicInstrument SEEK_GOAT_HORN = getInstrument("seek_goat_horn");
public static final MusicInstrument SING_GOAT_HORN = getInstrument("sing_goat_horn");
public static final MusicInstrument SEEK_GOAT_HORN = getInstrument("seek_goat_horn");
public static final MusicInstrument FEEL_GOAT_HORN = getInstrument("feel_goat_horn");
public static final MusicInstrument ADMIRE_GOAT_HORN = getInstrument("admire_goat_horn");
public static final MusicInstrument CALL_GOAT_HORN = getInstrument("call_goat_horn");
public static final MusicInstrument YEARN_GOAT_HORN = getInstrument("yearn_goat_horn");
// End generate - MusicInstrument
public static final MusicInstrument DREAM_GOAT_HORN = getInstrument("dream_goat_horn");
/**
* Returns a {@link MusicInstrument} by a {@link NamespacedKey}.
@@ -83,14 +83,12 @@ public final class NamespacedKey implements net.kyori.adventure.key.Key, com.des
* @see #NamespacedKey(Plugin, String)
*/
public NamespacedKey(@NotNull String namespace, @NotNull String key) {
Preconditions.checkArgument(namespace != null && isValidNamespace(namespace), "Invalid namespace. Must be [a-z0-9._-]: %s", namespace);
Preconditions.checkArgument(key != null && isValidKey(key), "Invalid key. Must be [a-z0-9/._-]: %s", key);
Preconditions.checkArgument(namespace != null, "Namespace cannot be null");
Preconditions.checkArgument(key != null, "Key cannot be null");
this.namespace = namespace;
this.key = key;
String string = toString();
Preconditions.checkArgument(string.length() <= Short.MAX_VALUE, "NamespacedKey must be less than 32768 characters", string); // Paper - Fix improper length validation
this.validate();
}
/**
@@ -108,16 +106,17 @@ public final class NamespacedKey implements net.kyori.adventure.key.Key, com.des
public NamespacedKey(@NotNull Plugin plugin, @NotNull String key) {
Preconditions.checkArgument(plugin != null, "Plugin cannot be null");
Preconditions.checkArgument(key != null, "Key cannot be null");
this.namespace = plugin.getName().toLowerCase(Locale.ROOT);
this.key = key.toLowerCase(Locale.ROOT);
// Check validity after normalization
this.validate();
}
private void validate() {
Preconditions.checkArgument(this.namespace.length() + 1 + this.key.length() <= Short.MAX_VALUE, "NamespacedKey must be less than 32768 characters");
Preconditions.checkArgument(isValidNamespace(this.namespace), "Invalid namespace. Must be [a-z0-9._-]: %s", this.namespace);
Preconditions.checkArgument(isValidKey(this.key), "Invalid key. Must be [a-z0-9/._-]: %s", this.key);
String string = toString();
Preconditions.checkArgument(string.length() <= Short.MAX_VALUE, "NamespacedKey must be less than 32768 characters", string); // Paper - Fix improper length validation
}
@NotNull
@@ -3,6 +3,7 @@ package org.bukkit;
import com.google.common.base.Preconditions;
import com.google.common.base.Predicates;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Iterables;
import io.papermc.paper.datacomponent.DataComponentType;
import io.papermc.paper.registry.RegistryAccess;
import io.papermc.paper.registry.RegistryKey;
@@ -63,7 +64,7 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
@SuppressWarnings("removal")
@Deprecated(forRemoval = true, since = "1.21.4")
private static <A extends Keyed> Registry<A> legacyRegistryFor(final Class<A> clazz) {
return Objects.requireNonNull(RegistryAccess.registryAccess().getRegistry(clazz), "No registry present for " + clazz.getSimpleName() + ". This is a bug.");
return Objects.requireNonNull(RegistryAccess.registryAccess().getRegistry(clazz), () -> "No registry present for " + clazz.getSimpleName() + ". This is a bug.");
}
/**
@@ -290,15 +291,20 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
*
* @see MemoryKey
*/
Registry<MemoryKey<?>> MEMORY_MODULE_TYPE = new NotARegistry<>() {
Registry<MemoryKey> MEMORY_MODULE_TYPE = new NotARegistry<>() {
@Override
public Iterator<MemoryKey<?>> iterator() {
public Iterator iterator() {
return MemoryKey.values().iterator();
}
@Override
public @Nullable MemoryKey<?> get(final NamespacedKey key) {
public int size() {
return MemoryKey.values().size();
}
@Override
public @Nullable MemoryKey get(final NamespacedKey key) {
return MemoryKey.getByKey(key);
}
};
@@ -536,6 +542,13 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
return (namespacedKey != null) ? this.get(namespacedKey) : null;
}
/**
* Gets the size of the registry.
*
* @return the size of the registry
*/
int size();
@ApiStatus.Internal
class SimpleRegistry<T extends Enum<T> & Keyed> extends NotARegistry<T> { // Paper - remove final
@@ -564,6 +577,11 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
return this.map.get(key);
}
@Override
public int size() {
return map.size();
}
@Override
public Iterator<T> iterator() {
return this.map.values().iterator();
@@ -584,6 +602,11 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
return StreamSupport.stream(this.spliterator(), false);
}
@Override
public int size() {
return Iterables.size(this);
}
@Override
public NamespacedKey getKey(final A value) {
return value.getKey();
+42 -2
View File
@@ -422,7 +422,7 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
* @param message MiniMessage content
*/
default void sendRichMessage(final @NotNull String message) {
this.sendMessage(MiniMessage.miniMessage().deserialize(message));
this.sendMessage(MiniMessage.miniMessage().deserialize(message, this));
}
/**
@@ -435,7 +435,7 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
* @param resolvers resolvers to use
*/
default void sendRichMessage(final @NotNull String message, final @NotNull TagResolver... resolvers) {
this.sendMessage(MiniMessage.miniMessage().deserialize(message, resolvers));
this.sendMessage(MiniMessage.miniMessage().deserialize(message, this, resolvers));
}
/**
@@ -2309,24 +2309,52 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
// Spigot start
public class Spigot {
/**
* @deprecated Server config options may be renamed or removed without notice. Prefer using existing API
* wherever possible, rather than directly reading from a server config.
*
* @return The server's spigot config.
*/
@Deprecated(since = "1.21.4", forRemoval = true)
@NotNull
public org.bukkit.configuration.file.YamlConfiguration getConfig() {
throw new UnsupportedOperationException("Not supported yet.");
}
/**
* @deprecated Server config options may be renamed or removed without notice. Prefer using existing API
* wherever possible, rather than directly reading from a server config.
*
* @return The server's bukkit config.
*/
// Paper start
@Deprecated(since = "1.21.4", forRemoval = true)
@NotNull
public org.bukkit.configuration.file.YamlConfiguration getBukkitConfig()
{
throw new UnsupportedOperationException( "Not supported yet." );
}
/**
* @deprecated Server config options may be renamed or removed without notice. Prefer using existing API
* wherever possible, rather than directly reading from a server config.
*
* @return The server's spigot config.
*/
@Deprecated(since = "1.21.4", forRemoval = true)
@NotNull
public org.bukkit.configuration.file.YamlConfiguration getSpigotConfig()
{
throw new UnsupportedOperationException("Not supported yet.");
}
/**
* @deprecated Server config options may be renamed or removed without notice. Prefer using existing API
* wherever possible, rather than directly reading from a server config.
*
* @return The server's paper config.
*/
@Deprecated(since = "1.21.4", forRemoval = true)
@NotNull
public org.bukkit.configuration.file.YamlConfiguration getPaperConfig()
{
@@ -2358,16 +2386,28 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
/**
* Restart the server. If the server administrator has not configured restarting, the server will stop.
*
* @deprecated Use {@link Server#restart()} instead.
*/
@Deprecated(since = "1.21.4", forRemoval = true)
public void restart() {
throw new UnsupportedOperationException("Not supported yet.");
}
}
/**
* @deprecated All methods on this class have been deprecated, see the individual methods for replacements.
*/
@Deprecated(since = "1.21.4", forRemoval = true)
@NotNull
Spigot spigot();
// Spigot end
/**
* Restarts the server. If the server administrator has not configured restarting, the server will stop.
*/
void restart();
void reloadPermissions(); // Paper
boolean reloadCommandAliases(); // Paper
File diff suppressed because it is too large. Load diff
@@ -7,95 +7,92 @@ import org.jetbrains.annotations.NotNull;
* Represents a countable statistic, which is tracked by the server.
*/
public enum Statistic implements Keyed {
// Start generate - StatisticCustom
// @GeneratedFrom 1.21.4
ANIMALS_BRED,
AVIATE_ONE_CM,
BELL_RING,
BOAT_ONE_CM,
ARMOR_CLEANED,
BANNER_CLEANED,
CLEAN_SHULKER_BOX,
CLIMB_ONE_CM,
CROUCH_ONE_CM,
DAMAGE_ABSORBED,
DAMAGE_BLOCKED_BY_SHIELD,
DAMAGE_DEALT,
DAMAGE_DEALT_ABSORBED,
DAMAGE_DEALT_RESISTED,
DAMAGE_RESISTED,
DAMAGE_TAKEN,
DEATHS,
DROP_COUNT,
CAKE_SLICES_EATEN,
ITEM_ENCHANTED,
FALL_ONE_CM,
CAULDRON_FILLED,
FISH_CAUGHT,
FLY_ONE_CM,
HORSE_ONE_CM,
DISPENSER_INSPECTED,
DROPPER_INSPECTED,
HOPPER_INSPECTED,
INTERACT_WITH_ANVIL,
BEACON_INTERACTION,
INTERACT_WITH_BLAST_FURNACE,
BREWINGSTAND_INTERACTION,
INTERACT_WITH_CAMPFIRE,
INTERACT_WITH_CARTOGRAPHY_TABLE,
CRAFTING_TABLE_INTERACTION,
FURNACE_INTERACTION,
INTERACT_WITH_GRINDSTONE,
INTERACT_WITH_LECTERN,
INTERACT_WITH_LOOM,
INTERACT_WITH_SMITHING_TABLE,
INTERACT_WITH_SMOKER,
INTERACT_WITH_STONECUTTER,
JUMP,
LEAVE_GAME,
MINECART_ONE_CM,
MOB_KILLS,
OPEN_BARREL,
CHEST_OPENED,
ENDERCHEST_OPENED,
SHULKER_BOX_OPENED,
PIG_ONE_CM,
NOTEBLOCK_PLAYED,
RECORD_PLAYED,
PLAY_ONE_MINUTE,
PLAYER_KILLS,
FLOWER_POTTED,
RAID_TRIGGER,
RAID_WIN,
SLEEP_IN_BED,
SNEAK_TIME,
SPRINT_ONE_CM,
STRIDER_ONE_CM,
SWIM_ONE_CM,
TALKED_TO_VILLAGER,
TARGET_HIT,
TIME_SINCE_DEATH,
TIME_SINCE_REST,
FISH_CAUGHT,
ANIMALS_BRED,
LEAVE_GAME,
JUMP,
DROP_COUNT,
DROP(Type.ITEM),
PICKUP(Type.ITEM),
/**
* Name is misleading, actually records ticks played.
*/
PLAY_ONE_MINUTE,
TOTAL_WORLD_TIME,
TRADED_WITH_VILLAGER,
TRAPPED_CHEST_TRIGGERED,
NOTEBLOCK_TUNED,
CAULDRON_USED,
WALK_ON_WATER_ONE_CM,
WALK_ONE_CM,
WALK_ON_WATER_ONE_CM,
FALL_ONE_CM,
SNEAK_TIME,
CLIMB_ONE_CM,
FLY_ONE_CM,
WALK_UNDER_WATER_ONE_CM,
// End generate - StatisticCustom
// Start generate - StatisticType
// @GeneratedFrom 1.21.4
MINECART_ONE_CM,
BOAT_ONE_CM,
PIG_ONE_CM,
HORSE_ONE_CM,
SPRINT_ONE_CM,
CROUCH_ONE_CM,
AVIATE_ONE_CM,
MINE_BLOCK(Type.BLOCK),
USE_ITEM(Type.ITEM),
BREAK_ITEM(Type.ITEM),
CRAFT_ITEM(Type.ITEM),
DROP(Type.ITEM),
KILL_ENTITY(Type.ENTITY),
ENTITY_KILLED_BY(Type.ENTITY),
MINE_BLOCK(Type.BLOCK),
PICKUP(Type.ITEM),
USE_ITEM(Type.ITEM);
// End generate - StatisticType
TIME_SINCE_DEATH,
TALKED_TO_VILLAGER,
TRADED_WITH_VILLAGER,
CAKE_SLICES_EATEN,
CAULDRON_FILLED,
CAULDRON_USED,
ARMOR_CLEANED,
BANNER_CLEANED,
BREWINGSTAND_INTERACTION,
BEACON_INTERACTION,
DROPPER_INSPECTED,
HOPPER_INSPECTED,
DISPENSER_INSPECTED,
NOTEBLOCK_PLAYED,
NOTEBLOCK_TUNED,
FLOWER_POTTED,
TRAPPED_CHEST_TRIGGERED,
ENDERCHEST_OPENED,
ITEM_ENCHANTED,
RECORD_PLAYED,
FURNACE_INTERACTION,
CRAFTING_TABLE_INTERACTION,
CHEST_OPENED,
SLEEP_IN_BED,
SHULKER_BOX_OPENED,
TIME_SINCE_REST,
SWIM_ONE_CM,
DAMAGE_DEALT_ABSORBED,
DAMAGE_DEALT_RESISTED,
DAMAGE_BLOCKED_BY_SHIELD,
DAMAGE_ABSORBED,
DAMAGE_RESISTED,
CLEAN_SHULKER_BOX,
OPEN_BARREL,
INTERACT_WITH_BLAST_FURNACE,
INTERACT_WITH_SMOKER,
INTERACT_WITH_LECTERN,
INTERACT_WITH_CAMPFIRE,
INTERACT_WITH_CARTOGRAPHY_TABLE,
INTERACT_WITH_LOOM,
INTERACT_WITH_STONECUTTER,
BELL_RING,
RAID_TRIGGER,
RAID_WIN,
INTERACT_WITH_ANVIL,
INTERACT_WITH_GRINDSTONE,
TARGET_HIT,
INTERACT_WITH_SMITHING_TABLE,
STRIDER_ONE_CM;
private final Type type;
private final NamespacedKey key;
File diff suppressed because it is too large. Load diff
@@ -17,72 +17,134 @@ import org.jetbrains.annotations.NotNull;
*/
public interface Attribute extends OldEnum<Attribute>, Keyed, Translatable, net.kyori.adventure.translation.Translatable { // Paper - Adventure translations
// Start generate - Attribute
// @GeneratedFrom 1.21.4
Attribute ARMOR = getAttribute("armor");
Attribute ARMOR_TOUGHNESS = getAttribute("armor_toughness");
Attribute ATTACK_DAMAGE = getAttribute("attack_damage");
Attribute ATTACK_KNOCKBACK = getAttribute("attack_knockback");
Attribute ATTACK_SPEED = getAttribute("attack_speed");
Attribute BLOCK_BREAK_SPEED = getAttribute("block_break_speed");
Attribute BLOCK_INTERACTION_RANGE = getAttribute("block_interaction_range");
Attribute BURNING_TIME = getAttribute("burning_time");
Attribute ENTITY_INTERACTION_RANGE = getAttribute("entity_interaction_range");
Attribute EXPLOSION_KNOCKBACK_RESISTANCE = getAttribute("explosion_knockback_resistance");
Attribute FALL_DAMAGE_MULTIPLIER = getAttribute("fall_damage_multiplier");
Attribute FLYING_SPEED = getAttribute("flying_speed");
Attribute FOLLOW_RANGE = getAttribute("follow_range");
Attribute GRAVITY = getAttribute("gravity");
Attribute JUMP_STRENGTH = getAttribute("jump_strength");
Attribute KNOCKBACK_RESISTANCE = getAttribute("knockback_resistance");
Attribute LUCK = getAttribute("luck");
Attribute MAX_ABSORPTION = getAttribute("max_absorption");
/**
* Maximum health of an Entity.
*/
Attribute MAX_HEALTH = getAttribute("max_health");
Attribute MINING_EFFICIENCY = getAttribute("mining_efficiency");
Attribute MOVEMENT_EFFICIENCY = getAttribute("movement_efficiency");
/**
* Range at which an Entity will follow others.
*/
Attribute FOLLOW_RANGE = getAttribute("follow_range");
/**
* Resistance of an Entity to knockback.
*/
Attribute KNOCKBACK_RESISTANCE = getAttribute("knockback_resistance");
/**
* Movement speed of an Entity.
*/
Attribute MOVEMENT_SPEED = getAttribute("movement_speed");
Attribute OXYGEN_BONUS = getAttribute("oxygen_bonus");
/**
* Flying speed of an Entity.
*/
Attribute FLYING_SPEED = getAttribute("flying_speed");
/**
* Attack damage of an Entity.
*/
Attribute ATTACK_DAMAGE = getAttribute("attack_damage");
/**
* Attack knockback of an Entity.
*/
Attribute ATTACK_KNOCKBACK = getAttribute("attack_knockback");
/**
* Attack speed of an Entity.
*/
Attribute ATTACK_SPEED = getAttribute("attack_speed");
/**
* Armor bonus of an Entity.
*/
Attribute ARMOR = getAttribute("armor");
/**
* Armor durability bonus of an Entity.
*/
Attribute ARMOR_TOUGHNESS = getAttribute("armor_toughness");
/**
* The fall damage multiplier of an Entity.
*/
Attribute FALL_DAMAGE_MULTIPLIER = getAttribute("fall_damage_multiplier");
/**
* Luck bonus of an Entity.
*/
Attribute LUCK = getAttribute("luck");
/**
* Maximum absorption of an Entity.
*/
Attribute MAX_ABSORPTION = getAttribute("max_absorption");
/**
* The distance which an Entity can fall without damage.
*/
Attribute SAFE_FALL_DISTANCE = getAttribute("safe_fall_distance");
/**
* The relative scale of an Entity.
*/
Attribute SCALE = getAttribute("scale");
Attribute SNEAKING_SPEED = getAttribute("sneaking_speed");
Attribute SPAWN_REINFORCEMENTS = getAttribute("spawn_reinforcements");
/**
* The height which an Entity can walk over.
*/
Attribute STEP_HEIGHT = getAttribute("step_height");
Attribute SUBMERGED_MINING_SPEED = getAttribute("submerged_mining_speed");
Attribute SWEEPING_DAMAGE_RATIO = getAttribute("sweeping_damage_ratio");
Attribute TEMPT_RANGE = getAttribute("tempt_range");
/**
* The gravity applied to an Entity.
*/
Attribute GRAVITY = getAttribute("gravity");
/**
* Strength with which an Entity will jump.
*/
Attribute JUMP_STRENGTH = getAttribute("jump_strength");
/**
* How long an entity remains burning after ignition.
*/
Attribute BURNING_TIME = getAttribute("burning_time");
/**
* Resistance to knockback from explosions.
*/
Attribute EXPLOSION_KNOCKBACK_RESISTANCE = getAttribute("explosion_knockback_resistance");
/**
* Movement speed through difficult terrain.
*/
Attribute MOVEMENT_EFFICIENCY = getAttribute("movement_efficiency");
/**
* Oxygen use underwater.
*/
Attribute OXYGEN_BONUS = getAttribute("oxygen_bonus");
/**
* Movement speed through water.
*/
Attribute WATER_MOVEMENT_EFFICIENCY = getAttribute("water_movement_efficiency");
// End generate - Attribute
/**
* Range at which mobs will be tempted by items.
*/
Attribute TEMPT_RANGE = getAttribute("tempt_range");
/**
* The block reach distance of a Player.
*/
Attribute BLOCK_INTERACTION_RANGE = getAttribute("block_interaction_range");
/**
* The entity reach distance of a Player.
*/
Attribute ENTITY_INTERACTION_RANGE = getAttribute("entity_interaction_range");
/**
* Block break speed of a Player.
*/
Attribute BLOCK_BREAK_SPEED = getAttribute("block_break_speed");
/**
* Mining speed for correct tools.
*/
Attribute MINING_EFFICIENCY = getAttribute("mining_efficiency");
/**
* Sneaking speed.
*/
Attribute SNEAKING_SPEED = getAttribute("sneaking_speed");
/**
* Underwater mining speed.
*/
Attribute SUBMERGED_MINING_SPEED = getAttribute("submerged_mining_speed");
/**
* Sweeping damage.
*/
Attribute SWEEPING_DAMAGE_RATIO = getAttribute("sweeping_damage_ratio");
/**
* Chance of a zombie to spawn reinforcements.
*/
Attribute SPAWN_REINFORCEMENTS = getAttribute("spawn_reinforcements");
@NotNull
private static Attribute getAttribute(@NotNull String key) {
@@ -23,138 +23,71 @@ import org.jetbrains.annotations.NotNull;
*/
public interface Biome extends OldEnum<Biome>, Keyed, net.kyori.adventure.translation.Translatable { // Paper - Adventure translations
// Start generate - Biome
// @GeneratedFrom 1.21.4
Biome BADLANDS = getBiome("badlands");
Biome BAMBOO_JUNGLE = getBiome("bamboo_jungle");
Biome BASALT_DELTAS = getBiome("basalt_deltas");
Biome BEACH = getBiome("beach");
Biome BIRCH_FOREST = getBiome("birch_forest");
Biome CHERRY_GROVE = getBiome("cherry_grove");
Biome COLD_OCEAN = getBiome("cold_ocean");
Biome CRIMSON_FOREST = getBiome("crimson_forest");
Biome DARK_FOREST = getBiome("dark_forest");
Biome DEEP_COLD_OCEAN = getBiome("deep_cold_ocean");
Biome DEEP_DARK = getBiome("deep_dark");
Biome DEEP_FROZEN_OCEAN = getBiome("deep_frozen_ocean");
Biome DEEP_LUKEWARM_OCEAN = getBiome("deep_lukewarm_ocean");
Biome DEEP_OCEAN = getBiome("deep_ocean");
Biome DESERT = getBiome("desert");
Biome DRIPSTONE_CAVES = getBiome("dripstone_caves");
Biome END_BARRENS = getBiome("end_barrens");
Biome END_HIGHLANDS = getBiome("end_highlands");
Biome END_MIDLANDS = getBiome("end_midlands");
Biome ERODED_BADLANDS = getBiome("eroded_badlands");
Biome FLOWER_FOREST = getBiome("flower_forest");
Biome FOREST = getBiome("forest");
Biome FROZEN_OCEAN = getBiome("frozen_ocean");
Biome FROZEN_PEAKS = getBiome("frozen_peaks");
Biome FROZEN_RIVER = getBiome("frozen_river");
Biome GROVE = getBiome("grove");
Biome ICE_SPIKES = getBiome("ice_spikes");
Biome JAGGED_PEAKS = getBiome("jagged_peaks");
Biome JUNGLE = getBiome("jungle");
Biome LUKEWARM_OCEAN = getBiome("lukewarm_ocean");
Biome LUSH_CAVES = getBiome("lush_caves");
Biome MANGROVE_SWAMP = getBiome("mangrove_swamp");
Biome MEADOW = getBiome("meadow");
Biome MUSHROOM_FIELDS = getBiome("mushroom_fields");
Biome NETHER_WASTES = getBiome("nether_wastes");
Biome OCEAN = getBiome("ocean");
Biome OLD_GROWTH_BIRCH_FOREST = getBiome("old_growth_birch_forest");
Biome OLD_GROWTH_PINE_TAIGA = getBiome("old_growth_pine_taiga");
Biome OLD_GROWTH_SPRUCE_TAIGA = getBiome("old_growth_spruce_taiga");
Biome PALE_GARDEN = getBiome("pale_garden");
Biome PLAINS = getBiome("plains");
Biome RIVER = getBiome("river");
Biome SAVANNA = getBiome("savanna");
Biome SAVANNA_PLATEAU = getBiome("savanna_plateau");
Biome SMALL_END_ISLANDS = getBiome("small_end_islands");
Biome SNOWY_BEACH = getBiome("snowy_beach");
Biome SNOWY_PLAINS = getBiome("snowy_plains");
Biome SNOWY_SLOPES = getBiome("snowy_slopes");
Biome SNOWY_TAIGA = getBiome("snowy_taiga");
Biome SOUL_SAND_VALLEY = getBiome("soul_sand_valley");
Biome SPARSE_JUNGLE = getBiome("sparse_jungle");
Biome STONY_PEAKS = getBiome("stony_peaks");
Biome STONY_SHORE = getBiome("stony_shore");
Biome SUNFLOWER_PLAINS = getBiome("sunflower_plains");
Biome SWAMP = getBiome("swamp");
Biome TAIGA = getBiome("taiga");
Biome THE_END = getBiome("the_end");
Biome THE_VOID = getBiome("the_void");
Biome WARM_OCEAN = getBiome("warm_ocean");
Biome WARPED_FOREST = getBiome("warped_forest");
Biome WINDSWEPT_FOREST = getBiome("windswept_forest");
Biome WINDSWEPT_GRAVELLY_HILLS = getBiome("windswept_gravelly_hills");
Biome DESERT = getBiome("desert");
Biome WINDSWEPT_HILLS = getBiome("windswept_hills");
Biome WINDSWEPT_SAVANNA = getBiome("windswept_savanna");
Biome FOREST = getBiome("forest");
Biome TAIGA = getBiome("taiga");
Biome SWAMP = getBiome("swamp");
Biome MANGROVE_SWAMP = getBiome("mangrove_swamp");
Biome RIVER = getBiome("river");
Biome NETHER_WASTES = getBiome("nether_wastes");
Biome THE_END = getBiome("the_end");
Biome FROZEN_OCEAN = getBiome("frozen_ocean");
Biome FROZEN_RIVER = getBiome("frozen_river");
Biome SNOWY_PLAINS = getBiome("snowy_plains");
Biome MUSHROOM_FIELDS = getBiome("mushroom_fields");
Biome BEACH = getBiome("beach");
Biome JUNGLE = getBiome("jungle");
Biome SPARSE_JUNGLE = getBiome("sparse_jungle");
Biome DEEP_OCEAN = getBiome("deep_ocean");
Biome STONY_SHORE = getBiome("stony_shore");
Biome SNOWY_BEACH = getBiome("snowy_beach");
Biome BIRCH_FOREST = getBiome("birch_forest");
Biome DARK_FOREST = getBiome("dark_forest");
Biome PALE_GARDEN = getBiome("pale_garden");
Biome SNOWY_TAIGA = getBiome("snowy_taiga");
Biome OLD_GROWTH_PINE_TAIGA = getBiome("old_growth_pine_taiga");
Biome WINDSWEPT_FOREST = getBiome("windswept_forest");
Biome SAVANNA = getBiome("savanna");
Biome SAVANNA_PLATEAU = getBiome("savanna_plateau");
Biome BADLANDS = getBiome("badlands");
Biome WOODED_BADLANDS = getBiome("wooded_badlands");
// End generate - Biome
Biome SMALL_END_ISLANDS = getBiome("small_end_islands");
Biome END_MIDLANDS = getBiome("end_midlands");
Biome END_HIGHLANDS = getBiome("end_highlands");
Biome END_BARRENS = getBiome("end_barrens");
Biome WARM_OCEAN = getBiome("warm_ocean");
Biome LUKEWARM_OCEAN = getBiome("lukewarm_ocean");
Biome COLD_OCEAN = getBiome("cold_ocean");
Biome DEEP_LUKEWARM_OCEAN = getBiome("deep_lukewarm_ocean");
Biome DEEP_COLD_OCEAN = getBiome("deep_cold_ocean");
Biome DEEP_FROZEN_OCEAN = getBiome("deep_frozen_ocean");
Biome THE_VOID = getBiome("the_void");
Biome SUNFLOWER_PLAINS = getBiome("sunflower_plains");
Biome WINDSWEPT_GRAVELLY_HILLS = getBiome("windswept_gravelly_hills");
Biome FLOWER_FOREST = getBiome("flower_forest");
Biome ICE_SPIKES = getBiome("ice_spikes");
Biome OLD_GROWTH_BIRCH_FOREST = getBiome("old_growth_birch_forest");
Biome OLD_GROWTH_SPRUCE_TAIGA = getBiome("old_growth_spruce_taiga");
Biome WINDSWEPT_SAVANNA = getBiome("windswept_savanna");
Biome ERODED_BADLANDS = getBiome("eroded_badlands");
Biome BAMBOO_JUNGLE = getBiome("bamboo_jungle");
Biome SOUL_SAND_VALLEY = getBiome("soul_sand_valley");
Biome CRIMSON_FOREST = getBiome("crimson_forest");
Biome WARPED_FOREST = getBiome("warped_forest");
Biome BASALT_DELTAS = getBiome("basalt_deltas");
Biome DRIPSTONE_CAVES = getBiome("dripstone_caves");
Biome LUSH_CAVES = getBiome("lush_caves");
Biome DEEP_DARK = getBiome("deep_dark");
Biome MEADOW = getBiome("meadow");
Biome GROVE = getBiome("grove");
Biome SNOWY_SLOPES = getBiome("snowy_slopes");
Biome FROZEN_PEAKS = getBiome("frozen_peaks");
Biome JAGGED_PEAKS = getBiome("jagged_peaks");
Biome STONY_PEAKS = getBiome("stony_peaks");
Biome CHERRY_GROVE = getBiome("cherry_grove");
/**
* Represents a custom Biome
File diff suppressed because it is too large. Load diff
@@ -1,20 +0,0 @@
package org.bukkit.block;
/**
* Represents the face and the direction of a block
*/
public enum Orientation {
DOWN_EAST,
DOWN_NORTH,
DOWN_SOUTH,
DOWN_WEST,
UP_EAST,
UP_NORTH,
UP_SOUTH,
UP_WEST,
WEST_UP,
EAST_UP,
NORTH_UP,
SOUTH_UP
}
@@ -82,6 +82,8 @@ public interface Skull extends TileState {
* may appear as the texture depending on skull type.
*
* @return the profile of the owning player
*
* @deprecated Use {@link #getPlayerProfile()} instead.
*/
@Nullable
@Deprecated // Paper
@@ -98,6 +100,8 @@ public interface Skull extends TileState {
* @param profile the profile of the owning player
* @throws IllegalArgumentException if the profile does not contain the
* necessary information
*
* @deprecated Use {@link #setPlayerProfile(com.destroystokyo.paper.profile.PlayerProfile)} instead.
*/
@Deprecated // Paper
void setOwnerProfile(@Nullable PlayerProfile profile);
@@ -14,95 +14,49 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public interface PatternType extends OldEnum<PatternType>, Keyed {
// Start generate - PatternType
// @GeneratedFrom 1.21.4
PatternType BASE = getType("base");
PatternType BORDER = getType("border");
PatternType BRICKS = getType("bricks");
PatternType CIRCLE = getType("circle");
PatternType CREEPER = getType("creeper");
PatternType CROSS = getType("cross");
PatternType CURLY_BORDER = getType("curly_border");
PatternType DIAGONAL_LEFT = getType("diagonal_left");
PatternType DIAGONAL_RIGHT = getType("diagonal_right");
PatternType DIAGONAL_UP_LEFT = getType("diagonal_up_left");
PatternType DIAGONAL_UP_RIGHT = getType("diagonal_up_right");
PatternType FLOW = getType("flow");
PatternType FLOWER = getType("flower");
PatternType GLOBE = getType("globe");
PatternType GRADIENT = getType("gradient");
PatternType GRADIENT_UP = getType("gradient_up");
PatternType GUSTER = getType("guster");
PatternType HALF_HORIZONTAL = getType("half_horizontal");
PatternType HALF_HORIZONTAL_BOTTOM = getType("half_horizontal_bottom");
PatternType HALF_VERTICAL = getType("half_vertical");
PatternType HALF_VERTICAL_RIGHT = getType("half_vertical_right");
PatternType MOJANG = getType("mojang");
PatternType PIGLIN = getType("piglin");
PatternType RHOMBUS = getType("rhombus");
PatternType SKULL = getType("skull");
PatternType SMALL_STRIPES = getType("small_stripes");
PatternType SQUARE_BOTTOM_LEFT = getType("square_bottom_left");
PatternType SQUARE_BOTTOM_RIGHT = getType("square_bottom_right");
PatternType SQUARE_TOP_LEFT = getType("square_top_left");
PatternType SQUARE_TOP_RIGHT = getType("square_top_right");
PatternType STRAIGHT_CROSS = getType("straight_cross");
PatternType STRIPE_BOTTOM = getType("stripe_bottom");
PatternType STRIPE_CENTER = getType("stripe_center");
PatternType STRIPE_DOWNLEFT = getType("stripe_downleft");
PatternType STRIPE_DOWNRIGHT = getType("stripe_downright");
PatternType STRIPE_LEFT = getType("stripe_left");
PatternType STRIPE_MIDDLE = getType("stripe_middle");
PatternType STRIPE_RIGHT = getType("stripe_right");
PatternType STRIPE_TOP = getType("stripe_top");
PatternType STRIPE_LEFT = getType("stripe_left");
PatternType STRIPE_RIGHT = getType("stripe_right");
PatternType STRIPE_CENTER = getType("stripe_center");
PatternType STRIPE_MIDDLE = getType("stripe_middle");
PatternType STRIPE_DOWNRIGHT = getType("stripe_downright");
PatternType STRIPE_DOWNLEFT = getType("stripe_downleft");
PatternType SMALL_STRIPES = getType("small_stripes");
PatternType CROSS = getType("cross");
PatternType STRAIGHT_CROSS = getType("straight_cross");
PatternType TRIANGLE_BOTTOM = getType("triangle_bottom");
PatternType TRIANGLE_TOP = getType("triangle_top");
PatternType TRIANGLES_BOTTOM = getType("triangles_bottom");
PatternType TRIANGLES_TOP = getType("triangles_top");
// End generate - PatternType
PatternType DIAGONAL_LEFT = getType("diagonal_left");
PatternType DIAGONAL_UP_RIGHT = getType("diagonal_up_right");
PatternType DIAGONAL_UP_LEFT = getType("diagonal_up_left");
PatternType DIAGONAL_RIGHT = getType("diagonal_right");
PatternType CIRCLE = getType("circle");
PatternType RHOMBUS = getType("rhombus");
PatternType HALF_VERTICAL = getType("half_vertical");
PatternType HALF_HORIZONTAL = getType("half_horizontal");
PatternType HALF_VERTICAL_RIGHT = getType("half_vertical_right");
PatternType HALF_HORIZONTAL_BOTTOM = getType("half_horizontal_bottom");
PatternType BORDER = getType("border");
PatternType CURLY_BORDER = getType("curly_border");
PatternType CREEPER = getType("creeper");
PatternType GRADIENT = getType("gradient");
PatternType GRADIENT_UP = getType("gradient_up");
PatternType BRICKS = getType("bricks");
PatternType SKULL = getType("skull");
PatternType FLOWER = getType("flower");
PatternType MOJANG = getType("mojang");
PatternType GLOBE = getType("globe");
PatternType PIGLIN = getType("piglin");
PatternType FLOW = getType("flow");
PatternType GUSTER = getType("guster");
// Paper start - deprecate getKey
/**
@@ -11,19 +11,8 @@ public interface CaveVinesPlant extends BlockData {
* Gets the value of the 'berries' property.
*
* @return the 'berries' value
* @deprecated bad name, use {@link #hasBerries()}
*/
@Deprecated
default boolean isBerries() {
return this.hasBerries();
}
/**
* Gets the value of the 'berries' property.
*
* @return the 'berries' value
*/
boolean hasBerries();
boolean isBerries();
/**
* Sets the value of the 'berries' property.
@@ -48,23 +48,18 @@ public interface Crafter extends BlockData {
* @return the 'orientation' value
*/
@NotNull
org.bukkit.block.Orientation getOrientation();
Orientation getOrientation();
/**
* Sets the value of the 'orientation' property.
*
* @param orientation the new 'orientation' value
*/
void setOrientation(@NotNull org.bukkit.block.Orientation orientation);
void setOrientation(@NotNull Orientation orientation);
/**
* The directions the Crafter can be oriented.
*
* @deprecated this property is not specific to the Crafter, use
* {@link org.bukkit.block.Orientation} instead. All references
* to this enum will be redirected to that enum at runtime.
*/
@Deprecated
public enum Orientation {
DOWN_EAST,
@@ -4,18 +4,17 @@ import org.bukkit.block.data.Directional;
import org.bukkit.block.data.Waterlogged;
public interface DecoratedPot extends Directional, Waterlogged {
// Paper start - add missing block data api
/**
* @return whether the pot is cracked
*/
public boolean isCracked();
/**
* Gets the value of the 'cracked' property.
* Set whether the pot is cracked.
*
* @return the 'cracked' value
* @param cracked whether the pot is cracked
*/
boolean isCracked();
/**
* Sets the value of the 'cracked' property.
*
* @param cracked the new 'cracked' value
*/
void setCracked(boolean cracked);
public void setCracked(boolean cracked);
// Paper end - add missing block data api
}
@@ -14,23 +14,18 @@ public interface Jigsaw extends BlockData {
* @return the 'orientation' value
*/
@NotNull
org.bukkit.block.Orientation getOrientation();
Orientation getOrientation();
/**
* Sets the value of the 'orientation' property.
*
* @param orientation the new 'orientation' value
*/
void setOrientation(@NotNull org.bukkit.block.Orientation orientation);
void setOrientation(@NotNull Orientation orientation);
/**
* The directions the Jigsaw can be oriented.
*
* @deprecated this property is not specific to the Jigsaw, use
* {@link org.bukkit.block.Orientation} instead. All references
* to this enum will be redirected to that enum at runtime.
*/
@Deprecated
public enum Orientation {
DOWN_EAST,
@@ -14,11 +14,4 @@ public interface Jukebox extends BlockData {
* @return the 'has_record' value
*/
boolean hasRecord();
/**
* Sets the value of the 'has_record' property.
*
* @param hasRecord the new 'has_record' value
*/
void setHasRecord(boolean hasRecord);
}
@@ -15,11 +15,4 @@ public interface Lectern extends Directional, Powerable {
* @return the 'has_book' value
*/
boolean hasBook();
/**
* Sets the value of the 'has_book' property.
*
* @param hasBook the new 'has_book' value
*/
void setHasBook(boolean hasBook);
}
@@ -33,7 +33,7 @@ public interface MossyCarpet extends BlockData {
* @return if face is enabled
*/
@NotNull
Wall.Height getHeight(@NotNull BlockFace face);
Height getHeight(@NotNull BlockFace face);
/**
* Set the height of the specified face.
@@ -41,16 +41,11 @@ public interface MossyCarpet extends BlockData {
* @param face to set
* @param height the height
*/
void setHeight(@NotNull BlockFace face, @NotNull Wall.Height height);
void setHeight(@NotNull BlockFace face, @NotNull Height height);
/**
* The different heights a face may have.
*
* @deprecated this property is not specific to the MossyCarpet, use
* {@link org.bukkit.block.data.type.Wall.Height} instead. All references
* to this enum will be redirected to that enum at runtime.
*/
@Deprecated
public enum Height {
/**
* Not present.
@@ -13,39 +13,16 @@ public interface SculkSensor extends AnaloguePowerable, Waterlogged {
* Gets the value of the 'sculk_sensor_phase' property.
*
* @return the 'sculk_sensor_phase' value
* @deprecated bad name, use {@link #getSculkSensorPhase()}
*/
@NotNull
@Deprecated
default Phase getPhase() {
return this.getSculkSensorPhase();
}
/**
* Sets the value of the 'sculk_sensor_phase' property.
*
* @param phase the new 'sculk_sensor_phase' value
* @deprecated bad name, use {@link #setSculkSensorPhase(Phase)}
*/
@Deprecated
default void setPhase(@NotNull Phase phase) {
this.setSculkSensorPhase(phase);
}
/**
* Gets the value of the 'sculk_sensor_phase' property.
*
* @return the 'sculk_sensor_phase' value
*/
@NotNull
Phase getSculkSensorPhase();
Phase getPhase();
/**
* Sets the value of the 'sculk_sensor_phase' property.
*
* @param phase the new 'sculk_sensor_phase' value
*/
void setSculkSensorPhase(@NotNull Phase phase);
void setPhase(@NotNull Phase phase);
/**
* The Phase of the sensor.
@@ -7,11 +7,6 @@ import org.jetbrains.annotations.NotNull;
public interface Switch extends Directional, FaceAttachable, Powerable {
@NotNull
AttachedFace getAttachedFace();
void setAttachedFace(@NotNull AttachedFace face);
/**
* Gets the value of the 'face' property.
*
@@ -20,9 +15,7 @@ public interface Switch extends Directional, FaceAttachable, Powerable {
*/
@NotNull
@Deprecated(since = "1.15.2")
default Face getFace() {
return Face.valueOf(this.getAttachedFace().name());
}
Face getFace();
/**
* Sets the value of the 'face' property.
@@ -31,9 +24,7 @@ public interface Switch extends Directional, FaceAttachable, Powerable {
* @deprecated use {@link #setAttachedFace(AttachedFace)}
*/
@Deprecated(since = "1.15.2")
default void setFace(@NotNull Face face) {
this.setAttachedFace(AttachedFace.valueOf(face.name()));
}
void setFace(@NotNull Face face);
/**
* The face to which a switch type block is stuck.
@@ -26,9 +26,7 @@ public interface Vault extends Directional {
*/
@Deprecated(since = "1.21.3", forRemoval = true)
@NotNull
default State getTrialSpawnerState() {
return this.getVaultState();
}
State getTrialSpawnerState();
/**
* Sets the value of the 'vault_state' property.
@@ -44,9 +42,7 @@ public interface Vault extends Directional {
* @deprecated see {@link #setVaultState(State)}
*/
@Deprecated(since = "1.21.3", forRemoval = true)
default void setTrialSpawnerState(@NotNull State state) {
this.setVaultState(state);
}
void setTrialSpawnerState(@NotNull State state);
/**
* Gets the value of the 'ominous' property.
@@ -147,7 +147,7 @@ public interface CommandSender extends net.kyori.adventure.audience.Audience, Pe
* @param message MiniMessage content
*/
default void sendRichMessage(final @NotNull String message) {
this.sendMessage(net.kyori.adventure.text.minimessage.MiniMessage.miniMessage().deserialize(message));
this.sendMessage(net.kyori.adventure.text.minimessage.MiniMessage.miniMessage().deserialize(message, this));
}
/**
@@ -160,7 +160,7 @@ public interface CommandSender extends net.kyori.adventure.audience.Audience, Pe
* @param resolvers resolvers to use
*/
default void sendRichMessage(final @NotNull String message, final net.kyori.adventure.text.minimessage.tag.resolver.@NotNull TagResolver... resolvers) {
this.sendMessage(net.kyori.adventure.text.minimessage.MiniMessage.miniMessage().deserialize(message, resolvers));
this.sendMessage(net.kyori.adventure.text.minimessage.MiniMessage.miniMessage().deserialize(message, this, resolvers));
}
/**
@@ -21,106 +21,55 @@ import org.jetbrains.annotations.NotNull;
@ApiStatus.Experimental
public interface DamageType extends Keyed, Translatable {
// Start generate - DamageType
// @GeneratedFrom 1.21.4
DamageType ARROW = getDamageType("arrow");
DamageType BAD_RESPAWN_POINT = getDamageType("bad_respawn_point");
DamageType CACTUS = getDamageType("cactus");
DamageType CAMPFIRE = getDamageType("campfire");
DamageType CRAMMING = getDamageType("cramming");
DamageType DRAGON_BREATH = getDamageType("dragon_breath");
DamageType DROWN = getDamageType("drown");
DamageType DRY_OUT = getDamageType("dry_out");
DamageType ENDER_PEARL = getDamageType("ender_pearl");
DamageType EXPLOSION = getDamageType("explosion");
DamageType FALL = getDamageType("fall");
DamageType FALLING_ANVIL = getDamageType("falling_anvil");
DamageType FALLING_BLOCK = getDamageType("falling_block");
DamageType FALLING_STALACTITE = getDamageType("falling_stalactite");
DamageType FIREBALL = getDamageType("fireball");
DamageType FIREWORKS = getDamageType("fireworks");
DamageType FLY_INTO_WALL = getDamageType("fly_into_wall");
DamageType FREEZE = getDamageType("freeze");
DamageType GENERIC = getDamageType("generic");
DamageType GENERIC_KILL = getDamageType("generic_kill");
DamageType HOT_FLOOR = getDamageType("hot_floor");
DamageType IN_FIRE = getDamageType("in_fire");
DamageType IN_WALL = getDamageType("in_wall");
DamageType INDIRECT_MAGIC = getDamageType("indirect_magic");
DamageType LAVA = getDamageType("lava");
DamageType LIGHTNING_BOLT = getDamageType("lightning_bolt");
DamageType MACE_SMASH = getDamageType("mace_smash");
DamageType MAGIC = getDamageType("magic");
DamageType MOB_ATTACK = getDamageType("mob_attack");
DamageType MOB_ATTACK_NO_AGGRO = getDamageType("mob_attack_no_aggro");
DamageType MOB_PROJECTILE = getDamageType("mob_projectile");
DamageType ON_FIRE = getDamageType("on_fire");
DamageType OUT_OF_WORLD = getDamageType("out_of_world");
DamageType OUTSIDE_BORDER = getDamageType("outside_border");
DamageType PLAYER_ATTACK = getDamageType("player_attack");
DamageType PLAYER_EXPLOSION = getDamageType("player_explosion");
DamageType SONIC_BOOM = getDamageType("sonic_boom");
DamageType SPIT = getDamageType("spit");
DamageType STALAGMITE = getDamageType("stalagmite");
DamageType STARVE = getDamageType("starve");
DamageType STING = getDamageType("sting");
DamageType SWEET_BERRY_BUSH = getDamageType("sweet_berry_bush");
DamageType THORNS = getDamageType("thorns");
DamageType THROWN = getDamageType("thrown");
DamageType TRIDENT = getDamageType("trident");
DamageType UNATTRIBUTED_FIREBALL = getDamageType("unattributed_fireball");
DamageType WIND_CHARGE = getDamageType("wind_charge");
DamageType WITHER = getDamageType("wither");
DamageType WITHER_SKULL = getDamageType("wither_skull");
// End generate - DamageType
public static final DamageType IN_FIRE = getDamageType("in_fire");
public static final DamageType CAMPFIRE = getDamageType("campfire");
public static final DamageType LIGHTNING_BOLT = getDamageType("lightning_bolt");
public static final DamageType ON_FIRE = getDamageType("on_fire");
public static final DamageType LAVA = getDamageType("lava");
public static final DamageType HOT_FLOOR = getDamageType("hot_floor");
public static final DamageType IN_WALL = getDamageType("in_wall");
public static final DamageType CRAMMING = getDamageType("cramming");
public static final DamageType DROWN = getDamageType("drown");
public static final DamageType STARVE = getDamageType("starve");
public static final DamageType CACTUS = getDamageType("cactus");
public static final DamageType FALL = getDamageType("fall");
public static final DamageType ENDER_PEARL = getDamageType("ender_pearl");
public static final DamageType FLY_INTO_WALL = getDamageType("fly_into_wall");
public static final DamageType OUT_OF_WORLD = getDamageType("out_of_world");
public static final DamageType GENERIC = getDamageType("generic");
public static final DamageType MAGIC = getDamageType("magic");
public static final DamageType WITHER = getDamageType("wither");
public static final DamageType DRAGON_BREATH = getDamageType("dragon_breath");
public static final DamageType DRY_OUT = getDamageType("dry_out");
public static final DamageType SWEET_BERRY_BUSH = getDamageType("sweet_berry_bush");
public static final DamageType FREEZE = getDamageType("freeze");
public static final DamageType STALAGMITE = getDamageType("stalagmite");
public static final DamageType FALLING_BLOCK = getDamageType("falling_block");
public static final DamageType FALLING_ANVIL = getDamageType("falling_anvil");
public static final DamageType FALLING_STALACTITE = getDamageType("falling_stalactite");
public static final DamageType STING = getDamageType("sting");
public static final DamageType MOB_ATTACK = getDamageType("mob_attack");
public static final DamageType MOB_ATTACK_NO_AGGRO = getDamageType("mob_attack_no_aggro");
public static final DamageType PLAYER_ATTACK = getDamageType("player_attack");
public static final DamageType ARROW = getDamageType("arrow");
public static final DamageType TRIDENT = getDamageType("trident");
public static final DamageType MOB_PROJECTILE = getDamageType("mob_projectile");
public static final DamageType SPIT = getDamageType("spit");
public static final DamageType FIREWORKS = getDamageType("fireworks");
public static final DamageType FIREBALL = getDamageType("fireball");
public static final DamageType UNATTRIBUTED_FIREBALL = getDamageType("unattributed_fireball");
public static final DamageType WITHER_SKULL = getDamageType("wither_skull");
public static final DamageType THROWN = getDamageType("thrown");
public static final DamageType INDIRECT_MAGIC = getDamageType("indirect_magic");
public static final DamageType THORNS = getDamageType("thorns");
public static final DamageType EXPLOSION = getDamageType("explosion");
public static final DamageType PLAYER_EXPLOSION = getDamageType("player_explosion");
public static final DamageType SONIC_BOOM = getDamageType("sonic_boom");
public static final DamageType BAD_RESPAWN_POINT = getDamageType("bad_respawn_point");
public static final DamageType OUTSIDE_BORDER = getDamageType("outside_border");
public static final DamageType GENERIC_KILL = getDamageType("generic_kill");
public static final DamageType WIND_CHARGE = getDamageType("wind_charge");
public static final DamageType MACE_SMASH = getDamageType("mace_smash");
@NotNull
private static DamageType getDamageType(@NotNull String key) {
@@ -6,10 +6,7 @@ import org.jetbrains.annotations.NotNull;
/**
* Represents the applicable target for a {@link Enchantment}
*
* @deprecated enchantment groupings are now managed by tags, not categories
*/
@Deprecated(since = "1.20.5", forRemoval = true)
public enum EnchantmentTarget {
/**
* Allows the Enchantment to be placed on all items
@@ -175,15 +175,12 @@ public interface Boat extends Vehicle, io.papermc.paper.entity.Leashable { // Pa
*/
public enum Status {
NOT_IN_WORLD,
// Start generate - BoatStatus
// @GeneratedFrom 1.21.4
NOT_IN_WORLD, // Paper
IN_WATER,
UNDER_WATER,
UNDER_FLOWING_WATER,
ON_LAND,
IN_AIR;
// End generate - BoatStatus
}
// Paper start
@@ -52,30 +52,17 @@ public interface Cat extends Tameable, Sittable, io.papermc.paper.entity.CollarC
*/
interface Type extends OldEnum<Type>, Keyed {
// Start generate - CatType
// @GeneratedFrom 1.21.4
Type ALL_BLACK = getType("all_black");
Type BLACK = getType("black");
Type BRITISH_SHORTHAIR = getType("british_shorthair");
Type CALICO = getType("calico");
Type JELLIE = getType("jellie");
Type PERSIAN = getType("persian");
Type RAGDOLL = getType("ragdoll");
Type RED = getType("red");
Type SIAMESE = getType("siamese");
Type TABBY = getType("tabby");
Type BLACK = getType("black");
Type RED = getType("red");
Type SIAMESE = getType("siamese");
Type BRITISH_SHORTHAIR = getType("british_shorthair");
Type CALICO = getType("calico");
Type PERSIAN = getType("persian");
Type RAGDOLL = getType("ragdoll");
Type WHITE = getType("white");
// End generate - CatType
Type JELLIE = getType("jellie");
Type ALL_BLACK = getType("all_black");
@NotNull
private static Type getType(@NotNull String key) {
Loaded 100 of 748 files, more files were not shown because too many files have changed in this diff. Show more