Compare commits

1 Commits

Author SHA1 Message Date
c420ed5c55 Remove Pre-Load of CrashReport and ObfHelper
Some checks failed
Build Paper / build (21) (push) Has been cancelled
Build Paper / Event File (push) Has been cancelled
2025-01-02 21:52:15 +01:00
2443 changed files with 53186 additions and 62052 deletions

View File

@ -1,34 +1,32 @@
root = true
[*] [*]
charset = utf-8 charset=utf-8
end_of_line = lf end_of_line=lf
insert_final_newline = true insert_final_newline=true
indent_style = space indent_style=space
indent_size = 4 indent_size=4
ij_any_block_comment_add_space = false ij_any_block_comment_add_space = false
ij_any_block_comment_at_first_column = false ij_any_block_comment_at_first_column = false
ij_any_line_comment_at_first_column = false ij_any_line_comment_at_first_column = false
ij_any_line_comment_add_space = true ij_any_line_comment_add_space = true
[*.tiny] [*.tiny]
indent_style = tab indent_style=tab
[*.bat] [*.bat]
end_of_line = crlf end_of_line=crlf
[*.yml] [*.yml]
indent_size = 2 indent_size=2
[*.patch] [*.patch]
trim_trailing_whitespace = false trim_trailing_whitespace=false
[*.java] [*.java]
ij_continuation_indent_size = 4 ij_continuation_indent_size = 4
ij_java_class_count_to_use_import_on_demand = 999999 ij_java_class_count_to_use_import_on_demand = 999999
ij_java_insert_inner_class_imports = false ij_java_insert_inner_class_imports = false
ij_java_names_count_to_use_import_on_demand = 999999 ij_java_names_count_to_use_import_on_demand = 999999
ij_java_imports_layout = *, |, $* ij_java_imports_layout = *,|,$*
ij_java_generate_final_locals = true ij_java_generate_final_locals = true
ij_java_generate_final_parameters = true ij_java_generate_final_parameters = true
ij_java_method_parameters_new_line_after_left_paren = true ij_java_method_parameters_new_line_after_left_paren = true
@ -42,5 +40,5 @@ ij_java_use_fq_class_names = true
[paper-server/src/minecraft/resources/data/**/*.json] [paper-server/src/minecraft/resources/data/**/*.json]
indent_size = 2 indent_size = 2
[paper-{server,api}/src/generated/java/**/*.java] [paper-api-generator/generated/**/*.java]
ij_java_imports_layout = $*, |, * ij_java_imports_layout = $*,|,*

View File

@ -35,10 +35,6 @@ jobs:
steps: steps:
- if: ${{ github.event_name == 'push' }} - if: ${{ github.event_name == 'push' }}
uses: actions/checkout@v4 uses: actions/checkout@v4
with:
# todo remove me again after the update
ref: ${{ github.ref_name }}
fetch-depth: 0
- if: ${{ github.event_name == 'pull_request' }} - if: ${{ github.event_name == 'pull_request' }}
uses: actions/checkout@v4 uses: actions/checkout@v4
with: with:

View File

@ -18,11 +18,10 @@ jobs:
steps: steps:
- name: "authenticate" - name: "authenticate"
id: "authenticate" id: "authenticate"
uses: "tibdex/github-app-token@3beb63f4bd073e61482598c45c71c1019b59b73a" # v2.1.0 uses: "tibdex/github-app-token@b62528385c34dbc9f38e5f4225ac829252d1ea92" # v1
with: with:
installation_retrieval_mode: id
installation_retrieval_payload: "36153445"
app_id: "${{ secrets.PROJECTS_APP_ID }}" app_id: "${{ secrets.PROJECTS_APP_ID }}"
installation_id: "36153445"
private_key: "${{ secrets.PROJECTS_PRIVATE_KEY }}" private_key: "${{ secrets.PROJECTS_PRIVATE_KEY }}"
- uses: PaperMC/update-projects-action@v0.2.0 - uses: PaperMC/update-projects-action@v0.2.0

2
.gitignore vendored
View File

@ -45,7 +45,7 @@ logs/
!gradle/wrapper/gradle-wrapper.jar !gradle/wrapper/gradle-wrapper.jar
test-plugin.settings.gradle.kts test-plugin.settings.gradle.kts
paper-generator.settings.gradle.kts paper-api-generator.settings.gradle.kts
# Don't track patched vanilla submodules # Don't track patched vanilla submodules
paper-server/src/minecraft/ paper-server/src/minecraft/

View File

@ -208,8 +208,7 @@ required.
with `// Paper end - <COMMIT DESCRIPTION>`. with `// Paper end - <COMMIT DESCRIPTION>`.
- One-line changes should have `// Paper - <COMMIT DESCRIPTION>` at the end of the line. - One-line changes should have `// Paper - <COMMIT DESCRIPTION>` at the end of the line.
> [!NOTE] > [!NOTE] These comments are incredibly important to be able to keep track of changes
> These comments are incredibly important to be able to keep track of changes
> across files and to remember what they are for, even a decade into the future. > across files and to remember what they are for, even a decade into the future.
Here's an example of how to mark changes by Paper: Here's an example of how to mark changes by Paper:
@ -264,40 +263,6 @@ are assumed to be non-null by default. For less obvious placing such as on gener
**For other classes**: Keep using both `@Nullable` and `@NotNull` from `org.jetbrains.annotations`. These **For other classes**: Keep using both `@Nullable` and `@NotNull` from `org.jetbrains.annotations`. These
will be replaced later. will be replaced later.
### API checks
When performing API-related checks where an exception needs to be thrown under specific conditions, you should use the `Preconditions` class.
#### Checking Method Arguments
To validate method arguments, use `Preconditions#checkArgument`. This will throw an `IllegalArgumentException` if the condition is not met.
> Don't use Preconditions#checkNotNull, as it throws a NullPointerException, which makes it harder to determine whether the error was caused by an internal issue or invalid arguments.
ex:
```java
@Override
public void sendMessage(Player player, Component message) {
Preconditions.checkArgument(player != null, "player cannot be null");
Preconditions.checkArgument(player.isOnline(), "player %s must be online", player.getName());
Preconditions.checkArgument(message != null, "message cannot be null");
// rest of code
}
```
#### Checking Object State
To validate the state of an object inside a method, use `Preconditions#checkState`. This will throw an `IllegalStateException` if the condition is not met.
ex:
```java
private Player player;
@Override
public void sendMessage(Component message) {
Preconditions.checkArgument(message != null, "message cannot be null");
Preconditions.checkState(this.player != null, "player cannot be null");
Preconditions.checkState(this.player.isOnline(), "player %s must be online", this.player.getName());
// rest of code
}
```
## Access Transformers ## Access Transformers
Sometimes, Vanilla code already contains a field, method, or type you want to access Sometimes, Vanilla code already contains a field, method, or type you want to access
but the visibility is too low (e.g. a private field in an entity class). Paper can use access transformers but the visibility is too low (e.g. a private field in an entity class). Paper can use access transformers

View File

@ -40,7 +40,7 @@ How To (Plugin Developers)
<dependency> <dependency>
<groupId>io.papermc.paper</groupId> <groupId>io.papermc.paper</groupId>
<artifactId>paper-api</artifactId> <artifactId>paper-api</artifactId>
<version>1.21.5-R0.1-SNAPSHOT</version> <version>1.21.4-R0.1-SNAPSHOT</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
``` ```
@ -53,7 +53,7 @@ repositories {
} }
dependencies { dependencies {
compileOnly("io.papermc.paper:paper-api:1.21.5-R0.1-SNAPSHOT") compileOnly("io.papermc.paper:paper-api:1.21.4-R0.1-SNAPSHOT")
} }
java { java {

View File

@ -15,10 +15,14 @@ public net.minecraft.commands.CommandSourceStack source
public net.minecraft.commands.arguments.DimensionArgument ERROR_INVALID_VALUE public net.minecraft.commands.arguments.DimensionArgument ERROR_INVALID_VALUE
public net.minecraft.commands.arguments.blocks.BlockInput tag public net.minecraft.commands.arguments.blocks.BlockInput tag
public net.minecraft.core.MappedRegistry validateWrite(Lnet/minecraft/resources/ResourceKey;)V public net.minecraft.core.MappedRegistry validateWrite(Lnet/minecraft/resources/ResourceKey;)V
public net.minecraft.nbt.ListTag <init>(Ljava/util/List;)V public net.minecraft.nbt.ListTag <init>(Ljava/util/List;B)V
public net.minecraft.nbt.ListTag identifyRawElementType()B public net.minecraft.nbt.TagParser readArrayTag()Lnet/minecraft/nbt/Tag;
public net.minecraft.nbt.TagParser type(Ljava/lang/String;)Lnet/minecraft/nbt/Tag;
public net.minecraft.network.Connection address public net.minecraft.network.Connection address
public net.minecraft.network.Connection channel public net.minecraft.network.Connection channel
public net.minecraft.network.chat.HoverEvent$ItemStackInfo components
public net.minecraft.network.chat.HoverEvent$ItemStackInfo count
public net.minecraft.network.chat.HoverEvent$ItemStackInfo item
public net.minecraft.network.chat.TextColor name public net.minecraft.network.chat.TextColor name
public net.minecraft.network.chat.contents.TranslatableContents filterAllowedArguments(Ljava/lang/Object;)Lcom/mojang/serialization/DataResult; public net.minecraft.network.chat.contents.TranslatableContents filterAllowedArguments(Ljava/lang/Object;)Lcom/mojang/serialization/DataResult;
public net.minecraft.network.chat.numbers.FixedFormat value public net.minecraft.network.chat.numbers.FixedFormat value
@ -33,10 +37,9 @@ public net.minecraft.network.protocol.game.ServerboundMovePlayerPacket xRot
public net.minecraft.network.protocol.game.ServerboundMovePlayerPacket y public net.minecraft.network.protocol.game.ServerboundMovePlayerPacket y
public net.minecraft.network.protocol.game.ServerboundMovePlayerPacket yRot public net.minecraft.network.protocol.game.ServerboundMovePlayerPacket yRot
public net.minecraft.network.protocol.game.ServerboundMovePlayerPacket z public net.minecraft.network.protocol.game.ServerboundMovePlayerPacket z
public net.minecraft.network.syncher.SynchedEntityData getItem(Lnet/minecraft/network/syncher/EntityDataAccessor;)Lnet/minecraft/network/syncher/SynchedEntityData$DataItem;
public net.minecraft.resources.RegistryOps lookupProvider public net.minecraft.resources.RegistryOps lookupProvider
public net.minecraft.resources.RegistryOps$HolderLookupAdapter public net.minecraft.resources.RegistryOps$HolderLookupAdapter
public net.minecraft.server.Main forceUpgrade(Lnet/minecraft/world/level/storage/LevelStorageSource$LevelStorageAccess;Lnet/minecraft/world/level/storage/WorldData;Lcom/mojang/datafixers/DataFixer;ZLjava/util/function/BooleanSupplier;Lnet/minecraft/core/RegistryAccess;Z)V public net.minecraft.server.Main forceUpgrade(Lnet/minecraft/world/level/storage/LevelStorageSource$LevelStorageAccess;Lcom/mojang/datafixers/DataFixer;ZLjava/util/function/BooleanSupplier;Lnet/minecraft/core/RegistryAccess;Z)V
public net.minecraft.server.MinecraftServer LOGGER public net.minecraft.server.MinecraftServer LOGGER
public net.minecraft.server.MinecraftServer doRunTask(Lnet/minecraft/server/TickTask;)V public net.minecraft.server.MinecraftServer doRunTask(Lnet/minecraft/server/TickTask;)V
public net.minecraft.server.MinecraftServer executor public net.minecraft.server.MinecraftServer executor
@ -50,7 +53,6 @@ public net.minecraft.server.MinecraftServer$ReloadableResources
public net.minecraft.server.RegistryLayer STATIC_ACCESS public net.minecraft.server.RegistryLayer STATIC_ACCESS
public net.minecraft.server.ReloadableServerResources public net.minecraft.server.ReloadableServerResources
public net.minecraft.server.ServerAdvancementManager advancements public net.minecraft.server.ServerAdvancementManager advancements
public net.minecraft.server.Services USERID_CACHE_FILE
public net.minecraft.server.dedicated.DedicatedServerProperties$WorldDimensionData public net.minecraft.server.dedicated.DedicatedServerProperties$WorldDimensionData
public net.minecraft.server.dedicated.Settings getStringRaw(Ljava/lang/String;)Ljava/lang/String; public net.minecraft.server.dedicated.Settings getStringRaw(Ljava/lang/String;)Ljava/lang/String;
public net.minecraft.server.dedicated.Settings properties public net.minecraft.server.dedicated.Settings properties
@ -70,17 +72,15 @@ public net.minecraft.server.level.ChunkMap setServerViewDistance(I)V
public net.minecraft.server.level.ChunkMap toDrop public net.minecraft.server.level.ChunkMap toDrop
public net.minecraft.server.level.ChunkMap updatingChunkMap public net.minecraft.server.level.ChunkMap updatingChunkMap
public net.minecraft.server.level.ChunkMap visibleChunkMap public net.minecraft.server.level.ChunkMap visibleChunkMap
public net.minecraft.server.level.ChunkMap$DistanceManager
public net.minecraft.server.level.ChunkMap$TrackedEntity public net.minecraft.server.level.ChunkMap$TrackedEntity
public net.minecraft.server.level.ChunkMap$TrackedEntity seenBy public net.minecraft.server.level.ChunkMap$TrackedEntity seenBy
public net.minecraft.server.level.ChunkMap$TrackedEntity serverEntity public net.minecraft.server.level.ChunkMap$TrackedEntity serverEntity
public net.minecraft.server.level.DistanceManager simulationDistance public net.minecraft.server.level.DistanceManager simulationDistance
public net.minecraft.server.level.DistanceManager ticketStorage public net.minecraft.server.level.DistanceManager tickets
public net.minecraft.server.level.ServerBossEvent broadcast(Ljava/util/function/Function;)V public net.minecraft.server.level.ServerBossEvent broadcast(Ljava/util/function/Function;)V
public net.minecraft.server.level.ServerBossEvent visible public net.minecraft.server.level.ServerBossEvent visible
public net.minecraft.server.level.ServerChunkCache mainThread public net.minecraft.server.level.ServerChunkCache mainThread
public net.minecraft.server.level.ServerChunkCache mainThreadProcessor public net.minecraft.server.level.ServerChunkCache mainThreadProcessor
public net.minecraft.server.level.ServerChunkCache runDistanceManagerUpdates()Z
public net.minecraft.server.level.ServerChunkCache spawnEnemies public net.minecraft.server.level.ServerChunkCache spawnEnemies
public net.minecraft.server.level.ServerChunkCache spawnFriendlies public net.minecraft.server.level.ServerChunkCache spawnFriendlies
public net.minecraft.server.level.ServerChunkCache$MainThreadExecutor public net.minecraft.server.level.ServerChunkCache$MainThreadExecutor
@ -91,7 +91,7 @@ public net.minecraft.server.level.ServerLevel getEntities()Lnet/minecraft/world/
public net.minecraft.server.level.ServerLevel serverLevelData public net.minecraft.server.level.ServerLevel serverLevelData
public net.minecraft.server.level.ServerPlayer completeUsingItem()V public net.minecraft.server.level.ServerPlayer completeUsingItem()V
public net.minecraft.server.level.ServerPlayer containerSynchronizer public net.minecraft.server.level.ServerPlayer containerSynchronizer
public net.minecraft.server.level.ServerPlayer findRespawnAndUseSpawnBlock(Lnet/minecraft/server/level/ServerLevel;Lnet/minecraft/server/level/ServerPlayer$RespawnConfig;Z)Ljava/util/Optional; public net.minecraft.server.level.ServerPlayer findRespawnAndUseSpawnBlock(Lnet/minecraft/server/level/ServerLevel;Lnet/minecraft/core/BlockPos;FZZ)Ljava/util/Optional;
public net.minecraft.server.level.ServerPlayer initMenu(Lnet/minecraft/world/inventory/AbstractContainerMenu;)V public net.minecraft.server.level.ServerPlayer initMenu(Lnet/minecraft/world/inventory/AbstractContainerMenu;)V
public net.minecraft.server.level.ServerPlayer isChangingDimension public net.minecraft.server.level.ServerPlayer isChangingDimension
public net.minecraft.server.level.ServerPlayer language public net.minecraft.server.level.ServerPlayer language
@ -103,25 +103,25 @@ public net.minecraft.server.level.ServerPlayer triggerDimensionChangeTriggers(Ln
public net.minecraft.server.level.ServerPlayer wardenSpawnTracker public net.minecraft.server.level.ServerPlayer wardenSpawnTracker
public net.minecraft.server.level.ServerPlayer$RespawnPosAngle public net.minecraft.server.level.ServerPlayer$RespawnPosAngle
public net.minecraft.server.level.ServerPlayerGameMode level public net.minecraft.server.level.ServerPlayerGameMode level
public net.minecraft.server.level.TicketType register(Ljava/lang/String;JZLnet/minecraft/server/level/TicketType$TicketUse;)Lnet/minecraft/server/level/TicketType; public net.minecraft.server.level.Ticket key
public net.minecraft.server.network.ServerGamePacketListenerImpl isChatMessageIllegal(Ljava/lang/String;)Z public net.minecraft.server.network.ServerGamePacketListenerImpl isChatMessageIllegal(Ljava/lang/String;)Z
public net.minecraft.server.network.ServerLoginPacketListenerImpl authenticatedProfile public net.minecraft.server.network.ServerLoginPacketListenerImpl authenticatedProfile
public net.minecraft.server.network.ServerLoginPacketListenerImpl connection public net.minecraft.server.network.ServerLoginPacketListenerImpl connection
public net.minecraft.server.network.ServerLoginPacketListenerImpl state public net.minecraft.server.network.ServerLoginPacketListenerImpl state
public net.minecraft.server.network.ServerLoginPacketListenerImpl$State public net.minecraft.server.network.ServerLoginPacketListenerImpl$State
public net.minecraft.server.packs.VanillaPackResourcesBuilder safeGetPath(Ljava/net/URI;)Ljava/nio/file/Path;
public net.minecraft.server.packs.repository.FolderRepositorySource$FolderPackDetector public net.minecraft.server.packs.repository.FolderRepositorySource$FolderPackDetector
public net.minecraft.server.packs.repository.FolderRepositorySource$FolderPackDetector <init>(Lnet/minecraft/world/level/validation/DirectoryValidator;)V public net.minecraft.server.packs.repository.FolderRepositorySource$FolderPackDetector <init>(Lnet/minecraft/world/level/validation/DirectoryValidator;)V
public net.minecraft.server.packs.repository.Pack resources public net.minecraft.server.packs.repository.Pack resources
public net.minecraft.server.players.PlayerList playerIo public net.minecraft.server.players.PlayerList playerIo
public net.minecraft.server.players.PlayerList players public net.minecraft.server.players.PlayerList players
public net.minecraft.server.players.PlayerList updateEntireScoreboard(Lnet/minecraft/server/ServerScoreboard;Lnet/minecraft/server/level/ServerPlayer;)V public net.minecraft.server.players.PlayerList updateEntireScoreboard(Lnet/minecraft/server/ServerScoreboard;Lnet/minecraft/server/level/ServerPlayer;)V
public net.minecraft.server.players.PlayerList verifyChatTrusted(Lnet/minecraft/network/chat/PlayerChatMessage;)Z
public net.minecraft.server.players.StoredUserEntry getUser()Ljava/lang/Object; public net.minecraft.server.players.StoredUserEntry getUser()Ljava/lang/Object;
public net.minecraft.stats.ServerRecipeBook known public net.minecraft.stats.ServerRecipeBook known
public net.minecraft.tags.TagEntry id public net.minecraft.tags.TagEntry id
public net.minecraft.tags.TagEntry required public net.minecraft.tags.TagEntry required
public net.minecraft.tags.TagEntry tag public net.minecraft.tags.TagEntry tag
public net.minecraft.util.datafix.fixes.BlockStateData register(ILcom/mojang/serialization/Dynamic;[Lcom/mojang/serialization/Dynamic;)V public net.minecraft.util.datafix.fixes.BlockStateData register(ILjava/lang/String;[Ljava/lang/String;)V
public net.minecraft.util.datafix.fixes.ItemIdFix ITEM_NAMES public net.minecraft.util.datafix.fixes.ItemIdFix ITEM_NAMES
public net.minecraft.util.datafix.fixes.ItemSpawnEggFix ID_TO_ENTITY public net.minecraft.util.datafix.fixes.ItemSpawnEggFix ID_TO_ENTITY
public net.minecraft.world.BossEvent color public net.minecraft.world.BossEvent color
@ -130,11 +130,6 @@ public net.minecraft.world.BossEvent overlay
public net.minecraft.world.CompoundContainer container1 public net.minecraft.world.CompoundContainer container1
public net.minecraft.world.CompoundContainer container2 public net.minecraft.world.CompoundContainer container2
public net.minecraft.world.SimpleContainer items public net.minecraft.world.SimpleContainer items
public net.minecraft.world.damagesource.CombatTracker entries
public net.minecraft.world.damagesource.CombatTracker getMostSignificantFall()Lnet/minecraft/world/damagesource/CombatEntry;
public net.minecraft.world.damagesource.CombatTracker inCombat
public net.minecraft.world.damagesource.CombatTracker mob
public net.minecraft.world.damagesource.CombatTracker takingDamage
public net.minecraft.world.damagesource.DamageSource <init>(Lnet/minecraft/core/Holder;Lnet/minecraft/world/entity/Entity;Lnet/minecraft/world/entity/Entity;Lnet/minecraft/world/phys/Vec3;)V public net.minecraft.world.damagesource.DamageSource <init>(Lnet/minecraft/core/Holder;Lnet/minecraft/world/entity/Entity;Lnet/minecraft/world/entity/Entity;Lnet/minecraft/world/phys/Vec3;)V
public net.minecraft.world.effect.MobEffect attributeModifiers public net.minecraft.world.effect.MobEffect attributeModifiers
public net.minecraft.world.effect.MobEffect$AttributeTemplate public net.minecraft.world.effect.MobEffect$AttributeTemplate
@ -190,11 +185,8 @@ public net.minecraft.world.entity.Entity FLAG_INVISIBLE
public net.minecraft.world.entity.Entity getEncodeId()Ljava/lang/String; public net.minecraft.world.entity.Entity getEncodeId()Ljava/lang/String;
public net.minecraft.world.entity.Entity getFireImmuneTicks()I public net.minecraft.world.entity.Entity getFireImmuneTicks()I
public net.minecraft.world.entity.Entity getSharedFlag(I)Z public net.minecraft.world.entity.Entity getSharedFlag(I)Z
public net.minecraft.world.entity.Entity getSwimHighSpeedSplashSound()Lnet/minecraft/sounds/SoundEvent;
public net.minecraft.world.entity.Entity getSwimSound()Lnet/minecraft/sounds/SoundEvent;
public net.minecraft.world.entity.Entity getSwimSplashSound()Lnet/minecraft/sounds/SoundEvent;
public net.minecraft.world.entity.Entity hasVisualFire public net.minecraft.world.entity.Entity hasVisualFire
public net.minecraft.world.entity.Entity isAffectedByBlocks()Z public net.minecraft.world.entity.Entity isInBubbleColumn()Z
public net.minecraft.world.entity.Entity isInRain()Z public net.minecraft.world.entity.Entity isInRain()Z
public net.minecraft.world.entity.Entity isInvulnerableToBase(Lnet/minecraft/world/damagesource/DamageSource;)Z public net.minecraft.world.entity.Entity isInvulnerableToBase(Lnet/minecraft/world/damagesource/DamageSource;)Z
public net.minecraft.world.entity.Entity onGround public net.minecraft.world.entity.Entity onGround
@ -204,11 +196,10 @@ public net.minecraft.world.entity.Entity random
public net.minecraft.world.entity.Entity setLevel(Lnet/minecraft/world/level/Level;)V public net.minecraft.world.entity.Entity setLevel(Lnet/minecraft/world/level/Level;)V
public net.minecraft.world.entity.Entity setRot(FF)V public net.minecraft.world.entity.Entity setRot(FF)V
public net.minecraft.world.entity.Entity setSharedFlag(IZ)V public net.minecraft.world.entity.Entity setSharedFlag(IZ)V
public net.minecraft.world.entity.Entity teleportPassengers()V
public net.minecraft.world.entity.Entity unsetRemoved()V public net.minecraft.world.entity.Entity unsetRemoved()V
public net.minecraft.world.entity.Entity wasTouchingWater public net.minecraft.world.entity.Entity wasTouchingWater
public net.minecraft.world.entity.ExperienceOrb count public net.minecraft.world.entity.ExperienceOrb count
public net.minecraft.world.entity.ExperienceOrb setValue(I)V public net.minecraft.world.entity.ExperienceOrb value
public net.minecraft.world.entity.GlowSquid setDarkTicks(I)V public net.minecraft.world.entity.GlowSquid setDarkTicks(I)V
public net.minecraft.world.entity.Interaction attack public net.minecraft.world.entity.Interaction attack
public net.minecraft.world.entity.Interaction getHeight()F public net.minecraft.world.entity.Interaction getHeight()F
@ -234,19 +225,18 @@ public net.minecraft.world.entity.LivingEntity detectEquipmentUpdates()V
public net.minecraft.world.entity.LivingEntity effectsDirty public net.minecraft.world.entity.LivingEntity effectsDirty
public net.minecraft.world.entity.LivingEntity entityEventForEquipmentBreak(Lnet/minecraft/world/entity/EquipmentSlot;)B public net.minecraft.world.entity.LivingEntity entityEventForEquipmentBreak(Lnet/minecraft/world/entity/EquipmentSlot;)B
public net.minecraft.world.entity.LivingEntity getDeathSound()Lnet/minecraft/sounds/SoundEvent; public net.minecraft.world.entity.LivingEntity getDeathSound()Lnet/minecraft/sounds/SoundEvent;
public net.minecraft.world.entity.LivingEntity getFallDamageSound(I)Lnet/minecraft/sounds/SoundEvent;
public net.minecraft.world.entity.LivingEntity getHurtSound(Lnet/minecraft/world/damagesource/DamageSource;)Lnet/minecraft/sounds/SoundEvent;
public net.minecraft.world.entity.LivingEntity getSoundVolume()F public net.minecraft.world.entity.LivingEntity getSoundVolume()F
public net.minecraft.world.entity.LivingEntity jumping public net.minecraft.world.entity.LivingEntity jumping
public net.minecraft.world.entity.LivingEntity lastHurt public net.minecraft.world.entity.LivingEntity lastHurt
public net.minecraft.world.entity.LivingEntity lastHurtByMob public net.minecraft.world.entity.LivingEntity lastHurtByMob
public net.minecraft.world.entity.LivingEntity lastHurtByMobTimestamp public net.minecraft.world.entity.LivingEntity lastHurtByMobTimestamp
public net.minecraft.world.entity.LivingEntity lastHurtByPlayer public net.minecraft.world.entity.LivingEntity lastHurtByPlayer
public net.minecraft.world.entity.LivingEntity lastHurtByPlayerMemoryTime public net.minecraft.world.entity.LivingEntity lastHurtByPlayerTime
public net.minecraft.world.entity.LivingEntity playSecondaryHurtSound(Lnet/minecraft/world/damagesource/DamageSource;)V
public net.minecraft.world.entity.LivingEntity setLivingEntityFlag(IZ)V public net.minecraft.world.entity.LivingEntity setLivingEntityFlag(IZ)V
public net.minecraft.world.entity.LivingEntity useItemRemaining public net.minecraft.world.entity.LivingEntity useItemRemaining
public net.minecraft.world.entity.Mob getAmbientSound()Lnet/minecraft/sounds/SoundEvent; public net.minecraft.world.entity.Mob armorDropChances
public net.minecraft.world.entity.Mob getEquipmentDropChance(Lnet/minecraft/world/entity/EquipmentSlot;)F
public net.minecraft.world.entity.Mob handDropChances
public net.minecraft.world.entity.Mob isSunBurnTick()Z public net.minecraft.world.entity.Mob isSunBurnTick()Z
public net.minecraft.world.entity.Mob lootTable public net.minecraft.world.entity.Mob lootTable
public net.minecraft.world.entity.Mob lootTableSeed public net.minecraft.world.entity.Mob lootTableSeed
@ -274,60 +264,47 @@ public net.minecraft.world.entity.animal.Bee ticksWithoutNectarSinceExitingHive
public net.minecraft.world.entity.animal.Cat isRelaxStateOne()Z public net.minecraft.world.entity.animal.Cat isRelaxStateOne()Z
public net.minecraft.world.entity.animal.Cat setCollarColor(Lnet/minecraft/world/item/DyeColor;)V public net.minecraft.world.entity.animal.Cat setCollarColor(Lnet/minecraft/world/item/DyeColor;)V
public net.minecraft.world.entity.animal.Cat setRelaxStateOne(Z)V public net.minecraft.world.entity.animal.Cat setRelaxStateOne(Z)V
public net.minecraft.world.entity.animal.Cat setVariant(Lnet/minecraft/core/Holder;)V
public net.minecraft.world.entity.animal.Dolphin treasurePos
public net.minecraft.world.entity.animal.Fox DATA_TRUSTED_ID_0 public net.minecraft.world.entity.animal.Fox DATA_TRUSTED_ID_0
public net.minecraft.world.entity.animal.Fox DATA_TRUSTED_ID_1 public net.minecraft.world.entity.animal.Fox DATA_TRUSTED_ID_1
public net.minecraft.world.entity.animal.Fox isDefending()Z public net.minecraft.world.entity.animal.Fox isDefending()Z
public net.minecraft.world.entity.animal.Fox setDefending(Z)V public net.minecraft.world.entity.animal.Fox setDefending(Z)V
public net.minecraft.world.entity.animal.Fox setFaceplanted(Z)V public net.minecraft.world.entity.animal.Fox setFaceplanted(Z)V
public net.minecraft.world.entity.animal.Fox setSleeping(Z)V public net.minecraft.world.entity.animal.Fox setSleeping(Z)V
public net.minecraft.world.entity.animal.Fox setVariant(Lnet/minecraft/world/entity/animal/Fox$Variant;)V
public net.minecraft.world.entity.animal.MushroomCow setVariant(Lnet/minecraft/world/entity/animal/MushroomCow$Variant;)V
public net.minecraft.world.entity.animal.MushroomCow stewEffects public net.minecraft.world.entity.animal.MushroomCow stewEffects
public net.minecraft.world.entity.animal.Ocelot isTrusting()Z public net.minecraft.world.entity.animal.Ocelot isTrusting()Z
public net.minecraft.world.entity.animal.Ocelot setTrusting(Z)V public net.minecraft.world.entity.animal.Ocelot setTrusting(Z)V
public net.minecraft.world.entity.animal.Panda getEatCounter()I public net.minecraft.world.entity.animal.Panda getEatCounter()I
public net.minecraft.world.entity.animal.Panda setEatCounter(I)V public net.minecraft.world.entity.animal.Panda setEatCounter(I)V
public net.minecraft.world.entity.animal.Parrot setVariant(Lnet/minecraft/world/entity/animal/Parrot$Variant;)V
public net.minecraft.world.entity.animal.Pig setVariant(Lnet/minecraft/core/Holder;)V
public net.minecraft.world.entity.animal.Pig steering public net.minecraft.world.entity.animal.Pig steering
public net.minecraft.world.entity.animal.Rabbit moreCarrotTicks public net.minecraft.world.entity.animal.Rabbit moreCarrotTicks
public net.minecraft.world.entity.animal.Rabbit registerGoals()V public net.minecraft.world.entity.animal.Rabbit registerGoals()V
public net.minecraft.world.entity.animal.Rabbit setVariant(Lnet/minecraft/world/entity/animal/Rabbit$Variant;)V
public net.minecraft.world.entity.animal.Salmon setVariant(Lnet/minecraft/world/entity/animal/Salmon$Variant;)V
public net.minecraft.world.entity.animal.TropicalFish getPackedVariant()I public net.minecraft.world.entity.animal.TropicalFish getPackedVariant()I
public net.minecraft.world.entity.animal.TropicalFish setPackedVariant(I)V public net.minecraft.world.entity.animal.TropicalFish setPackedVariant(I)V
public net.minecraft.world.entity.animal.Turtle goingHome public net.minecraft.world.entity.animal.Turtle getHomePos()Lnet/minecraft/core/BlockPos;
public net.minecraft.world.entity.animal.Turtle homePos public net.minecraft.world.entity.animal.Turtle isGoingHome()Z
public net.minecraft.world.entity.animal.Turtle isTravelling()Z
public net.minecraft.world.entity.animal.Turtle setGoingHome(Z)V
public net.minecraft.world.entity.animal.Turtle setHasEgg(Z)V public net.minecraft.world.entity.animal.Turtle setHasEgg(Z)V
public net.minecraft.world.entity.animal.Turtle setTravelling(Z)V
public net.minecraft.world.entity.animal.Wolf isWet
public net.minecraft.world.entity.animal.Wolf setCollarColor(Lnet/minecraft/world/item/DyeColor;)V
public net.minecraft.world.entity.animal.allay.Allay canDuplicate()Z public net.minecraft.world.entity.animal.allay.Allay canDuplicate()Z
public net.minecraft.world.entity.animal.allay.Allay duplicateAllay()V public net.minecraft.world.entity.animal.allay.Allay duplicateAllay()V
public net.minecraft.world.entity.animal.allay.Allay duplicationCooldown public net.minecraft.world.entity.animal.allay.Allay duplicationCooldown
public net.minecraft.world.entity.animal.allay.Allay jukeboxPos public net.minecraft.world.entity.animal.allay.Allay jukeboxPos
public net.minecraft.world.entity.animal.allay.Allay resetDuplicationCooldown()V public net.minecraft.world.entity.animal.allay.Allay resetDuplicationCooldown()V
public net.minecraft.world.entity.animal.axolotl.Axolotl setVariant(Lnet/minecraft/world/entity/animal/axolotl/Axolotl$Variant;)V
public net.minecraft.world.entity.animal.frog.Frog setVariant(Lnet/minecraft/core/Holder;)V
public net.minecraft.world.entity.animal.frog.Tadpole age public net.minecraft.world.entity.animal.frog.Tadpole age
public net.minecraft.world.entity.animal.goat.Goat DATA_HAS_LEFT_HORN public net.minecraft.world.entity.animal.goat.Goat DATA_HAS_LEFT_HORN
public net.minecraft.world.entity.animal.goat.Goat DATA_HAS_RIGHT_HORN public net.minecraft.world.entity.animal.goat.Goat DATA_HAS_RIGHT_HORN
public net.minecraft.world.entity.animal.horse.AbstractHorse createInventory()V public net.minecraft.world.entity.animal.horse.AbstractHorse createInventory()V
public net.minecraft.world.entity.animal.horse.AbstractHorse inventory public net.minecraft.world.entity.animal.horse.AbstractHorse inventory
public net.minecraft.world.entity.animal.horse.AbstractHorse owner
public net.minecraft.world.entity.animal.horse.Horse setVariantAndMarkings(Lnet/minecraft/world/entity/animal/horse/Variant;Lnet/minecraft/world/entity/animal/horse/Markings;)V public net.minecraft.world.entity.animal.horse.Horse setVariantAndMarkings(Lnet/minecraft/world/entity/animal/horse/Variant;Lnet/minecraft/world/entity/animal/horse/Markings;)V
public net.minecraft.world.entity.animal.horse.Llama setVariant(Lnet/minecraft/world/entity/animal/horse/Llama$Variant;)V
public net.minecraft.world.entity.animal.horse.SkeletonHorse trapTime public net.minecraft.world.entity.animal.horse.SkeletonHorse trapTime
public net.minecraft.world.entity.animal.sniffer.Sniffer calculateDigPosition()Ljava/util/Optional; public net.minecraft.world.entity.animal.sniffer.Sniffer calculateDigPosition()Ljava/util/Optional;
public net.minecraft.world.entity.animal.sniffer.Sniffer canDig()Z public net.minecraft.world.entity.animal.sniffer.Sniffer canDig()Z
public net.minecraft.world.entity.animal.sniffer.Sniffer getExploredPositions()Ljava/util/stream/Stream; public net.minecraft.world.entity.animal.sniffer.Sniffer getExploredPositions()Ljava/util/stream/Stream;
public net.minecraft.world.entity.animal.sniffer.Sniffer getState()Lnet/minecraft/world/entity/animal/sniffer/Sniffer$State; public net.minecraft.world.entity.animal.sniffer.Sniffer getState()Lnet/minecraft/world/entity/animal/sniffer/Sniffer$State;
public net.minecraft.world.entity.animal.sniffer.Sniffer storeExploredPosition(Lnet/minecraft/core/BlockPos;)Lnet/minecraft/world/entity/animal/sniffer/Sniffer; public net.minecraft.world.entity.animal.sniffer.Sniffer storeExploredPosition(Lnet/minecraft/core/BlockPos;)Lnet/minecraft/world/entity/animal/sniffer/Sniffer;
public net.minecraft.world.entity.animal.wolf.Wolf getSoundVariant()Lnet/minecraft/core/Holder;
public net.minecraft.world.entity.animal.wolf.Wolf getVariant()Lnet/minecraft/core/Holder;
public net.minecraft.world.entity.animal.wolf.Wolf isWet
public net.minecraft.world.entity.animal.wolf.Wolf setCollarColor(Lnet/minecraft/world/item/DyeColor;)V
public net.minecraft.world.entity.animal.wolf.Wolf setSoundVariant(Lnet/minecraft/core/Holder;)V
public net.minecraft.world.entity.animal.wolf.Wolf setVariant(Lnet/minecraft/core/Holder;)V
public net.minecraft.world.entity.boss.enderdragon.EnderDragon subEntities public net.minecraft.world.entity.boss.enderdragon.EnderDragon subEntities
public net.minecraft.world.entity.boss.wither.WitherBoss bossEvent public net.minecraft.world.entity.boss.wither.WitherBoss bossEvent
public net.minecraft.world.entity.decoration.ArmorStand bodyPose public net.minecraft.world.entity.decoration.ArmorStand bodyPose
@ -346,7 +323,6 @@ public net.minecraft.world.entity.decoration.ItemFrame DATA_ROTATION
public net.minecraft.world.entity.decoration.ItemFrame dropChance public net.minecraft.world.entity.decoration.ItemFrame dropChance
public net.minecraft.world.entity.decoration.ItemFrame fixed public net.minecraft.world.entity.decoration.ItemFrame fixed
public net.minecraft.world.entity.decoration.ItemFrame setDirection(Lnet/minecraft/core/Direction;)V public net.minecraft.world.entity.decoration.ItemFrame setDirection(Lnet/minecraft/core/Direction;)V
public net.minecraft.world.entity.decoration.Painting setVariant(Lnet/minecraft/core/Holder;)V
public net.minecraft.world.entity.item.FallingBlockEntity <init>(Lnet/minecraft/world/level/Level;DDDLnet/minecraft/world/level/block/state/BlockState;)V public net.minecraft.world.entity.item.FallingBlockEntity <init>(Lnet/minecraft/world/level/Level;DDDLnet/minecraft/world/level/block/state/BlockState;)V
public net.minecraft.world.entity.item.FallingBlockEntity blockState public net.minecraft.world.entity.item.FallingBlockEntity blockState
public net.minecraft.world.entity.item.FallingBlockEntity cancelDrop public net.minecraft.world.entity.item.FallingBlockEntity cancelDrop
@ -369,8 +345,8 @@ public net.minecraft.world.entity.monster.Drowned waterNavigation
public net.minecraft.world.entity.monster.EnderMan teleport()Z public net.minecraft.world.entity.monster.EnderMan teleport()Z
public net.minecraft.world.entity.monster.EnderMan teleportTowards(Lnet/minecraft/world/entity/Entity;)Z public net.minecraft.world.entity.monster.EnderMan teleportTowards(Lnet/minecraft/world/entity/Entity;)Z
public net.minecraft.world.entity.monster.Endermite life public net.minecraft.world.entity.monster.Endermite life
public net.minecraft.world.entity.monster.Evoker getWololoTarget()Lnet/minecraft/world/entity/animal/sheep/Sheep; public net.minecraft.world.entity.monster.Evoker getWololoTarget()Lnet/minecraft/world/entity/animal/Sheep;
public net.minecraft.world.entity.monster.Evoker setWololoTarget(Lnet/minecraft/world/entity/animal/sheep/Sheep;)V public net.minecraft.world.entity.monster.Evoker setWololoTarget(Lnet/minecraft/world/entity/animal/Sheep;)V
public net.minecraft.world.entity.monster.Guardian randomStrollGoal public net.minecraft.world.entity.monster.Guardian randomStrollGoal
public net.minecraft.world.entity.monster.Guardian setActiveAttackTarget(I)V public net.minecraft.world.entity.monster.Guardian setActiveAttackTarget(I)V
public net.minecraft.world.entity.monster.Guardian$GuardianAttackGoal public net.minecraft.world.entity.monster.Guardian$GuardianAttackGoal
@ -422,25 +398,15 @@ public net.minecraft.world.entity.npc.Villager setUnhappy()V
public net.minecraft.world.entity.npc.WanderingTrader getWanderTarget()Lnet/minecraft/core/BlockPos; public net.minecraft.world.entity.npc.WanderingTrader getWanderTarget()Lnet/minecraft/core/BlockPos;
public net.minecraft.world.entity.player.Abilities flyingSpeed public net.minecraft.world.entity.player.Abilities flyingSpeed
public net.minecraft.world.entity.player.Abilities walkingSpeed public net.minecraft.world.entity.player.Abilities walkingSpeed
public net.minecraft.world.entity.player.Inventory equipment public net.minecraft.world.entity.player.Inventory compartments
public net.minecraft.world.entity.player.Player DATA_PLAYER_MODE_CUSTOMISATION public net.minecraft.world.entity.player.Player DATA_PLAYER_MODE_CUSTOMISATION
public net.minecraft.world.entity.player.Player closeContainer()V public net.minecraft.world.entity.player.Player closeContainer()V
public net.minecraft.world.entity.player.Player enchantmentSeed public net.minecraft.world.entity.player.Player enchantmentSeed
public net.minecraft.world.entity.player.Player getFireImmuneTicks()I public net.minecraft.world.entity.player.Player getFireImmuneTicks()I
public net.minecraft.world.entity.player.Player hurtDir
public net.minecraft.world.entity.player.Player removeEntitiesOnShoulder()V public net.minecraft.world.entity.player.Player removeEntitiesOnShoulder()V
public net.minecraft.world.entity.player.Player setShoulderEntityLeft(Lnet/minecraft/nbt/CompoundTag;)V public net.minecraft.world.entity.player.Player setShoulderEntityLeft(Lnet/minecraft/nbt/CompoundTag;)V
public net.minecraft.world.entity.player.Player setShoulderEntityRight(Lnet/minecraft/nbt/CompoundTag;)V public net.minecraft.world.entity.player.Player setShoulderEntityRight(Lnet/minecraft/nbt/CompoundTag;)V
public net.minecraft.world.entity.player.Player sleepCounter public net.minecraft.world.entity.player.Player sleepCounter
public net.minecraft.world.entity.projectile.AbstractArrow baseDamage
public net.minecraft.world.entity.projectile.AbstractArrow firedFromWeapon
public net.minecraft.world.entity.projectile.AbstractArrow getHitGroundSoundEvent()Lnet/minecraft/sounds/SoundEvent;
public net.minecraft.world.entity.projectile.AbstractArrow getPickupItem()Lnet/minecraft/world/item/ItemStack;
public net.minecraft.world.entity.projectile.AbstractArrow isInGround()Z
public net.minecraft.world.entity.projectile.AbstractArrow life
public net.minecraft.world.entity.projectile.AbstractArrow pickupItemStack
public net.minecraft.world.entity.projectile.AbstractArrow setPickupItemStack(Lnet/minecraft/world/item/ItemStack;)V
public net.minecraft.world.entity.projectile.AbstractArrow setPierceLevel(B)V
public net.minecraft.world.entity.projectile.AbstractHurtingProjectile assignDirectionalMovement(Lnet/minecraft/world/phys/Vec3;D)V public net.minecraft.world.entity.projectile.AbstractHurtingProjectile assignDirectionalMovement(Lnet/minecraft/world/phys/Vec3;D)V
public net.minecraft.world.entity.projectile.Arrow NO_EFFECT_COLOR public net.minecraft.world.entity.projectile.Arrow NO_EFFECT_COLOR
public net.minecraft.world.entity.projectile.Arrow getPotionContents()Lnet/minecraft/world/item/alchemy/PotionContents; public net.minecraft.world.entity.projectile.Arrow getPotionContents()Lnet/minecraft/world/item/alchemy/PotionContents;
@ -481,7 +447,7 @@ public net.minecraft.world.entity.projectile.ShulkerBullet targetDeltaX
public net.minecraft.world.entity.projectile.ShulkerBullet targetDeltaY public net.minecraft.world.entity.projectile.ShulkerBullet targetDeltaY
public net.minecraft.world.entity.projectile.ShulkerBullet targetDeltaZ public net.minecraft.world.entity.projectile.ShulkerBullet targetDeltaZ
public net.minecraft.world.entity.projectile.SpectralArrow duration public net.minecraft.world.entity.projectile.SpectralArrow duration
public net.minecraft.world.entity.projectile.ThrowableItemProjectile getDefaultItem()Lnet/minecraft/world/item/Item; public net.minecraft.world.entity.projectile.ThrownPotion isLingering()Z
public net.minecraft.world.entity.projectile.ThrownTrident dealtDamage public net.minecraft.world.entity.projectile.ThrownTrident dealtDamage
public net.minecraft.world.entity.projectile.windcharge.AbstractWindCharge explode(Lnet/minecraft/world/phys/Vec3;)V public net.minecraft.world.entity.projectile.windcharge.AbstractWindCharge explode(Lnet/minecraft/world/phys/Vec3;)V
public net.minecraft.world.entity.projectile.windcharge.BreezeWindCharge explode(Lnet/minecraft/world/phys/Vec3;)V public net.minecraft.world.entity.projectile.windcharge.BreezeWindCharge explode(Lnet/minecraft/world/phys/Vec3;)V
@ -494,6 +460,7 @@ public net.minecraft.world.entity.raid.Raid ticksActive
public net.minecraft.world.entity.raid.Raid totalHealth public net.minecraft.world.entity.raid.Raid totalHealth
public net.minecraft.world.entity.raid.Raider$HoldGroundAttackGoal public net.minecraft.world.entity.raid.Raider$HoldGroundAttackGoal
public net.minecraft.world.entity.raid.Raids raidMap public net.minecraft.world.entity.raid.Raids raidMap
public net.minecraft.world.entity.vehicle.AbstractBoat getDropItem()Lnet/minecraft/world/item/Item;
public net.minecraft.world.entity.vehicle.AbstractBoat getStatus()Lnet/minecraft/world/entity/vehicle/AbstractBoat$Status; public net.minecraft.world.entity.vehicle.AbstractBoat getStatus()Lnet/minecraft/world/entity/vehicle/AbstractBoat$Status;
public net.minecraft.world.entity.vehicle.AbstractBoat status public net.minecraft.world.entity.vehicle.AbstractBoat status
public net.minecraft.world.entity.vehicle.AbstractMinecartContainer lootTable public net.minecraft.world.entity.vehicle.AbstractMinecartContainer lootTable
@ -504,14 +471,12 @@ public net.minecraft.world.entity.vehicle.MinecartTNT explode(D)V
public net.minecraft.world.entity.vehicle.MinecartTNT explosionPowerBase public net.minecraft.world.entity.vehicle.MinecartTNT explosionPowerBase
public net.minecraft.world.entity.vehicle.MinecartTNT explosionSpeedFactor public net.minecraft.world.entity.vehicle.MinecartTNT explosionSpeedFactor
public net.minecraft.world.entity.vehicle.MinecartTNT fuse public net.minecraft.world.entity.vehicle.MinecartTNT fuse
public net.minecraft.world.entity.vehicle.VehicleEntity getDropItem()Lnet/minecraft/world/item/Item;
public net.minecraft.world.flag.FeatureFlag mask public net.minecraft.world.flag.FeatureFlag mask
public net.minecraft.world.flag.FeatureFlag universe public net.minecraft.world.flag.FeatureFlag universe
public net.minecraft.world.flag.FeatureFlagRegistry names public net.minecraft.world.flag.FeatureFlagRegistry names
public net.minecraft.world.food.FoodData exhaustionLevel public net.minecraft.world.food.FoodData exhaustionLevel
public net.minecraft.world.food.FoodData foodLevel public net.minecraft.world.food.FoodData foodLevel
public net.minecraft.world.food.FoodData saturationLevel public net.minecraft.world.food.FoodData saturationLevel
public net.minecraft.world.inventory.AbstractContainerMenu menuType
public net.minecraft.world.inventory.AbstractContainerMenu quickcraftSlots public net.minecraft.world.inventory.AbstractContainerMenu quickcraftSlots
public net.minecraft.world.inventory.AbstractContainerMenu quickcraftStatus public net.minecraft.world.inventory.AbstractContainerMenu quickcraftStatus
public net.minecraft.world.inventory.AbstractContainerMenu quickcraftType public net.minecraft.world.inventory.AbstractContainerMenu quickcraftType
@ -525,9 +490,6 @@ public net.minecraft.world.inventory.BrewingStandMenu brewingStandData
public net.minecraft.world.inventory.CraftingMenu access public net.minecraft.world.inventory.CraftingMenu access
public net.minecraft.world.inventory.DispenserMenu dispenser public net.minecraft.world.inventory.DispenserMenu dispenser
public net.minecraft.world.inventory.HorseInventoryMenu SLOT_BODY_ARMOR public net.minecraft.world.inventory.HorseInventoryMenu SLOT_BODY_ARMOR
public net.minecraft.world.inventory.HorseInventoryMenu SLOT_HORSE_INVENTORY_START
public net.minecraft.world.inventory.HorseInventoryMenu SLOT_SADDLE
public net.minecraft.world.inventory.HorseInventoryMenu horse
public net.minecraft.world.inventory.MerchantContainer selectionHint public net.minecraft.world.inventory.MerchantContainer selectionHint
public net.minecraft.world.inventory.Slot slot public net.minecraft.world.inventory.Slot slot
public net.minecraft.world.item.AdventureModePredicate predicates public net.minecraft.world.item.AdventureModePredicate predicates
@ -539,15 +501,15 @@ public net.minecraft.world.item.ItemCooldowns tickCount
public net.minecraft.world.item.ItemCooldowns$CooldownInstance public net.minecraft.world.item.ItemCooldowns$CooldownInstance
public net.minecraft.world.item.ItemStackLinkedSet TYPE_AND_TAG public net.minecraft.world.item.ItemStackLinkedSet TYPE_AND_TAG
public net.minecraft.world.item.JukeboxSongPlayer song public net.minecraft.world.item.JukeboxSongPlayer song
public net.minecraft.world.item.MapItem createNewSavedData(Lnet/minecraft/server/level/ServerLevel;IIIZZLnet/minecraft/resources/ResourceKey;)Lnet/minecraft/world/level/saveddata/maps/MapId; public net.minecraft.world.item.MapItem createNewSavedData(Lnet/minecraft/world/level/Level;IIIZZLnet/minecraft/resources/ResourceKey;)Lnet/minecraft/world/level/saveddata/maps/MapId;
public net.minecraft.world.item.StandingAndWallBlockItem wallBlock public net.minecraft.world.item.StandingAndWallBlockItem wallBlock
public net.minecraft.world.item.component.BundleContents$Mutable getMaxAmountToAdd(Lnet/minecraft/world/item/ItemStack;)I
public net.minecraft.world.item.component.ItemContainerContents MAX_SIZE public net.minecraft.world.item.component.ItemContainerContents MAX_SIZE
public net.minecraft.world.item.component.ItemContainerContents items public net.minecraft.world.item.component.ItemContainerContents items
public net.minecraft.world.item.context.UseOnContext <init>(Lnet/minecraft/world/level/Level;Lnet/minecraft/world/entity/player/Player;Lnet/minecraft/world/InteractionHand;Lnet/minecraft/world/item/ItemStack;Lnet/minecraft/world/phys/BlockHitResult;)V public net.minecraft.world.item.context.UseOnContext <init>(Lnet/minecraft/world/level/Level;Lnet/minecraft/world/entity/player/Player;Lnet/minecraft/world/InteractionHand;Lnet/minecraft/world/item/ItemStack;Lnet/minecraft/world/phys/BlockHitResult;)V
public net.minecraft.world.item.crafting.RecipeManager recipes public net.minecraft.world.item.crafting.RecipeManager recipes
public net.minecraft.world.item.crafting.RecipeMap byKey public net.minecraft.world.item.crafting.RecipeMap byKey
public net.minecraft.world.item.crafting.RecipeMap byType public net.minecraft.world.item.crafting.RecipeMap byType
public net.minecraft.world.item.enchantment.ItemEnchantments showInTooltip
public net.minecraft.world.item.trading.MerchantOffer demand public net.minecraft.world.item.trading.MerchantOffer demand
public net.minecraft.world.item.trading.MerchantOffer result public net.minecraft.world.item.trading.MerchantOffer result
public net.minecraft.world.item.trading.MerchantOffer specialPriceDiff public net.minecraft.world.item.trading.MerchantOffer specialPriceDiff
@ -564,10 +526,7 @@ public net.minecraft.world.level.BaseSpawner spawnCount
public net.minecraft.world.level.BaseSpawner spawnDelay public net.minecraft.world.level.BaseSpawner spawnDelay
public net.minecraft.world.level.BaseSpawner spawnPotentials public net.minecraft.world.level.BaseSpawner spawnPotentials
public net.minecraft.world.level.BaseSpawner spawnRange public net.minecraft.world.level.BaseSpawner spawnRange
public net.minecraft.world.level.GameRules GAME_RULE_TYPES
public net.minecraft.world.level.GameRules$Value deserialize(Ljava/lang/String;)V
public net.minecraft.world.level.GameRules$Value onChanged(Lnet/minecraft/server/MinecraftServer;)V public net.minecraft.world.level.GameRules$Value onChanged(Lnet/minecraft/server/MinecraftServer;)V
public net.minecraft.world.level.Level blockEntityTickers
public net.minecraft.world.level.Level getEntities()Lnet/minecraft/world/level/entity/LevelEntityGetter; public net.minecraft.world.level.Level getEntities()Lnet/minecraft/world/level/entity/LevelEntityGetter;
public net.minecraft.world.level.Level levelData public net.minecraft.world.level.Level levelData
public net.minecraft.world.level.Level rainLevel public net.minecraft.world.level.Level rainLevel
@ -575,7 +534,6 @@ public net.minecraft.world.level.Level thread
public net.minecraft.world.level.Level thunderLevel public net.minecraft.world.level.Level thunderLevel
public net.minecraft.world.level.NaturalSpawner SPAWNING_CATEGORIES public net.minecraft.world.level.NaturalSpawner SPAWNING_CATEGORIES
public net.minecraft.world.level.StructureManager level public net.minecraft.world.level.StructureManager level
public net.minecraft.world.level.TicketStorage tickets
public net.minecraft.world.level.biome.Biome climateSettings public net.minecraft.world.level.biome.Biome climateSettings
public net.minecraft.world.level.biome.Biome getTemperature(Lnet/minecraft/core/BlockPos;I)F public net.minecraft.world.level.biome.Biome getTemperature(Lnet/minecraft/core/BlockPos;I)F
public net.minecraft.world.level.biome.Biome$ClimateSettings public net.minecraft.world.level.biome.Biome$ClimateSettings
@ -600,7 +558,6 @@ public net.minecraft.world.level.block.entity.AbstractFurnaceBlockEntity cooking
public net.minecraft.world.level.block.entity.AbstractFurnaceBlockEntity getTotalCookTime(Lnet/minecraft/server/level/ServerLevel;Lnet/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity;)I public net.minecraft.world.level.block.entity.AbstractFurnaceBlockEntity getTotalCookTime(Lnet/minecraft/server/level/ServerLevel;Lnet/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity;)I
public net.minecraft.world.level.block.entity.AbstractFurnaceBlockEntity litTimeRemaining public net.minecraft.world.level.block.entity.AbstractFurnaceBlockEntity litTimeRemaining
public net.minecraft.world.level.block.entity.AbstractFurnaceBlockEntity recipesUsed public net.minecraft.world.level.block.entity.AbstractFurnaceBlockEntity recipesUsed
public net.minecraft.world.level.block.entity.BannerBlockEntity name
public net.minecraft.world.level.block.entity.BarrelBlockEntity openersCounter public net.minecraft.world.level.block.entity.BarrelBlockEntity openersCounter
public net.minecraft.world.level.block.entity.BarrelBlockEntity playSound(Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/sounds/SoundEvent;)V public net.minecraft.world.level.block.entity.BarrelBlockEntity playSound(Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/sounds/SoundEvent;)V
public net.minecraft.world.level.block.entity.BarrelBlockEntity updateBlockState(Lnet/minecraft/world/level/block/state/BlockState;Z)V public net.minecraft.world.level.block.entity.BarrelBlockEntity updateBlockState(Lnet/minecraft/world/level/block/state/BlockState;Z)V
@ -645,7 +602,6 @@ public net.minecraft.world.level.block.entity.SculkSensorBlockEntity lastVibrati
public net.minecraft.world.level.block.entity.SculkShriekerBlockEntity warningLevel public net.minecraft.world.level.block.entity.SculkShriekerBlockEntity warningLevel
public net.minecraft.world.level.block.entity.ShulkerBoxBlockEntity openCount public net.minecraft.world.level.block.entity.ShulkerBoxBlockEntity openCount
public net.minecraft.world.level.block.entity.SignBlockEntity playerWhoMayEdit public net.minecraft.world.level.block.entity.SignBlockEntity playerWhoMayEdit
public net.minecraft.world.level.block.entity.SkullBlockEntity customName
public net.minecraft.world.level.block.entity.SkullBlockEntity noteBlockSound public net.minecraft.world.level.block.entity.SkullBlockEntity noteBlockSound
public net.minecraft.world.level.block.entity.SkullBlockEntity owner public net.minecraft.world.level.block.entity.SkullBlockEntity owner
public net.minecraft.world.level.block.entity.StructureBlockEntity author public net.minecraft.world.level.block.entity.StructureBlockEntity author
@ -666,16 +622,9 @@ public net.minecraft.world.level.block.entity.TheEndGatewayBlockEntity exitPorta
public net.minecraft.world.level.block.entity.TrialSpawnerBlockEntity trialSpawner public net.minecraft.world.level.block.entity.TrialSpawnerBlockEntity trialSpawner
public net.minecraft.world.level.block.entity.trialspawner.TrialSpawner isOminous public net.minecraft.world.level.block.entity.trialspawner.TrialSpawner isOminous
public net.minecraft.world.level.block.entity.trialspawner.TrialSpawner stateAccessor public net.minecraft.world.level.block.entity.trialspawner.TrialSpawner stateAccessor
public net.minecraft.world.level.block.entity.trialspawner.TrialSpawnerData cooldownEndsAt
public net.minecraft.world.level.block.entity.trialspawner.TrialSpawnerData currentMobs public net.minecraft.world.level.block.entity.trialspawner.TrialSpawnerData currentMobs
public net.minecraft.world.level.block.entity.trialspawner.TrialSpawnerData detectedPlayers public net.minecraft.world.level.block.entity.trialspawner.TrialSpawnerData detectedPlayers
public net.minecraft.world.level.block.entity.trialspawner.TrialSpawnerData nextMobSpawnsAt
public net.minecraft.world.level.block.entity.trialspawner.TrialSpawnerData nextSpawnData public net.minecraft.world.level.block.entity.trialspawner.TrialSpawnerData nextSpawnData
public net.minecraft.world.level.block.entity.vault.VaultBlockEntity serverData
public net.minecraft.world.level.block.entity.vault.VaultServerData getRewardedPlayers()Ljava/util/Set;
public net.minecraft.world.level.block.entity.vault.VaultServerData pauseStateUpdatingUntil(J)V
public net.minecraft.world.level.block.entity.vault.VaultServerData stateUpdatingResumesAt()J
public net.minecraft.world.level.block.entity.vault.VaultSharedData getConnectedPlayers()Ljava/util/Set;
public net.minecraft.world.level.block.state.BlockBehaviour getMenuProvider(Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;)Lnet/minecraft/world/MenuProvider; public net.minecraft.world.level.block.state.BlockBehaviour getMenuProvider(Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;)Lnet/minecraft/world/MenuProvider;
public net.minecraft.world.level.block.state.BlockBehaviour hasCollision public net.minecraft.world.level.block.state.BlockBehaviour hasCollision
public net.minecraft.world.level.block.state.BlockBehaviour$BlockStateBase destroySpeed public net.minecraft.world.level.block.state.BlockBehaviour$BlockStateBase destroySpeed
@ -689,7 +638,6 @@ public net.minecraft.world.level.chunk.LevelChunk level
public net.minecraft.world.level.chunk.LevelChunk loaded public net.minecraft.world.level.chunk.LevelChunk loaded
public net.minecraft.world.level.chunk.LevelChunkSection states public net.minecraft.world.level.chunk.LevelChunkSection states
public net.minecraft.world.level.chunk.PalettedContainer registry public net.minecraft.world.level.chunk.PalettedContainer registry
public net.minecraft.world.level.chunk.status.ChunkStatusTasks postLoadProtoChunk(Lnet/minecraft/server/level/ServerLevel;Ljava/util/List;)V
public net.minecraft.world.level.chunk.storage.EntityStorage entityDeserializerQueue public net.minecraft.world.level.chunk.storage.EntityStorage entityDeserializerQueue
public net.minecraft.world.level.chunk.storage.EntityStorage level public net.minecraft.world.level.chunk.storage.EntityStorage level
public net.minecraft.world.level.chunk.storage.RegionFileStorage regionCache public net.minecraft.world.level.chunk.storage.RegionFileStorage regionCache
@ -722,7 +670,6 @@ public net.minecraft.world.level.levelgen.SurfaceRules$LazyCondition
public net.minecraft.world.level.levelgen.SurfaceRules$LazyYCondition public net.minecraft.world.level.levelgen.SurfaceRules$LazyYCondition
public net.minecraft.world.level.levelgen.SurfaceRules$SurfaceRule public net.minecraft.world.level.levelgen.SurfaceRules$SurfaceRule
public net.minecraft.world.level.levelgen.SurfaceRules$VerticalGradientConditionSource public net.minecraft.world.level.levelgen.SurfaceRules$VerticalGradientConditionSource
public net.minecraft.world.level.levelgen.structure.StructurePiece SHAPE_CHECK_BLOCKS
public net.minecraft.world.level.levelgen.structure.placement.StructurePlacement exclusionZone public net.minecraft.world.level.levelgen.structure.placement.StructurePlacement exclusionZone
public net.minecraft.world.level.levelgen.structure.placement.StructurePlacement frequency public net.minecraft.world.level.levelgen.structure.placement.StructurePlacement frequency
public net.minecraft.world.level.levelgen.structure.placement.StructurePlacement frequencyReductionMethod public net.minecraft.world.level.levelgen.structure.placement.StructurePlacement frequencyReductionMethod
@ -754,6 +701,7 @@ public-f net.minecraft.server.ReloadableServerResources commands
public-f net.minecraft.server.dedicated.DedicatedServer serverLinks public-f net.minecraft.server.dedicated.DedicatedServer serverLinks
public-f net.minecraft.server.dedicated.DedicatedServer settings public-f net.minecraft.server.dedicated.DedicatedServer settings
public-f net.minecraft.server.dedicated.DedicatedServerProperties pauseWhenEmptySeconds public-f net.minecraft.server.dedicated.DedicatedServerProperties pauseWhenEmptySeconds
public-f net.minecraft.server.level.TicketType timeout
public-f net.minecraft.server.players.PlayerList maxPlayers public-f net.minecraft.server.players.PlayerList maxPlayers
public-f net.minecraft.world.entity.LivingEntity combatTracker public-f net.minecraft.world.entity.LivingEntity combatTracker
public-f net.minecraft.world.entity.LivingEntity invulnerableDuration public-f net.minecraft.world.entity.LivingEntity invulnerableDuration
@ -766,6 +714,7 @@ public-f net.minecraft.world.inventory.AbstractContainerMenu lastSlots
public-f net.minecraft.world.inventory.AbstractContainerMenu remoteDataSlots public-f net.minecraft.world.inventory.AbstractContainerMenu remoteDataSlots
public-f net.minecraft.world.inventory.AbstractContainerMenu remoteSlots public-f net.minecraft.world.inventory.AbstractContainerMenu remoteSlots
public-f net.minecraft.world.inventory.AbstractContainerMenu slots public-f net.minecraft.world.inventory.AbstractContainerMenu slots
public-f net.minecraft.world.item.enchantment.ItemEnchantments$Mutable showInTooltip
public-f net.minecraft.world.item.trading.MerchantOffer baseCostA public-f net.minecraft.world.item.trading.MerchantOffer baseCostA
public-f net.minecraft.world.item.trading.MerchantOffer costB public-f net.minecraft.world.item.trading.MerchantOffer costB
public-f net.minecraft.world.item.trading.MerchantOffer maxUses public-f net.minecraft.world.item.trading.MerchantOffer maxUses
@ -774,7 +723,6 @@ public-f net.minecraft.world.item.trading.MerchantOffer rewardExp
public-f net.minecraft.world.item.trading.MerchantOffer xp public-f net.minecraft.world.item.trading.MerchantOffer xp
public-f net.minecraft.world.level.LevelSettings hardcore public-f net.minecraft.world.level.LevelSettings hardcore
public-f net.minecraft.world.level.LevelSettings levelName public-f net.minecraft.world.level.LevelSettings levelName
public-f net.minecraft.world.level.block.ChestBlock MENU_PROVIDER_COMBINER
public-f net.minecraft.world.level.block.entity.BannerBlockEntity baseColor public-f net.minecraft.world.level.block.entity.BannerBlockEntity baseColor
public-f net.minecraft.world.level.block.entity.trialspawner.TrialSpawner normalConfig public-f net.minecraft.world.level.block.entity.trialspawner.TrialSpawner normalConfig
public-f net.minecraft.world.level.block.entity.trialspawner.TrialSpawner ominousConfig public-f net.minecraft.world.level.block.entity.trialspawner.TrialSpawner ominousConfig

View File

@ -1,8 +1,18 @@
import io.papermc.paperweight.util.*
import io.papermc.paperweight.util.constants.*
import org.gradle.api.tasks.testing.logging.TestExceptionFormat import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.gradle.api.tasks.testing.logging.TestLogEvent import org.gradle.api.tasks.testing.logging.TestLogEvent
import java.io.IOException
import java.net.URI
import java.nio.file.FileVisitResult
import java.nio.file.Files
import java.nio.file.SimpleFileVisitor
import kotlin.io.path.*
import java.nio.file.Path
import kotlin.random.Random
plugins { plugins {
id("io.papermc.paperweight.core") version "2.0.0-beta.17" apply false id("io.papermc.paperweight.core") version "2.0.0-beta.10" apply false
} }
subprojects { subprojects {
@ -28,7 +38,6 @@ subprojects {
options.encoding = Charsets.UTF_8.name() options.encoding = Charsets.UTF_8.name()
options.release = 21 options.release = 21
options.isFork = true options.isFork = true
options.compilerArgs.addAll(listOf("-Xlint:-deprecation", "-Xlint:-removal"))
} }
tasks.withType<Javadoc> { tasks.withType<Javadoc> {
options.encoding = Charsets.UTF_8.name() options.encoding = Charsets.UTF_8.name()
@ -72,3 +81,248 @@ tasks.register("printPaperVersion") {
println(paperVersion.get()) println(paperVersion.get())
} }
} }
/*
// Used when updating to a new Minecraft version
tasks.register("pickUpdateDirectory") {
val issue = providers.gradleProperty("updateTaskListIssue").get()
val patchesFolder = layout.projectDirectory.dir("paper-server/patches/").convertToPath()
val storage = layout.cache.resolve("last-updating-folder").also { it.parent.createDirectories() }
doLast {
val html = URI(issue).toURL().readText()
val beginMarker = "```[tasklist]"
val start = html.indexOf(beginMarker)
val end = html.indexOf("```", start + beginMarker.length)
val taskList = html.substring(start + beginMarker.length, end)
// Extract all incomplete tasks and select a random one
val incompleteTasks = taskList.split("\\n").filter { it.startsWith("- [ ]") }.map { it.replace("- [ ] ", "") }
if (incompleteTasks.isEmpty()) {
error("No incomplete tasks found in the task list.")
}
val next = incompleteTasks[Random.nextInt(incompleteTasks.size)]
println("checking out $next...")
val dir = patchesFolder.resolve("unapplied").resolve(next)
if (!dir.exists()) {
error("Unapplied patch folder $next does not exist, did someone else already check it out and forgot to mark it?")
}
dir.listDirectoryEntries("*.patch").forEach { patch ->
patch.copyTo(patchesFolder.resolve("sources").resolve(next).resolve(patch.fileName).also { it.createDirectories() }, overwrite = true)
patch.deleteIfExists()
}
if (dir.listDirectoryEntries().isEmpty()) {
dir.deleteIfExists()
}
storage.writeText(next)
println("please tick the box in the issue: $issue")
println("if you don't finish it, uncheck the task again after you commited")
}
}
tasks.register("showUpdateDirectories") {
val patchDir = layout.projectDirectory.dir("paper-server/patches/unapplied/").convertToPath()
doLast {
Files.walkFileTree(patchDir, object : SimpleFileVisitor<Path>() {
override fun postVisitDirectory(dir: Path?, exc: IOException?): FileVisitResult {
dir?.takeIf { it.listDirectoryEntries("*.patch").isNotEmpty() }?.let {
println("- [ ] ${patchDir.relativize(it).pathString.replace("\\", "/")}")
}
return FileVisitResult.CONTINUE
}
})
}
}
tasks.register("moveUpdateDirectory") {
notCompatibleWithConfigurationCache("This task is interactive")
fun expandUserHome(path: String): Path {
return Path.of(path.replaceFirst("^~".toRegex(), System.getProperty("user.home")))
}
val input = providers.fileContents(layout.projectDirectory.file("$CACHE_PATH/last-updating-folder")).asText.map { it.trim() }
val patchFolder = layout.projectDirectory.dir("paper-server/patches/sources").dir(input)
val sourceFolder = layout.projectDirectory.dir("paper-server/src/minecraft/java").dir(input)
val targetFolder = providers.gradleProperty("cleanPaperRepo").map {
expandUserHome(it).resolve(input.get())
}
fun copy(back: Boolean = false) {
patchFolder.path.listDirectoryEntries().forEach {
val relative = patchFolder.path.relativize(it).toString().replace(".patch", "")
val source = sourceFolder.path.resolve(relative)
val target = targetFolder.get().resolve(relative)
if (target.isDirectory()) { return@forEach }
if (back) {
target.copyTo(source, overwrite = true)
} else {
source.copyTo(target, overwrite = true)
}
}
}
doLast {
if (!targetFolder.isPresent) {
error("cleanPaperRepo is required, define it in gradle.properties")
}
copy()
val files = patchFolder.path.listDirectoryEntries().map { it.fileName.toString().replace(".patch", "") }
println("Copied $files from $sourceFolder to $targetFolder")
println("Make the files compile, then press enter to copy them back!")
System.`in`.read()
copy(back = true)
println("copied back!")
}
}
// see gradle.properties
if (providers.gradleProperty("updatingMinecraft").getOrElse("false").toBoolean()) {
tasks.collectAtsFromPatches {
val dir = layout.projectDirectory.dir("patches/unapplied/server")
if (dir.path.isDirectory()) {
extraPatchDir = dir
}
}
tasks.withType<io.papermc.paperweight.tasks.RebuildGitPatches>().configureEach {
filterPatches = false
}
tasks.register("continueServerUpdate", RebasePatches::class) {
description = "Moves the next X patches from unapplied to applied, and applies them. X being the number of patches that apply cleanly, plus the terminal failure if any."
projectDir = project.projectDir
appliedPatches = file("patches/server")
unappliedPatches = file("patches/unapplied/server")
applyTaskName = "applyServerPatches"
patchedDir = "Paper-Server"
}
}
@UntrackedTask(because = "Does not make sense to track state")
abstract class RebasePatches : BaseTask() {
@get:Internal
abstract val projectDir: DirectoryProperty
@get:InputFiles
abstract val appliedPatches: DirectoryProperty
@get:InputFiles
abstract val unappliedPatches: DirectoryProperty
@get:Input
abstract val applyTaskName: Property<String>
@get:Input
abstract val patchedDir: Property<String>
private fun unapplied(): List<Path> =
unappliedPatches.path.listDirectoryEntries("*.patch").sortedBy { it.name }
private fun appliedLoc(patch: Path): Path = appliedPatches.path.resolve(unappliedPatches.path.relativize(patch))
companion object {
val regex = Pattern.compile("Patch failed at ([0-9]{4}) (.*)")
val continuationRegex = Pattern.compile("^\\s{1}.+\$")
const val subjectPrefix = "Subject: [PATCH] "
}
@TaskAction
fun run() {
val patchedDirPath = projectDir.path.resolve(patchedDir.get())
if (patchedDirPath.isDirectory()) {
val status = Git(patchedDirPath)("status").getText()
if (status.contains("You are in the middle of an am session.")) {
throw PaperweightException("Cannot continue update when $patchedDirPath is in the middle of an am session.")
}
}
val unapplied = unapplied()
for (patch in unapplied) {
patch.copyTo(appliedLoc(patch))
}
val out = ByteArrayOutputStream()
val proc = ProcessBuilder()
.directory(projectDir.path)
.command("./gradlew", applyTaskName.get())
.redirectErrorStream(true)
.start()
val f = redirect(proc.inputStream, out)
val exit = proc.waitFor()
f.get()
if (exit != 0) {
val outStr = String(out.toByteArray())
val matcher = regex.matcher(outStr)
if (!matcher.find()) error("Could not determine failure point")
val failedSubjectFragment = matcher.group(2)
val failed = unapplied.single { p ->
p.useLines { lines ->
val collect = mutableListOf<String>()
for (line in lines) {
if (line.startsWith(subjectPrefix)) {
collect += line
} else if (collect.size == 1) {
if (continuationRegex.matcher(line).matches()) {
collect += line
} else {
break
}
}
}
val subjectLine = collect.joinToString("").substringAfter(subjectPrefix)
subjectLine.startsWith(failedSubjectFragment)
}
}
// delete successful & failure point from unapplied patches dir
for (path in unapplied) {
path.deleteIfExists()
if (path == failed) {
break
}
}
// delete failed from patches dir
var started = false
for (path in unapplied) {
if (path == failed) {
started = true
continue
}
if (started) {
appliedLoc(path).deleteIfExists()
}
}
// Delete the build file before resetting the AM session in case it has compilation errors
patchedDirPath.resolve("build.gradle.kts").deleteIfExists()
// Apply again to reset the am session (so it ends on the failed patch, to allow us to rebuild after fixing it)
val apply2 = ProcessBuilder()
.directory(projectDir.path)
.command("./gradlew", applyTaskName.get())
.redirectErrorStream(true)
.start()
val f1 = redirect(apply2.inputStream, System.out)
apply2.waitFor()
f1.get()
logger.lifecycle(outStr)
logger.lifecycle("Patch failed at $failed; See Git output above.")
} else {
unapplied.forEach { it.deleteIfExists() }
logger.lifecycle("All patches applied!")
}
val git = Git(projectDir.path)
git("add", appliedPatches.path.toString() + "/*").runSilently()
git("add", unappliedPatches.path.toString() + "/*").runSilently()
}
}
*/

View File

@ -1,9 +1,9 @@
group=io.papermc.paper group=io.papermc.paper
version=1.21.5-R0.1-SNAPSHOT version=1.21.4-R0.1-SNAPSHOT
mcVersion=1.21.5 mcVersion=1.21.4
# Set to true while updating Minecraft version # Set to true while updating Minecraft version
updatingMinecraft=true updatingMinecraft=false
updateTaskListIssue=https://github.com/PaperMC/Paper/issues/11736 updateTaskListIssue=https://github.com/PaperMC/Paper/issues/11736
org.gradle.configuration-cache=true org.gradle.configuration-cache=true

Binary file not shown.

View File

@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip
networkTimeout=10000 networkTimeout=10000
validateDistributionUrl=true validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME

6
gradlew vendored
View File

@ -114,7 +114,7 @@ case "$( uname )" in #(
NONSTOP* ) nonstop=true ;; NONSTOP* ) nonstop=true ;;
esac esac
CLASSPATH="\\\"\\\"" CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM. # Determine the Java command to use to start the JVM.
@ -205,7 +205,7 @@ fi
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Collect all arguments for the java command: # Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, # * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped. # and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be # * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line. # treated as '${Hostname}' itself on the command line.
@ -213,7 +213,7 @@ DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
set -- \ set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \ "-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \ -classpath "$CLASSPATH" \
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \ org.gradle.wrapper.GradleWrapperMain \
"$@" "$@"
# Stop when "xargs" is not available. # Stop when "xargs" is not available.

4
gradlew.bat vendored
View File

@ -70,11 +70,11 @@ goto fail
:execute :execute
@rem Setup the command line @rem Setup the command line
set CLASSPATH= set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle @rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
:end :end
@rem End local scope for the variables with windows NT shell @rem End local scope for the variables with windows NT shell

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(projectDir.toPath().resolve("generated").toString())
javaLauncher = javaToolchains.defaultJavaLauncher(project)
}
tasks.test {
useJUnitPlatform()
}
group = "io.papermc.paper"
version = "1.0-SNAPSHOT"

View File

@ -66,8 +66,8 @@ import org.jspecify.annotations.NullMarked;
"unused", "unused",
"SpellCheckingInspection" "SpellCheckingInspection"
}) })
@GeneratedFrom("1.21.4")
@NullMarked @NullMarked
@GeneratedFrom("1.21.5")
public interface VanillaGoal<T extends Mob> extends Goal<T> { public interface VanillaGoal<T extends Mob> extends Goal<T> {
GoalKey<AbstractHorse> RANDOM_STAND = create("random_stand", AbstractHorse.class); GoalKey<AbstractHorse> RANDOM_STAND = create("random_stand", AbstractHorse.class);

View File

@ -7,6 +7,7 @@ import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.TypedKey; import io.papermc.paper.registry.TypedKey;
import net.kyori.adventure.key.Key; import net.kyori.adventure.key.Key;
import org.bukkit.attribute.Attribute; import org.bukkit.attribute.Attribute;
import org.jetbrains.annotations.ApiStatus;
import org.jspecify.annotations.NullMarked; import org.jspecify.annotations.NullMarked;
/** /**
@ -22,8 +23,9 @@ import org.jspecify.annotations.NullMarked;
"unused", "unused",
"SpellCheckingInspection" "SpellCheckingInspection"
}) })
@GeneratedFrom("1.21.4")
@NullMarked @NullMarked
@GeneratedFrom("1.21.5") @ApiStatus.Experimental
public final class AttributeKeys { public final class AttributeKeys {
/** /**
* {@code minecraft:armor} * {@code minecraft:armor}

View File

@ -7,6 +7,7 @@ import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.TypedKey; import io.papermc.paper.registry.TypedKey;
import net.kyori.adventure.key.Key; import net.kyori.adventure.key.Key;
import org.bukkit.block.banner.PatternType; import org.bukkit.block.banner.PatternType;
import org.jetbrains.annotations.ApiStatus;
import org.jspecify.annotations.NullMarked; import org.jspecify.annotations.NullMarked;
/** /**
@ -22,8 +23,9 @@ import org.jspecify.annotations.NullMarked;
"unused", "unused",
"SpellCheckingInspection" "SpellCheckingInspection"
}) })
@GeneratedFrom("1.21.4")
@NullMarked @NullMarked
@GeneratedFrom("1.21.5") @ApiStatus.Experimental
public final class BannerPatternKeys { public final class BannerPatternKeys {
/** /**
* {@code minecraft:base} * {@code minecraft:base}
@ -330,11 +332,12 @@ 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 * @param key the value's key in the registry
* @return a new typed key * @return a new typed key
*/ */
@ApiStatus.Experimental
public static TypedKey<PatternType> create(final Key key) { public static TypedKey<PatternType> create(final Key key) {
return TypedKey.create(RegistryKey.BANNER_PATTERN, key); return TypedKey.create(RegistryKey.BANNER_PATTERN, key);
} }

View File

@ -7,6 +7,7 @@ import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.TypedKey; import io.papermc.paper.registry.TypedKey;
import net.kyori.adventure.key.Key; import net.kyori.adventure.key.Key;
import org.bukkit.block.Biome; import org.bukkit.block.Biome;
import org.jetbrains.annotations.ApiStatus;
import org.jspecify.annotations.NullMarked; import org.jspecify.annotations.NullMarked;
/** /**
@ -22,8 +23,9 @@ import org.jspecify.annotations.NullMarked;
"unused", "unused",
"SpellCheckingInspection" "SpellCheckingInspection"
}) })
@GeneratedFrom("1.21.4")
@NullMarked @NullMarked
@GeneratedFrom("1.21.5") @ApiStatus.Experimental
public final class BiomeKeys { public final class BiomeKeys {
/** /**
* {@code minecraft:badlands} * {@code minecraft:badlands}
@ -484,11 +486,12 @@ 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 * @param key the value's key in the registry
* @return a new typed key * @return a new typed key
*/ */
@ApiStatus.Experimental
public static TypedKey<Biome> create(final Key key) { public static TypedKey<Biome> create(final Key key) {
return TypedKey.create(RegistryKey.BIOME, key); return TypedKey.create(RegistryKey.BIOME, key);
} }

View File

@ -7,6 +7,7 @@ import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.TypedKey; import io.papermc.paper.registry.TypedKey;
import net.kyori.adventure.key.Key; import net.kyori.adventure.key.Key;
import org.bukkit.block.BlockType; import org.bukkit.block.BlockType;
import org.jetbrains.annotations.ApiStatus;
import org.jspecify.annotations.NullMarked; import org.jspecify.annotations.NullMarked;
/** /**
@ -22,8 +23,9 @@ import org.jspecify.annotations.NullMarked;
"unused", "unused",
"SpellCheckingInspection" "SpellCheckingInspection"
}) })
@GeneratedFrom("1.21.4")
@NullMarked @NullMarked
@GeneratedFrom("1.21.5") @ApiStatus.Experimental
public final class BlockTypeKeys { public final class BlockTypeKeys {
/** /**
* {@code minecraft:acacia_button} * {@code minecraft:acacia_button}
@ -1061,13 +1063,6 @@ public final class BlockTypeKeys {
*/ */
public static final TypedKey<BlockType> BUDDING_AMETHYST = create(key("budding_amethyst")); public static final TypedKey<BlockType> BUDDING_AMETHYST = create(key("budding_amethyst"));
/**
* {@code minecraft:bush}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<BlockType> BUSH = create(key("bush"));
/** /**
* {@code minecraft:cactus} * {@code minecraft:cactus}
* *
@ -1075,13 +1070,6 @@ public final class BlockTypeKeys {
*/ */
public static final TypedKey<BlockType> CACTUS = create(key("cactus")); public static final TypedKey<BlockType> CACTUS = create(key("cactus"));
/**
* {@code minecraft:cactus_flower}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<BlockType> CACTUS_FLOWER = create(key("cactus_flower"));
/** /**
* {@code minecraft:cake} * {@code minecraft:cake}
* *
@ -2699,13 +2687,6 @@ public final class BlockTypeKeys {
*/ */
public static final TypedKey<BlockType> FIRE_CORAL_WALL_FAN = create(key("fire_coral_wall_fan")); public static final TypedKey<BlockType> FIRE_CORAL_WALL_FAN = create(key("fire_coral_wall_fan"));
/**
* {@code minecraft:firefly_bush}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<BlockType> FIREFLY_BUSH = create(key("firefly_bush"));
/** /**
* {@code minecraft:fletching_table} * {@code minecraft:fletching_table}
* *
@ -3427,13 +3408,6 @@ public final class BlockTypeKeys {
*/ */
public static final TypedKey<BlockType> LAVA_CAULDRON = create(key("lava_cauldron")); public static final TypedKey<BlockType> LAVA_CAULDRON = create(key("lava_cauldron"));
/**
* {@code minecraft:leaf_litter}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<BlockType> LEAF_LITTER = create(key("leaf_litter"));
/** /**
* {@code minecraft:lectern} * {@code minecraft:lectern}
* *
@ -6108,13 +6082,6 @@ public final class BlockTypeKeys {
*/ */
public static final TypedKey<BlockType> SEAGRASS = create(key("seagrass")); public static final TypedKey<BlockType> SEAGRASS = create(key("seagrass"));
/**
* {@code minecraft:short_dry_grass}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<BlockType> SHORT_DRY_GRASS = create(key("short_dry_grass"));
/** /**
* {@code minecraft:short_grass} * {@code minecraft:short_grass}
* *
@ -6766,13 +6733,6 @@ public final class BlockTypeKeys {
*/ */
public static final TypedKey<BlockType> SWEET_BERRY_BUSH = create(key("sweet_berry_bush")); public static final TypedKey<BlockType> SWEET_BERRY_BUSH = create(key("sweet_berry_bush"));
/**
* {@code minecraft:tall_dry_grass}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<BlockType> TALL_DRY_GRASS = create(key("tall_dry_grass"));
/** /**
* {@code minecraft:tall_grass} * {@code minecraft:tall_grass}
* *
@ -6801,20 +6761,6 @@ public final class BlockTypeKeys {
*/ */
public static final TypedKey<BlockType> TERRACOTTA = create(key("terracotta")); public static final TypedKey<BlockType> TERRACOTTA = create(key("terracotta"));
/**
* {@code minecraft:test_block}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<BlockType> TEST_BLOCK = create(key("test_block"));
/**
* {@code minecraft:test_instance_block}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<BlockType> TEST_INSTANCE_BLOCK = create(key("test_instance_block"));
/** /**
* {@code minecraft:tinted_glass} * {@code minecraft:tinted_glass}
* *
@ -7613,13 +7559,6 @@ public final class BlockTypeKeys {
*/ */
public static final TypedKey<BlockType> WHITE_WOOL = create(key("white_wool")); public static final TypedKey<BlockType> WHITE_WOOL = create(key("white_wool"));
/**
* {@code minecraft:wildflowers}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<BlockType> WILDFLOWERS = create(key("wildflowers"));
/** /**
* {@code minecraft:wither_rose} * {@code minecraft:wither_rose}
* *

View File

@ -7,6 +7,7 @@ import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.TypedKey; import io.papermc.paper.registry.TypedKey;
import net.kyori.adventure.key.Key; import net.kyori.adventure.key.Key;
import org.bukkit.entity.Cat; import org.bukkit.entity.Cat;
import org.jetbrains.annotations.ApiStatus;
import org.jspecify.annotations.NullMarked; import org.jspecify.annotations.NullMarked;
/** /**
@ -22,8 +23,9 @@ import org.jspecify.annotations.NullMarked;
"unused", "unused",
"SpellCheckingInspection" "SpellCheckingInspection"
}) })
@GeneratedFrom("1.21.4")
@NullMarked @NullMarked
@GeneratedFrom("1.21.5") @ApiStatus.Experimental
public final class CatVariantKeys { public final class CatVariantKeys {
/** /**
* {@code minecraft:all_black} * {@code minecraft:all_black}
@ -105,13 +107,7 @@ public final class CatVariantKeys {
private CatVariantKeys() { private CatVariantKeys() {
} }
/** private static TypedKey<Cat.Type> create(final Key key) {
* Creates a typed key for {@link Cat.Type} in the registry {@code minecraft:cat_variant}.
*
* @param key the value's key in the registry
* @return a new typed key
*/
public static TypedKey<Cat.Type> create(final Key key) {
return TypedKey.create(RegistryKey.CAT_VARIANT, key); return TypedKey.create(RegistryKey.CAT_VARIANT, key);
} }
} }

View File

@ -7,6 +7,7 @@ import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.TypedKey; import io.papermc.paper.registry.TypedKey;
import net.kyori.adventure.key.Key; import net.kyori.adventure.key.Key;
import org.bukkit.damage.DamageType; import org.bukkit.damage.DamageType;
import org.jetbrains.annotations.ApiStatus;
import org.jspecify.annotations.NullMarked; import org.jspecify.annotations.NullMarked;
/** /**
@ -22,8 +23,9 @@ import org.jspecify.annotations.NullMarked;
"unused", "unused",
"SpellCheckingInspection" "SpellCheckingInspection"
}) })
@GeneratedFrom("1.21.4")
@NullMarked @NullMarked
@GeneratedFrom("1.21.5") @ApiStatus.Experimental
public final class DamageTypeKeys { public final class DamageTypeKeys {
/** /**
* {@code minecraft:arrow} * {@code minecraft:arrow}
@ -372,11 +374,12 @@ 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 * @param key the value's key in the registry
* @return a new typed key * @return a new typed key
*/ */
@ApiStatus.Experimental
public static TypedKey<DamageType> create(final Key key) { public static TypedKey<DamageType> create(final Key key) {
return TypedKey.create(RegistryKey.DAMAGE_TYPE, key); return TypedKey.create(RegistryKey.DAMAGE_TYPE, key);
} }

View File

@ -7,6 +7,7 @@ import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.TypedKey; import io.papermc.paper.registry.TypedKey;
import net.kyori.adventure.key.Key; import net.kyori.adventure.key.Key;
import org.bukkit.enchantments.Enchantment; import org.bukkit.enchantments.Enchantment;
import org.jetbrains.annotations.ApiStatus;
import org.jspecify.annotations.NullMarked; import org.jspecify.annotations.NullMarked;
/** /**
@ -22,8 +23,9 @@ import org.jspecify.annotations.NullMarked;
"unused", "unused",
"SpellCheckingInspection" "SpellCheckingInspection"
}) })
@GeneratedFrom("1.21.4")
@NullMarked @NullMarked
@GeneratedFrom("1.21.5") @ApiStatus.Experimental
public final class EnchantmentKeys { public final class EnchantmentKeys {
/** /**
* {@code minecraft:aqua_affinity} * {@code minecraft:aqua_affinity}
@ -323,11 +325,12 @@ 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 * @param key the value's key in the registry
* @return a new typed key * @return a new typed key
*/ */
@ApiStatus.Experimental
public static TypedKey<Enchantment> create(final Key key) { public static TypedKey<Enchantment> create(final Key key) {
return TypedKey.create(RegistryKey.ENCHANTMENT, key); return TypedKey.create(RegistryKey.ENCHANTMENT, key);
} }

View File

@ -7,6 +7,7 @@ import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.TypedKey; import io.papermc.paper.registry.TypedKey;
import net.kyori.adventure.key.Key; import net.kyori.adventure.key.Key;
import org.bukkit.Fluid; import org.bukkit.Fluid;
import org.jetbrains.annotations.ApiStatus;
import org.jspecify.annotations.NullMarked; import org.jspecify.annotations.NullMarked;
/** /**
@ -22,8 +23,9 @@ import org.jspecify.annotations.NullMarked;
"unused", "unused",
"SpellCheckingInspection" "SpellCheckingInspection"
}) })
@GeneratedFrom("1.21.4")
@NullMarked @NullMarked
@GeneratedFrom("1.21.5") @ApiStatus.Experimental
public final class FluidKeys { public final class FluidKeys {
/** /**
* {@code minecraft:empty} * {@code minecraft:empty}

View File

@ -7,6 +7,7 @@ import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.TypedKey; import io.papermc.paper.registry.TypedKey;
import net.kyori.adventure.key.Key; import net.kyori.adventure.key.Key;
import org.bukkit.entity.Frog; import org.bukkit.entity.Frog;
import org.jetbrains.annotations.ApiStatus;
import org.jspecify.annotations.NullMarked; import org.jspecify.annotations.NullMarked;
/** /**
@ -22,8 +23,9 @@ import org.jspecify.annotations.NullMarked;
"unused", "unused",
"SpellCheckingInspection" "SpellCheckingInspection"
}) })
@GeneratedFrom("1.21.4")
@NullMarked @NullMarked
@GeneratedFrom("1.21.5") @ApiStatus.Experimental
public final class FrogVariantKeys { public final class FrogVariantKeys {
/** /**
* {@code minecraft:cold} * {@code minecraft:cold}
@ -49,13 +51,7 @@ public final class FrogVariantKeys {
private FrogVariantKeys() { private FrogVariantKeys() {
} }
/** private static TypedKey<Frog.Variant> create(final Key key) {
* Creates a typed key for {@link Frog.Variant} in the registry {@code minecraft:frog_variant}.
*
* @param key the value's key in the registry
* @return a new typed key
*/
public static TypedKey<Frog.Variant> create(final Key key) {
return TypedKey.create(RegistryKey.FROG_VARIANT, key); return TypedKey.create(RegistryKey.FROG_VARIANT, key);
} }
} }

View File

@ -7,6 +7,7 @@ import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.TypedKey; import io.papermc.paper.registry.TypedKey;
import net.kyori.adventure.key.Key; import net.kyori.adventure.key.Key;
import org.bukkit.GameEvent; import org.bukkit.GameEvent;
import org.jetbrains.annotations.ApiStatus;
import org.jspecify.annotations.NullMarked; import org.jspecify.annotations.NullMarked;
/** /**
@ -22,8 +23,9 @@ import org.jspecify.annotations.NullMarked;
"unused", "unused",
"SpellCheckingInspection" "SpellCheckingInspection"
}) })
@GeneratedFrom("1.21.4")
@NullMarked @NullMarked
@GeneratedFrom("1.21.5") @ApiStatus.Experimental
public final class GameEventKeys { public final class GameEventKeys {
/** /**
* {@code minecraft:block_activate} * {@code minecraft:block_activate}
@ -449,11 +451,12 @@ 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 * @param key the value's key in the registry
* @return a new typed key * @return a new typed key
*/ */
@ApiStatus.Experimental
public static TypedKey<GameEvent> create(final Key key) { public static TypedKey<GameEvent> create(final Key key) {
return TypedKey.create(RegistryKey.GAME_EVENT, key); return TypedKey.create(RegistryKey.GAME_EVENT, key);
} }

View File

@ -7,6 +7,7 @@ import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.TypedKey; import io.papermc.paper.registry.TypedKey;
import net.kyori.adventure.key.Key; import net.kyori.adventure.key.Key;
import org.bukkit.MusicInstrument; import org.bukkit.MusicInstrument;
import org.jetbrains.annotations.ApiStatus;
import org.jspecify.annotations.NullMarked; import org.jspecify.annotations.NullMarked;
/** /**
@ -22,8 +23,9 @@ import org.jspecify.annotations.NullMarked;
"unused", "unused",
"SpellCheckingInspection" "SpellCheckingInspection"
}) })
@GeneratedFrom("1.21.4")
@NullMarked @NullMarked
@GeneratedFrom("1.21.5") @ApiStatus.Experimental
public final class InstrumentKeys { public final class InstrumentKeys {
/** /**
* {@code minecraft:admire_goat_horn} * {@code minecraft:admire_goat_horn}
@ -85,11 +87,12 @@ 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 * @param key the value's key in the registry
* @return a new typed key * @return a new typed key
*/ */
@ApiStatus.Experimental
public static TypedKey<MusicInstrument> create(final Key key) { public static TypedKey<MusicInstrument> create(final Key key) {
return TypedKey.create(RegistryKey.INSTRUMENT, key); return TypedKey.create(RegistryKey.INSTRUMENT, key);
} }

View File

@ -7,6 +7,7 @@ import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.TypedKey; import io.papermc.paper.registry.TypedKey;
import net.kyori.adventure.key.Key; import net.kyori.adventure.key.Key;
import org.bukkit.JukeboxSong; import org.bukkit.JukeboxSong;
import org.jetbrains.annotations.ApiStatus;
import org.jspecify.annotations.NullMarked; import org.jspecify.annotations.NullMarked;
/** /**
@ -22,8 +23,9 @@ import org.jspecify.annotations.NullMarked;
"unused", "unused",
"SpellCheckingInspection" "SpellCheckingInspection"
}) })
@GeneratedFrom("1.21.4")
@NullMarked @NullMarked
@GeneratedFrom("1.21.5") @ApiStatus.Experimental
public final class JukeboxSongKeys { public final class JukeboxSongKeys {
/** /**
* {@code minecraft:11} * {@code minecraft:11}
@ -162,11 +164,12 @@ 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 * @param key the value's key in the registry
* @return a new typed key * @return a new typed key
*/ */
@ApiStatus.Experimental
public static TypedKey<JukeboxSong> create(final Key key) { public static TypedKey<JukeboxSong> create(final Key key) {
return TypedKey.create(RegistryKey.JUKEBOX_SONG, key); return TypedKey.create(RegistryKey.JUKEBOX_SONG, key);
} }

View File

@ -7,6 +7,7 @@ import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.TypedKey; import io.papermc.paper.registry.TypedKey;
import net.kyori.adventure.key.Key; import net.kyori.adventure.key.Key;
import org.bukkit.map.MapCursor; import org.bukkit.map.MapCursor;
import org.jetbrains.annotations.ApiStatus;
import org.jspecify.annotations.NullMarked; import org.jspecify.annotations.NullMarked;
/** /**
@ -22,8 +23,9 @@ import org.jspecify.annotations.NullMarked;
"unused", "unused",
"SpellCheckingInspection" "SpellCheckingInspection"
}) })
@GeneratedFrom("1.21.4")
@NullMarked @NullMarked
@GeneratedFrom("1.21.5") @ApiStatus.Experimental
public final class MapDecorationTypeKeys { public final class MapDecorationTypeKeys {
/** /**
* {@code minecraft:banner_black} * {@code minecraft:banner_black}

View File

@ -7,6 +7,7 @@ import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.TypedKey; import io.papermc.paper.registry.TypedKey;
import net.kyori.adventure.key.Key; import net.kyori.adventure.key.Key;
import org.bukkit.inventory.MenuType; import org.bukkit.inventory.MenuType;
import org.jetbrains.annotations.ApiStatus;
import org.jspecify.annotations.NullMarked; import org.jspecify.annotations.NullMarked;
/** /**
@ -22,8 +23,9 @@ import org.jspecify.annotations.NullMarked;
"unused", "unused",
"SpellCheckingInspection" "SpellCheckingInspection"
}) })
@GeneratedFrom("1.21.4")
@NullMarked @NullMarked
@GeneratedFrom("1.21.5") @ApiStatus.Experimental
public final class MenuTypeKeys { public final class MenuTypeKeys {
/** /**
* {@code minecraft:anvil} * {@code minecraft:anvil}

View File

@ -7,6 +7,7 @@ import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.TypedKey; import io.papermc.paper.registry.TypedKey;
import net.kyori.adventure.key.Key; import net.kyori.adventure.key.Key;
import org.bukkit.potion.PotionEffectType; import org.bukkit.potion.PotionEffectType;
import org.jetbrains.annotations.ApiStatus;
import org.jspecify.annotations.NullMarked; import org.jspecify.annotations.NullMarked;
/** /**
@ -22,8 +23,9 @@ import org.jspecify.annotations.NullMarked;
"unused", "unused",
"SpellCheckingInspection" "SpellCheckingInspection"
}) })
@GeneratedFrom("1.21.4")
@NullMarked @NullMarked
@GeneratedFrom("1.21.5") @ApiStatus.Experimental
public final class MobEffectKeys { public final class MobEffectKeys {
/** /**
* {@code minecraft:absorption} * {@code minecraft:absorption}

View File

@ -7,6 +7,7 @@ import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.TypedKey; import io.papermc.paper.registry.TypedKey;
import net.kyori.adventure.key.Key; import net.kyori.adventure.key.Key;
import org.bukkit.Art; import org.bukkit.Art;
import org.jetbrains.annotations.ApiStatus;
import org.jspecify.annotations.NullMarked; import org.jspecify.annotations.NullMarked;
/** /**
@ -22,8 +23,9 @@ import org.jspecify.annotations.NullMarked;
"unused", "unused",
"SpellCheckingInspection" "SpellCheckingInspection"
}) })
@GeneratedFrom("1.21.4")
@NullMarked @NullMarked
@GeneratedFrom("1.21.5") @ApiStatus.Experimental
public final class PaintingVariantKeys { public final class PaintingVariantKeys {
/** /**
* {@code minecraft:alban} * {@code minecraft:alban}
@ -379,11 +381,12 @@ 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 * @param key the value's key in the registry
* @return a new typed key * @return a new typed key
*/ */
@ApiStatus.Experimental
public static TypedKey<Art> create(final Key key) { public static TypedKey<Art> create(final Key key) {
return TypedKey.create(RegistryKey.PAINTING_VARIANT, key); return TypedKey.create(RegistryKey.PAINTING_VARIANT, key);
} }

View File

@ -7,6 +7,7 @@ import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.TypedKey; import io.papermc.paper.registry.TypedKey;
import net.kyori.adventure.key.Key; import net.kyori.adventure.key.Key;
import org.bukkit.Sound; import org.bukkit.Sound;
import org.jetbrains.annotations.ApiStatus;
import org.jspecify.annotations.NullMarked; import org.jspecify.annotations.NullMarked;
/** /**
@ -22,8 +23,9 @@ import org.jspecify.annotations.NullMarked;
"unused", "unused",
"SpellCheckingInspection" "SpellCheckingInspection"
}) })
@GeneratedFrom("1.21.4")
@NullMarked @NullMarked
@GeneratedFrom("1.21.5") @ApiStatus.Experimental
public final class SoundEventKeys { public final class SoundEventKeys {
/** /**
* {@code minecraft:ambient.basalt_deltas.additions} * {@code minecraft:ambient.basalt_deltas.additions}
@ -879,20 +881,6 @@ public final class SoundEventKeys {
*/ */
public static final TypedKey<Sound> BLOCK_BUBBLE_COLUMN_WHIRLPOOL_INSIDE = create(key("block.bubble_column.whirlpool_inside")); public static final TypedKey<Sound> BLOCK_BUBBLE_COLUMN_WHIRLPOOL_INSIDE = create(key("block.bubble_column.whirlpool_inside"));
/**
* {@code minecraft:block.cactus_flower.break}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Sound> BLOCK_CACTUS_FLOWER_BREAK = create(key("block.cactus_flower.break"));
/**
* {@code minecraft:block.cactus_flower.place}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Sound> BLOCK_CACTUS_FLOWER_PLACE = create(key("block.cactus_flower.place"));
/** /**
* {@code minecraft:block.cake.add_candle} * {@code minecraft:block.cake.add_candle}
* *
@ -1740,13 +1728,6 @@ public final class SoundEventKeys {
*/ */
public static final TypedKey<Sound> BLOCK_CROP_BREAK = create(key("block.crop.break")); public static final TypedKey<Sound> BLOCK_CROP_BREAK = create(key("block.crop.break"));
/**
* {@code minecraft:block.deadbush.idle}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Sound> BLOCK_DEADBUSH_IDLE = create(key("block.deadbush.idle"));
/** /**
* {@code minecraft:block.decorated_pot.break} * {@code minecraft:block.decorated_pot.break}
* *
@ -2069,13 +2050,6 @@ public final class SoundEventKeys {
*/ */
public static final TypedKey<Sound> BLOCK_FIRE_EXTINGUISH = create(key("block.fire.extinguish")); public static final TypedKey<Sound> BLOCK_FIRE_EXTINGUISH = create(key("block.fire.extinguish"));
/**
* {@code minecraft:block.firefly_bush.idle}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Sound> BLOCK_FIREFLY_BUSH_IDLE = create(key("block.firefly_bush.idle"));
/** /**
* {@code minecraft:block.flowering_azalea.break} * {@code minecraft:block.flowering_azalea.break}
* *
@ -2538,41 +2512,6 @@ public final class SoundEventKeys {
*/ */
public static final TypedKey<Sound> BLOCK_HONEY_BLOCK_STEP = create(key("block.honey_block.step")); public static final TypedKey<Sound> BLOCK_HONEY_BLOCK_STEP = create(key("block.honey_block.step"));
/**
* {@code minecraft:block.iron.break}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Sound> BLOCK_IRON_BREAK = create(key("block.iron.break"));
/**
* {@code minecraft:block.iron.fall}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Sound> BLOCK_IRON_FALL = create(key("block.iron.fall"));
/**
* {@code minecraft:block.iron.hit}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Sound> BLOCK_IRON_HIT = create(key("block.iron.hit"));
/**
* {@code minecraft:block.iron.place}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Sound> BLOCK_IRON_PLACE = create(key("block.iron.place"));
/**
* {@code minecraft:block.iron.step}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Sound> BLOCK_IRON_STEP = create(key("block.iron.step"));
/** /**
* {@code minecraft:block.iron_door.close} * {@code minecraft:block.iron_door.close}
* *
@ -2706,41 +2645,6 @@ public final class SoundEventKeys {
*/ */
public static final TypedKey<Sound> BLOCK_LAVA_POP = create(key("block.lava.pop")); public static final TypedKey<Sound> BLOCK_LAVA_POP = create(key("block.lava.pop"));
/**
* {@code minecraft:block.leaf_litter.break}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Sound> BLOCK_LEAF_LITTER_BREAK = create(key("block.leaf_litter.break"));
/**
* {@code minecraft:block.leaf_litter.fall}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Sound> BLOCK_LEAF_LITTER_FALL = create(key("block.leaf_litter.fall"));
/**
* {@code minecraft:block.leaf_litter.hit}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Sound> BLOCK_LEAF_LITTER_HIT = create(key("block.leaf_litter.hit"));
/**
* {@code minecraft:block.leaf_litter.place}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Sound> BLOCK_LEAF_LITTER_PLACE = create(key("block.leaf_litter.place"));
/**
* {@code minecraft:block.leaf_litter.step}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Sound> BLOCK_LEAF_LITTER_STEP = create(key("block.leaf_litter.step"));
/** /**
* {@code minecraft:block.lever.click} * {@code minecraft:block.lever.click}
* *
@ -4092,13 +3996,6 @@ public final class SoundEventKeys {
*/ */
public static final TypedKey<Sound> BLOCK_SAND_HIT = create(key("block.sand.hit")); public static final TypedKey<Sound> BLOCK_SAND_HIT = create(key("block.sand.hit"));
/**
* {@code minecraft:block.sand.idle}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Sound> BLOCK_SAND_IDLE = create(key("block.sand.idle"));
/** /**
* {@code minecraft:block.sand.place} * {@code minecraft:block.sand.place}
* *
@ -4113,13 +4010,6 @@ public final class SoundEventKeys {
*/ */
public static final TypedKey<Sound> BLOCK_SAND_STEP = create(key("block.sand.step")); public static final TypedKey<Sound> BLOCK_SAND_STEP = create(key("block.sand.step"));
/**
* {@code minecraft:block.sand.wind}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Sound> BLOCK_SAND_WIND = create(key("block.sand.wind"));
/** /**
* {@code minecraft:block.scaffolding.break} * {@code minecraft:block.scaffolding.break}
* *
@ -10329,6 +10219,13 @@ public final class SoundEventKeys {
*/ */
public static final TypedKey<Sound> ENTITY_WOLF_GROWL = create(key("entity.wolf.growl")); public static final TypedKey<Sound> ENTITY_WOLF_GROWL = create(key("entity.wolf.growl"));
/**
* {@code minecraft:entity.wolf.howl}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Sound> ENTITY_WOLF_HOWL = create(key("entity.wolf.howl"));
/** /**
* {@code minecraft:entity.wolf.hurt} * {@code minecraft:entity.wolf.hurt}
* *
@ -10364,258 +10261,6 @@ public final class SoundEventKeys {
*/ */
public static final TypedKey<Sound> ENTITY_WOLF_WHINE = create(key("entity.wolf.whine")); public static final TypedKey<Sound> ENTITY_WOLF_WHINE = create(key("entity.wolf.whine"));
/**
* {@code minecraft:entity.wolf_angry.ambient}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Sound> ENTITY_WOLF_ANGRY_AMBIENT = create(key("entity.wolf_angry.ambient"));
/**
* {@code minecraft:entity.wolf_angry.death}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Sound> ENTITY_WOLF_ANGRY_DEATH = create(key("entity.wolf_angry.death"));
/**
* {@code minecraft:entity.wolf_angry.growl}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Sound> ENTITY_WOLF_ANGRY_GROWL = create(key("entity.wolf_angry.growl"));
/**
* {@code minecraft:entity.wolf_angry.hurt}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Sound> ENTITY_WOLF_ANGRY_HURT = create(key("entity.wolf_angry.hurt"));
/**
* {@code minecraft:entity.wolf_angry.pant}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Sound> ENTITY_WOLF_ANGRY_PANT = create(key("entity.wolf_angry.pant"));
/**
* {@code minecraft:entity.wolf_angry.whine}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Sound> ENTITY_WOLF_ANGRY_WHINE = create(key("entity.wolf_angry.whine"));
/**
* {@code minecraft:entity.wolf_big.ambient}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Sound> ENTITY_WOLF_BIG_AMBIENT = create(key("entity.wolf_big.ambient"));
/**
* {@code minecraft:entity.wolf_big.death}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Sound> ENTITY_WOLF_BIG_DEATH = create(key("entity.wolf_big.death"));
/**
* {@code minecraft:entity.wolf_big.growl}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Sound> ENTITY_WOLF_BIG_GROWL = create(key("entity.wolf_big.growl"));
/**
* {@code minecraft:entity.wolf_big.hurt}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Sound> ENTITY_WOLF_BIG_HURT = create(key("entity.wolf_big.hurt"));
/**
* {@code minecraft:entity.wolf_big.pant}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Sound> ENTITY_WOLF_BIG_PANT = create(key("entity.wolf_big.pant"));
/**
* {@code minecraft:entity.wolf_big.whine}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Sound> ENTITY_WOLF_BIG_WHINE = create(key("entity.wolf_big.whine"));
/**
* {@code minecraft:entity.wolf_cute.ambient}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Sound> ENTITY_WOLF_CUTE_AMBIENT = create(key("entity.wolf_cute.ambient"));
/**
* {@code minecraft:entity.wolf_cute.death}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Sound> ENTITY_WOLF_CUTE_DEATH = create(key("entity.wolf_cute.death"));
/**
* {@code minecraft:entity.wolf_cute.growl}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Sound> ENTITY_WOLF_CUTE_GROWL = create(key("entity.wolf_cute.growl"));
/**
* {@code minecraft:entity.wolf_cute.hurt}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Sound> ENTITY_WOLF_CUTE_HURT = create(key("entity.wolf_cute.hurt"));
/**
* {@code minecraft:entity.wolf_cute.pant}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Sound> ENTITY_WOLF_CUTE_PANT = create(key("entity.wolf_cute.pant"));
/**
* {@code minecraft:entity.wolf_cute.whine}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Sound> ENTITY_WOLF_CUTE_WHINE = create(key("entity.wolf_cute.whine"));
/**
* {@code minecraft:entity.wolf_grumpy.ambient}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Sound> ENTITY_WOLF_GRUMPY_AMBIENT = create(key("entity.wolf_grumpy.ambient"));
/**
* {@code minecraft:entity.wolf_grumpy.death}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Sound> ENTITY_WOLF_GRUMPY_DEATH = create(key("entity.wolf_grumpy.death"));
/**
* {@code minecraft:entity.wolf_grumpy.growl}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Sound> ENTITY_WOLF_GRUMPY_GROWL = create(key("entity.wolf_grumpy.growl"));
/**
* {@code minecraft:entity.wolf_grumpy.hurt}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Sound> ENTITY_WOLF_GRUMPY_HURT = create(key("entity.wolf_grumpy.hurt"));
/**
* {@code minecraft:entity.wolf_grumpy.pant}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Sound> ENTITY_WOLF_GRUMPY_PANT = create(key("entity.wolf_grumpy.pant"));
/**
* {@code minecraft:entity.wolf_grumpy.whine}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Sound> ENTITY_WOLF_GRUMPY_WHINE = create(key("entity.wolf_grumpy.whine"));
/**
* {@code minecraft:entity.wolf_puglin.ambient}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Sound> ENTITY_WOLF_PUGLIN_AMBIENT = create(key("entity.wolf_puglin.ambient"));
/**
* {@code minecraft:entity.wolf_puglin.death}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Sound> ENTITY_WOLF_PUGLIN_DEATH = create(key("entity.wolf_puglin.death"));
/**
* {@code minecraft:entity.wolf_puglin.growl}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Sound> ENTITY_WOLF_PUGLIN_GROWL = create(key("entity.wolf_puglin.growl"));
/**
* {@code minecraft:entity.wolf_puglin.hurt}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Sound> ENTITY_WOLF_PUGLIN_HURT = create(key("entity.wolf_puglin.hurt"));
/**
* {@code minecraft:entity.wolf_puglin.pant}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Sound> ENTITY_WOLF_PUGLIN_PANT = create(key("entity.wolf_puglin.pant"));
/**
* {@code minecraft:entity.wolf_puglin.whine}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Sound> ENTITY_WOLF_PUGLIN_WHINE = create(key("entity.wolf_puglin.whine"));
/**
* {@code minecraft:entity.wolf_sad.ambient}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Sound> ENTITY_WOLF_SAD_AMBIENT = create(key("entity.wolf_sad.ambient"));
/**
* {@code minecraft:entity.wolf_sad.death}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Sound> ENTITY_WOLF_SAD_DEATH = create(key("entity.wolf_sad.death"));
/**
* {@code minecraft:entity.wolf_sad.growl}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Sound> ENTITY_WOLF_SAD_GROWL = create(key("entity.wolf_sad.growl"));
/**
* {@code minecraft:entity.wolf_sad.hurt}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Sound> ENTITY_WOLF_SAD_HURT = create(key("entity.wolf_sad.hurt"));
/**
* {@code minecraft:entity.wolf_sad.pant}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Sound> ENTITY_WOLF_SAD_PANT = create(key("entity.wolf_sad.pant"));
/**
* {@code minecraft:entity.wolf_sad.whine}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Sound> ENTITY_WOLF_SAD_WHINE = create(key("entity.wolf_sad.whine"));
/** /**
* {@code minecraft:entity.zoglin.ambient} * {@code minecraft:entity.zoglin.ambient}
* *

View File

@ -7,6 +7,7 @@ import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.TypedKey; import io.papermc.paper.registry.TypedKey;
import net.kyori.adventure.key.Key; import net.kyori.adventure.key.Key;
import org.bukkit.generator.structure.Structure; import org.bukkit.generator.structure.Structure;
import org.jetbrains.annotations.ApiStatus;
import org.jspecify.annotations.NullMarked; import org.jspecify.annotations.NullMarked;
/** /**
@ -22,8 +23,9 @@ import org.jspecify.annotations.NullMarked;
"unused", "unused",
"SpellCheckingInspection" "SpellCheckingInspection"
}) })
@GeneratedFrom("1.21.4")
@NullMarked @NullMarked
@GeneratedFrom("1.21.5") @ApiStatus.Experimental
public final class StructureKeys { public final class StructureKeys {
/** /**
* {@code minecraft:ancient_city} * {@code minecraft:ancient_city}
@ -267,11 +269,12 @@ 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 * @param key the value's key in the registry
* @return a new typed key * @return a new typed key
*/ */
@ApiStatus.Experimental
public static TypedKey<Structure> create(final Key key) { public static TypedKey<Structure> create(final Key key) {
return TypedKey.create(RegistryKey.STRUCTURE, key); return TypedKey.create(RegistryKey.STRUCTURE, key);
} }

View File

@ -7,6 +7,7 @@ import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.TypedKey; import io.papermc.paper.registry.TypedKey;
import net.kyori.adventure.key.Key; import net.kyori.adventure.key.Key;
import org.bukkit.generator.structure.StructureType; import org.bukkit.generator.structure.StructureType;
import org.jetbrains.annotations.ApiStatus;
import org.jspecify.annotations.NullMarked; import org.jspecify.annotations.NullMarked;
/** /**
@ -22,8 +23,9 @@ import org.jspecify.annotations.NullMarked;
"unused", "unused",
"SpellCheckingInspection" "SpellCheckingInspection"
}) })
@GeneratedFrom("1.21.4")
@NullMarked @NullMarked
@GeneratedFrom("1.21.5") @ApiStatus.Experimental
public final class StructureTypeKeys { public final class StructureTypeKeys {
/** /**
* {@code minecraft:buried_treasure} * {@code minecraft:buried_treasure}

View File

@ -7,6 +7,7 @@ import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.TypedKey; import io.papermc.paper.registry.TypedKey;
import net.kyori.adventure.key.Key; import net.kyori.adventure.key.Key;
import org.bukkit.inventory.meta.trim.TrimMaterial; import org.bukkit.inventory.meta.trim.TrimMaterial;
import org.jetbrains.annotations.ApiStatus;
import org.jspecify.annotations.NullMarked; import org.jspecify.annotations.NullMarked;
/** /**
@ -22,8 +23,9 @@ import org.jspecify.annotations.NullMarked;
"unused", "unused",
"SpellCheckingInspection" "SpellCheckingInspection"
}) })
@GeneratedFrom("1.21.4")
@NullMarked @NullMarked
@GeneratedFrom("1.21.5") @ApiStatus.Experimental
public final class TrimMaterialKeys { public final class TrimMaterialKeys {
/** /**
* {@code minecraft:amethyst} * {@code minecraft:amethyst}
@ -106,11 +108,12 @@ 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 * @param key the value's key in the registry
* @return a new typed key * @return a new typed key
*/ */
@ApiStatus.Experimental
public static TypedKey<TrimMaterial> create(final Key key) { public static TypedKey<TrimMaterial> create(final Key key) {
return TypedKey.create(RegistryKey.TRIM_MATERIAL, key); return TypedKey.create(RegistryKey.TRIM_MATERIAL, key);
} }

View File

@ -7,6 +7,7 @@ import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.TypedKey; import io.papermc.paper.registry.TypedKey;
import net.kyori.adventure.key.Key; import net.kyori.adventure.key.Key;
import org.bukkit.inventory.meta.trim.TrimPattern; import org.bukkit.inventory.meta.trim.TrimPattern;
import org.jetbrains.annotations.ApiStatus;
import org.jspecify.annotations.NullMarked; import org.jspecify.annotations.NullMarked;
/** /**
@ -22,8 +23,9 @@ import org.jspecify.annotations.NullMarked;
"unused", "unused",
"SpellCheckingInspection" "SpellCheckingInspection"
}) })
@GeneratedFrom("1.21.4")
@NullMarked @NullMarked
@GeneratedFrom("1.21.5") @ApiStatus.Experimental
public final class TrimPatternKeys { public final class TrimPatternKeys {
/** /**
* {@code minecraft:bolt} * {@code minecraft:bolt}
@ -155,11 +157,12 @@ 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 * @param key the value's key in the registry
* @return a new typed key * @return a new typed key
*/ */
@ApiStatus.Experimental
public static TypedKey<TrimPattern> create(final Key key) { public static TypedKey<TrimPattern> create(final Key key) {
return TypedKey.create(RegistryKey.TRIM_PATTERN, key); return TypedKey.create(RegistryKey.TRIM_PATTERN, key);
} }

View File

@ -7,6 +7,7 @@ import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.TypedKey; import io.papermc.paper.registry.TypedKey;
import net.kyori.adventure.key.Key; import net.kyori.adventure.key.Key;
import org.bukkit.entity.Villager; import org.bukkit.entity.Villager;
import org.jetbrains.annotations.ApiStatus;
import org.jspecify.annotations.NullMarked; import org.jspecify.annotations.NullMarked;
/** /**
@ -22,8 +23,9 @@ import org.jspecify.annotations.NullMarked;
"unused", "unused",
"SpellCheckingInspection" "SpellCheckingInspection"
}) })
@GeneratedFrom("1.21.4")
@NullMarked @NullMarked
@GeneratedFrom("1.21.5") @ApiStatus.Experimental
public final class VillagerProfessionKeys { public final class VillagerProfessionKeys {
/** /**
* {@code minecraft:armorer} * {@code minecraft:armorer}

View File

@ -7,6 +7,7 @@ import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.TypedKey; import io.papermc.paper.registry.TypedKey;
import net.kyori.adventure.key.Key; import net.kyori.adventure.key.Key;
import org.bukkit.entity.Villager; import org.bukkit.entity.Villager;
import org.jetbrains.annotations.ApiStatus;
import org.jspecify.annotations.NullMarked; import org.jspecify.annotations.NullMarked;
/** /**
@ -22,8 +23,9 @@ import org.jspecify.annotations.NullMarked;
"unused", "unused",
"SpellCheckingInspection" "SpellCheckingInspection"
}) })
@GeneratedFrom("1.21.4")
@NullMarked @NullMarked
@GeneratedFrom("1.21.5") @ApiStatus.Experimental
public final class VillagerTypeKeys { public final class VillagerTypeKeys {
/** /**
* {@code minecraft:desert} * {@code minecraft:desert}

View File

@ -7,6 +7,7 @@ import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.TypedKey; import io.papermc.paper.registry.TypedKey;
import net.kyori.adventure.key.Key; import net.kyori.adventure.key.Key;
import org.bukkit.entity.Wolf; import org.bukkit.entity.Wolf;
import org.jetbrains.annotations.ApiStatus;
import org.jspecify.annotations.NullMarked; import org.jspecify.annotations.NullMarked;
/** /**
@ -22,8 +23,9 @@ import org.jspecify.annotations.NullMarked;
"unused", "unused",
"SpellCheckingInspection" "SpellCheckingInspection"
}) })
@GeneratedFrom("1.21.4")
@NullMarked @NullMarked
@GeneratedFrom("1.21.5") @ApiStatus.Experimental
public final class WolfVariantKeys { public final class WolfVariantKeys {
/** /**
* {@code minecraft:ashen} * {@code minecraft:ashen}
@ -92,11 +94,12 @@ 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 * @param key the value's key in the registry
* @return a new typed key * @return a new typed key
*/ */
@ApiStatus.Experimental
public static TypedKey<Wolf.Variant> create(final Key key) { public static TypedKey<Wolf.Variant> create(final Key key) {
return TypedKey.create(RegistryKey.WOLF_VARIANT, key); return TypedKey.create(RegistryKey.WOLF_VARIANT, key);
} }

View File

@ -11,7 +11,7 @@ import org.jetbrains.annotations.ApiStatus;
import org.jspecify.annotations.NullMarked; 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 * @apiNote The fields provided here are a direct representation of
* what is available from the vanilla game source. They may be * what is available from the vanilla game source. They may be
@ -23,8 +23,8 @@ import org.jspecify.annotations.NullMarked;
"unused", "unused",
"SpellCheckingInspection" "SpellCheckingInspection"
}) })
@GeneratedFrom("1.21.4")
@NullMarked @NullMarked
@GeneratedFrom("1.21.5")
@ApiStatus.Experimental @ApiStatus.Experimental
public final class BannerPatternTagKeys { public final class BannerPatternTagKeys {
/** /**

View File

@ -11,7 +11,7 @@ import org.jetbrains.annotations.ApiStatus;
import org.jspecify.annotations.NullMarked; 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 * @apiNote The fields provided here are a direct representation of
* what is available from the vanilla game source. They may be * what is available from the vanilla game source. They may be
@ -23,8 +23,8 @@ import org.jspecify.annotations.NullMarked;
"unused", "unused",
"SpellCheckingInspection" "SpellCheckingInspection"
}) })
@GeneratedFrom("1.21.4")
@NullMarked @NullMarked
@GeneratedFrom("1.21.5")
@ApiStatus.Experimental @ApiStatus.Experimental
public final class BiomeTagKeys { public final class BiomeTagKeys {
/** /**
@ -447,13 +447,6 @@ public final class BiomeTagKeys {
*/ */
public static final TagKey<Biome> SNOW_GOLEM_MELTS = create(key("snow_golem_melts")); public static final TagKey<Biome> SNOW_GOLEM_MELTS = create(key("snow_golem_melts"));
/**
* {@code #minecraft:spawns_cold_variant_farm_animals}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Biome> SPAWNS_COLD_VARIANT_FARM_ANIMALS = create(key("spawns_cold_variant_farm_animals"));
/** /**
* {@code #minecraft:spawns_cold_variant_frogs} * {@code #minecraft:spawns_cold_variant_frogs}
* *
@ -475,13 +468,6 @@ public final class BiomeTagKeys {
*/ */
public static final TagKey<Biome> SPAWNS_SNOW_FOXES = create(key("spawns_snow_foxes")); public static final TagKey<Biome> SPAWNS_SNOW_FOXES = create(key("spawns_snow_foxes"));
/**
* {@code #minecraft:spawns_warm_variant_farm_animals}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Biome> SPAWNS_WARM_VARIANT_FARM_ANIMALS = create(key("spawns_warm_variant_farm_animals"));
/** /**
* {@code #minecraft:spawns_warm_variant_frogs} * {@code #minecraft:spawns_warm_variant_frogs}
* *

View File

@ -11,7 +11,7 @@ import org.jetbrains.annotations.ApiStatus;
import org.jspecify.annotations.NullMarked; 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 * @apiNote The fields provided here are a direct representation of
* what is available from the vanilla game source. They may be * what is available from the vanilla game source. They may be
@ -23,8 +23,8 @@ import org.jspecify.annotations.NullMarked;
"unused", "unused",
"SpellCheckingInspection" "SpellCheckingInspection"
}) })
@GeneratedFrom("1.21.4")
@NullMarked @NullMarked
@GeneratedFrom("1.21.5")
@ApiStatus.Experimental @ApiStatus.Experimental
public final class BlockTypeTagKeys { public final class BlockTypeTagKeys {
/** /**
@ -223,13 +223,6 @@ public final class BlockTypeTagKeys {
*/ */
public static final TagKey<BlockType> CAMEL_SAND_STEP_SOUND_BLOCKS = create(key("camel_sand_step_sound_blocks")); public static final TagKey<BlockType> CAMEL_SAND_STEP_SOUND_BLOCKS = create(key("camel_sand_step_sound_blocks"));
/**
* {@code #minecraft:camels_spawnable_on}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<BlockType> CAMELS_SPAWNABLE_ON = create(key("camels_spawnable_on"));
/** /**
* {@code #minecraft:campfires} * {@code #minecraft:campfires}
* *
@ -384,6 +377,13 @@ public final class BlockTypeTagKeys {
*/ */
public static final TagKey<BlockType> DARK_OAK_LOGS = create(key("dark_oak_logs")); public static final TagKey<BlockType> DARK_OAK_LOGS = create(key("dark_oak_logs"));
/**
* {@code #minecraft:dead_bush_may_place_on}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<BlockType> DEAD_BUSH_MAY_PLACE_ON = create(key("dead_bush_may_place_on"));
/** /**
* {@code #minecraft:deepslate_ore_replaceables} * {@code #minecraft:deepslate_ore_replaceables}
* *
@ -440,20 +440,6 @@ public final class BlockTypeTagKeys {
*/ */
public static final TagKey<BlockType> DRIPSTONE_REPLACEABLE_BLOCKS = create(key("dripstone_replaceable_blocks")); public static final TagKey<BlockType> DRIPSTONE_REPLACEABLE_BLOCKS = create(key("dripstone_replaceable_blocks"));
/**
* {@code #minecraft:dry_vegetation_may_place_on}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<BlockType> DRY_VEGETATION_MAY_PLACE_ON = create(key("dry_vegetation_may_place_on"));
/**
* {@code #minecraft:edible_for_sheep}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<BlockType> EDIBLE_FOR_SHEEP = create(key("edible_for_sheep"));
/** /**
* {@code #minecraft:emerald_ores} * {@code #minecraft:emerald_ores}
* *
@ -909,13 +895,6 @@ public final class BlockTypeTagKeys {
*/ */
public static final TagKey<BlockType> PLANKS = create(key("planks")); public static final TagKey<BlockType> PLANKS = create(key("planks"));
/**
* {@code #minecraft:plays_ambient_desert_block_sounds}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<BlockType> PLAYS_AMBIENT_DESERT_BLOCK_SOUNDS = create(key("plays_ambient_desert_block_sounds"));
/** /**
* {@code #minecraft:polar_bears_spawnable_on_alternate} * {@code #minecraft:polar_bears_spawnable_on_alternate}
* *
@ -972,13 +951,6 @@ public final class BlockTypeTagKeys {
*/ */
public static final TagKey<BlockType> REPLACEABLE = create(key("replaceable")); public static final TagKey<BlockType> REPLACEABLE = create(key("replaceable"));
/**
* {@code #minecraft:replaceable_by_mushrooms}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<BlockType> REPLACEABLE_BY_MUSHROOMS = create(key("replaceable_by_mushrooms"));
/** /**
* {@code #minecraft:replaceable_by_trees} * {@code #minecraft:replaceable_by_trees}
* *
@ -1175,13 +1147,6 @@ public final class BlockTypeTagKeys {
*/ */
public static final TagKey<BlockType> SWORD_EFFICIENT = create(key("sword_efficient")); public static final TagKey<BlockType> SWORD_EFFICIENT = create(key("sword_efficient"));
/**
* {@code #minecraft:sword_instantly_mines}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<BlockType> SWORD_INSTANTLY_MINES = create(key("sword_instantly_mines"));
/** /**
* {@code #minecraft:terracotta} * {@code #minecraft:terracotta}
* *

View File

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

View File

@ -11,7 +11,7 @@ import org.jetbrains.annotations.ApiStatus;
import org.jspecify.annotations.NullMarked; 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 * @apiNote The fields provided here are a direct representation of
* what is available from the vanilla game source. They may be * what is available from the vanilla game source. They may be
@ -23,8 +23,8 @@ import org.jspecify.annotations.NullMarked;
"unused", "unused",
"SpellCheckingInspection" "SpellCheckingInspection"
}) })
@GeneratedFrom("1.21.4")
@NullMarked @NullMarked
@GeneratedFrom("1.21.5")
@ApiStatus.Experimental @ApiStatus.Experimental
public final class DamageTypeTagKeys { public final class DamageTypeTagKeys {
/** /**

View File

@ -12,7 +12,7 @@ import org.jetbrains.annotations.ApiStatus;
import org.jspecify.annotations.NullMarked; 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 * @apiNote The fields provided here are a direct representation of
* what is available from the vanilla game source. They may be * what is available from the vanilla game source. They may be
@ -24,8 +24,8 @@ import org.jspecify.annotations.NullMarked;
"unused", "unused",
"SpellCheckingInspection" "SpellCheckingInspection"
}) })
@GeneratedFrom("1.21.4")
@NullMarked @NullMarked
@GeneratedFrom("1.21.5")
@ApiStatus.Experimental @ApiStatus.Experimental
public final class EnchantmentTagKeys { public final class EnchantmentTagKeys {
/** /**

View File

@ -11,7 +11,7 @@ import org.jetbrains.annotations.ApiStatus;
import org.jspecify.annotations.NullMarked; 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 * @apiNote The fields provided here are a direct representation of
* what is available from the vanilla game source. They may be * what is available from the vanilla game source. They may be
@ -23,8 +23,8 @@ import org.jspecify.annotations.NullMarked;
"unused", "unused",
"SpellCheckingInspection" "SpellCheckingInspection"
}) })
@GeneratedFrom("1.21.4")
@NullMarked @NullMarked
@GeneratedFrom("1.21.5")
@ApiStatus.Experimental @ApiStatus.Experimental
public final class EntityTypeTagKeys { public final class EntityTypeTagKeys {
/** /**
@ -83,13 +83,6 @@ public final class EntityTypeTagKeys {
*/ */
public static final TagKey<EntityType> CAN_BREATHE_UNDER_WATER = create(key("can_breathe_under_water")); public static final TagKey<EntityType> CAN_BREATHE_UNDER_WATER = create(key("can_breathe_under_water"));
/**
* {@code #minecraft:can_equip_saddle}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<EntityType> CAN_EQUIP_SADDLE = create(key("can_equip_saddle"));
/** /**
* {@code #minecraft:can_turn_in_boats} * {@code #minecraft:can_turn_in_boats}
* *
@ -97,13 +90,6 @@ public final class EntityTypeTagKeys {
*/ */
public static final TagKey<EntityType> CAN_TURN_IN_BOATS = create(key("can_turn_in_boats")); public static final TagKey<EntityType> CAN_TURN_IN_BOATS = create(key("can_turn_in_boats"));
/**
* {@code #minecraft:can_wear_horse_armor}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<EntityType> CAN_WEAR_HORSE_ARMOR = create(key("can_wear_horse_armor"));
/** /**
* {@code #minecraft:deflects_projectiles} * {@code #minecraft:deflects_projectiles}
* *

View File

@ -11,7 +11,7 @@ import org.jetbrains.annotations.ApiStatus;
import org.jspecify.annotations.NullMarked; 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 * @apiNote The fields provided here are a direct representation of
* what is available from the vanilla game source. They may be * what is available from the vanilla game source. They may be
@ -23,8 +23,8 @@ import org.jspecify.annotations.NullMarked;
"unused", "unused",
"SpellCheckingInspection" "SpellCheckingInspection"
}) })
@GeneratedFrom("1.21.4")
@NullMarked @NullMarked
@GeneratedFrom("1.21.5")
@ApiStatus.Experimental @ApiStatus.Experimental
public final class FluidTagKeys { public final class FluidTagKeys {
/** /**

View File

@ -11,7 +11,7 @@ import org.jetbrains.annotations.ApiStatus;
import org.jspecify.annotations.NullMarked; 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 * @apiNote The fields provided here are a direct representation of
* what is available from the vanilla game source. They may be * what is available from the vanilla game source. They may be
@ -23,8 +23,8 @@ import org.jspecify.annotations.NullMarked;
"unused", "unused",
"SpellCheckingInspection" "SpellCheckingInspection"
}) })
@GeneratedFrom("1.21.4")
@NullMarked @NullMarked
@GeneratedFrom("1.21.5")
@ApiStatus.Experimental @ApiStatus.Experimental
public final class GameEventTagKeys { public final class GameEventTagKeys {
/** /**

View File

@ -11,7 +11,7 @@ import org.jetbrains.annotations.ApiStatus;
import org.jspecify.annotations.NullMarked; 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 * @apiNote The fields provided here are a direct representation of
* what is available from the vanilla game source. They may be * what is available from the vanilla game source. They may be
@ -23,8 +23,8 @@ import org.jspecify.annotations.NullMarked;
"unused", "unused",
"SpellCheckingInspection" "SpellCheckingInspection"
}) })
@GeneratedFrom("1.21.4")
@NullMarked @NullMarked
@GeneratedFrom("1.21.5")
@ApiStatus.Experimental @ApiStatus.Experimental
public final class InstrumentTagKeys { public final class InstrumentTagKeys {
/** /**

View File

@ -11,7 +11,7 @@ import org.jetbrains.annotations.ApiStatus;
import org.jspecify.annotations.NullMarked; 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 * @apiNote The fields provided here are a direct representation of
* what is available from the vanilla game source. They may be * what is available from the vanilla game source. They may be
@ -23,8 +23,8 @@ import org.jspecify.annotations.NullMarked;
"unused", "unused",
"SpellCheckingInspection" "SpellCheckingInspection"
}) })
@GeneratedFrom("1.21.4")
@NullMarked @NullMarked
@GeneratedFrom("1.21.5")
@ApiStatus.Experimental @ApiStatus.Experimental
public final class ItemTypeTagKeys { public final class ItemTypeTagKeys {
/** /**
@ -118,13 +118,6 @@ public final class ItemTypeTagKeys {
*/ */
public static final TagKey<ItemType> BOATS = create(key("boats")); public static final TagKey<ItemType> BOATS = create(key("boats"));
/**
* {@code #minecraft:book_cloning_target}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<ItemType> BOOK_CLONING_TARGET = create(key("book_cloning_target"));
/** /**
* {@code #minecraft:bookshelf_books} * {@code #minecraft:bookshelf_books}
* *
@ -356,13 +349,6 @@ public final class ItemTypeTagKeys {
*/ */
public static final TagKey<ItemType> DYEABLE = create(key("dyeable")); public static final TagKey<ItemType> DYEABLE = create(key("dyeable"));
/**
* {@code #minecraft:eggs}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<ItemType> EGGS = create(key("eggs"));
/** /**
* {@code #minecraft:emerald_ores} * {@code #minecraft:emerald_ores}
* *
@ -524,13 +510,6 @@ public final class ItemTypeTagKeys {
*/ */
public static final TagKey<ItemType> FISHES = create(key("fishes")); public static final TagKey<ItemType> FISHES = create(key("fishes"));
/**
* {@code #minecraft:flowers}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<ItemType> FLOWERS = create(key("flowers"));
/** /**
* {@code #minecraft:foot_armor} * {@code #minecraft:foot_armor}
* *

View File

@ -11,7 +11,7 @@ import org.jetbrains.annotations.ApiStatus;
import org.jspecify.annotations.NullMarked; 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 * @apiNote The fields provided here are a direct representation of
* what is available from the vanilla game source. They may be * what is available from the vanilla game source. They may be
@ -23,8 +23,8 @@ import org.jspecify.annotations.NullMarked;
"unused", "unused",
"SpellCheckingInspection" "SpellCheckingInspection"
}) })
@GeneratedFrom("1.21.4")
@NullMarked @NullMarked
@GeneratedFrom("1.21.5")
@ApiStatus.Experimental @ApiStatus.Experimental
public final class PaintingVariantTagKeys { public final class PaintingVariantTagKeys {
/** /**

View File

@ -6,12 +6,13 @@ import io.papermc.paper.generated.GeneratedFrom;
import io.papermc.paper.registry.RegistryKey; import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.tag.TagKey; import io.papermc.paper.registry.tag.TagKey;
import net.kyori.adventure.key.Key; import net.kyori.adventure.key.Key;
import org.bukkit.MinecraftExperimental;
import org.bukkit.generator.structure.Structure; import org.bukkit.generator.structure.Structure;
import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.ApiStatus;
import org.jspecify.annotations.NullMarked; 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 * @apiNote The fields provided here are a direct representation of
* what is available from the vanilla game source. They may be * what is available from the vanilla game source. They may be
@ -23,8 +24,8 @@ import org.jspecify.annotations.NullMarked;
"unused", "unused",
"SpellCheckingInspection" "SpellCheckingInspection"
}) })
@GeneratedFrom("1.21.4")
@NullMarked @NullMarked
@GeneratedFrom("1.21.5")
@ApiStatus.Experimental @ApiStatus.Experimental
public final class StructureTagKeys { public final class StructureTagKeys {
/** /**
@ -74,6 +75,8 @@ public final class StructureTagKeys {
* *
* @apiNote This field is version-dependant and may be removed in future Minecraft versions * @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/ */
@ApiStatus.Experimental
@MinecraftExperimental(MinecraftExperimental.Requires.TRADE_REBALANCE)
public static final TagKey<Structure> ON_DESERT_VILLAGE_MAPS = create(key("on_desert_village_maps")); public static final TagKey<Structure> ON_DESERT_VILLAGE_MAPS = create(key("on_desert_village_maps"));
/** /**
@ -81,6 +84,8 @@ public final class StructureTagKeys {
* *
* @apiNote This field is version-dependant and may be removed in future Minecraft versions * @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/ */
@ApiStatus.Experimental
@MinecraftExperimental(MinecraftExperimental.Requires.TRADE_REBALANCE)
public static final TagKey<Structure> ON_JUNGLE_EXPLORER_MAPS = create(key("on_jungle_explorer_maps")); public static final TagKey<Structure> ON_JUNGLE_EXPLORER_MAPS = create(key("on_jungle_explorer_maps"));
/** /**
@ -95,6 +100,8 @@ public final class StructureTagKeys {
* *
* @apiNote This field is version-dependant and may be removed in future Minecraft versions * @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/ */
@ApiStatus.Experimental
@MinecraftExperimental(MinecraftExperimental.Requires.TRADE_REBALANCE)
public static final TagKey<Structure> ON_PLAINS_VILLAGE_MAPS = create(key("on_plains_village_maps")); public static final TagKey<Structure> ON_PLAINS_VILLAGE_MAPS = create(key("on_plains_village_maps"));
/** /**
@ -102,6 +109,8 @@ public final class StructureTagKeys {
* *
* @apiNote This field is version-dependant and may be removed in future Minecraft versions * @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/ */
@ApiStatus.Experimental
@MinecraftExperimental(MinecraftExperimental.Requires.TRADE_REBALANCE)
public static final TagKey<Structure> ON_SAVANNA_VILLAGE_MAPS = create(key("on_savanna_village_maps")); public static final TagKey<Structure> ON_SAVANNA_VILLAGE_MAPS = create(key("on_savanna_village_maps"));
/** /**
@ -109,6 +118,8 @@ public final class StructureTagKeys {
* *
* @apiNote This field is version-dependant and may be removed in future Minecraft versions * @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/ */
@ApiStatus.Experimental
@MinecraftExperimental(MinecraftExperimental.Requires.TRADE_REBALANCE)
public static final TagKey<Structure> ON_SNOWY_VILLAGE_MAPS = create(key("on_snowy_village_maps")); public static final TagKey<Structure> ON_SNOWY_VILLAGE_MAPS = create(key("on_snowy_village_maps"));
/** /**
@ -116,6 +127,8 @@ public final class StructureTagKeys {
* *
* @apiNote This field is version-dependant and may be removed in future Minecraft versions * @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/ */
@ApiStatus.Experimental
@MinecraftExperimental(MinecraftExperimental.Requires.TRADE_REBALANCE)
public static final TagKey<Structure> ON_SWAMP_EXPLORER_MAPS = create(key("on_swamp_explorer_maps")); public static final TagKey<Structure> ON_SWAMP_EXPLORER_MAPS = create(key("on_swamp_explorer_maps"));
/** /**
@ -123,6 +136,8 @@ public final class StructureTagKeys {
* *
* @apiNote This field is version-dependant and may be removed in future Minecraft versions * @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/ */
@ApiStatus.Experimental
@MinecraftExperimental(MinecraftExperimental.Requires.TRADE_REBALANCE)
public static final TagKey<Structure> ON_TAIGA_VILLAGE_MAPS = create(key("on_taiga_village_maps")); public static final TagKey<Structure> ON_TAIGA_VILLAGE_MAPS = create(key("on_taiga_village_maps"));
/** /**

View File

@ -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);
}
}

View File

@ -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);
}
}
}

View File

@ -0,0 +1,207 @@
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.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()
);
}
@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
} else {
typeBuilder.addAnnotation(EXPERIMENTAL_API_ANNOTATION); // TODO 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");
}
}

View File

@ -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");
}
}

View File

@ -2,16 +2,13 @@ package io.papermc.generator.types;
import com.squareup.javapoet.JavaFile; import com.squareup.javapoet.JavaFile;
import com.squareup.javapoet.TypeSpec; import com.squareup.javapoet.TypeSpec;
import java.io.IOException; import java.io.IOException;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.nio.file.Path; import java.nio.file.Path;
import org.jspecify.annotations.NullMarked;
@NullMarked
public abstract class SimpleGenerator implements SourceGenerator { public abstract class SimpleGenerator implements SourceGenerator {
public static final String INDENT_UNIT = " ";
protected final String className; protected final String className;
protected final String packageName; protected final String packageName;
@ -22,15 +19,14 @@ public abstract class SimpleGenerator implements SourceGenerator {
protected abstract TypeSpec getTypeSpec(); protected abstract TypeSpec getTypeSpec();
protected JavaFile.Builder file(JavaFile.Builder builder) { protected abstract JavaFile.Builder file(JavaFile.Builder builder);
return builder;
}
@Override @Override
public void writeToFile(Path parent) throws IOException { public void writeToFile(Path parent) throws IOException {
JavaFile.Builder builder = JavaFile.builder(this.packageName, this.getTypeSpec()); JavaFile.Builder builder = JavaFile.builder(this.packageName, this.getTypeSpec());
this.file(builder) this.file(builder)
.indent(INDENT_UNIT) .indent(" ")
.skipJavaLangImports(true); .skipJavaLangImports(true);
builder.build().writeTo(parent, StandardCharsets.UTF_8); builder.build().writeTo(parent, StandardCharsets.UTF_8);

View File

@ -2,9 +2,7 @@ package io.papermc.generator.types;
import java.io.IOException; import java.io.IOException;
import java.nio.file.Path; import java.nio.file.Path;
import org.jspecify.annotations.NullMarked;
@NullMarked
public interface SourceGenerator { public interface SourceGenerator {
void writeToFile(Path parent) throws IOException; void writeToFile(Path parent) throws IOException;

View File

@ -3,6 +3,7 @@ package io.papermc.generator.types.goal;
import com.destroystokyo.paper.entity.ai.GoalKey; import com.destroystokyo.paper.entity.ai.GoalKey;
import com.squareup.javapoet.ClassName; import com.squareup.javapoet.ClassName;
import com.squareup.javapoet.FieldSpec; import com.squareup.javapoet.FieldSpec;
import com.squareup.javapoet.JavaFile;
import com.squareup.javapoet.MethodSpec; import com.squareup.javapoet.MethodSpec;
import com.squareup.javapoet.ParameterSpec; import com.squareup.javapoet.ParameterSpec;
import com.squareup.javapoet.ParameterizedTypeName; 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.Annotations;
import io.papermc.generator.utils.Formatting; import io.papermc.generator.utils.Formatting;
import io.papermc.generator.utils.Javadocs; import io.papermc.generator.utils.Javadocs;
import io.papermc.typewriter.util.ClassHelper;
import java.util.Comparator; import java.util.Comparator;
import java.util.List; import java.util.List;
import java.util.stream.Stream;
import net.minecraft.world.entity.ai.goal.Goal; 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 net.minecraft.world.entity.ai.goal.WrappedGoal;
import org.bukkit.NamespacedKey; import org.bukkit.NamespacedKey;
import org.bukkit.entity.Mob; 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.FINAL;
import static javax.lang.model.element.Modifier.PRIVATE; import static javax.lang.model.element.Modifier.PRIVATE;
import static javax.lang.model.element.Modifier.PUBLIC; import static javax.lang.model.element.Modifier.PUBLIC;
import static javax.lang.model.element.Modifier.STATIC; import static javax.lang.model.element.Modifier.STATIC;
@NullMarked @DefaultQualifier(NonNull.class)
public class MobGoalGenerator extends SimpleGenerator { 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) { public MobGoalGenerator(final String keysClassName, final String pkg) {
super(className, packageName); super(keysClassName, pkg);
} }
@Override @Override
@ -51,8 +51,9 @@ public class MobGoalGenerator extends SimpleGenerator {
.addJavadoc(CLASS_HEADER); .addJavadoc(CLASS_HEADER);
TypeName mobType = ParameterizedTypeName.get(ClassName.get(Class.class), type); 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(); ParameterSpec typeParam = ParameterSpec.builder(mobType, "type", FINAL).build();
MethodSpec.Builder createMethod = MethodSpec.methodBuilder("create") MethodSpec.Builder createMethod = MethodSpec.methodBuilder("create")
.addModifiers(PRIVATE, STATIC) .addModifiers(PRIVATE, STATIC)
@ -67,25 +68,33 @@ public class MobGoalGenerator extends SimpleGenerator {
classes = scanResult.getSubclasses(Goal.class.getName()).loadClasses(Goal.class); 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 -> !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 .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()) .sorted(Comparator.<GoalKey<?>, String>comparing(o -> o.getEntityClass().getSimpleName())
.thenComparing(vanillaGoalKey -> vanillaGoalKey.getNamespacedKey().getKey()) .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()); 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) FieldSpec.Builder fieldBuilder = FieldSpec.builder(typedKey, fieldName, PUBLIC, STATIC, FINAL)
.initializer("$N($S, $T.class)", createMethod.build(), keyPath, goalKey.getEntityClass()); .initializer("$N($S, $T.class)", createMethod.build(), keyPath, goalKey.getEntityClass());
typeBuilder.addField(fieldBuilder.build()); typeBuilder.addField(fieldBuilder.build());
}); }
return typeBuilder.addMethod(createMethod.build()).build(); return typeBuilder.addMethod(createMethod.build()).build();
} }
@Override
protected JavaFile.Builder file(JavaFile.Builder builder) {
return builder;
}
} }

View File

@ -2,32 +2,140 @@ package io.papermc.generator.types.goal;
import com.destroystokyo.paper.entity.RangedEntity; import com.destroystokyo.paper.entity.RangedEntity;
import com.destroystokyo.paper.entity.ai.GoalKey; import com.destroystokyo.paper.entity.ai.GoalKey;
import com.google.common.base.CaseFormat; import com.google.common.collect.BiMap;
import io.papermc.generator.utils.Formatting; import com.google.common.collect.HashBiMap;
import io.papermc.paper.entity.SchoolableFish; 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.lang.reflect.Constructor;
import java.util.HashMap; import java.util.HashMap;
import java.util.LinkedHashMap; import java.util.HashSet;
import java.util.Locale;
import java.util.Map; import java.util.Map;
import net.minecraft.world.entity.ai.goal.Goal; import java.util.Set;
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;
@NullMarked public class MobGoalNames {
public final class MobGoalNames { // todo sync with MobGoalHelper ideally this should not be duplicated
private static final Map<Class<? extends Goal>, Class<? extends Mob>> entityClassCache = new HashMap<>(); 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 { static {
//<editor-fold defaultstate="collapsed" desc="bukkitMap Entities"> //<editor-fold defaultstate="collapsed" desc="bukkitMap Entities">
bukkitMap.put(net.minecraft.world.entity.Mob.class, Mob.class); 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.AgeableMob.class, Ageable.class);
bukkitMap.put(net.minecraft.world.entity.ambient.AmbientCreature.class, Ambient.class); bukkitMap.put(AmbientCreature.class, Ambient.class);
bukkitMap.put(net.minecraft.world.entity.animal.Animal.class, Animals.class); bukkitMap.put(Animal.class, Animals.class);
bukkitMap.put(net.minecraft.world.entity.ambient.Bat.class, Bat.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.animal.Bee.class, Bee.class);
bukkitMap.put(net.minecraft.world.entity.monster.Blaze.class, Blaze.class); bukkitMap.put(net.minecraft.world.entity.monster.Blaze.class, Blaze.class);
@ -36,56 +144,56 @@ 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.Chicken.class, Chicken.class);
bukkitMap.put(net.minecraft.world.entity.animal.Cod.class, Cod.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.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.monster.Creeper.class, Creeper.class);
bukkitMap.put(net.minecraft.world.entity.animal.Dolphin.class, Dolphin.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.monster.Drowned.class, Drowned.class);
bukkitMap.put(net.minecraft.world.entity.boss.enderdragon.EnderDragon.class, EnderDragon.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.Endermite.class, Endermite.class);
bukkitMap.put(net.minecraft.world.entity.monster.Evoker.class, Evoker.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(AbstractFish.class, Fish.class);
bukkitMap.put(net.minecraft.world.entity.animal.AbstractSchoolingFish.class, SchoolableFish.class); bukkitMap.put(AbstractSchoolingFish.class, io.papermc.paper.entity.SchoolableFish.class);
bukkitMap.put(net.minecraft.world.entity.FlyingMob.class, Flying.class); bukkitMap.put(FlyingMob.class, Flying.class);
bukkitMap.put(net.minecraft.world.entity.animal.Fox.class, Fox.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.Ghast.class, Ghast.class);
bukkitMap.put(net.minecraft.world.entity.monster.Giant.class, Giant.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.Guardian.class, Guardian.class);
bukkitMap.put(net.minecraft.world.entity.monster.ElderGuardian.class, ElderGuardian.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.Horse.class, Horse.class);
bukkitMap.put(net.minecraft.world.entity.animal.horse.AbstractHorse.class, AbstractHorse.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.Donkey.class, Donkey.class);
bukkitMap.put(net.minecraft.world.entity.animal.horse.Mule.class, Mule.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.SkeletonHorse.class, SkeletonHorse.class);
bukkitMap.put(net.minecraft.world.entity.animal.horse.ZombieHorse.class, ZombieHorse.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.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.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.IronGolem.class, IronGolem.class);
bukkitMap.put(net.minecraft.world.entity.animal.horse.Llama.class, Llama.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.animal.horse.TraderLlama.class, TraderLlama.class);
bukkitMap.put(net.minecraft.world.entity.monster.MagmaCube.class, MagmaCube.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.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.MushroomCow.class, MushroomCow.class);
bukkitMap.put(net.minecraft.world.entity.animal.Ocelot.class, Ocelot.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.Panda.class, Panda.class);
bukkitMap.put(net.minecraft.world.entity.animal.Parrot.class, Parrot.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.monster.Phantom.class, Phantom.class);
bukkitMap.put(net.minecraft.world.entity.animal.Pig.class, Pig.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.monster.Pillager.class, Pillager.class);
bukkitMap.put(net.minecraft.world.entity.animal.PolarBear.class, PolarBear.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.animal.Rabbit.class, Rabbit.class);
bukkitMap.put(net.minecraft.world.entity.raid.Raider.class, Raider.class); bukkitMap.put(net.minecraft.world.entity.raid.Raider.class, Raider.class);
bukkitMap.put(net.minecraft.world.entity.monster.Ravager.class, Ravager.class); bukkitMap.put(net.minecraft.world.entity.monster.Ravager.class, Ravager.class);
bukkitMap.put(net.minecraft.world.entity.animal.Salmon.class, Salmon.class); bukkitMap.put(net.minecraft.world.entity.animal.Salmon.class, Salmon.class);
bukkitMap.put(net.minecraft.world.entity.animal.sheep.Sheep.class, Sheep.class); bukkitMap.put(net.minecraft.world.entity.animal.Sheep.class, Sheep.class);
bukkitMap.put(net.minecraft.world.entity.monster.Shulker.class, Shulker.class); bukkitMap.put(net.minecraft.world.entity.monster.Shulker.class, Shulker.class);
bukkitMap.put(net.minecraft.world.entity.monster.Silverfish.class, Silverfish.class); bukkitMap.put(net.minecraft.world.entity.monster.Silverfish.class, Silverfish.class);
bukkitMap.put(net.minecraft.world.entity.monster.Skeleton.class, Skeleton.class); bukkitMap.put(net.minecraft.world.entity.monster.Skeleton.class, Skeleton.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.Stray.class, Stray.class);
bukkitMap.put(net.minecraft.world.entity.monster.WitherSkeleton.class, WitherSkeleton.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.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.monster.Spider.class, Spider.class);
bukkitMap.put(net.minecraft.world.entity.animal.Squid.class, Squid.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.TropicalFish.class, TropicalFish.class);
bukkitMap.put(net.minecraft.world.entity.animal.Turtle.class, Turtle.class); bukkitMap.put(net.minecraft.world.entity.animal.Turtle.class, Turtle.class);
bukkitMap.put(net.minecraft.world.entity.monster.Vex.class, Vex.class); bukkitMap.put(net.minecraft.world.entity.monster.Vex.class, Vex.class);
@ -104,86 +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.AbstractVillager.class, AbstractVillager.class);
bukkitMap.put(net.minecraft.world.entity.npc.WanderingTrader.class, WanderingTrader.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.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.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.Wolf.class, Wolf.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.Zombie.class, Zombie.class);
bukkitMap.put(net.minecraft.world.entity.monster.Husk.class, Husk.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.ZombieVillager.class, ZombieVillager.class);
bukkitMap.put(net.minecraft.world.entity.monster.hoglin.Hoglin.class, Hoglin.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.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.piglin.PiglinBrute.class, PiglinBrute.class);
bukkitMap.put(net.minecraft.world.entity.monster.Strider.class, Strider.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.monster.Zoglin.class, Zoglin.class);
bukkitMap.put(net.minecraft.world.entity.GlowSquid.class, GlowSquid.class); bukkitMap.put(net.minecraft.world.entity.GlowSquid.class, org.bukkit.entity.GlowSquid.class);
bukkitMap.put(net.minecraft.world.entity.animal.axolotl.Axolotl.class, Axolotl.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, Goat.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, Frog.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, Tadpole.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, Warden.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, Allay.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, Sniffer.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, Breeze.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, Armadillo.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, Bogged.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, Creaking.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, Squid.class); // close enough bukkitMap.put(net.minecraft.world.entity.animal.AgeableWaterCreature.class, org.bukkit.entity.Squid.class); // close enough
bukkitMap.put(net.minecraft.world.entity.animal.AbstractCow.class, AbstractCow.class);
//</editor-fold> //</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 { static {
// TODO these kinda should be checked on each release, in case obfuscation changes
deobfuscationMap.put("abstract_skeleton_1", "abstract_skeleton_melee"); 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) { public static String getUsableName(String name) {
String pathName = name.substring(name.lastIndexOf('.') + 1); final String original = name;
boolean needDeobfMap = false; name = name.substring(name.lastIndexOf(".") + 1);
boolean flag = false;
// inner classes // inner classes
int firstInnerDelimiter = pathName.indexOf('$'); if (name.contains("$")) {
if (firstInnerDelimiter != -1) { String cut = name.substring(name.indexOf("$") + 1);
String innerClassName = pathName.substring(firstInnerDelimiter + 1); if (cut.length() <= 2) {
for (String nestedClass : innerClassName.split("\\$")) { name = name.replace("Entity", "");
if (NumberUtils.isDigits(nestedClass)) { name = name.replace("$", "_");
needDeobfMap = true; flag = true;
break; } else {
} // mapped, wooo
name = cut;
} }
if (!needDeobfMap) {
pathName = innerClassName;
}
pathName = pathName.replace('$', '_');
// mapped, wooo!
} }
pathName = Formatting.stripWordOfCamelCaseName(pathName, "TargetGoal", true); // replace last? reverse search? name = name.replace("PathfinderGoal", "");
pathName = Formatting.stripWordOfCamelCaseName(pathName, "Goal", true); name = name.replace("TargetGoal", "");
pathName = CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, pathName); 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)) { if (flag && !deobfuscationMap.containsKey(name.toLowerCase(Locale.ROOT)) && !ignored.contains(name)) {
System.err.println("need to map " + name + " (" + pathName + ")"); System.out.println("need to map " + original + " (" + name.toLowerCase(Locale.ROOT) + ")");
} }
// did we rename this key? // 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) { public static boolean isIgnored(String name) {
String name = getPathName(goalClass.getName()); 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)); 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 //noinspection unchecked
return (Class<T>) entityClassCache.computeIfAbsent(goalClass, key -> { return (Class<T>) entityClassCache.computeIfAbsent(goalClass, key -> {
for (Constructor<?> ctor : key.getDeclaredConstructors()) { 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)) { if (net.minecraft.world.entity.Mob.class.isAssignableFrom(param)) {
//noinspection unchecked //noinspection unchecked
return toBukkitClass((Class<? extends net.minecraft.world.entity.Mob>) param); return toBukkitClass((Class<? extends net.minecraft.world.entity.Mob>) param);
@ -192,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); Class<? extends Mob> bukkitClass = bukkitMap.get(nmsClass);
if (bukkitClass == null) { if (bukkitClass == null) {
throw new RuntimeException("Can't figure out applicable bukkit entity for nms entity " + nmsClass); // maybe just return Mob? throw new RuntimeException("Can't figure out applicable bukkit entity for nms entity " + nmsClass); // maybe just return Mob?

View File

@ -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() {
}
}

View File

@ -1,4 +1,4 @@
package io.papermc.generator.utils.experimental; package io.papermc.generator.utils;
import com.mojang.serialization.Lifecycle; import com.mojang.serialization.Lifecycle;
import io.papermc.generator.Main; import io.papermc.generator.Main;
@ -8,20 +8,21 @@ import net.minecraft.core.HolderGetter;
import net.minecraft.core.Registry; import net.minecraft.core.Registry;
import net.minecraft.data.worldgen.BootstrapContext; import net.minecraft.data.worldgen.BootstrapContext;
import net.minecraft.resources.ResourceKey; 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, public record CollectingContext<T>(Set<ResourceKey<T>> registered,
Registry<T> registry) implements BootstrapContext<T> { Registry<T> registry) implements BootstrapContext<T> {
@Override @Override
public Holder.Reference<T> register(ResourceKey<T> key, T value, Lifecycle lifecycle) { public Holder.Reference<T> register(final ResourceKey<T> resourceKey, final @NonNull T t, final Lifecycle lifecycle) {
this.registered.add(key); this.registered.add(resourceKey);
return Holder.Reference.createStandAlone(this.registry, key); return Holder.Reference.createStandAlone(this.registry, resourceKey);
} }
@Override @Override
public <S> HolderGetter<S> lookup(ResourceKey<? extends Registry<? extends S>> key) { public <S> HolderGetter<S> lookup(final ResourceKey<? extends Registry<? extends S>> resourceKey) {
return Main.REGISTRY_ACCESS.lookupOrThrow(key); return Main.REGISTRY_ACCESS.lookupOrThrow(resourceKey);
} }
} }

View File

@ -7,29 +7,13 @@ import java.util.Locale;
import java.util.OptionalInt; import java.util.OptionalInt;
import java.util.function.Function; import java.util.function.Function;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import java.util.stream.IntStream;
import net.minecraft.core.Registry;
import net.minecraft.core.registries.Registries;
import net.minecraft.resources.ResourceKey;
import org.jspecify.annotations.NullMarked;
@NullMarked
public final class Formatting { public final class Formatting {
private static final Pattern ILLEGAL_FIELD_CHARACTERS = Pattern.compile("[.-/]"); private static final Pattern ILLEGAL_FIELD_CHARACTERS = Pattern.compile("[.-/]");
public static String formatKeyAsField(String path) { public static String formatKeyAsField(String path) {
return ILLEGAL_FIELD_CHARACTERS.matcher(path.toUpperCase(Locale.ENGLISH)).replaceAll("_"); return ILLEGAL_FIELD_CHARACTERS.matcher(path.toUpperCase(Locale.ROOT)).replaceAll("_");
}
public static String formatTagFieldPrefix(String name, ResourceKey<? extends Registry<?>> registryKey) {
if (registryKey == Registries.BLOCK) {
return "";
}
if (registryKey == Registries.GAME_EVENT) {
return "GAME_EVENT_"; // Paper doesn't follow the format (should be GAME_EVENTS_) (pre 1.21)
}
return name.toUpperCase(Locale.ENGLISH) + "_";
} }
public static Optional<String> formatTagKey(String tagDir, String resourcePath) { public static Optional<String> formatTagKey(String tagDir, String resourcePath) {
@ -41,39 +25,7 @@ public final class Formatting {
return Optional.of(resourcePath.substring(tagsIndex + tagDir.length() + 1, dotIndex)); // namespace/tags/registry_key/[tag_key].json return Optional.of(resourcePath.substring(tagsIndex + tagDir.length() + 1, dotIndex)); // namespace/tags/registry_key/[tag_key].json
} }
public static String quoted(String value) { public static Comparator<String> ALPHABETIC_KEY_ORDER = alphabeticKeyOrder(path -> path);
return "\"" + value + "\"";
}
public static String[] asCode(int... values) {
return IntStream.of(values).mapToObj(Integer::toString).toArray(String[]::new);
}
public static String stripWordOfCamelCaseName(String name, String word, boolean onlyOnce) {
String newName = name;
int startIndex = 0;
while (true) {
int baseIndex = newName.indexOf(word, startIndex);
if (baseIndex == -1) {
return newName;
}
if ((baseIndex > 0 && !Character.isLowerCase(newName.charAt(baseIndex - 1))) ||
(baseIndex + word.length() < newName.length() && !Character.isUpperCase(newName.charAt(baseIndex + word.length())))) {
startIndex = baseIndex + word.length();
continue;
}
newName = newName.substring(0, baseIndex) + newName.substring(baseIndex + word.length());
startIndex = baseIndex;
if (onlyOnce) {
break;
}
}
return newName;
}
public static final Comparator<String> ALPHABETIC_KEY_ORDER = alphabeticKeyOrder(path -> path);
public static <T> Comparator<T> alphabeticKeyOrder(Function<T, String> mapper) { public static <T> Comparator<T> alphabeticKeyOrder(Function<T, String> mapper) {
return (o1, o2) -> { return (o1, o2) -> {

View File

@ -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() {
}
}

View File

@ -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() {
}
}

View File

@ -3,21 +3,21 @@ package io.papermc.generator;
import io.github.classgraph.ClassGraph; import io.github.classgraph.ClassGraph;
import io.github.classgraph.ScanResult; import io.github.classgraph.ScanResult;
import io.papermc.generator.types.goal.MobGoalNames; 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.Entity;
import net.minecraft.world.entity.Mob; import net.minecraft.world.entity.Mob;
import org.junit.jupiter.api.Test; 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.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.fail;
public class MobGoalConverterTest { public class MobGoalConverterTest {
@Test @Test
public void testBukkitMap() { public void testBukkitMap() {
final List<Class<Mob>> classes; 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); 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));
}
} }
} }

View File

@ -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 # for auto-marking experimental stuff
public net/minecraft/core/RegistrySetBuilder entries public net/minecraft/core/RegistrySetBuilder entries
public net/minecraft/core/RegistrySetBuilder$RegistryStub public net/minecraft/core/RegistrySetBuilder$RegistryStub
public net/minecraft/data/registries/VanillaRegistries BUILDER public net/minecraft/data/registries/VanillaRegistries BUILDER
public net/minecraft/data/registries/WinterDropRegistries BUILDER
public net/minecraft/data/registries/TradeRebalanceRegistries BUILDER public net/minecraft/data/registries/TradeRebalanceRegistries BUILDER
public net/minecraft/world/flag/FeatureFlagRegistry names
public net/minecraft/world/flag/FeatureFlagSet mask

View File

@ -9,12 +9,11 @@ java {
withJavadocJar() withJavadocJar()
} }
val annotationsVersion = "26.0.2" val annotationsVersion = "26.0.1"
// Keep in sync with paper-server adventure-text-serializer-ansi dep val bungeeCordChatVersion = "1.20-R0.2"
val adventureVersion = "4.21.0" val adventureVersion = "4.18.0"
val bungeeCordChatVersion = "1.21-R0.2-deprecated+build.21" val slf4jVersion = "2.0.9"
val slf4jVersion = "2.0.16" val log4jVersion = "2.17.1"
val log4jVersion = "2.24.1"
val apiAndDocs: Configuration by configurations.creating { val apiAndDocs: Configuration by configurations.creating {
attributes { attributes {
@ -40,6 +39,7 @@ abstract class MockitoAgentProvider : CommandLineArgumentProvider {
} }
dependencies { dependencies {
// api dependencies are listed transitively to API consumers // api dependencies are listed transitively to API consumers
api("com.google.guava:guava:33.3.1-jre") api("com.google.guava:guava:33.3.1-jre")
api("com.google.code.gson:gson:2.11.0") api("com.google.code.gson:gson:2.11.0")
@ -47,13 +47,16 @@ dependencies {
api("org.joml:joml:1.10.8") { api("org.joml:joml:1.10.8") {
isTransitive = false // https://github.com/JOML-CI/JOML/issues/352 isTransitive = false // https://github.com/JOML-CI/JOML/issues/352
} }
api("com.googlecode.json-simple:json-simple:1.1.1") {
isTransitive = false // includes junit
}
api("it.unimi.dsi:fastutil:8.5.15") api("it.unimi.dsi:fastutil:8.5.15")
api("org.apache.logging.log4j:log4j-api:$log4jVersion") api("org.apache.logging.log4j:log4j-api:$log4jVersion")
api("org.slf4j:slf4j-api:$slf4jVersion") api("org.slf4j:slf4j-api:$slf4jVersion")
api("com.mojang:brigadier:1.3.10") api("com.mojang:brigadier:1.3.10")
// Deprecate bungeecord-chat in favor of adventure // Deprecate bungeecord-chat in favor of adventure
api("net.md-5:bungeecord-chat:$bungeeCordChatVersion") { api("net.md-5:bungeecord-chat:$bungeeCordChatVersion-deprecated+build.19") {
exclude("com.google.guava", "guava") exclude("com.google.guava", "guava")
} }
@ -74,32 +77,32 @@ dependencies {
compileOnly(annotations) compileOnly(annotations)
testCompileOnly(annotations) testCompileOnly(annotations)
val checkerQual = "org.checkerframework:checker-qual:3.49.2" val checkerQual = "org.checkerframework:checker-qual:3.33.0"
compileOnlyApi(checkerQual) compileOnlyApi(checkerQual)
testCompileOnly(checkerQual) testCompileOnly(checkerQual)
api("org.jspecify:jspecify:1.0.0") api("org.jspecify:jspecify:1.0.0")
// Test dependencies // Test dependencies
testImplementation("org.apache.commons:commons-lang3:3.17.0") testImplementation("org.apache.commons:commons-lang3:3.12.0")
testImplementation("org.junit.jupiter:junit-jupiter:5.12.2") testImplementation("org.junit.jupiter:junit-jupiter:5.10.2")
testImplementation("org.hamcrest:hamcrest:2.2") testImplementation("org.hamcrest:hamcrest:2.2")
testImplementation("org.mockito:mockito-core:5.14.1") testImplementation("org.mockito:mockito-core:5.14.1")
testImplementation("org.ow2.asm:asm-tree:9.8") testImplementation("org.ow2.asm:asm-tree:9.7.1")
mockitoAgent("org.mockito:mockito-core:5.14.1") { isTransitive = false } // configure mockito agent that is needed in newer java versions mockitoAgent("org.mockito:mockito-core:5.14.1") { isTransitive = false } // configure mockito agent that is needed in newer java versions
testRuntimeOnly("org.junit.platform:junit-platform-launcher") 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 = rootProject.projectDir.toPath().resolve("paper-api-generator/generated")
idea { idea {
module { module {
generatedSourceDirs.add(generatedDir.toFile()) generatedSourceDirs.add(generatedApiPath.toFile())
} }
} }
sourceSets { sourceSets {
main { main {
java { java {
srcDir(generatedDir) srcDir(generatedApiPath)
} }
} }
} }
@ -173,7 +176,7 @@ tasks.withType<Javadoc> {
"https://guava.dev/releases/33.3.1-jre/api/docs/", "https://guava.dev/releases/33.3.1-jre/api/docs/",
"https://javadoc.io/doc/org.yaml/snakeyaml/2.2/", "https://javadoc.io/doc/org.yaml/snakeyaml/2.2/",
"https://javadoc.io/doc/org.jetbrains/annotations/$annotationsVersion/", "https://javadoc.io/doc/org.jetbrains/annotations/$annotationsVersion/",
"https://javadoc.io/doc/org.joml/joml/1.10.8/", "https://javadoc.io/doc/org.joml/joml/1.10.8/index.html",
"https://www.javadoc.io/doc/com.google.code.gson/gson/2.11.0", "https://www.javadoc.io/doc/com.google.code.gson/gson/2.11.0",
"https://jspecify.dev/docs/api/", "https://jspecify.dev/docs/api/",
"https://jd.advntr.dev/api/$adventureVersion/", "https://jd.advntr.dev/api/$adventureVersion/",
@ -184,7 +187,7 @@ tasks.withType<Javadoc> {
"https://jd.advntr.dev/text-serializer-plain/$adventureVersion/", "https://jd.advntr.dev/text-serializer-plain/$adventureVersion/",
"https://jd.advntr.dev/text-logger-slf4j/$adventureVersion/", "https://jd.advntr.dev/text-logger-slf4j/$adventureVersion/",
"https://javadoc.io/doc/org.slf4j/slf4j-api/$slf4jVersion/", "https://javadoc.io/doc/org.slf4j/slf4j-api/$slf4jVersion/",
"https://logging.apache.org/log4j/2.x/javadoc/log4j-api/", "https://javadoc.io/doc/org.apache.logging.log4j/log4j-api/$log4jVersion/",
"https://javadoc.io/doc/org.apache.maven.resolver/maven-resolver-api/1.7.3", "https://javadoc.io/doc/org.apache.maven.resolver/maven-resolver-api/1.7.3",
) )
options.tags("apiNote:a:API Note:") options.tags("apiNote:a:API Note:")
@ -225,23 +228,21 @@ tasks.compileTestJava {
options.compilerArgs.add("-parameters") 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;") badAnnotations.add("Lio/papermc/paper/annotation/DoNotUse;")
jarToScan.set(tasks.jar.flatMap { it.archiveFile }) jarToScan.set(tasks.jar.flatMap { it.archiveFile })
classpath.from(configurations.compileClasspath) classpath.from(configurations.compileClasspath)
} }
tasks.check { tasks.check {
dependsOn(scanJarForBadCalls) dependsOn(scanJar)
} }
if (providers.gradleProperty("updatingMinecraft").getOrElse("false").toBoolean()) { val scanJarForOldGeneratedCode = tasks.register("scanJarForOldGeneratedCode", io.papermc.paperweight.tasks.ScanJarForOldGeneratedCode::class) {
val scanJarForOldGeneratedCode by tasks.registering(io.papermc.paperweight.tasks.ScanJarForOldGeneratedCode::class) { mcVersion.set(providers.gradleProperty("mcVersion"))
mcVersion.set(providers.gradleProperty("mcVersion")) annotation.set("Lio/papermc/paper/generated/GeneratedFrom;")
annotation.set("Lio/papermc/paper/generated/GeneratedFrom;") jarToScan.set(tasks.jar.flatMap { it.archiveFile })
jarToScan.set(tasks.jar.flatMap { it.archiveFile }) classpath.from(configurations.compileClasspath)
classpath.from(configurations.compileClasspath) }
} tasks.check {
tasks.check { dependsOn(scanJarForOldGeneratedCode)
dependsOn(scanJarForOldGeneratedCode)
}
} }

View File

@ -1,61 +0,0 @@
package io.papermc.paper.registry.keys;
import static net.kyori.adventure.key.Key.key;
import io.papermc.paper.generated.GeneratedFrom;
import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.TypedKey;
import net.kyori.adventure.key.Key;
import org.bukkit.entity.Chicken;
import org.jspecify.annotations.NullMarked;
/**
* Vanilla keys for {@link RegistryKey#CHICKEN_VARIANT}.
*
* @apiNote The fields provided here are a direct representation of
* what is available from the vanilla game source. They may be
* changed (including removals) on any Minecraft version
* bump, so cross-version compatibility is not provided on the
* same level as it is on most of the other API.
*/
@SuppressWarnings({
"unused",
"SpellCheckingInspection"
})
@NullMarked
@GeneratedFrom("1.21.5")
public final class ChickenVariantKeys {
/**
* {@code minecraft:cold}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Chicken.Variant> COLD = create(key("cold"));
/**
* {@code minecraft:temperate}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Chicken.Variant> TEMPERATE = create(key("temperate"));
/**
* {@code minecraft:warm}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Chicken.Variant> WARM = create(key("warm"));
private ChickenVariantKeys() {
}
/**
* Creates a typed key for {@link Chicken.Variant} in the registry {@code minecraft:chicken_variant}.
*
* @param key the value's key in the registry
* @return a new typed key
*/
public static TypedKey<Chicken.Variant> create(final Key key) {
return TypedKey.create(RegistryKey.CHICKEN_VARIANT, key);
}
}

View File

@ -1,61 +0,0 @@
package io.papermc.paper.registry.keys;
import static net.kyori.adventure.key.Key.key;
import io.papermc.paper.generated.GeneratedFrom;
import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.TypedKey;
import net.kyori.adventure.key.Key;
import org.bukkit.entity.Cow;
import org.jspecify.annotations.NullMarked;
/**
* Vanilla keys for {@link RegistryKey#COW_VARIANT}.
*
* @apiNote The fields provided here are a direct representation of
* what is available from the vanilla game source. They may be
* changed (including removals) on any Minecraft version
* bump, so cross-version compatibility is not provided on the
* same level as it is on most of the other API.
*/
@SuppressWarnings({
"unused",
"SpellCheckingInspection"
})
@NullMarked
@GeneratedFrom("1.21.5")
public final class CowVariantKeys {
/**
* {@code minecraft:cold}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Cow.Variant> COLD = create(key("cold"));
/**
* {@code minecraft:temperate}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Cow.Variant> TEMPERATE = create(key("temperate"));
/**
* {@code minecraft:warm}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Cow.Variant> WARM = create(key("warm"));
private CowVariantKeys() {
}
/**
* Creates a typed key for {@link Cow.Variant} in the registry {@code minecraft:cow_variant}.
*
* @param key the value's key in the registry
* @return a new typed key
*/
public static TypedKey<Cow.Variant> create(final Key key) {
return TypedKey.create(RegistryKey.COW_VARIANT, key);
}
}

View File

@ -1,706 +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.5")
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:axolotl/variant}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DataComponentType> AXOLOTL_VARIANT = create(key("axolotl/variant"));
/**
* {@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:blocks_attacks}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DataComponentType> BLOCKS_ATTACKS = create(key("blocks_attacks"));
/**
* {@code minecraft:break_sound}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DataComponentType> BREAK_SOUND = create(key("break_sound"));
/**
* {@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:cat/collar}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DataComponentType> CAT_COLLAR = create(key("cat/collar"));
/**
* {@code minecraft:cat/variant}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DataComponentType> CAT_VARIANT = create(key("cat/variant"));
/**
* {@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:chicken/variant}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DataComponentType> CHICKEN_VARIANT = create(key("chicken/variant"));
/**
* {@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:cow/variant}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DataComponentType> COW_VARIANT = create(key("cow/variant"));
/**
* {@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:fox/variant}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DataComponentType> FOX_VARIANT = create(key("fox/variant"));
/**
* {@code minecraft:frog/variant}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DataComponentType> FROG_VARIANT = create(key("frog/variant"));
/**
* {@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:horse/variant}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DataComponentType> HORSE_VARIANT = create(key("horse/variant"));
/**
* {@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:llama/variant}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DataComponentType> LLAMA_VARIANT = create(key("llama/variant"));
/**
* {@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:mooshroom/variant}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DataComponentType> MOOSHROOM_VARIANT = create(key("mooshroom/variant"));
/**
* {@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:painting/variant}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DataComponentType> PAINTING_VARIANT = create(key("painting/variant"));
/**
* {@code minecraft:parrot/variant}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DataComponentType> PARROT_VARIANT = create(key("parrot/variant"));
/**
* {@code minecraft:pig/variant}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DataComponentType> PIG_VARIANT = create(key("pig/variant"));
/**
* {@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:potion_duration_scale}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DataComponentType> POTION_DURATION_SCALE = create(key("potion_duration_scale"));
/**
* {@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:provides_banner_patterns}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DataComponentType> PROVIDES_BANNER_PATTERNS = create(key("provides_banner_patterns"));
/**
* {@code minecraft:provides_trim_material}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DataComponentType> PROVIDES_TRIM_MATERIAL = create(key("provides_trim_material"));
/**
* {@code minecraft:rabbit/variant}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DataComponentType> RABBIT_VARIANT = create(key("rabbit/variant"));
/**
* {@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:salmon/size}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DataComponentType> SALMON_SIZE = create(key("salmon/size"));
/**
* {@code minecraft:sheep/color}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DataComponentType> SHEEP_COLOR = create(key("sheep/color"));
/**
* {@code minecraft:shulker/color}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DataComponentType> SHULKER_COLOR = create(key("shulker/color"));
/**
* {@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_display}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DataComponentType> TOOLTIP_DISPLAY = create(key("tooltip_display"));
/**
* {@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:tropical_fish/base_color}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DataComponentType> TROPICAL_FISH_BASE_COLOR = create(key("tropical_fish/base_color"));
/**
* {@code minecraft:tropical_fish/pattern}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DataComponentType> TROPICAL_FISH_PATTERN = create(key("tropical_fish/pattern"));
/**
* {@code minecraft:tropical_fish/pattern_color}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DataComponentType> TROPICAL_FISH_PATTERN_COLOR = create(key("tropical_fish/pattern_color"));
/**
* {@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:villager/variant}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DataComponentType> VILLAGER_VARIANT = create(key("villager/variant"));
/**
* {@code minecraft:weapon}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DataComponentType> WEAPON = create(key("weapon"));
/**
* {@code minecraft:wolf/collar}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DataComponentType> WOLF_COLLAR = create(key("wolf/collar"));
/**
* {@code minecraft:wolf/sound_variant}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DataComponentType> WOLF_SOUND_VARIANT = create(key("wolf/sound_variant"));
/**
* {@code minecraft:wolf/variant}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DataComponentType> WOLF_VARIANT = create(key("wolf/variant"));
/**
* {@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);
}
}

View File

@ -1,61 +0,0 @@
package io.papermc.paper.registry.keys;
import static net.kyori.adventure.key.Key.key;
import io.papermc.paper.generated.GeneratedFrom;
import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.TypedKey;
import net.kyori.adventure.key.Key;
import org.bukkit.entity.Pig;
import org.jspecify.annotations.NullMarked;
/**
* Vanilla keys for {@link RegistryKey#PIG_VARIANT}.
*
* @apiNote The fields provided here are a direct representation of
* what is available from the vanilla game source. They may be
* changed (including removals) on any Minecraft version
* bump, so cross-version compatibility is not provided on the
* same level as it is on most of the other API.
*/
@SuppressWarnings({
"unused",
"SpellCheckingInspection"
})
@NullMarked
@GeneratedFrom("1.21.5")
public final class PigVariantKeys {
/**
* {@code minecraft:cold}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Pig.Variant> COLD = create(key("cold"));
/**
* {@code minecraft:temperate}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Pig.Variant> TEMPERATE = create(key("temperate"));
/**
* {@code minecraft:warm}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Pig.Variant> WARM = create(key("warm"));
private PigVariantKeys() {
}
/**
* Creates a typed key for {@link Pig.Variant} in the registry {@code minecraft:pig_variant}.
*
* @param key the value's key in the registry
* @return a new typed key
*/
public static TypedKey<Pig.Variant> create(final Key key) {
return TypedKey.create(RegistryKey.PIG_VARIANT, key);
}
}

View File

@ -1,89 +0,0 @@
package io.papermc.paper.registry.keys;
import static net.kyori.adventure.key.Key.key;
import io.papermc.paper.generated.GeneratedFrom;
import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.TypedKey;
import net.kyori.adventure.key.Key;
import org.bukkit.entity.Wolf;
import org.jspecify.annotations.NullMarked;
/**
* Vanilla keys for {@link RegistryKey#WOLF_SOUND_VARIANT}.
*
* @apiNote The fields provided here are a direct representation of
* what is available from the vanilla game source. They may be
* changed (including removals) on any Minecraft version
* bump, so cross-version compatibility is not provided on the
* same level as it is on most of the other API.
*/
@SuppressWarnings({
"unused",
"SpellCheckingInspection"
})
@NullMarked
@GeneratedFrom("1.21.5")
public final class WolfSoundVariantKeys {
/**
* {@code minecraft:angry}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Wolf.SoundVariant> ANGRY = create(key("angry"));
/**
* {@code minecraft:big}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Wolf.SoundVariant> BIG = create(key("big"));
/**
* {@code minecraft:classic}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Wolf.SoundVariant> CLASSIC = create(key("classic"));
/**
* {@code minecraft:cute}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Wolf.SoundVariant> CUTE = create(key("cute"));
/**
* {@code minecraft:grumpy}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Wolf.SoundVariant> GRUMPY = create(key("grumpy"));
/**
* {@code minecraft:puglin}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Wolf.SoundVariant> PUGLIN = create(key("puglin"));
/**
* {@code minecraft:sad}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Wolf.SoundVariant> SAD = create(key("sad"));
private WolfSoundVariantKeys() {
}
/**
* Creates a typed key for {@link Wolf.SoundVariant} in the registry {@code minecraft:wolf_sound_variant}.
*
* @param key the value's key in the registry
* @return a new typed key
*/
public static TypedKey<Wolf.SoundVariant> create(final Key key) {
return TypedKey.create(RegistryKey.WOLF_SOUND_VARIANT, key);
}
}

View File

@ -289,7 +289,7 @@ public class TimingHistory {
final TicksRecord ticksRecord = new TicksRecord(); final TicksRecord ticksRecord = new TicksRecord();
final PingRecord pingRecord = new PingRecord(); final PingRecord pingRecord = new PingRecord();
final TimingData fst = TimingsManager.FULL_SERVER_TICK.minuteData.clone(); final TimingData fst = TimingsManager.FULL_SERVER_TICK.minuteData.clone();
final double tps = 1E9 / (System.nanoTime() - lastMinuteTime) * ticksRecord.timed; final double tps = 1E9 / ( System.nanoTime() - lastMinuteTime ) * ticksRecord.timed;
final double usedMemory = TimingsManager.FULL_SERVER_TICK.avgUsedMemory; final double usedMemory = TimingsManager.FULL_SERVER_TICK.avgUsedMemory;
final double freeMemory = TimingsManager.FULL_SERVER_TICK.avgFreeMemory; final double freeMemory = TimingsManager.FULL_SERVER_TICK.avgFreeMemory;
final double loadAvg = ManagementFactory.getOperatingSystemMXBean().getSystemLoadAverage(); final double loadAvg = ManagementFactory.getOperatingSystemMXBean().getSystemLoadAverage();

View File

@ -153,9 +153,9 @@ public final class TimingsManager {
public static Timing getCommandTiming(@Nullable String pluginName, @NotNull Command command) { public static Timing getCommandTiming(@Nullable String pluginName, @NotNull Command command) {
Plugin plugin = null; Plugin plugin = null;
final Server server = Bukkit.getServer(); final Server server = Bukkit.getServer();
if (!(server == null || pluginName == null || if (!( server == null || pluginName == null ||
"minecraft".equals(pluginName) || "bukkit".equals(pluginName) || "minecraft".equals(pluginName) || "bukkit".equals(pluginName) ||
"spigot".equalsIgnoreCase(pluginName) || "paper".equals(pluginName) "spigot".equalsIgnoreCase(pluginName) || "paper".equals(pluginName)
)) { )) {
plugin = server.getPluginManager().getPlugin(pluginName); plugin = server.getPluginManager().getPlugin(pluginName);
} }

View File

@ -5,7 +5,10 @@ import com.google.common.collect.Lists;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import java.util.ArrayList;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;

View File

@ -568,8 +568,8 @@ public class MaterialTags {
Material.FLINT_AND_STEEL, Material.CARROT_ON_A_STICK, Material.WARPED_FUNGUS_ON_A_STICK, Material.FLINT_AND_STEEL, Material.CARROT_ON_A_STICK, Material.WARPED_FUNGUS_ON_A_STICK,
Material.BRUSH, Material.CARVED_PUMPKIN, Material.COMPASS, Material.SKELETON_SKULL, Material.BRUSH, Material.CARVED_PUMPKIN, Material.COMPASS, Material.SKELETON_SKULL,
Material.WITHER_SKELETON_SKULL, Material.PLAYER_HEAD, Material.ZOMBIE_HEAD, Material.WITHER_SKELETON_SKULL, Material.PLAYER_HEAD, Material.ZOMBIE_HEAD,
Material.CREEPER_HEAD, Material.DRAGON_HEAD, Material.PIGLIN_HEAD, Material.MACE) Material.CREEPER_HEAD, Material.DRAGON_HEAD, Material.PIGLIN_HEAD)
.ensureSize("ENCHANTABLE", 76).lock(); .ensureSize("ENCHANTABLE", 75).lock();
/** /**
* Covers the variants of raw ores. * Covers the variants of raw ores.

View File

@ -5,7 +5,6 @@ import java.util.Locale;
import java.util.UUID; import java.util.UUID;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import org.bukkit.plugin.Plugin; import org.bukkit.plugin.Plugin;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
/** /**
@ -32,10 +31,10 @@ public final class NamespacedTag implements com.destroystokyo.paper.Namespaced {
* compatibility measures. * compatibility measures.
*/ */
public static final String BUKKIT = "bukkit"; public static final String BUKKIT = "bukkit";
//
private static final Pattern VALID_NAMESPACE = Pattern.compile("[a-z0-9._-]+"); private static final Pattern VALID_NAMESPACE = Pattern.compile("[a-z0-9._-]+");
private static final Pattern VALID_KEY = Pattern.compile("[a-z0-9/._-]+"); private static final Pattern VALID_KEY = Pattern.compile("[a-z0-9/._-]+");
//
private final String namespace; private final String namespace;
private final String key; private final String key;
@ -127,7 +126,6 @@ public final class NamespacedTag implements com.destroystokyo.paper.Namespaced {
* @deprecated should never be used by plugins, for internal use only!! * @deprecated should never be used by plugins, for internal use only!!
*/ */
@Deprecated @Deprecated
@ApiStatus.Internal
public static NamespacedTag randomKey() { public static NamespacedTag randomKey() {
return new NamespacedTag(BUKKIT, UUID.randomUUID().toString()); return new NamespacedTag(BUKKIT, UUID.randomUUID().toString());
} }

View File

@ -1,6 +1,6 @@
package com.destroystokyo.paper.entity.ai; package com.destroystokyo.paper.entity.ai;
import java.util.Objects; import com.google.common.base.Objects;
import java.util.StringJoiner; import java.util.StringJoiner;
import org.bukkit.NamespacedKey; import org.bukkit.NamespacedKey;
import org.bukkit.entity.Mob; import org.bukkit.entity.Mob;
@ -36,13 +36,13 @@ public final class GoalKey<T extends Mob> {
if (this == o) return true; if (this == o) return true;
if (o == null || this.getClass() != o.getClass()) return false; if (o == null || this.getClass() != o.getClass()) return false;
GoalKey<?> goalKey = (GoalKey<?>) o; GoalKey<?> goalKey = (GoalKey<?>) o;
return Objects.equals(this.entityClass, goalKey.entityClass) && return Objects.equal(this.entityClass, goalKey.entityClass) &&
Objects.equals(this.namespacedKey, goalKey.namespacedKey); Objects.equal(this.namespacedKey, goalKey.namespacedKey);
} }
@Override @Override
public int hashCode() { public int hashCode() {
return Objects.hash(this.entityClass, this.namespacedKey); return Objects.hashCode(this.entityClass, this.namespacedKey);
} }
@Override @Override

View File

@ -24,8 +24,8 @@ public class BeaconEffectEvent extends BlockEvent implements Cancellable {
private boolean cancelled; private boolean cancelled;
@ApiStatus.Internal @ApiStatus.Internal
public BeaconEffectEvent(final Block beacon, final PotionEffect effect, final Player player, final boolean primary) { public BeaconEffectEvent(final Block block, final PotionEffect effect, final Player player, final boolean primary) {
super(beacon); super(block);
this.effect = effect; this.effect = effect;
this.player = player; this.player = player;
this.primary = primary; this.primary = primary;

View File

@ -11,7 +11,7 @@ import org.jspecify.annotations.NullMarked;
/** /**
* Fired anytime the server intends to 'destroy' a block through some triggering reason. * Fired anytime the server intends to 'destroy' a block through some triggering reason.
* This does not fire anytime a block is set to air, but only with more direct triggers such * This does not fire anytime a block is set to air, but only with more direct triggers such
* as physics updates, pistons, entities changing blocks, commands set to "Destroy". * as physics updates, pistons, Entities changing blocks, commands set to "Destroy".
* <p> * <p>
* This event is associated with the game playing a sound effect at the block in question, when * This event is associated with the game playing a sound effect at the block in question, when
* something can be described as "intend to destroy what is there", * something can be described as "intend to destroy what is there",
@ -39,7 +39,7 @@ public class BlockDestroyEvent extends BlockExpEvent implements Cancellable {
} }
/** /**
* Gets the effect that will be played when the block is broken. * Get the effect that will be played when the block is broken.
* *
* @return block break effect * @return block break effect
*/ */

View File

@ -33,8 +33,8 @@ public class TNTPrimeEvent extends BlockEvent implements Cancellable {
private boolean cancelled; private boolean cancelled;
@ApiStatus.Internal @ApiStatus.Internal
public TNTPrimeEvent(@NotNull Block block, @NotNull PrimeReason reason, @Nullable Entity primerEntity) { public TNTPrimeEvent(@NotNull Block theBlock, @NotNull PrimeReason reason, @Nullable Entity primerEntity) {
super(block); super(theBlock);
this.reason = reason; this.reason = reason;
this.primerEntity = primerEntity; this.primerEntity = primerEntity;
} }

View File

@ -27,9 +27,7 @@ public class EndermanEscapeEvent extends EntityEvent implements Cancellable {
} }
/** /**
* Gets the reason the enderman is trying to escape. * @return The reason the enderman is trying to escape
*
* @return The reason
*/ */
public Reason getReason() { public Reason getReason() {
return this.reason; return this.reason;
@ -44,8 +42,7 @@ public class EndermanEscapeEvent extends EntityEvent implements Cancellable {
* Cancels the escape. * Cancels the escape.
* <p> * <p>
* If this escape normally had resulted in damage avoidance such as indirect, * If this escape normally had resulted in damage avoidance such as indirect,
* the enderman will now take damage. However, this does not change the Enderman's * the enderman will now take damage.
* innate immunities or damage behavior like arrows where the damage never happens.
*/ */
@Override @Override
public void setCancelled(final boolean cancel) { public void setCancelled(final boolean cancel) {
@ -79,7 +76,7 @@ public class EndermanEscapeEvent extends EntityEvent implements Cancellable {
*/ */
STARE, STARE,
/** /**
* Specific case for {@link #CRITICAL_HIT} where the enderman is taking damage by drowning (ex: rain) * Specific case for {@link #CRITICAL_HIT} where the enderman is taking rain damage
*/ */
DROWN DROWN
} }

View File

@ -1,5 +1,6 @@
package com.destroystokyo.paper.event.entity; package com.destroystokyo.paper.event.entity;
import com.google.common.collect.ImmutableList;
import java.util.List; import java.util.List;
import org.bukkit.entity.HumanEntity; import org.bukkit.entity.HumanEntity;
import org.bukkit.entity.SkeletonHorse; import org.bukkit.entity.SkeletonHorse;
@ -20,6 +21,12 @@ public class SkeletonHorseTrapEvent extends EntityEvent implements Cancellable {
private final List<HumanEntity> eligibleHumans; private final List<HumanEntity> eligibleHumans;
private boolean cancelled; private boolean cancelled;
@Deprecated
@ApiStatus.Internal
public SkeletonHorseTrapEvent(final SkeletonHorse horse) {
this(horse, ImmutableList.of());
}
@ApiStatus.Internal @ApiStatus.Internal
public SkeletonHorseTrapEvent(final SkeletonHorse horse, final List<HumanEntity> eligibleHumans) { public SkeletonHorseTrapEvent(final SkeletonHorse horse, final List<HumanEntity> eligibleHumans) {
super(horse); super(horse);

View File

@ -10,7 +10,7 @@ import org.jetbrains.annotations.Nullable;
/** /**
* @deprecated Not used * @deprecated Not used
*/ */
@Deprecated(since = "1.16.4", forRemoval = true) @Deprecated(since = "1.16.4")
public class IllegalPacketEvent extends PlayerEvent { public class IllegalPacketEvent extends PlayerEvent {
private static final HandlerList HANDLER_LIST = new HandlerList(); private static final HandlerList HANDLER_LIST = new HandlerList();

View File

@ -5,7 +5,6 @@ import org.bukkit.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.HandlerList; import org.bukkit.event.HandlerList;
import org.bukkit.event.player.PlayerEvent; import org.bukkit.event.player.PlayerEvent;
import org.bukkit.inventory.EquipmentSlot;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.ApiStatus;
import org.jspecify.annotations.NullMarked; import org.jspecify.annotations.NullMarked;
@ -17,10 +16,8 @@ import static org.bukkit.Material.*;
* Called when the player themselves change their armor items * Called when the player themselves change their armor items
* <p> * <p>
* Not currently called for environmental factors though it <strong>MAY BE IN THE FUTURE</strong> * Not currently called for environmental factors though it <strong>MAY BE IN THE FUTURE</strong>
* @apiNote Use {@link io.papermc.paper.event.entity.EntityEquipmentChangedEvent} for all entity equipment changes
*/ */
@NullMarked @NullMarked
@ApiStatus.Obsolete(since = "1.21.4")
public class PlayerArmorChangeEvent extends PlayerEvent { public class PlayerArmorChangeEvent extends PlayerEvent {
private static final HandlerList HANDLER_LIST = new HandlerList(); private static final HandlerList HANDLER_LIST = new HandlerList();
@ -41,27 +38,11 @@ public class PlayerArmorChangeEvent extends PlayerEvent {
* Gets the type of slot being altered. * Gets the type of slot being altered.
* *
* @return type of slot being altered * @return type of slot being altered
* @deprecated {@link SlotType} does not accurately represent what item types are valid in each slot. Use {@link #getSlot()} instead.
*/ */
@Deprecated(since = "1.21.4")
public SlotType getSlotType() { public SlotType getSlotType() {
return this.slotType; return this.slotType;
} }
/**
* Gets the slot being altered.
*
* @return slot being altered
*/
public EquipmentSlot getSlot() {
return switch (this.slotType) {
case HEAD -> EquipmentSlot.HEAD;
case CHEST -> EquipmentSlot.CHEST;
case LEGS -> EquipmentSlot.LEGS;
case FEET -> EquipmentSlot.FEET;
};
}
/** /**
* Gets the existing item that's being replaced * Gets the existing item that's being replaced
* *
@ -89,10 +70,6 @@ public class PlayerArmorChangeEvent extends PlayerEvent {
return HANDLER_LIST; return HANDLER_LIST;
} }
/**
* @deprecated {@link SlotType} does not accurately represent what item types are valid in each slot.
*/
@Deprecated(since = "1.21.4")
public enum SlotType { public enum SlotType {
HEAD(NETHERITE_HELMET, DIAMOND_HELMET, GOLDEN_HELMET, IRON_HELMET, CHAINMAIL_HELMET, LEATHER_HELMET, CARVED_PUMPKIN, PLAYER_HEAD, SKELETON_SKULL, ZOMBIE_HEAD, CREEPER_HEAD, WITHER_SKELETON_SKULL, TURTLE_HELMET, DRAGON_HEAD, PIGLIN_HEAD), HEAD(NETHERITE_HELMET, DIAMOND_HELMET, GOLDEN_HELMET, IRON_HELMET, CHAINMAIL_HELMET, LEATHER_HELMET, CARVED_PUMPKIN, PLAYER_HEAD, SKELETON_SKULL, ZOMBIE_HEAD, CREEPER_HEAD, WITHER_SKELETON_SKULL, TURTLE_HELMET, DRAGON_HEAD, PIGLIN_HEAD),
CHEST(NETHERITE_CHESTPLATE, DIAMOND_CHESTPLATE, GOLDEN_CHESTPLATE, IRON_CHESTPLATE, CHAINMAIL_CHESTPLATE, LEATHER_CHESTPLATE, ELYTRA), CHEST(NETHERITE_CHESTPLATE, DIAMOND_CHESTPLATE, GOLDEN_CHESTPLATE, IRON_CHESTPLATE, CHAINMAIL_CHESTPLATE, LEATHER_CHESTPLATE, ELYTRA),

View File

@ -30,6 +30,20 @@ public class PlayerClientOptionsChangeEvent extends PlayerEvent {
private final boolean textFilteringEnabled; private final boolean textFilteringEnabled;
private final ParticleVisibility particleVisibility; private final ParticleVisibility particleVisibility;
@Deprecated
public PlayerClientOptionsChangeEvent(final Player player, final String locale, final int viewDistance, final ChatVisibility chatVisibility, final boolean chatColors, final SkinParts skinParts, final MainHand mainHand) {
super(player);
this.locale = locale;
this.viewDistance = viewDistance;
this.chatVisibility = chatVisibility;
this.chatColors = chatColors;
this.skinparts = skinParts;
this.mainHand = mainHand;
this.allowsServerListings = false;
this.textFilteringEnabled = false;
this.particleVisibility = ParticleVisibility.ALL;
}
@ApiStatus.Internal @ApiStatus.Internal
public PlayerClientOptionsChangeEvent(final Player player, final Map<ClientOption<?>, ?> options) { public PlayerClientOptionsChangeEvent(final Player player, final Map<ClientOption<?>, ?> options) {
super(player); super(player);

View File

@ -50,6 +50,32 @@ public class PlayerHandshakeEvent extends Event implements Cancellable {
this.cancelled = cancelled; this.cancelled = cancelled;
} }
/**
* Determines if this event is cancelled.
* <p>
* When this event is cancelled, custom handshake logic will not
* be processed.
*
* @return {@code true} if this event is cancelled, {@code false} otherwise
*/
@Override
public boolean isCancelled() {
return this.cancelled;
}
/**
* Sets if this event is cancelled.
* <p>
* When this event is cancelled, custom handshake logic will not
* be processed.
*
* @param cancel {@code true} if this event is cancelled, {@code false} otherwise
*/
@Override
public void setCancelled(final boolean cancel) {
this.cancelled = cancel;
}
/** /**
* Gets the original handshake string. * Gets the original handshake string.
* *
@ -220,32 +246,6 @@ public class PlayerHandshakeEvent extends Event implements Cancellable {
this.failMessage(LegacyComponentSerializer.legacySection().deserialize(failMessage)); this.failMessage(LegacyComponentSerializer.legacySection().deserialize(failMessage));
} }
/**
* Determines if this event is cancelled.
* <p>
* When this event is cancelled, custom handshake logic will not
* be processed.
*
* @return {@code true} if this event is cancelled, {@code false} otherwise
*/
@Override
public boolean isCancelled() {
return this.cancelled;
}
/**
* Sets if this event is cancelled.
* <p>
* When this event is cancelled, custom handshake logic will not
* be processed.
*
* @param cancel {@code true} if this event is cancelled, {@code false} otherwise
*/
@Override
public void setCancelled(final boolean cancel) {
this.cancelled = cancel;
}
@Override @Override
public HandlerList getHandlers() { public HandlerList getHandlers() {
return HANDLER_LIST; return HANDLER_LIST;

View File

@ -37,7 +37,7 @@ public class PlayerJumpEvent extends PlayerEvent implements Cancellable {
/** /**
* {@inheritDoc} * {@inheritDoc}
* <p> * <p>
* If this event is cancelled, the player will be moved or * If a jump event is cancelled, the player will be moved or
* teleported back to the Location as defined by {@link #getFrom()}. This will not * teleported back to the Location as defined by {@link #getFrom()}. This will not
* fire an event * fire an event
* *
@ -51,7 +51,7 @@ public class PlayerJumpEvent extends PlayerEvent implements Cancellable {
/** /**
* {@inheritDoc} * {@inheritDoc}
* <p> * <p>
* If this event is cancelled, the player will be moved or * If a jump event is cancelled, the player will be moved or
* teleported back to the Location as defined by {@link #getFrom()}. This will not * teleported back to the Location as defined by {@link #getFrom()}. This will not
* fire an event * fire an event
* *

View File

@ -1,10 +1,9 @@
package com.destroystokyo.paper.event.player; package com.destroystokyo.paper.event.player;
import io.papermc.paper.event.player.AbstractRespawnEvent;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.HandlerList; import org.bukkit.event.HandlerList;
import org.bukkit.event.player.PlayerRespawnEvent; import org.bukkit.event.player.PlayerEvent;
import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.ApiStatus;
import org.jspecify.annotations.NullMarked; import org.jspecify.annotations.NullMarked;
@ -12,31 +11,36 @@ import org.jspecify.annotations.NullMarked;
* Fired after a player has respawned * Fired after a player has respawned
*/ */
@NullMarked @NullMarked
public class PlayerPostRespawnEvent extends AbstractRespawnEvent { public class PlayerPostRespawnEvent extends PlayerEvent {
private static final HandlerList HANDLER_LIST = new HandlerList(); private static final HandlerList HANDLER_LIST = new HandlerList();
private final Location respawnedLocation;
private final boolean isBedSpawn;
@ApiStatus.Internal @ApiStatus.Internal
public PlayerPostRespawnEvent( public PlayerPostRespawnEvent(final Player respawnPlayer, final Location respawnedLocation, final boolean isBedSpawn) {
final Player respawnPlayer, super(respawnPlayer);
final Location respawnLocation, this.respawnedLocation = respawnedLocation;
final boolean isBedSpawn, this.isBedSpawn = isBedSpawn;
final boolean isAnchorSpawn,
final boolean missingRespawnBlock,
final PlayerRespawnEvent.RespawnReason respawnReason
) {
super(respawnPlayer, respawnLocation, isBedSpawn, isAnchorSpawn, missingRespawnBlock, respawnReason);
} }
/** /**
* Returns the location of the respawned player. * Returns the location of the respawned player
* *
* @return location of the respawned player * @return location of the respawned player
* @see #getRespawnLocation()
*/ */
@ApiStatus.Obsolete
public Location getRespawnedLocation() { public Location getRespawnedLocation() {
return super.getRespawnLocation(); return this.respawnedLocation.clone();
}
/**
* Checks if the player respawned to their bed
*
* @return whether the player respawned to their bed
*/
public boolean isBedSpawn() {
return this.isBedSpawn;
} }
@Override @Override

View File

@ -109,7 +109,7 @@ public class PlayerSetSpawnEvent extends PlayerEvent implements Cancellable {
/** /**
* Gets the notification message that will be sent to the player * Gets the notification message that will be sent to the player
* if {@link #willNotifyPlayer()} returns {@code true}. * if {@link #willNotifyPlayer()} returns true.
* *
* @return {@code null} if no notification * @return {@code null} if no notification
*/ */

View File

@ -11,7 +11,7 @@ import org.jspecify.annotations.NullMarked;
import org.jspecify.annotations.Nullable; import org.jspecify.annotations.Nullable;
/** /**
* Represents an event that is called when a player clicks an unknown entity. * Represents an event that is called when a player right-clicks an unknown entity.
* Useful for plugins dealing with virtual entities (entities that aren't actually spawned on the server). * Useful for plugins dealing with virtual entities (entities that aren't actually spawned on the server).
* <br> * <br>
* This event may be called multiple times per interaction with different interaction hands * This event may be called multiple times per interaction with different interaction hands

View File

@ -50,6 +50,12 @@ public class ProfileWhitelistVerifyEvent extends Event {
private boolean whitelisted; private boolean whitelisted;
private @Nullable Component kickMessage; private @Nullable Component kickMessage;
@Deprecated
@ApiStatus.Internal
public ProfileWhitelistVerifyEvent(final PlayerProfile profile, final boolean whitelistEnabled, final boolean whitelisted, final boolean isOp, final @Nullable String kickMessage) {
this(profile, whitelistEnabled, whitelisted, isOp, kickMessage == null ? null : LegacyComponentSerializer.legacySection().deserialize(kickMessage));
}
@ApiStatus.Internal @ApiStatus.Internal
public ProfileWhitelistVerifyEvent(final PlayerProfile profile, final boolean whitelistEnabled, final boolean whitelisted, final boolean isOp, final @Nullable Component kickMessage) { public ProfileWhitelistVerifyEvent(final PlayerProfile profile, final boolean whitelistEnabled, final boolean whitelisted, final boolean isOp, final @Nullable Component kickMessage) {
this.profile = profile; this.profile = profile;

View File

@ -119,7 +119,7 @@ public class AsyncTabCompleteEvent extends Event implements Cancellable {
* the standard process of calling {@link Command#tabComplete(CommandSender, String, String[])} * the standard process of calling {@link Command#tabComplete(CommandSender, String, String[])}
* or current player names will not be called. * or current player names will not be called.
* <p> * <p>
* The passed collection will be cloned to a new {@code List}. You must call {@link #getCompletions()} to mutate from here * The passed collection will be cloned to a new {@code List}. You must call {{@link #getCompletions()}} to mutate from here
* *
* @param completions the new completions * @param completions the new completions
*/ */

View File

@ -55,6 +55,18 @@ public class PaperServerListPingEvent extends ServerListPingEvent implements Can
private boolean originalPlayerCount = true; private boolean originalPlayerCount = true;
private Object[] players; private Object[] players;
@Deprecated
@ApiStatus.Internal
public PaperServerListPingEvent(@NotNull StatusClient client, @NotNull String motd, int numPlayers, int maxPlayers,
@NotNull String version, int protocolVersion, @Nullable CachedServerIcon favicon) {
super("", client.getAddress().getAddress(), motd, numPlayers, maxPlayers);
this.client = client;
this.numPlayers = numPlayers;
this.version = version;
this.protocolVersion = protocolVersion;
setServerIcon(favicon);
}
@ApiStatus.Internal @ApiStatus.Internal
public PaperServerListPingEvent(@NotNull StatusClient client, @NotNull net.kyori.adventure.text.Component motd, int numPlayers, int maxPlayers, public PaperServerListPingEvent(@NotNull StatusClient client, @NotNull net.kyori.adventure.text.Component motd, int numPlayers, int maxPlayers,
@NotNull String version, int protocolVersion, @Nullable CachedServerIcon favicon) { @NotNull String version, int protocolVersion, @Nullable CachedServerIcon favicon) {

View File

@ -21,7 +21,7 @@ public interface NetworkClient {
* Returns the protocol version of the client. * Returns the protocol version of the client.
* *
* @return The client's protocol version, or {@code -1} if unknown * @return The client's protocol version, or {@code -1} if unknown
* @see <a href="https://minecraft.wiki/w/Minecraft_Wiki:Projects/wiki.vg_merge/Protocol_version_numbers">List of protocol * @see <a href="http://wiki.vg/Protocol_version_numbers">List of protocol
* version numbers</a> * version numbers</a>
*/ */
int getProtocolVersion(); int getProtocolVersion();

View File

@ -21,24 +21,12 @@ public interface VersionFetcher {
/** /**
* Gets the version message to cache and show to command senders. * Gets the version message to cache and show to command senders.
* *
* @return the message to show when requesting a version * <p>NOTE: This is run in a new thread separate from that of the command processing thread</p>
* @apiNote This method may involve a web request which will block the executing thread
*/
Component getVersionMessage();
/**
* Gets the version message to cache and show to command senders.
* *
* @param serverVersion the current version of the server (will match {@link Bukkit#getVersion()}) * @param serverVersion the current version of the server (will match {@link Bukkit#getVersion()})
* @return the message to show when requesting a version * @return the message to show when requesting a version
* @apiNote This method may involve a web request which will block the current thread
* @see #getVersionMessage()
* @deprecated {@code serverVersion} is not required
*/ */
@Deprecated Component getVersionMessage(String serverVersion);
default Component getVersionMessage(String serverVersion) {
return getVersionMessage();
}
@ApiStatus.Internal @ApiStatus.Internal
class DummyVersionFetcher implements VersionFetcher { class DummyVersionFetcher implements VersionFetcher {
@ -49,7 +37,7 @@ public interface VersionFetcher {
} }
@Override @Override
public Component getVersionMessage() { public Component getVersionMessage(final String serverVersion) {
Bukkit.getLogger().warning("Version provider has not been set, cannot check for updates!"); Bukkit.getLogger().warning("Version provider has not been set, cannot check for updates!");
Bukkit.getLogger().info("Override the default implementation of org.bukkit.UnsafeValues#getVersionFetcher()"); Bukkit.getLogger().info("Override the default implementation of org.bukkit.UnsafeValues#getVersionFetcher()");
new Throwable().printStackTrace(); new Throwable().printStackTrace();

View File

@ -1,15 +1,9 @@
package io.papermc.paper; package io.papermc.paper;
import io.papermc.paper.world.damagesource.CombatEntry;
import io.papermc.paper.world.damagesource.FallLocationType;
import net.kyori.adventure.util.Services; import net.kyori.adventure.util.Services;
import org.bukkit.block.Biome;
import org.bukkit.damage.DamageEffect; import org.bukkit.damage.DamageEffect;
import org.bukkit.damage.DamageSource;
import org.bukkit.entity.LivingEntity;
import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.ApiStatus;
import org.jspecify.annotations.NullMarked; import org.jspecify.annotations.NullMarked;
import org.jspecify.annotations.Nullable;
/** /**
* Static bridge to the server internals. * Static bridge to the server internals.
@ -41,37 +35,5 @@ public interface InternalAPIBridge {
* @return the damage effect. * @return the damage effect.
*/ */
DamageEffect getDamageEffect(String key); DamageEffect getDamageEffect(String key);
/**
* Constructs the legacy custom biome instance for the biome enum.
*
* @return the created biome.
*/
@Deprecated(forRemoval = true, since = "1.21.5")
@ApiStatus.ScheduledForRemoval(inVersion = "1.22")
Biome constructLegacyCustomBiome();
/**
* Creates a new combat entry.
* <p>
* The fall location and fall distance will be calculated from the entity's current state.
*
* @param entity entity
* @param damageSource damage source
* @param damage damage amount
* @return new combat entry
*/
CombatEntry createCombatEntry(LivingEntity entity, DamageSource damageSource, float damage);
/**
* Creates a new combat entry
*
* @param damageSource damage source
* @param damage damage amount
* @param fallLocationType fall location type
* @param fallDistance fall distance
* @return combat entry
*/
CombatEntry createCombatEntry(DamageSource damageSource, float damage, @Nullable FallLocationType fallLocationType, float fallDistance);
} }

View File

@ -5,7 +5,7 @@ import org.bukkit.block.Lockable;
import org.bukkit.block.TileState; import org.bukkit.block.TileState;
/** /**
* Interface for block entities that are lockable. * Interface for tile entities that are lockable.
*/ */
public interface LockableTileState extends TileState, Lockable, Nameable { public interface LockableTileState extends TileState, Lockable, Nameable {
} }

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