Compare commits
135
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6483f4fc43 | ||
|
|
d8cf62ae9c | ||
|
|
636ae0cd87 | ||
|
|
fcb2e81590 | ||
|
|
e5a8ee849f | ||
|
|
7b4d44f573 | ||
|
|
ab984a0711 | ||
|
|
5e2a3bc0e2 | ||
|
|
edda0db18b | ||
|
|
09f1f88f58 | ||
|
|
f070081825 | ||
|
|
b386a8f527 | ||
|
|
e494f2894e | ||
|
|
142695eb00 | ||
|
|
d26a9e90c8 | ||
|
|
3b9106c7d1 | ||
|
|
fd69140d80 | ||
|
|
8eb8e44ac3 | ||
|
|
84609dc046 | ||
|
|
88cdd22076 | ||
|
|
b27e11cce6 | ||
|
|
60394c5b98 | ||
|
|
28d07dc5ab | ||
|
|
06f96dd655 | ||
|
|
2a4a115432 | ||
|
|
a3781ff3be | ||
|
|
b9023b5dc3 | ||
|
|
7bee99714a | ||
|
|
608f004a2c | ||
|
|
00701267c8 | ||
|
|
cb25c0cf31 | ||
|
|
a6e82d90ce | ||
|
|
404167841d | ||
|
|
c62252e19f | ||
|
|
9b9de82706 | ||
|
|
6cfa2f7f31 | ||
|
|
46f4fdaae3 | ||
|
|
0680485095 | ||
|
|
0a04c3fe22 | ||
|
|
e616498ed7 | ||
|
|
a06179a018 | ||
|
|
1be2e5f311 | ||
|
|
072a8317b2 | ||
|
|
cf7c6c7483 | ||
|
|
db2aa1803d | ||
|
|
13c80a5eb3 | ||
|
|
3bd69f2e56 | ||
|
|
fa5824e4c8 | ||
|
|
cafef9ce9b | ||
|
|
edacfdf462 | ||
|
|
eff617b8f8 | ||
|
|
1a04e96ab7 | ||
|
|
61312fdb59 | ||
|
|
51acc802b8 | ||
|
|
cb6c57e0f8 | ||
|
|
786ddf53c6 | ||
|
|
53ae5c95b7 | ||
|
|
597dcfffb9 | ||
|
|
742968e078 | ||
|
|
5395ae37bd | ||
|
|
8927091a08 | ||
|
|
e0711af5d5 | ||
|
|
5bcfb12a99 | ||
|
|
d4a957849c | ||
|
|
54b2e9d973 | ||
|
|
e2f0efd1af | ||
|
|
1004374a83 | ||
|
|
a392d475c2 | ||
|
|
5a34bf0425 | ||
|
|
7e21cb8181 | ||
|
|
3af5e77132 | ||
|
|
fb5b173c6a | ||
|
|
2477f1f6a9 | ||
|
|
ce95b5d653 | ||
|
|
81bb82f521 | ||
|
|
939bb7828f | ||
|
|
336ea9dfeb | ||
|
|
88bbead13b | ||
|
|
30046e0410 | ||
|
|
6b7650d81b | ||
|
|
30fdfb1aa1 | ||
|
|
73f7736eb9 | ||
|
|
a35cfe93f9 | ||
|
|
e150ffd272 | ||
|
|
938a84fc39 | ||
|
|
b1b88cd316 | ||
|
|
cd9d6d6998 | ||
|
|
b6be7cd0ae | ||
|
|
8e80d4e158 | ||
|
|
209e5f8580 | ||
|
|
eeec611b9d | ||
|
|
9f74858760 | ||
|
|
e82f7e6bb6 | ||
|
|
85d0040f57 | ||
|
|
c44f891d99 | ||
|
|
fe75eaf09a | ||
|
|
6fde26d7f8 | ||
|
|
d69981b611 | ||
|
|
1bb3677651 | ||
|
|
ab1b312064 | ||
|
|
5e23d28ad2 | ||
|
|
3709150bc1 | ||
|
|
50c2c59c4e | ||
|
|
ad74b673fa | ||
|
|
2ea6aee343 | ||
|
|
86c6308faf | ||
|
|
76617ddf43 | ||
|
|
eb4db794eb | ||
|
|
e5542cfdc3 | ||
|
|
9746d73ade | ||
|
|
08ac057fda | ||
|
|
ed75b0e54b | ||
|
|
c2f24e1567 | ||
|
|
c94922514a | ||
|
|
775002a357 | ||
|
|
ac3aaa248b | ||
|
|
19ddbeff9e | ||
|
|
79ffcd1536 | ||
|
|
3ad3fbc19a | ||
|
|
3d9ecc4e08 | ||
|
|
3e42518b34 | ||
|
|
b242f1eb15 | ||
|
|
ea7b961926 | ||
|
|
6316a50dbd | ||
|
|
b03d39b5ce | ||
|
|
1b38f2810e | ||
|
|
400717174e | ||
|
|
5e14504f20 | ||
|
|
08fc33ca03 | ||
|
|
55f3f280cb | ||
|
|
efdcaa25ee | ||
|
|
b34ae4fb3c | ||
|
|
49d15f6345 | ||
|
|
337557044e | ||
|
|
486e521105 |
No files matched your search
+14
-12
@@ -1,32 +1,34 @@
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset=utf-8
|
||||
end_of_line=lf
|
||||
insert_final_newline=true
|
||||
indent_style=space
|
||||
indent_size=4
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
ij_any_block_comment_add_space = false
|
||||
ij_any_block_comment_at_first_column = false
|
||||
ij_any_line_comment_at_first_column = false
|
||||
ij_any_line_comment_add_space = true
|
||||
|
||||
[*.tiny]
|
||||
indent_style=tab
|
||||
indent_style = tab
|
||||
|
||||
[*.bat]
|
||||
end_of_line=crlf
|
||||
end_of_line = crlf
|
||||
|
||||
[*.yml]
|
||||
indent_size=2
|
||||
indent_size = 2
|
||||
|
||||
[*.patch]
|
||||
trim_trailing_whitespace=false
|
||||
trim_trailing_whitespace = false
|
||||
|
||||
[*.java]
|
||||
ij_continuation_indent_size = 4
|
||||
ij_java_class_count_to_use_import_on_demand = 999999
|
||||
ij_java_insert_inner_class_imports = false
|
||||
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_parameters = true
|
||||
ij_java_method_parameters_new_line_after_left_paren = true
|
||||
@@ -40,5 +42,5 @@ ij_java_use_fq_class_names = true
|
||||
[paper-server/src/minecraft/resources/data/**/*.json]
|
||||
indent_size = 2
|
||||
|
||||
[paper-api-generator/generated/**/*.java]
|
||||
ij_java_imports_layout = $*,|,*
|
||||
[paper-{server,api}/src/generated/java/**/*.java]
|
||||
ij_java_imports_layout = $*, |, *
|
||||
+1
-1
@@ -45,7 +45,7 @@ logs/
|
||||
!gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
test-plugin.settings.gradle.kts
|
||||
paper-api-generator.settings.gradle.kts
|
||||
paper-generator.settings.gradle.kts
|
||||
|
||||
# Don't track patched vanilla submodules
|
||||
paper-server/src/minecraft/
|
||||
+2
-1
@@ -208,7 +208,8 @@ required.
|
||||
with `// Paper end - <COMMIT DESCRIPTION>`.
|
||||
- One-line changes should have `// Paper - <COMMIT DESCRIPTION>` at the end of the line.
|
||||
|
||||
> [!NOTE] These comments are incredibly important to be able to keep track of changes
|
||||
> [!NOTE]
|
||||
> 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.
|
||||
|
||||
Here's an example of how to mark changes by Paper:
|
||||
|
||||
@@ -186,6 +186,7 @@ public net.minecraft.world.entity.Entity getEncodeId()Ljava/lang/String;
|
||||
public net.minecraft.world.entity.Entity getFireImmuneTicks()I
|
||||
public net.minecraft.world.entity.Entity getSharedFlag(I)Z
|
||||
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 isInvulnerableToBase(Lnet/minecraft/world/damagesource/DamageSource;)Z
|
||||
@@ -504,6 +505,7 @@ public net.minecraft.world.item.ItemStackLinkedSet TYPE_AND_TAG
|
||||
public net.minecraft.world.item.JukeboxSongPlayer song
|
||||
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.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 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
|
||||
@@ -623,9 +625,16 @@ 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.trialspawner.TrialSpawner isOminous
|
||||
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 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.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 hasCollision
|
||||
public net.minecraft.world.level.block.state.BlockBehaviour$BlockStateBase destroySpeed
|
||||
@@ -724,6 +733,7 @@ public-f net.minecraft.world.item.trading.MerchantOffer rewardExp
|
||||
public-f net.minecraft.world.item.trading.MerchantOffer xp
|
||||
public-f net.minecraft.world.level.LevelSettings hardcore
|
||||
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.trialspawner.TrialSpawner normalConfig
|
||||
public-f net.minecraft.world.level.block.entity.trialspawner.TrialSpawner ominousConfig
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@ import java.nio.file.Path
|
||||
import kotlin.random.Random
|
||||
|
||||
plugins {
|
||||
id("io.papermc.paperweight.core") version "2.0.0-beta.10" apply false
|
||||
id("io.papermc.paperweight.core") version "2.0.0-beta.14" apply false
|
||||
}
|
||||
|
||||
subprojects {
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
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"
|
||||
@@ -1,96 +0,0 @@
|
||||
package io.papermc.generator;
|
||||
|
||||
import io.papermc.generator.types.GeneratedKeyType;
|
||||
import io.papermc.generator.types.GeneratedTagKeyType;
|
||||
import io.papermc.generator.types.SourceGenerator;
|
||||
import io.papermc.generator.types.goal.MobGoalGenerator;
|
||||
import io.papermc.paper.registry.RegistryKey;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.core.registries.Registries;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import org.bukkit.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);
|
||||
}
|
||||
}
|
||||
@@ -1,93 +0,0 @@
|
||||
package io.papermc.generator;
|
||||
|
||||
import com.google.common.util.concurrent.MoreExecutors;
|
||||
import com.mojang.logging.LogUtils;
|
||||
import io.papermc.generator.types.SourceGenerator;
|
||||
import io.papermc.generator.utils.TagCollector;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,207 +0,0 @@
|
||||
package io.papermc.generator.types;
|
||||
|
||||
import com.google.common.collect.Sets;
|
||||
import com.squareup.javapoet.FieldSpec;
|
||||
import com.squareup.javapoet.JavaFile;
|
||||
import com.squareup.javapoet.MethodSpec;
|
||||
import com.squareup.javapoet.ParameterSpec;
|
||||
import com.squareup.javapoet.ParameterizedTypeName;
|
||||
import com.squareup.javapoet.TypeName;
|
||||
import com.squareup.javapoet.TypeSpec;
|
||||
import io.papermc.generator.Main;
|
||||
import io.papermc.generator.utils.Annotations;
|
||||
import io.papermc.generator.utils.CollectingContext;
|
||||
import io.papermc.generator.utils.Formatting;
|
||||
import io.papermc.generator.utils.Javadocs;
|
||||
import io.papermc.paper.registry.RegistryKey;
|
||||
import io.papermc.paper.registry.TypedKey;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.IdentityHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import 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");
|
||||
}
|
||||
}
|
||||
-138
@@ -1,138 +0,0 @@
|
||||
package io.papermc.generator.types;
|
||||
|
||||
import com.squareup.javapoet.FieldSpec;
|
||||
import com.squareup.javapoet.JavaFile;
|
||||
import com.squareup.javapoet.MethodSpec;
|
||||
import com.squareup.javapoet.ParameterSpec;
|
||||
import com.squareup.javapoet.ParameterizedTypeName;
|
||||
import com.squareup.javapoet.TypeName;
|
||||
import com.squareup.javapoet.TypeSpec;
|
||||
import io.papermc.generator.Main;
|
||||
import io.papermc.generator.utils.Annotations;
|
||||
import io.papermc.generator.utils.Formatting;
|
||||
import io.papermc.generator.utils.Javadocs;
|
||||
import io.papermc.paper.registry.RegistryKey;
|
||||
import io.papermc.paper.registry.tag.TagKey;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.util.HashMap;
|
||||
import java.util.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");
|
||||
}
|
||||
}
|
||||
@@ -1,65 +0,0 @@
|
||||
package io.papermc.generator.utils;
|
||||
|
||||
import com.squareup.javapoet.AnnotationSpec;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import io.papermc.paper.generated.GeneratedFrom;
|
||||
import net.minecraft.SharedConstants;
|
||||
import org.bukkit.MinecraftExperimental;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
public final class Annotations {
|
||||
|
||||
public static List<AnnotationSpec> experimentalAnnotations(final MinecraftExperimental.@Nullable Requires requiredFeatureFlag) {
|
||||
final List<AnnotationSpec> annotationSpecs = new ArrayList<>();
|
||||
annotationSpecs.add(AnnotationSpec.builder(ApiStatus.Experimental.class).build());
|
||||
if (requiredFeatureFlag != null) {
|
||||
annotationSpecs.add(AnnotationSpec.builder(MinecraftExperimental.class)
|
||||
.addMember("value", "$T.$L", MinecraftExperimental.Requires.class, requiredFeatureFlag.name())
|
||||
.build());
|
||||
} else {
|
||||
annotationSpecs.add(AnnotationSpec.builder(MinecraftExperimental.class).build());
|
||||
}
|
||||
return annotationSpecs;
|
||||
}
|
||||
|
||||
public static AnnotationSpec deprecatedVersioned(final @Nullable String version, final boolean forRemoval) {
|
||||
final AnnotationSpec.Builder annotationSpec = AnnotationSpec.builder(Deprecated.class);
|
||||
if (forRemoval) {
|
||||
annotationSpec.addMember("forRemoval", "$L", true);
|
||||
}
|
||||
if (version != null) {
|
||||
annotationSpec.addMember("since", "$S", version);
|
||||
}
|
||||
|
||||
return annotationSpec.build();
|
||||
}
|
||||
|
||||
public static AnnotationSpec scheduledRemoval(final @Nullable String version) {
|
||||
return AnnotationSpec.builder(ApiStatus.ScheduledForRemoval.class)
|
||||
.addMember("inVersion", "$S", version)
|
||||
.build();
|
||||
}
|
||||
|
||||
@ApiStatus.Experimental
|
||||
public static final AnnotationSpec EXPERIMENTAL_API_ANNOTATION = AnnotationSpec.builder(ApiStatus.Experimental.class).build();
|
||||
public static final AnnotationSpec NULL_MARKED = AnnotationSpec.builder(NullMarked.class).build();
|
||||
private static final AnnotationSpec SUPPRESS_WARNINGS = AnnotationSpec.builder(SuppressWarnings.class)
|
||||
.addMember("value", "$S", "unused")
|
||||
.addMember("value", "$S", "SpellCheckingInspection")
|
||||
.build();
|
||||
private static final AnnotationSpec GENERATED_FROM = AnnotationSpec.builder(GeneratedFrom.class)
|
||||
.addMember("value", "$S", SharedConstants.getCurrentVersion().getName())
|
||||
.build();
|
||||
public static final Iterable<AnnotationSpec> CLASS_HEADER = List.of(
|
||||
SUPPRESS_WARNINGS,
|
||||
GENERATED_FROM,
|
||||
NULL_MARKED
|
||||
);
|
||||
|
||||
private Annotations() {
|
||||
}
|
||||
}
|
||||
@@ -1,59 +0,0 @@
|
||||
package io.papermc.generator.utils;
|
||||
|
||||
import java.util.Optional;
|
||||
import org.apache.commons.lang3.math.NumberUtils;
|
||||
import java.util.Comparator;
|
||||
import java.util.Locale;
|
||||
import java.util.OptionalInt;
|
||||
import java.util.function.Function;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public final class Formatting {
|
||||
|
||||
private static final Pattern ILLEGAL_FIELD_CHARACTERS = Pattern.compile("[.-/]");
|
||||
|
||||
public static String formatKeyAsField(String path) {
|
||||
return ILLEGAL_FIELD_CHARACTERS.matcher(path.toUpperCase(Locale.ROOT)).replaceAll("_");
|
||||
}
|
||||
|
||||
public static Optional<String> formatTagKey(String tagDir, String resourcePath) {
|
||||
int tagsIndex = resourcePath.indexOf(tagDir);
|
||||
int dotIndex = resourcePath.lastIndexOf('.');
|
||||
if (tagsIndex == -1 || dotIndex == -1) {
|
||||
return Optional.empty();
|
||||
}
|
||||
return Optional.of(resourcePath.substring(tagsIndex + tagDir.length() + 1, dotIndex)); // namespace/tags/registry_key/[tag_key].json
|
||||
}
|
||||
|
||||
public static Comparator<String> ALPHABETIC_KEY_ORDER = alphabeticKeyOrder(path -> path);
|
||||
|
||||
public static <T> Comparator<T> alphabeticKeyOrder(Function<T, String> mapper) {
|
||||
return (o1, o2) -> {
|
||||
String path1 = mapper.apply(o1);
|
||||
String path2 = mapper.apply(o2);
|
||||
|
||||
OptionalInt trailingInt1 = tryParseTrailingInt(path1);
|
||||
OptionalInt trailingInt2 = tryParseTrailingInt(path2);
|
||||
|
||||
if (trailingInt1.isPresent() && trailingInt2.isPresent()) {
|
||||
return Integer.compare(trailingInt1.getAsInt(), trailingInt2.getAsInt());
|
||||
}
|
||||
|
||||
return path1.compareTo(path2);
|
||||
};
|
||||
}
|
||||
|
||||
private static OptionalInt tryParseTrailingInt(String path) {
|
||||
int delimiterIndex = path.lastIndexOf('_');
|
||||
if (delimiterIndex != -1) {
|
||||
String score = path.substring(delimiterIndex + 1);
|
||||
if (NumberUtils.isDigits(score)) {
|
||||
return OptionalInt.of(Integer.parseInt(score));
|
||||
}
|
||||
}
|
||||
return OptionalInt.empty();
|
||||
}
|
||||
|
||||
private Formatting() {
|
||||
}
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
package io.papermc.generator.utils;
|
||||
|
||||
public final class Javadocs {
|
||||
|
||||
public static String getVersionDependentClassHeader(String headerIdentifier) {
|
||||
return """
|
||||
Vanilla keys for %s.
|
||||
|
||||
@apiNote The fields provided here are a direct representation of
|
||||
what is available from the vanilla game source. They may be
|
||||
changed (including removals) on any Minecraft version
|
||||
bump, so cross-version compatibility is not provided on the
|
||||
same level as it is on most of the other API.
|
||||
""".formatted(headerIdentifier);
|
||||
}
|
||||
|
||||
public static String getVersionDependentField(String headerIdentifier) {
|
||||
return """
|
||||
%s
|
||||
|
||||
@apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
""".formatted(headerIdentifier);
|
||||
}
|
||||
|
||||
private Javadocs() {
|
||||
}
|
||||
}
|
||||
@@ -1,79 +0,0 @@
|
||||
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() {
|
||||
}
|
||||
}
|
||||
+15
-13
@@ -93,16 +93,16 @@ dependencies {
|
||||
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
|
||||
}
|
||||
|
||||
val generatedApiPath: java.nio.file.Path = rootProject.projectDir.toPath().resolve("paper-api-generator/generated")
|
||||
val generatedDir: java.nio.file.Path = layout.projectDirectory.dir("src/generated/java").asFile.toPath()
|
||||
idea {
|
||||
module {
|
||||
generatedSourceDirs.add(generatedApiPath.toFile())
|
||||
generatedSourceDirs.add(generatedDir.toFile())
|
||||
}
|
||||
}
|
||||
sourceSets {
|
||||
main {
|
||||
java {
|
||||
srcDir(generatedApiPath)
|
||||
srcDir(generatedDir)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -228,21 +228,23 @@ tasks.compileTestJava {
|
||||
options.compilerArgs.add("-parameters")
|
||||
}
|
||||
|
||||
val scanJar = tasks.register("scanJarForBadCalls", io.papermc.paperweight.tasks.ScanJarForBadCalls::class) {
|
||||
val scanJarForBadCalls by tasks.registering(io.papermc.paperweight.tasks.ScanJarForBadCalls::class) {
|
||||
badAnnotations.add("Lio/papermc/paper/annotation/DoNotUse;")
|
||||
jarToScan.set(tasks.jar.flatMap { it.archiveFile })
|
||||
classpath.from(configurations.compileClasspath)
|
||||
}
|
||||
tasks.check {
|
||||
dependsOn(scanJar)
|
||||
dependsOn(scanJarForBadCalls)
|
||||
}
|
||||
|
||||
val scanJarForOldGeneratedCode = tasks.register("scanJarForOldGeneratedCode", io.papermc.paperweight.tasks.ScanJarForOldGeneratedCode::class) {
|
||||
mcVersion.set(providers.gradleProperty("mcVersion"))
|
||||
annotation.set("Lio/papermc/paper/generated/GeneratedFrom;")
|
||||
jarToScan.set(tasks.jar.flatMap { it.archiveFile })
|
||||
classpath.from(configurations.compileClasspath)
|
||||
}
|
||||
tasks.check {
|
||||
dependsOn(scanJarForOldGeneratedCode)
|
||||
if (providers.gradleProperty("updatingMinecraft").getOrElse("false").toBoolean()) {
|
||||
val scanJarForOldGeneratedCode by tasks.registering(io.papermc.paperweight.tasks.ScanJarForOldGeneratedCode::class) {
|
||||
mcVersion.set(providers.gradleProperty("mcVersion"))
|
||||
annotation.set("Lio/papermc/paper/generated/GeneratedFrom;")
|
||||
jarToScan.set(tasks.jar.flatMap { it.archiveFile })
|
||||
classpath.from(configurations.compileClasspath)
|
||||
}
|
||||
tasks.check {
|
||||
dependsOn(scanJarForOldGeneratedCode)
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -66,8 +66,8 @@ import org.jspecify.annotations.NullMarked;
|
||||
"unused",
|
||||
"SpellCheckingInspection"
|
||||
})
|
||||
@GeneratedFrom("1.21.4")
|
||||
@NullMarked
|
||||
@GeneratedFrom("1.21.4")
|
||||
public interface VanillaGoal<T extends Mob> extends Goal<T> {
|
||||
GoalKey<AbstractHorse> RANDOM_STAND = create("random_stand", AbstractHorse.class);
|
||||
|
||||
+1
-3
@@ -7,7 +7,6 @@ import io.papermc.paper.registry.RegistryKey;
|
||||
import io.papermc.paper.registry.TypedKey;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import org.bukkit.attribute.Attribute;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
@@ -23,9 +22,8 @@ import org.jspecify.annotations.NullMarked;
|
||||
"unused",
|
||||
"SpellCheckingInspection"
|
||||
})
|
||||
@GeneratedFrom("1.21.4")
|
||||
@NullMarked
|
||||
@ApiStatus.Experimental
|
||||
@GeneratedFrom("1.21.4")
|
||||
public final class AttributeKeys {
|
||||
/**
|
||||
* {@code minecraft:armor}
|
||||
+2
-5
@@ -7,7 +7,6 @@ import io.papermc.paper.registry.RegistryKey;
|
||||
import io.papermc.paper.registry.TypedKey;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import org.bukkit.block.banner.PatternType;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
@@ -23,9 +22,8 @@ import org.jspecify.annotations.NullMarked;
|
||||
"unused",
|
||||
"SpellCheckingInspection"
|
||||
})
|
||||
@GeneratedFrom("1.21.4")
|
||||
@NullMarked
|
||||
@ApiStatus.Experimental
|
||||
@GeneratedFrom("1.21.4")
|
||||
public final class BannerPatternKeys {
|
||||
/**
|
||||
* {@code minecraft:base}
|
||||
@@ -332,12 +330,11 @@ public final class BannerPatternKeys {
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a key for {@link PatternType} in the registry {@code minecraft:banner_pattern}.
|
||||
* Creates a typed key for {@link PatternType} in the registry {@code minecraft:banner_pattern}.
|
||||
*
|
||||
* @param key the value's key in the registry
|
||||
* @return a new typed key
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
public static TypedKey<PatternType> create(final Key key) {
|
||||
return TypedKey.create(RegistryKey.BANNER_PATTERN, key);
|
||||
}
|
||||
+2
-5
@@ -7,7 +7,6 @@ import io.papermc.paper.registry.RegistryKey;
|
||||
import io.papermc.paper.registry.TypedKey;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import org.bukkit.block.Biome;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
@@ -23,9 +22,8 @@ import org.jspecify.annotations.NullMarked;
|
||||
"unused",
|
||||
"SpellCheckingInspection"
|
||||
})
|
||||
@GeneratedFrom("1.21.4")
|
||||
@NullMarked
|
||||
@ApiStatus.Experimental
|
||||
@GeneratedFrom("1.21.4")
|
||||
public final class BiomeKeys {
|
||||
/**
|
||||
* {@code minecraft:badlands}
|
||||
@@ -486,12 +484,11 @@ public final class BiomeKeys {
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a key for {@link Biome} in the registry {@code minecraft:worldgen/biome}.
|
||||
* Creates a typed key for {@link Biome} in the registry {@code minecraft:worldgen/biome}.
|
||||
*
|
||||
* @param key the value's key in the registry
|
||||
* @return a new typed key
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
public static TypedKey<Biome> create(final Key key) {
|
||||
return TypedKey.create(RegistryKey.BIOME, key);
|
||||
}
|
||||
+1
-3
@@ -7,7 +7,6 @@ import io.papermc.paper.registry.RegistryKey;
|
||||
import io.papermc.paper.registry.TypedKey;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import org.bukkit.block.BlockType;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
@@ -23,9 +22,8 @@ import org.jspecify.annotations.NullMarked;
|
||||
"unused",
|
||||
"SpellCheckingInspection"
|
||||
})
|
||||
@GeneratedFrom("1.21.4")
|
||||
@NullMarked
|
||||
@ApiStatus.Experimental
|
||||
@GeneratedFrom("1.21.4")
|
||||
public final class BlockTypeKeys {
|
||||
/**
|
||||
* {@code minecraft:acacia_button}
|
||||
+1
-3
@@ -7,7 +7,6 @@ import io.papermc.paper.registry.RegistryKey;
|
||||
import io.papermc.paper.registry.TypedKey;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import org.bukkit.entity.Cat;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
@@ -23,9 +22,8 @@ import org.jspecify.annotations.NullMarked;
|
||||
"unused",
|
||||
"SpellCheckingInspection"
|
||||
})
|
||||
@GeneratedFrom("1.21.4")
|
||||
@NullMarked
|
||||
@ApiStatus.Experimental
|
||||
@GeneratedFrom("1.21.4")
|
||||
public final class CatVariantKeys {
|
||||
/**
|
||||
* {@code minecraft:all_black}
|
||||
+2
-5
@@ -7,7 +7,6 @@ import io.papermc.paper.registry.RegistryKey;
|
||||
import io.papermc.paper.registry.TypedKey;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import org.bukkit.damage.DamageType;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
@@ -23,9 +22,8 @@ import org.jspecify.annotations.NullMarked;
|
||||
"unused",
|
||||
"SpellCheckingInspection"
|
||||
})
|
||||
@GeneratedFrom("1.21.4")
|
||||
@NullMarked
|
||||
@ApiStatus.Experimental
|
||||
@GeneratedFrom("1.21.4")
|
||||
public final class DamageTypeKeys {
|
||||
/**
|
||||
* {@code minecraft:arrow}
|
||||
@@ -374,12 +372,11 @@ public final class DamageTypeKeys {
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a key for {@link DamageType} in the registry {@code minecraft:damage_type}.
|
||||
* Creates a typed key for {@link DamageType} in the registry {@code minecraft:damage_type}.
|
||||
*
|
||||
* @param key the value's key in the registry
|
||||
* @return a new typed key
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
public static TypedKey<DamageType> create(final Key key) {
|
||||
return TypedKey.create(RegistryKey.DAMAGE_TYPE, key);
|
||||
}
|
||||
+503
@@ -0,0 +1,503 @@
|
||||
package io.papermc.paper.registry.keys;
|
||||
|
||||
import static net.kyori.adventure.key.Key.key;
|
||||
|
||||
import io.papermc.paper.datacomponent.DataComponentType;
|
||||
import io.papermc.paper.generated.GeneratedFrom;
|
||||
import io.papermc.paper.registry.RegistryKey;
|
||||
import io.papermc.paper.registry.TypedKey;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
* Vanilla keys for {@link RegistryKey#DATA_COMPONENT_TYPE}.
|
||||
*
|
||||
* @apiNote The fields provided here are a direct representation of
|
||||
* what is available from the vanilla game source. They may be
|
||||
* changed (including removals) on any Minecraft version
|
||||
* bump, so cross-version compatibility is not provided on the
|
||||
* same level as it is on most of the other API.
|
||||
*/
|
||||
@SuppressWarnings({
|
||||
"unused",
|
||||
"SpellCheckingInspection"
|
||||
})
|
||||
@NullMarked
|
||||
@GeneratedFrom("1.21.4")
|
||||
public final class DataComponentTypeKeys {
|
||||
/**
|
||||
* {@code minecraft:attribute_modifiers}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<DataComponentType> ATTRIBUTE_MODIFIERS = create(key("attribute_modifiers"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:banner_patterns}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<DataComponentType> BANNER_PATTERNS = create(key("banner_patterns"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:base_color}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<DataComponentType> BASE_COLOR = create(key("base_color"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:bees}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<DataComponentType> BEES = create(key("bees"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:block_entity_data}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<DataComponentType> BLOCK_ENTITY_DATA = create(key("block_entity_data"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:block_state}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<DataComponentType> BLOCK_STATE = create(key("block_state"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:bucket_entity_data}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<DataComponentType> BUCKET_ENTITY_DATA = create(key("bucket_entity_data"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:bundle_contents}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<DataComponentType> BUNDLE_CONTENTS = create(key("bundle_contents"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:can_break}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<DataComponentType> CAN_BREAK = create(key("can_break"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:can_place_on}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<DataComponentType> CAN_PLACE_ON = create(key("can_place_on"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:charged_projectiles}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<DataComponentType> CHARGED_PROJECTILES = create(key("charged_projectiles"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:consumable}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<DataComponentType> CONSUMABLE = create(key("consumable"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:container}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<DataComponentType> CONTAINER = create(key("container"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:container_loot}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<DataComponentType> CONTAINER_LOOT = create(key("container_loot"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:creative_slot_lock}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<DataComponentType> CREATIVE_SLOT_LOCK = create(key("creative_slot_lock"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:custom_data}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<DataComponentType> CUSTOM_DATA = create(key("custom_data"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:custom_model_data}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<DataComponentType> CUSTOM_MODEL_DATA = create(key("custom_model_data"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:custom_name}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<DataComponentType> CUSTOM_NAME = create(key("custom_name"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:damage}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<DataComponentType> DAMAGE = create(key("damage"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:damage_resistant}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<DataComponentType> DAMAGE_RESISTANT = create(key("damage_resistant"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:death_protection}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<DataComponentType> DEATH_PROTECTION = create(key("death_protection"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:debug_stick_state}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<DataComponentType> DEBUG_STICK_STATE = create(key("debug_stick_state"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:dyed_color}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<DataComponentType> DYED_COLOR = create(key("dyed_color"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:enchantable}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<DataComponentType> ENCHANTABLE = create(key("enchantable"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:enchantment_glint_override}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<DataComponentType> ENCHANTMENT_GLINT_OVERRIDE = create(key("enchantment_glint_override"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:enchantments}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<DataComponentType> ENCHANTMENTS = create(key("enchantments"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:entity_data}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<DataComponentType> ENTITY_DATA = create(key("entity_data"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:equippable}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<DataComponentType> EQUIPPABLE = create(key("equippable"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:firework_explosion}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<DataComponentType> FIREWORK_EXPLOSION = create(key("firework_explosion"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:fireworks}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<DataComponentType> FIREWORKS = create(key("fireworks"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:food}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<DataComponentType> FOOD = create(key("food"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:glider}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<DataComponentType> GLIDER = create(key("glider"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:hide_additional_tooltip}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<DataComponentType> HIDE_ADDITIONAL_TOOLTIP = create(key("hide_additional_tooltip"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:hide_tooltip}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<DataComponentType> HIDE_TOOLTIP = create(key("hide_tooltip"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:instrument}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<DataComponentType> INSTRUMENT = create(key("instrument"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:intangible_projectile}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<DataComponentType> INTANGIBLE_PROJECTILE = create(key("intangible_projectile"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:item_model}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<DataComponentType> ITEM_MODEL = create(key("item_model"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:item_name}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<DataComponentType> ITEM_NAME = create(key("item_name"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:jukebox_playable}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<DataComponentType> JUKEBOX_PLAYABLE = create(key("jukebox_playable"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:lock}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<DataComponentType> LOCK = create(key("lock"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:lodestone_tracker}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<DataComponentType> LODESTONE_TRACKER = create(key("lodestone_tracker"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:lore}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<DataComponentType> LORE = create(key("lore"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:map_color}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<DataComponentType> MAP_COLOR = create(key("map_color"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:map_decorations}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<DataComponentType> MAP_DECORATIONS = create(key("map_decorations"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:map_id}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<DataComponentType> MAP_ID = create(key("map_id"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:map_post_processing}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<DataComponentType> MAP_POST_PROCESSING = create(key("map_post_processing"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:max_damage}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<DataComponentType> MAX_DAMAGE = create(key("max_damage"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:max_stack_size}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<DataComponentType> MAX_STACK_SIZE = create(key("max_stack_size"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:note_block_sound}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<DataComponentType> NOTE_BLOCK_SOUND = create(key("note_block_sound"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:ominous_bottle_amplifier}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<DataComponentType> OMINOUS_BOTTLE_AMPLIFIER = create(key("ominous_bottle_amplifier"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:pot_decorations}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<DataComponentType> POT_DECORATIONS = create(key("pot_decorations"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:potion_contents}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<DataComponentType> POTION_CONTENTS = create(key("potion_contents"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:profile}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<DataComponentType> PROFILE = create(key("profile"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:rarity}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<DataComponentType> RARITY = create(key("rarity"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:recipes}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<DataComponentType> RECIPES = create(key("recipes"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:repair_cost}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<DataComponentType> REPAIR_COST = create(key("repair_cost"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:repairable}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<DataComponentType> REPAIRABLE = create(key("repairable"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:stored_enchantments}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<DataComponentType> STORED_ENCHANTMENTS = create(key("stored_enchantments"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:suspicious_stew_effects}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<DataComponentType> SUSPICIOUS_STEW_EFFECTS = create(key("suspicious_stew_effects"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:tool}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<DataComponentType> TOOL = create(key("tool"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:tooltip_style}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<DataComponentType> TOOLTIP_STYLE = create(key("tooltip_style"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:trim}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<DataComponentType> TRIM = create(key("trim"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:unbreakable}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<DataComponentType> UNBREAKABLE = create(key("unbreakable"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:use_cooldown}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<DataComponentType> USE_COOLDOWN = create(key("use_cooldown"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:use_remainder}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<DataComponentType> USE_REMAINDER = create(key("use_remainder"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:writable_book_content}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<DataComponentType> WRITABLE_BOOK_CONTENT = create(key("writable_book_content"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:written_book_content}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<DataComponentType> WRITTEN_BOOK_CONTENT = create(key("written_book_content"));
|
||||
|
||||
private DataComponentTypeKeys() {
|
||||
}
|
||||
|
||||
private static TypedKey<DataComponentType> create(final Key key) {
|
||||
return TypedKey.create(RegistryKey.DATA_COMPONENT_TYPE, key);
|
||||
}
|
||||
}
|
||||
+2
-5
@@ -7,7 +7,6 @@ import io.papermc.paper.registry.RegistryKey;
|
||||
import io.papermc.paper.registry.TypedKey;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
@@ -23,9 +22,8 @@ import org.jspecify.annotations.NullMarked;
|
||||
"unused",
|
||||
"SpellCheckingInspection"
|
||||
})
|
||||
@GeneratedFrom("1.21.4")
|
||||
@NullMarked
|
||||
@ApiStatus.Experimental
|
||||
@GeneratedFrom("1.21.4")
|
||||
public final class EnchantmentKeys {
|
||||
/**
|
||||
* {@code minecraft:aqua_affinity}
|
||||
@@ -325,12 +323,11 @@ public final class EnchantmentKeys {
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a key for {@link Enchantment} in the registry {@code minecraft:enchantment}.
|
||||
* Creates a typed key for {@link Enchantment} in the registry {@code minecraft:enchantment}.
|
||||
*
|
||||
* @param key the value's key in the registry
|
||||
* @return a new typed key
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
public static TypedKey<Enchantment> create(final Key key) {
|
||||
return TypedKey.create(RegistryKey.ENCHANTMENT, key);
|
||||
}
|
||||
+1
-3
@@ -7,7 +7,6 @@ import io.papermc.paper.registry.RegistryKey;
|
||||
import io.papermc.paper.registry.TypedKey;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import org.bukkit.Fluid;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
@@ -23,9 +22,8 @@ import org.jspecify.annotations.NullMarked;
|
||||
"unused",
|
||||
"SpellCheckingInspection"
|
||||
})
|
||||
@GeneratedFrom("1.21.4")
|
||||
@NullMarked
|
||||
@ApiStatus.Experimental
|
||||
@GeneratedFrom("1.21.4")
|
||||
public final class FluidKeys {
|
||||
/**
|
||||
* {@code minecraft:empty}
|
||||
+1
-3
@@ -7,7 +7,6 @@ import io.papermc.paper.registry.RegistryKey;
|
||||
import io.papermc.paper.registry.TypedKey;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import org.bukkit.entity.Frog;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
@@ -23,9 +22,8 @@ import org.jspecify.annotations.NullMarked;
|
||||
"unused",
|
||||
"SpellCheckingInspection"
|
||||
})
|
||||
@GeneratedFrom("1.21.4")
|
||||
@NullMarked
|
||||
@ApiStatus.Experimental
|
||||
@GeneratedFrom("1.21.4")
|
||||
public final class FrogVariantKeys {
|
||||
/**
|
||||
* {@code minecraft:cold}
|
||||
+2
-5
@@ -7,7 +7,6 @@ import io.papermc.paper.registry.RegistryKey;
|
||||
import io.papermc.paper.registry.TypedKey;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import org.bukkit.GameEvent;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
@@ -23,9 +22,8 @@ import org.jspecify.annotations.NullMarked;
|
||||
"unused",
|
||||
"SpellCheckingInspection"
|
||||
})
|
||||
@GeneratedFrom("1.21.4")
|
||||
@NullMarked
|
||||
@ApiStatus.Experimental
|
||||
@GeneratedFrom("1.21.4")
|
||||
public final class GameEventKeys {
|
||||
/**
|
||||
* {@code minecraft:block_activate}
|
||||
@@ -451,12 +449,11 @@ public final class GameEventKeys {
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a key for {@link GameEvent} in the registry {@code minecraft:game_event}.
|
||||
* Creates a typed key for {@link GameEvent} in the registry {@code minecraft:game_event}.
|
||||
*
|
||||
* @param key the value's key in the registry
|
||||
* @return a new typed key
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
public static TypedKey<GameEvent> create(final Key key) {
|
||||
return TypedKey.create(RegistryKey.GAME_EVENT, key);
|
||||
}
|
||||
+2
-5
@@ -7,7 +7,6 @@ import io.papermc.paper.registry.RegistryKey;
|
||||
import io.papermc.paper.registry.TypedKey;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import org.bukkit.MusicInstrument;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
@@ -23,9 +22,8 @@ import org.jspecify.annotations.NullMarked;
|
||||
"unused",
|
||||
"SpellCheckingInspection"
|
||||
})
|
||||
@GeneratedFrom("1.21.4")
|
||||
@NullMarked
|
||||
@ApiStatus.Experimental
|
||||
@GeneratedFrom("1.21.4")
|
||||
public final class InstrumentKeys {
|
||||
/**
|
||||
* {@code minecraft:admire_goat_horn}
|
||||
@@ -87,12 +85,11 @@ public final class InstrumentKeys {
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a key for {@link MusicInstrument} in the registry {@code minecraft:instrument}.
|
||||
* Creates a typed key for {@link MusicInstrument} in the registry {@code minecraft:instrument}.
|
||||
*
|
||||
* @param key the value's key in the registry
|
||||
* @return a new typed key
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
public static TypedKey<MusicInstrument> create(final Key key) {
|
||||
return TypedKey.create(RegistryKey.INSTRUMENT, key);
|
||||
}
|
||||
+1
-3
@@ -7,7 +7,6 @@ import io.papermc.paper.registry.RegistryKey;
|
||||
import io.papermc.paper.registry.TypedKey;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import org.bukkit.inventory.ItemType;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
@@ -23,9 +22,8 @@ import org.jspecify.annotations.NullMarked;
|
||||
"unused",
|
||||
"SpellCheckingInspection"
|
||||
})
|
||||
@GeneratedFrom("1.21.4")
|
||||
@NullMarked
|
||||
@ApiStatus.Experimental
|
||||
@GeneratedFrom("1.21.4")
|
||||
public final class ItemTypeKeys {
|
||||
/**
|
||||
* {@code minecraft:acacia_boat}
|
||||
+2
-5
@@ -7,7 +7,6 @@ import io.papermc.paper.registry.RegistryKey;
|
||||
import io.papermc.paper.registry.TypedKey;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import org.bukkit.JukeboxSong;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
@@ -23,9 +22,8 @@ import org.jspecify.annotations.NullMarked;
|
||||
"unused",
|
||||
"SpellCheckingInspection"
|
||||
})
|
||||
@GeneratedFrom("1.21.4")
|
||||
@NullMarked
|
||||
@ApiStatus.Experimental
|
||||
@GeneratedFrom("1.21.4")
|
||||
public final class JukeboxSongKeys {
|
||||
/**
|
||||
* {@code minecraft:11}
|
||||
@@ -164,12 +162,11 @@ public final class JukeboxSongKeys {
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a key for {@link JukeboxSong} in the registry {@code minecraft:jukebox_song}.
|
||||
* Creates a typed key for {@link JukeboxSong} in the registry {@code minecraft:jukebox_song}.
|
||||
*
|
||||
* @param key the value's key in the registry
|
||||
* @return a new typed key
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
public static TypedKey<JukeboxSong> create(final Key key) {
|
||||
return TypedKey.create(RegistryKey.JUKEBOX_SONG, key);
|
||||
}
|
||||
+1
-3
@@ -7,7 +7,6 @@ import io.papermc.paper.registry.RegistryKey;
|
||||
import io.papermc.paper.registry.TypedKey;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import org.bukkit.map.MapCursor;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
@@ -23,9 +22,8 @@ import org.jspecify.annotations.NullMarked;
|
||||
"unused",
|
||||
"SpellCheckingInspection"
|
||||
})
|
||||
@GeneratedFrom("1.21.4")
|
||||
@NullMarked
|
||||
@ApiStatus.Experimental
|
||||
@GeneratedFrom("1.21.4")
|
||||
public final class MapDecorationTypeKeys {
|
||||
/**
|
||||
* {@code minecraft:banner_black}
|
||||
+1
-3
@@ -7,7 +7,6 @@ import io.papermc.paper.registry.RegistryKey;
|
||||
import io.papermc.paper.registry.TypedKey;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import org.bukkit.inventory.MenuType;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
@@ -23,9 +22,8 @@ import org.jspecify.annotations.NullMarked;
|
||||
"unused",
|
||||
"SpellCheckingInspection"
|
||||
})
|
||||
@GeneratedFrom("1.21.4")
|
||||
@NullMarked
|
||||
@ApiStatus.Experimental
|
||||
@GeneratedFrom("1.21.4")
|
||||
public final class MenuTypeKeys {
|
||||
/**
|
||||
* {@code minecraft:anvil}
|
||||
+1
-3
@@ -7,7 +7,6 @@ import io.papermc.paper.registry.RegistryKey;
|
||||
import io.papermc.paper.registry.TypedKey;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
@@ -23,9 +22,8 @@ import org.jspecify.annotations.NullMarked;
|
||||
"unused",
|
||||
"SpellCheckingInspection"
|
||||
})
|
||||
@GeneratedFrom("1.21.4")
|
||||
@NullMarked
|
||||
@ApiStatus.Experimental
|
||||
@GeneratedFrom("1.21.4")
|
||||
public final class MobEffectKeys {
|
||||
/**
|
||||
* {@code minecraft:absorption}
|
||||
+2
-5
@@ -7,7 +7,6 @@ import io.papermc.paper.registry.RegistryKey;
|
||||
import io.papermc.paper.registry.TypedKey;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import org.bukkit.Art;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
@@ -23,9 +22,8 @@ import org.jspecify.annotations.NullMarked;
|
||||
"unused",
|
||||
"SpellCheckingInspection"
|
||||
})
|
||||
@GeneratedFrom("1.21.4")
|
||||
@NullMarked
|
||||
@ApiStatus.Experimental
|
||||
@GeneratedFrom("1.21.4")
|
||||
public final class PaintingVariantKeys {
|
||||
/**
|
||||
* {@code minecraft:alban}
|
||||
@@ -381,12 +379,11 @@ public final class PaintingVariantKeys {
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a key for {@link Art} in the registry {@code minecraft:painting_variant}.
|
||||
* Creates a typed key for {@link Art} in the registry {@code minecraft:painting_variant}.
|
||||
*
|
||||
* @param key the value's key in the registry
|
||||
* @return a new typed key
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
public static TypedKey<Art> create(final Key key) {
|
||||
return TypedKey.create(RegistryKey.PAINTING_VARIANT, key);
|
||||
}
|
||||
+1
-3
@@ -7,7 +7,6 @@ import io.papermc.paper.registry.RegistryKey;
|
||||
import io.papermc.paper.registry.TypedKey;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import org.bukkit.Sound;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
@@ -23,9 +22,8 @@ import org.jspecify.annotations.NullMarked;
|
||||
"unused",
|
||||
"SpellCheckingInspection"
|
||||
})
|
||||
@GeneratedFrom("1.21.4")
|
||||
@NullMarked
|
||||
@ApiStatus.Experimental
|
||||
@GeneratedFrom("1.21.4")
|
||||
public final class SoundEventKeys {
|
||||
/**
|
||||
* {@code minecraft:ambient.basalt_deltas.additions}
|
||||
+2
-5
@@ -7,7 +7,6 @@ import io.papermc.paper.registry.RegistryKey;
|
||||
import io.papermc.paper.registry.TypedKey;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import org.bukkit.generator.structure.Structure;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
@@ -23,9 +22,8 @@ import org.jspecify.annotations.NullMarked;
|
||||
"unused",
|
||||
"SpellCheckingInspection"
|
||||
})
|
||||
@GeneratedFrom("1.21.4")
|
||||
@NullMarked
|
||||
@ApiStatus.Experimental
|
||||
@GeneratedFrom("1.21.4")
|
||||
public final class StructureKeys {
|
||||
/**
|
||||
* {@code minecraft:ancient_city}
|
||||
@@ -269,12 +267,11 @@ public final class StructureKeys {
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a key for {@link Structure} in the registry {@code minecraft:worldgen/structure}.
|
||||
* Creates a typed key for {@link Structure} in the registry {@code minecraft:worldgen/structure}.
|
||||
*
|
||||
* @param key the value's key in the registry
|
||||
* @return a new typed key
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
public static TypedKey<Structure> create(final Key key) {
|
||||
return TypedKey.create(RegistryKey.STRUCTURE, key);
|
||||
}
|
||||
+1
-3
@@ -7,7 +7,6 @@ import io.papermc.paper.registry.RegistryKey;
|
||||
import io.papermc.paper.registry.TypedKey;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import org.bukkit.generator.structure.StructureType;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
@@ -23,9 +22,8 @@ import org.jspecify.annotations.NullMarked;
|
||||
"unused",
|
||||
"SpellCheckingInspection"
|
||||
})
|
||||
@GeneratedFrom("1.21.4")
|
||||
@NullMarked
|
||||
@ApiStatus.Experimental
|
||||
@GeneratedFrom("1.21.4")
|
||||
public final class StructureTypeKeys {
|
||||
/**
|
||||
* {@code minecraft:buried_treasure}
|
||||
+2
-5
@@ -7,7 +7,6 @@ import io.papermc.paper.registry.RegistryKey;
|
||||
import io.papermc.paper.registry.TypedKey;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import org.bukkit.inventory.meta.trim.TrimMaterial;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
@@ -23,9 +22,8 @@ import org.jspecify.annotations.NullMarked;
|
||||
"unused",
|
||||
"SpellCheckingInspection"
|
||||
})
|
||||
@GeneratedFrom("1.21.4")
|
||||
@NullMarked
|
||||
@ApiStatus.Experimental
|
||||
@GeneratedFrom("1.21.4")
|
||||
public final class TrimMaterialKeys {
|
||||
/**
|
||||
* {@code minecraft:amethyst}
|
||||
@@ -108,12 +106,11 @@ public final class TrimMaterialKeys {
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a key for {@link TrimMaterial} in the registry {@code minecraft:trim_material}.
|
||||
* Creates a typed key for {@link TrimMaterial} in the registry {@code minecraft:trim_material}.
|
||||
*
|
||||
* @param key the value's key in the registry
|
||||
* @return a new typed key
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
public static TypedKey<TrimMaterial> create(final Key key) {
|
||||
return TypedKey.create(RegistryKey.TRIM_MATERIAL, key);
|
||||
}
|
||||
+2
-5
@@ -7,7 +7,6 @@ import io.papermc.paper.registry.RegistryKey;
|
||||
import io.papermc.paper.registry.TypedKey;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import org.bukkit.inventory.meta.trim.TrimPattern;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
@@ -23,9 +22,8 @@ import org.jspecify.annotations.NullMarked;
|
||||
"unused",
|
||||
"SpellCheckingInspection"
|
||||
})
|
||||
@GeneratedFrom("1.21.4")
|
||||
@NullMarked
|
||||
@ApiStatus.Experimental
|
||||
@GeneratedFrom("1.21.4")
|
||||
public final class TrimPatternKeys {
|
||||
/**
|
||||
* {@code minecraft:bolt}
|
||||
@@ -157,12 +155,11 @@ public final class TrimPatternKeys {
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a key for {@link TrimPattern} in the registry {@code minecraft:trim_pattern}.
|
||||
* Creates a typed key for {@link TrimPattern} in the registry {@code minecraft:trim_pattern}.
|
||||
*
|
||||
* @param key the value's key in the registry
|
||||
* @return a new typed key
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
public static TypedKey<TrimPattern> create(final Key key) {
|
||||
return TypedKey.create(RegistryKey.TRIM_PATTERN, key);
|
||||
}
|
||||
+1
-3
@@ -7,7 +7,6 @@ import io.papermc.paper.registry.RegistryKey;
|
||||
import io.papermc.paper.registry.TypedKey;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import org.bukkit.entity.Villager;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
@@ -23,9 +22,8 @@ import org.jspecify.annotations.NullMarked;
|
||||
"unused",
|
||||
"SpellCheckingInspection"
|
||||
})
|
||||
@GeneratedFrom("1.21.4")
|
||||
@NullMarked
|
||||
@ApiStatus.Experimental
|
||||
@GeneratedFrom("1.21.4")
|
||||
public final class VillagerProfessionKeys {
|
||||
/**
|
||||
* {@code minecraft:armorer}
|
||||
+1
-3
@@ -7,7 +7,6 @@ import io.papermc.paper.registry.RegistryKey;
|
||||
import io.papermc.paper.registry.TypedKey;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import org.bukkit.entity.Villager;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
@@ -23,9 +22,8 @@ import org.jspecify.annotations.NullMarked;
|
||||
"unused",
|
||||
"SpellCheckingInspection"
|
||||
})
|
||||
@GeneratedFrom("1.21.4")
|
||||
@NullMarked
|
||||
@ApiStatus.Experimental
|
||||
@GeneratedFrom("1.21.4")
|
||||
public final class VillagerTypeKeys {
|
||||
/**
|
||||
* {@code minecraft:desert}
|
||||
+2
-5
@@ -7,7 +7,6 @@ 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.jetbrains.annotations.ApiStatus;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
@@ -23,9 +22,8 @@ import org.jspecify.annotations.NullMarked;
|
||||
"unused",
|
||||
"SpellCheckingInspection"
|
||||
})
|
||||
@GeneratedFrom("1.21.4")
|
||||
@NullMarked
|
||||
@ApiStatus.Experimental
|
||||
@GeneratedFrom("1.21.4")
|
||||
public final class WolfVariantKeys {
|
||||
/**
|
||||
* {@code minecraft:ashen}
|
||||
@@ -94,12 +92,11 @@ public final class WolfVariantKeys {
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a key for {@link Wolf.Variant} in the registry {@code minecraft:wolf_variant}.
|
||||
* Creates a typed key for {@link Wolf.Variant} in the registry {@code minecraft:wolf_variant}.
|
||||
*
|
||||
* @param key the value's key in the registry
|
||||
* @return a new typed key
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
public static TypedKey<Wolf.Variant> create(final Key key) {
|
||||
return TypedKey.create(RegistryKey.WOLF_VARIANT, key);
|
||||
}
|
||||
+2
-2
@@ -11,7 +11,7 @@ import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
* Vanilla keys for {@link RegistryKey#BANNER_PATTERN}.
|
||||
* Vanilla tag keys for {@link RegistryKey#BANNER_PATTERN}.
|
||||
*
|
||||
* @apiNote The fields provided here are a direct representation of
|
||||
* what is available from the vanilla game source. They may be
|
||||
@@ -23,8 +23,8 @@ import org.jspecify.annotations.NullMarked;
|
||||
"unused",
|
||||
"SpellCheckingInspection"
|
||||
})
|
||||
@GeneratedFrom("1.21.4")
|
||||
@NullMarked
|
||||
@GeneratedFrom("1.21.4")
|
||||
@ApiStatus.Experimental
|
||||
public final class BannerPatternTagKeys {
|
||||
/**
|
||||
+2
-2
@@ -11,7 +11,7 @@ import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
* Vanilla keys for {@link RegistryKey#BIOME}.
|
||||
* Vanilla tag keys for {@link RegistryKey#BIOME}.
|
||||
*
|
||||
* @apiNote The fields provided here are a direct representation of
|
||||
* what is available from the vanilla game source. They may be
|
||||
@@ -23,8 +23,8 @@ import org.jspecify.annotations.NullMarked;
|
||||
"unused",
|
||||
"SpellCheckingInspection"
|
||||
})
|
||||
@GeneratedFrom("1.21.4")
|
||||
@NullMarked
|
||||
@GeneratedFrom("1.21.4")
|
||||
@ApiStatus.Experimental
|
||||
public final class BiomeTagKeys {
|
||||
/**
|
||||
+2
-2
@@ -11,7 +11,7 @@ import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
* Vanilla keys for {@link RegistryKey#BLOCK}.
|
||||
* Vanilla tag keys for {@link RegistryKey#BLOCK}.
|
||||
*
|
||||
* @apiNote The fields provided here are a direct representation of
|
||||
* what is available from the vanilla game source. They may be
|
||||
@@ -23,8 +23,8 @@ import org.jspecify.annotations.NullMarked;
|
||||
"unused",
|
||||
"SpellCheckingInspection"
|
||||
})
|
||||
@GeneratedFrom("1.21.4")
|
||||
@NullMarked
|
||||
@GeneratedFrom("1.21.4")
|
||||
@ApiStatus.Experimental
|
||||
public final class BlockTypeTagKeys {
|
||||
/**
|
||||
+2
-2
@@ -11,7 +11,7 @@ import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
* Vanilla keys for {@link RegistryKey#CAT_VARIANT}.
|
||||
* Vanilla tag keys for {@link RegistryKey#CAT_VARIANT}.
|
||||
*
|
||||
* @apiNote The fields provided here are a direct representation of
|
||||
* what is available from the vanilla game source. They may be
|
||||
@@ -23,8 +23,8 @@ import org.jspecify.annotations.NullMarked;
|
||||
"unused",
|
||||
"SpellCheckingInspection"
|
||||
})
|
||||
@GeneratedFrom("1.21.4")
|
||||
@NullMarked
|
||||
@GeneratedFrom("1.21.4")
|
||||
@ApiStatus.Experimental
|
||||
public final class CatVariantTagKeys {
|
||||
/**
|
||||
+2
-2
@@ -11,7 +11,7 @@ import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
* Vanilla keys for {@link RegistryKey#DAMAGE_TYPE}.
|
||||
* Vanilla tag keys for {@link RegistryKey#DAMAGE_TYPE}.
|
||||
*
|
||||
* @apiNote The fields provided here are a direct representation of
|
||||
* what is available from the vanilla game source. They may be
|
||||
@@ -23,8 +23,8 @@ import org.jspecify.annotations.NullMarked;
|
||||
"unused",
|
||||
"SpellCheckingInspection"
|
||||
})
|
||||
@GeneratedFrom("1.21.4")
|
||||
@NullMarked
|
||||
@GeneratedFrom("1.21.4")
|
||||
@ApiStatus.Experimental
|
||||
public final class DamageTypeTagKeys {
|
||||
/**
|
||||
+2
-2
@@ -12,7 +12,7 @@ import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
* Vanilla keys for {@link RegistryKey#ENCHANTMENT}.
|
||||
* Vanilla tag keys for {@link RegistryKey#ENCHANTMENT}.
|
||||
*
|
||||
* @apiNote The fields provided here are a direct representation of
|
||||
* what is available from the vanilla game source. They may be
|
||||
@@ -24,8 +24,8 @@ import org.jspecify.annotations.NullMarked;
|
||||
"unused",
|
||||
"SpellCheckingInspection"
|
||||
})
|
||||
@GeneratedFrom("1.21.4")
|
||||
@NullMarked
|
||||
@GeneratedFrom("1.21.4")
|
||||
@ApiStatus.Experimental
|
||||
public final class EnchantmentTagKeys {
|
||||
/**
|
||||
+2
-2
@@ -11,7 +11,7 @@ import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
* Vanilla keys for {@link RegistryKey#ENTITY_TYPE}.
|
||||
* Vanilla tag keys for {@link RegistryKey#ENTITY_TYPE}.
|
||||
*
|
||||
* @apiNote The fields provided here are a direct representation of
|
||||
* what is available from the vanilla game source. They may be
|
||||
@@ -23,8 +23,8 @@ import org.jspecify.annotations.NullMarked;
|
||||
"unused",
|
||||
"SpellCheckingInspection"
|
||||
})
|
||||
@GeneratedFrom("1.21.4")
|
||||
@NullMarked
|
||||
@GeneratedFrom("1.21.4")
|
||||
@ApiStatus.Experimental
|
||||
public final class EntityTypeTagKeys {
|
||||
/**
|
||||
+2
-2
@@ -11,7 +11,7 @@ import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
* Vanilla keys for {@link RegistryKey#FLUID}.
|
||||
* Vanilla tag keys for {@link RegistryKey#FLUID}.
|
||||
*
|
||||
* @apiNote The fields provided here are a direct representation of
|
||||
* what is available from the vanilla game source. They may be
|
||||
@@ -23,8 +23,8 @@ import org.jspecify.annotations.NullMarked;
|
||||
"unused",
|
||||
"SpellCheckingInspection"
|
||||
})
|
||||
@GeneratedFrom("1.21.4")
|
||||
@NullMarked
|
||||
@GeneratedFrom("1.21.4")
|
||||
@ApiStatus.Experimental
|
||||
public final class FluidTagKeys {
|
||||
/**
|
||||
+2
-2
@@ -11,7 +11,7 @@ import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
* Vanilla keys for {@link RegistryKey#GAME_EVENT}.
|
||||
* Vanilla tag keys for {@link RegistryKey#GAME_EVENT}.
|
||||
*
|
||||
* @apiNote The fields provided here are a direct representation of
|
||||
* what is available from the vanilla game source. They may be
|
||||
@@ -23,8 +23,8 @@ import org.jspecify.annotations.NullMarked;
|
||||
"unused",
|
||||
"SpellCheckingInspection"
|
||||
})
|
||||
@GeneratedFrom("1.21.4")
|
||||
@NullMarked
|
||||
@GeneratedFrom("1.21.4")
|
||||
@ApiStatus.Experimental
|
||||
public final class GameEventTagKeys {
|
||||
/**
|
||||
+2
-2
@@ -11,7 +11,7 @@ import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
* Vanilla keys for {@link RegistryKey#INSTRUMENT}.
|
||||
* Vanilla tag keys for {@link RegistryKey#INSTRUMENT}.
|
||||
*
|
||||
* @apiNote The fields provided here are a direct representation of
|
||||
* what is available from the vanilla game source. They may be
|
||||
@@ -23,8 +23,8 @@ import org.jspecify.annotations.NullMarked;
|
||||
"unused",
|
||||
"SpellCheckingInspection"
|
||||
})
|
||||
@GeneratedFrom("1.21.4")
|
||||
@NullMarked
|
||||
@GeneratedFrom("1.21.4")
|
||||
@ApiStatus.Experimental
|
||||
public final class InstrumentTagKeys {
|
||||
/**
|
||||
+2
-2
@@ -11,7 +11,7 @@ import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
* Vanilla keys for {@link RegistryKey#ITEM}.
|
||||
* Vanilla tag keys for {@link RegistryKey#ITEM}.
|
||||
*
|
||||
* @apiNote The fields provided here are a direct representation of
|
||||
* what is available from the vanilla game source. They may be
|
||||
@@ -23,8 +23,8 @@ import org.jspecify.annotations.NullMarked;
|
||||
"unused",
|
||||
"SpellCheckingInspection"
|
||||
})
|
||||
@GeneratedFrom("1.21.4")
|
||||
@NullMarked
|
||||
@GeneratedFrom("1.21.4")
|
||||
@ApiStatus.Experimental
|
||||
public final class ItemTypeTagKeys {
|
||||
/**
|
||||
+2
-2
@@ -11,7 +11,7 @@ import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
* Vanilla keys for {@link RegistryKey#PAINTING_VARIANT}.
|
||||
* Vanilla tag keys for {@link RegistryKey#PAINTING_VARIANT}.
|
||||
*
|
||||
* @apiNote The fields provided here are a direct representation of
|
||||
* what is available from the vanilla game source. They may be
|
||||
@@ -23,8 +23,8 @@ import org.jspecify.annotations.NullMarked;
|
||||
"unused",
|
||||
"SpellCheckingInspection"
|
||||
})
|
||||
@GeneratedFrom("1.21.4")
|
||||
@NullMarked
|
||||
@GeneratedFrom("1.21.4")
|
||||
@ApiStatus.Experimental
|
||||
public final class PaintingVariantTagKeys {
|
||||
/**
|
||||
+2
-2
@@ -12,7 +12,7 @@ import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
* Vanilla keys for {@link RegistryKey#STRUCTURE}.
|
||||
* Vanilla tag keys for {@link RegistryKey#STRUCTURE}.
|
||||
*
|
||||
* @apiNote The fields provided here are a direct representation of
|
||||
* what is available from the vanilla game source. They may be
|
||||
@@ -24,8 +24,8 @@ import org.jspecify.annotations.NullMarked;
|
||||
"unused",
|
||||
"SpellCheckingInspection"
|
||||
})
|
||||
@GeneratedFrom("1.21.4")
|
||||
@NullMarked
|
||||
@GeneratedFrom("1.21.4")
|
||||
@ApiStatus.Experimental
|
||||
public final class StructureTagKeys {
|
||||
/**
|
||||
+23
@@ -5,6 +5,7 @@ import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.player.PlayerEvent;
|
||||
import org.bukkit.inventory.EquipmentSlot;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
@@ -16,8 +17,10 @@ import static org.bukkit.Material.*;
|
||||
* Called when the player themselves change their armor items
|
||||
* <p>
|
||||
* 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
|
||||
@ApiStatus.Obsolete(since = "1.21.4")
|
||||
public class PlayerArmorChangeEvent extends PlayerEvent {
|
||||
|
||||
private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
@@ -38,11 +41,27 @@ public class PlayerArmorChangeEvent extends PlayerEvent {
|
||||
* Gets the 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() {
|
||||
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
|
||||
*
|
||||
@@ -70,6 +89,10 @@ public class PlayerArmorChangeEvent extends PlayerEvent {
|
||||
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 {
|
||||
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),
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@ import org.jspecify.annotations.NullMarked;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Represents an event that is called when a player right-clicks an unknown entity.
|
||||
* Represents an event that is called when a player clicks an unknown entity.
|
||||
* Useful for plugins dealing with virtual entities (entities that aren't actually spawned on the server).
|
||||
* <br>
|
||||
* This event may be called multiple times per interaction with different interaction hands
|
||||
|
||||
+5
@@ -10,5 +10,10 @@ import org.jetbrains.annotations.ApiStatus;
|
||||
*/
|
||||
@ApiStatus.Internal
|
||||
public enum CommandRegistrationFlag {
|
||||
|
||||
/**
|
||||
* @deprecated This is the default behavior now.
|
||||
*/
|
||||
@Deprecated(since = "1.21.4")
|
||||
FLATTEN_ALIASES
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
package io.papermc.paper.command.brigadier;
|
||||
|
||||
import com.mojang.brigadier.RedirectModifier;
|
||||
import com.mojang.brigadier.tree.CommandNode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Entity;
|
||||
@@ -48,4 +50,24 @@ public interface CommandSourceStack {
|
||||
* @return entity that executes this command
|
||||
*/
|
||||
@Nullable Entity getExecutor();
|
||||
|
||||
/**
|
||||
* Creates a new CommandSourceStack object with a different location for redirecting commands to other nodes.
|
||||
*
|
||||
* @param location The location to create a new CommandSourceStack object with
|
||||
* @return The newly created CommandSourceStack
|
||||
* @see #getLocation()
|
||||
* @see com.mojang.brigadier.builder.ArgumentBuilder#fork(CommandNode, RedirectModifier)
|
||||
*/
|
||||
CommandSourceStack withLocation(Location location);
|
||||
|
||||
/**
|
||||
* Creates a new CommandSourceStack object with a different executor for redirecting commands to other nodes.
|
||||
*
|
||||
* @param executor The executing entity to create a new CommandSourceStack object with
|
||||
* @return The newly created CommandSourceStack
|
||||
* @see #getExecutor()
|
||||
* @see com.mojang.brigadier.builder.ArgumentBuilder#fork(CommandNode, RedirectModifier)
|
||||
*/
|
||||
CommandSourceStack withExecutor(Entity executor);
|
||||
}
|
||||
@@ -113,6 +113,7 @@ public interface Commands extends Registrar {
|
||||
* <p>Commands have certain overriding behavior:
|
||||
* <ul>
|
||||
* <li>Aliases will not override already existing commands (excluding namespaced ones)</li>
|
||||
* <li>Aliases are <b>not</b> Brigadier redirects, they just copy the command to a different label</li>
|
||||
* <li>The main command/namespaced label will override already existing commands</li>
|
||||
* </ul>
|
||||
*
|
||||
@@ -129,6 +130,7 @@ public interface Commands extends Registrar {
|
||||
* <p>Commands have certain overriding behavior:
|
||||
* <ul>
|
||||
* <li>Aliases will not override already existing commands (excluding namespaced ones)</li>
|
||||
* <li>Aliases are <b>not</b> Brigadier redirects, they just copy the command to a different label</li>
|
||||
* <li>The main command/namespaced label will override already existing commands</li>
|
||||
* </ul>
|
||||
*
|
||||
@@ -146,6 +148,7 @@ public interface Commands extends Registrar {
|
||||
* <p>Commands have certain overriding behavior:
|
||||
* <ul>
|
||||
* <li>Aliases will not override already existing commands (excluding namespaced ones)</li>
|
||||
* <li>Aliases are <b>not</b> Brigadier redirects, they just copy the command to a different label</li>
|
||||
* <li>The main command/namespaced label will override already existing commands</li>
|
||||
* </ul>
|
||||
*
|
||||
@@ -163,6 +166,7 @@ public interface Commands extends Registrar {
|
||||
* <p>Commands have certain overriding behavior:
|
||||
* <ul>
|
||||
* <li>Aliases will not override already existing commands (excluding namespaced ones)</li>
|
||||
* <li>Aliases are <b>not</b> Brigadier redirects, they just copy the command to a different label</li>
|
||||
* <li>The main command/namespaced label will override already existing commands</li>
|
||||
* </ul>
|
||||
*
|
||||
@@ -179,6 +183,7 @@ public interface Commands extends Registrar {
|
||||
* <p>Commands have certain overriding behavior:
|
||||
* <ul>
|
||||
* <li>Aliases will not override already existing commands (excluding namespaced ones)</li>
|
||||
* <li>Aliases are <b>not</b> Brigadier redirects, they just copy the command to a different label</li>
|
||||
* <li>The main command/namespaced label will override already existing commands</li>
|
||||
* </ul>
|
||||
*
|
||||
|
||||
+10
@@ -7,6 +7,7 @@ import io.papermc.paper.command.brigadier.argument.range.IntegerRangeProvider;
|
||||
import io.papermc.paper.command.brigadier.argument.resolvers.BlockPositionResolver;
|
||||
import io.papermc.paper.command.brigadier.argument.resolvers.FinePositionResolver;
|
||||
import io.papermc.paper.command.brigadier.argument.resolvers.PlayerProfileListResolver;
|
||||
import io.papermc.paper.command.brigadier.argument.resolvers.RotationResolver;
|
||||
import io.papermc.paper.command.brigadier.argument.resolvers.selector.EntitySelectorArgumentResolver;
|
||||
import io.papermc.paper.command.brigadier.argument.resolvers.selector.PlayerSelectorArgumentResolver;
|
||||
import io.papermc.paper.entity.LookAnchor;
|
||||
@@ -123,6 +124,15 @@ public final class ArgumentTypes {
|
||||
return provider().finePosition(centerIntegers);
|
||||
}
|
||||
|
||||
/**
|
||||
* A rotation argument.
|
||||
*
|
||||
* @return rotation argument
|
||||
*/
|
||||
public static ArgumentType<RotationResolver> rotation() {
|
||||
return provider().rotation();
|
||||
}
|
||||
|
||||
/**
|
||||
* A blockstate argument which will provide rich parsing for specifying
|
||||
* the specific block variant and then the block entity NBT if applicable.
|
||||
|
||||
+3
@@ -7,6 +7,7 @@ import io.papermc.paper.command.brigadier.argument.range.IntegerRangeProvider;
|
||||
import io.papermc.paper.command.brigadier.argument.resolvers.BlockPositionResolver;
|
||||
import io.papermc.paper.command.brigadier.argument.resolvers.FinePositionResolver;
|
||||
import io.papermc.paper.command.brigadier.argument.resolvers.PlayerProfileListResolver;
|
||||
import io.papermc.paper.command.brigadier.argument.resolvers.RotationResolver;
|
||||
import io.papermc.paper.command.brigadier.argument.resolvers.selector.EntitySelectorArgumentResolver;
|
||||
import io.papermc.paper.command.brigadier.argument.resolvers.selector.PlayerSelectorArgumentResolver;
|
||||
import io.papermc.paper.entity.LookAnchor;
|
||||
@@ -57,6 +58,8 @@ interface VanillaArgumentProvider {
|
||||
|
||||
ArgumentType<FinePositionResolver> finePosition(boolean centerIntegers);
|
||||
|
||||
ArgumentType<RotationResolver> rotation();
|
||||
|
||||
ArgumentType<BlockState> blockState();
|
||||
|
||||
ArgumentType<ItemStack> itemStack();
|
||||
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
package io.papermc.paper.command.brigadier.argument.resolvers;
|
||||
|
||||
import io.papermc.paper.command.brigadier.CommandSourceStack;
|
||||
import io.papermc.paper.math.Rotation;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
|
||||
/**
|
||||
* An {@link ArgumentResolver} that's capable of resolving
|
||||
* a rotation argument value using a {@link CommandSourceStack}.
|
||||
*
|
||||
* @see io.papermc.paper.command.brigadier.argument.ArgumentTypes#rotation()
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
@ApiStatus.NonExtendable
|
||||
public interface RotationResolver extends ArgumentResolver<Rotation> {
|
||||
}
|
||||
@@ -63,21 +63,76 @@ import static java.util.Objects.requireNonNull;
|
||||
@ApiStatus.Experimental
|
||||
public final class DataComponentTypes {
|
||||
|
||||
// Start generate - DataComponentTypes
|
||||
// @GeneratedFrom 1.21.4
|
||||
/**
|
||||
* Controls the maximum stacking size of this item.
|
||||
* <br>
|
||||
* Values greater than 1 are mutually exclusive with the {@link #MAX_DAMAGE} component.
|
||||
* Holds attribute modifiers applied to any item,
|
||||
* if not set, has an implicit default value based on the item type's
|
||||
* default attributes (e.g. attack damage for weapons).
|
||||
*/
|
||||
public static final DataComponentType.Valued<@IntRange(from = 1, to = 99) Integer> MAX_STACK_SIZE = valued("max_stack_size");
|
||||
public static final DataComponentType.Valued<ItemAttributeModifiers> ATTRIBUTE_MODIFIERS = valued("attribute_modifiers");
|
||||
|
||||
/**
|
||||
* Controls the maximum amount of damage than an item can take,
|
||||
* if not present, the item cannot be damaged.
|
||||
* <br>
|
||||
* Mutually exclusive with the {@link #MAX_STACK_SIZE} component greater than 1.
|
||||
* Stores the additional patterns applied to a Banner or Shield.
|
||||
*/
|
||||
public static final DataComponentType.Valued<BannerPatternLayers> BANNER_PATTERNS = valued("banner_patterns");
|
||||
|
||||
/**
|
||||
* Stores the base color for a Shield.
|
||||
*/
|
||||
public static final DataComponentType.Valued<DyeColor> BASE_COLOR = valued("base_color");
|
||||
|
||||
/**
|
||||
* Holds block state properties to apply when placing a block.
|
||||
*/
|
||||
public static final DataComponentType.Valued<BlockItemDataProperties> BLOCK_DATA = valued("block_state");
|
||||
|
||||
/**
|
||||
* Holds all items stored inside a Bundle.
|
||||
* If removed, items cannot be added to the Bundle.
|
||||
*/
|
||||
public static final DataComponentType.Valued<BundleContents> BUNDLE_CONTENTS = valued("bundle_contents");
|
||||
|
||||
/**
|
||||
* Controls which blocks a player in Adventure mode can break with this item.
|
||||
*/
|
||||
public static final DataComponentType.Valued<ItemAdventurePredicate> CAN_BREAK = valued("can_break");
|
||||
|
||||
/**
|
||||
* Controls which blocks a player in Adventure mode can place on with this item.
|
||||
*/
|
||||
public static final DataComponentType.Valued<ItemAdventurePredicate> CAN_PLACE_ON = valued("can_place_on");
|
||||
|
||||
/**
|
||||
* Holds all projectiles that have been loaded into a Crossbow.
|
||||
* If not present, the Crossbow is not charged.
|
||||
*/
|
||||
public static final DataComponentType.Valued<ChargedProjectiles> CHARGED_PROJECTILES = valued("charged_projectiles");
|
||||
|
||||
public static final DataComponentType.Valued<Consumable> CONSUMABLE = valued("consumable");
|
||||
|
||||
/**
|
||||
* Holds the contents of container blocks (Chests, Shulker Boxes) in item form.
|
||||
*/
|
||||
public static final DataComponentType.Valued<ItemContainerContents> CONTAINER = valued("container");
|
||||
|
||||
/**
|
||||
* Holds the unresolved loot table and seed of a container-like block.
|
||||
*/
|
||||
public static final DataComponentType.Valued<SeededContainerLoot> CONTAINER_LOOT = valued("container_loot");
|
||||
|
||||
/**
|
||||
* Controls the minecraft:custom_model_data property in the item model.
|
||||
*/
|
||||
public static final DataComponentType.Valued<CustomModelData> CUSTOM_MODEL_DATA = valued("custom_model_data");
|
||||
|
||||
/**
|
||||
* Custom name override for an item (as set by renaming with an Anvil).
|
||||
*
|
||||
* @see #DAMAGE
|
||||
* @see #ITEM_NAME
|
||||
*/
|
||||
public static final DataComponentType.Valued<@Positive Integer> MAX_DAMAGE = valued("max_damage");
|
||||
public static final DataComponentType.Valued<Component> CUSTOM_NAME = valued("custom_name");
|
||||
|
||||
/**
|
||||
* The amount of durability removed from an item,
|
||||
* for damageable items (with the {@link #MAX_DAMAGE} component), has an implicit default value of: {@code 0}.
|
||||
@@ -85,16 +140,80 @@ public final class DataComponentTypes {
|
||||
* @see #MAX_DAMAGE
|
||||
*/
|
||||
public static final DataComponentType.Valued<@NonNegative Integer> DAMAGE = valued("damage");
|
||||
|
||||
/**
|
||||
* If set, the item will not lose any durability when used.
|
||||
* If present, this item will not take damage from the specified damage types.
|
||||
*/
|
||||
public static final DataComponentType.Valued<Unbreakable> UNBREAKABLE = valued("unbreakable");
|
||||
public static final DataComponentType.Valued<DamageResistant> DAMAGE_RESISTANT = valued("damage_resistant");
|
||||
|
||||
public static final DataComponentType.Valued<DeathProtection> DEATH_PROTECTION = valued("death_protection");
|
||||
|
||||
/**
|
||||
* Custom name override for an item (as set by renaming with an Anvil).
|
||||
* Represents a color applied to a dyeable item (in the {@link io.papermc.paper.registry.keys.tags.ItemTypeTagKeys#DYEABLE} item tag).
|
||||
*/
|
||||
public static final DataComponentType.Valued<DyedItemColor> DYED_COLOR = valued("dyed_color");
|
||||
|
||||
public static final DataComponentType.Valued<Enchantable> ENCHANTABLE = valued("enchantable");
|
||||
|
||||
/**
|
||||
* Overrides the enchantment glint effect on an item.
|
||||
* If not present, default behaviour is used.
|
||||
*/
|
||||
public static final DataComponentType.Valued<Boolean> ENCHANTMENT_GLINT_OVERRIDE = valued("enchantment_glint_override");
|
||||
|
||||
/**
|
||||
* Controls the enchantments on an item.
|
||||
* <br>
|
||||
* If not present on a non-enchantment book, this item will not work in an anvil.
|
||||
*
|
||||
* @see #ITEM_NAME
|
||||
* @see #STORED_ENCHANTMENTS
|
||||
*/
|
||||
public static final DataComponentType.Valued<Component> CUSTOM_NAME = valued("custom_name");
|
||||
public static final DataComponentType.Valued<ItemEnchantments> ENCHANTMENTS = valued("enchantments");
|
||||
|
||||
public static final DataComponentType.Valued<Equippable> EQUIPPABLE = valued("equippable");
|
||||
|
||||
/**
|
||||
* Stores the explosion crafted in a Firework Star.
|
||||
*/
|
||||
public static final DataComponentType.Valued<FireworkEffect> FIREWORK_EXPLOSION = valued("firework_explosion");
|
||||
|
||||
/**
|
||||
* Stores all explosions crafted into a Firework Rocket, as well as flight duration.
|
||||
*/
|
||||
public static final DataComponentType.Valued<Fireworks> FIREWORKS = valued("fireworks");
|
||||
|
||||
/**
|
||||
* Controls potential food benefits gained when consuming the item the component is applied on.
|
||||
* Requires the {@link #CONSUMABLE} component to allow consumption in the first place.
|
||||
*/
|
||||
public static final DataComponentType.Valued<FoodProperties> FOOD = valued("food");
|
||||
|
||||
public static final DataComponentType.NonValued GLIDER = unvalued("glider");
|
||||
|
||||
/**
|
||||
* If set, disables 'additional' tooltip part which comes from the item type
|
||||
* (e.g. content of a shulker).
|
||||
*/
|
||||
public static final DataComponentType.NonValued HIDE_ADDITIONAL_TOOLTIP = unvalued("hide_additional_tooltip");
|
||||
|
||||
/**
|
||||
* If set, it will completely hide whole item tooltip (that includes item name).
|
||||
*/
|
||||
public static final DataComponentType.NonValued HIDE_TOOLTIP = unvalued("hide_tooltip");
|
||||
|
||||
/**
|
||||
* Holds the instrument type used by a Goat Horn.
|
||||
*/
|
||||
public static final DataComponentType.Valued<MusicInstrument> INSTRUMENT = valued("instrument");
|
||||
|
||||
/**
|
||||
* Marks that a projectile item would be intangible when fired
|
||||
* (i.e. can only be picked up by a creative mode player).
|
||||
*/
|
||||
public static final DataComponentType.NonValued INTANGIBLE_PROJECTILE = unvalued("intangible_projectile");
|
||||
|
||||
public static final DataComponentType.Valued<Key> ITEM_MODEL = valued("item_model");
|
||||
|
||||
/**
|
||||
* When present, replaces default item name with contained chat component.
|
||||
* <p>
|
||||
@@ -109,91 +228,100 @@ public final class DataComponentTypes {
|
||||
* @see #CUSTOM_NAME
|
||||
*/
|
||||
public static final DataComponentType.Valued<Component> ITEM_NAME = valued("item_name");
|
||||
public static final DataComponentType.Valued<Key> ITEM_MODEL = valued("item_model");
|
||||
|
||||
public static final DataComponentType.Valued<JukeboxPlayable> JUKEBOX_PLAYABLE = valued("jukebox_playable");
|
||||
|
||||
/**
|
||||
* If present, specifies that the Compass is a Lodestone Compass.
|
||||
*/
|
||||
public static final DataComponentType.Valued<LodestoneTracker> LODESTONE_TRACKER = valued("lodestone_tracker");
|
||||
|
||||
/**
|
||||
* Additional lines to include in an item's tooltip.
|
||||
*/
|
||||
public static final DataComponentType.Valued<ItemLore> LORE = valued("lore");
|
||||
|
||||
/**
|
||||
* Represents the tint of the decorations on the {@link org.bukkit.inventory.ItemType#FILLED_MAP} item.
|
||||
*/
|
||||
public static final DataComponentType.Valued<MapItemColor> MAP_COLOR = valued("map_color");
|
||||
|
||||
/**
|
||||
* Holds a list of markers to be placed on a {@link org.bukkit.inventory.ItemType#FILLED_MAP} (used for Explorer Maps).
|
||||
*/
|
||||
public static final DataComponentType.Valued<MapDecorations> MAP_DECORATIONS = valued("map_decorations");
|
||||
|
||||
/**
|
||||
* References the shared map state holding map contents and markers for a {@link org.bukkit.inventory.ItemType#FILLED_MAP}.
|
||||
*/
|
||||
public static final DataComponentType.Valued<MapId> MAP_ID = valued("map_id");
|
||||
|
||||
/**
|
||||
* Internal map item state used in the map crafting recipe.
|
||||
*/
|
||||
public static final DataComponentType.Valued<MapPostProcessing> MAP_POST_PROCESSING = valued("map_post_processing");
|
||||
|
||||
/**
|
||||
* Controls the maximum amount of damage than an item can take,
|
||||
* if not present, the item cannot be damaged.
|
||||
* <br>
|
||||
* Mutually exclusive with the {@link #MAX_STACK_SIZE} component greater than 1.
|
||||
*
|
||||
* @see #DAMAGE
|
||||
*/
|
||||
public static final DataComponentType.Valued<@Positive Integer> MAX_DAMAGE = valued("max_damage");
|
||||
|
||||
/**
|
||||
* Controls the maximum stacking size of this item.
|
||||
* <br>
|
||||
* Values greater than 1 are mutually exclusive with the {@link #MAX_DAMAGE} component.
|
||||
*/
|
||||
public static final DataComponentType.Valued<Integer> MAX_STACK_SIZE = valued("max_stack_size");
|
||||
|
||||
/**
|
||||
* Controls the sound played by a Player Head when placed on a Note Block.
|
||||
*/
|
||||
public static final DataComponentType.Valued<Key> NOTE_BLOCK_SOUND = valued("note_block_sound");
|
||||
|
||||
/**
|
||||
* Controls the amplifier amount for an Ominous Bottle's Bad Omen effect.
|
||||
*/
|
||||
public static final DataComponentType.Valued<OminousBottleAmplifier> OMINOUS_BOTTLE_AMPLIFIER = valued("ominous_bottle_amplifier");
|
||||
|
||||
/**
|
||||
* Stores the Sherds applied to each side of a Decorated Pot.
|
||||
*/
|
||||
public static final DataComponentType.Valued<PotDecorations> POT_DECORATIONS = valued("pot_decorations");
|
||||
|
||||
/**
|
||||
* Holds the contents of a potion (Potion, Splash Potion, Lingering Potion),
|
||||
* or potion applied to a Tipped Arrow.
|
||||
*/
|
||||
public static final DataComponentType.Valued<PotionContents> POTION_CONTENTS = valued("potion_contents");
|
||||
|
||||
/**
|
||||
* Controls the skin displayed on a Player Head.
|
||||
*/
|
||||
public static final DataComponentType.Valued<ResolvableProfile> PROFILE = valued("profile");
|
||||
|
||||
/**
|
||||
* Controls the color of the item name.
|
||||
*/
|
||||
public static final DataComponentType.Valued<ItemRarity> RARITY = valued("rarity");
|
||||
|
||||
/**
|
||||
* Controls the enchantments on an item.
|
||||
* <br>
|
||||
* If not present on a non-enchantment book, this item will not work in an anvil.
|
||||
*
|
||||
* @see #STORED_ENCHANTMENTS
|
||||
* List of recipes that should be unlocked when using the Knowledge Book item.
|
||||
*/
|
||||
public static final DataComponentType.Valued<ItemEnchantments> ENCHANTMENTS = valued("enchantments");
|
||||
/**
|
||||
* Controls which blocks a player in Adventure mode can place on with this item.
|
||||
*/
|
||||
public static final DataComponentType.Valued<ItemAdventurePredicate> CAN_PLACE_ON = valued("can_place_on");
|
||||
/**
|
||||
* Controls which blocks a player in Adventure mode can break with this item.
|
||||
*/
|
||||
public static final DataComponentType.Valued<ItemAdventurePredicate> CAN_BREAK = valued("can_break");
|
||||
/**
|
||||
* Holds attribute modifiers applied to any item,
|
||||
* if not set, has an implicit default value based on the item type's
|
||||
* default attributes (e.g. attack damage for weapons).
|
||||
*/
|
||||
public static final DataComponentType.Valued<ItemAttributeModifiers> ATTRIBUTE_MODIFIERS = valued("attribute_modifiers");
|
||||
/**
|
||||
* Controls the minecraft:custom_model_data property in the item model.
|
||||
*/
|
||||
public static final DataComponentType.Valued<CustomModelData> CUSTOM_MODEL_DATA = valued("custom_model_data");
|
||||
/**
|
||||
* If set, disables 'additional' tooltip part which comes from the item type
|
||||
* (e.g. content of a shulker).
|
||||
*/
|
||||
public static final DataComponentType.NonValued HIDE_ADDITIONAL_TOOLTIP = unvalued("hide_additional_tooltip");
|
||||
/**
|
||||
* If set, it will completely hide whole item tooltip (that includes item name).
|
||||
*/
|
||||
public static final DataComponentType.NonValued HIDE_TOOLTIP = unvalued("hide_tooltip");
|
||||
public static final DataComponentType.Valued<List<Key>> RECIPES = valued("recipes");
|
||||
|
||||
/**
|
||||
* The additional experience cost required to modify an item in an Anvil.
|
||||
* If not present, has an implicit default value of: {@code 0}.
|
||||
*/
|
||||
public static final DataComponentType.Valued<@NonNegative Integer> REPAIR_COST = valued("repair_cost");
|
||||
// /**
|
||||
// * Causes an item to not be pickable in the creative menu, currently not very useful.
|
||||
// */
|
||||
// public static final DataComponentType.NonValued CREATIVE_SLOT_LOCK = unvalued("creative_slot_lock");
|
||||
/**
|
||||
* Overrides the enchantment glint effect on an item.
|
||||
* If not present, default behaviour is used.
|
||||
*/
|
||||
public static final DataComponentType.Valued<Boolean> ENCHANTMENT_GLINT_OVERRIDE = valued("enchantment_glint_override");
|
||||
/**
|
||||
* Marks that a projectile item would be intangible when fired
|
||||
* (i.e. can only be picked up by a creative mode player).
|
||||
*/
|
||||
public static final DataComponentType.NonValued INTANGIBLE_PROJECTILE = unvalued("intangible_projectile");
|
||||
/**
|
||||
* Controls potential food benefits gained when consuming the item the component is applied on.
|
||||
* Requires the {@link #CONSUMABLE} component to allow consumption in the first place.
|
||||
*/
|
||||
public static final DataComponentType.Valued<FoodProperties> FOOD = valued("food");
|
||||
public static final DataComponentType.Valued<Consumable> CONSUMABLE = valued("consumable");
|
||||
public static final DataComponentType.Valued<UseRemainder> USE_REMAINDER = valued("use_remainder");
|
||||
public static final DataComponentType.Valued<UseCooldown> USE_COOLDOWN = valued("use_cooldown");
|
||||
/**
|
||||
* If present, this item will not take damage from the specified damage types.
|
||||
*/
|
||||
public static final DataComponentType.Valued<DamageResistant> DAMAGE_RESISTANT = valued("damage_resistant");
|
||||
/**
|
||||
* Controls the behavior of the item as a tool.
|
||||
*/
|
||||
public static final DataComponentType.Valued<Tool> TOOL = valued("tool");
|
||||
public static final DataComponentType.Valued<Enchantable> ENCHANTABLE = valued("enchantable");
|
||||
public static final DataComponentType.Valued<Equippable> EQUIPPABLE = valued("equippable");
|
||||
|
||||
public static final DataComponentType.Valued<Repairable> REPAIRABLE = valued("repairable");
|
||||
public static final DataComponentType.NonValued GLIDER = unvalued("glider");
|
||||
public static final DataComponentType.Valued<Key> TOOLTIP_STYLE = valued("tooltip_style");
|
||||
public static final DataComponentType.Valued<DeathProtection> DEATH_PROTECTION = valued("death_protection");
|
||||
|
||||
/**
|
||||
* Stores list of enchantments and their levels for an Enchanted Book.
|
||||
* Unlike {@link #ENCHANTMENTS}, the effects provided by enchantments
|
||||
@@ -208,114 +336,51 @@ public final class DataComponentTypes {
|
||||
* @see #ENCHANTMENTS
|
||||
*/
|
||||
public static final DataComponentType.Valued<ItemEnchantments> STORED_ENCHANTMENTS = valued("stored_enchantments");
|
||||
/**
|
||||
* Represents a color applied to a dyeable item (in the {@link io.papermc.paper.registry.keys.tags.ItemTypeTagKeys#DYEABLE} item tag).
|
||||
*/
|
||||
public static final DataComponentType.Valued<DyedItemColor> DYED_COLOR = valued("dyed_color");
|
||||
/**
|
||||
* Represents the tint of the decorations on the {@link org.bukkit.inventory.ItemType#FILLED_MAP} item.
|
||||
*/
|
||||
public static final DataComponentType.Valued<MapItemColor> MAP_COLOR = valued("map_color");
|
||||
/**
|
||||
* References the shared map state holding map contents and markers for a {@link org.bukkit.inventory.ItemType#FILLED_MAP}.
|
||||
*/
|
||||
public static final DataComponentType.Valued<MapId> MAP_ID = valued("map_id");
|
||||
/**
|
||||
* Holds a list of markers to be placed on a {@link org.bukkit.inventory.ItemType#FILLED_MAP} (used for Explorer Maps).
|
||||
*/
|
||||
public static final DataComponentType.Valued<MapDecorations> MAP_DECORATIONS = valued("map_decorations");
|
||||
/**
|
||||
* Internal map item state used in the map crafting recipe.
|
||||
*/
|
||||
public static final DataComponentType.Valued<MapPostProcessing> MAP_POST_PROCESSING = valued("map_post_processing");
|
||||
/**
|
||||
* Holds all projectiles that have been loaded into a Crossbow.
|
||||
* If not present, the Crossbow is not charged.
|
||||
*/
|
||||
public static final DataComponentType.Valued<ChargedProjectiles> CHARGED_PROJECTILES = valued("charged_projectiles");
|
||||
/**
|
||||
* Holds all items stored inside a Bundle.
|
||||
* If removed, items cannot be added to the Bundle.
|
||||
*/
|
||||
public static final DataComponentType.Valued<BundleContents> BUNDLE_CONTENTS = valued("bundle_contents");
|
||||
/**
|
||||
* Holds the contents of a potion (Potion, Splash Potion, Lingering Potion),
|
||||
* or potion applied to a Tipped Arrow.
|
||||
*/
|
||||
public static final DataComponentType.Valued<PotionContents> POTION_CONTENTS = valued("potion_contents");
|
||||
|
||||
/**
|
||||
* Holds the effects that will be applied when consuming Suspicious Stew.
|
||||
*/
|
||||
public static final DataComponentType.Valued<SuspiciousStewEffects> SUSPICIOUS_STEW_EFFECTS = valued("suspicious_stew_effects");
|
||||
|
||||
/**
|
||||
* Holds the contents in a Book and Quill.
|
||||
* Controls the behavior of the item as a tool.
|
||||
*/
|
||||
public static final DataComponentType.Valued<WritableBookContent> WRITABLE_BOOK_CONTENT = valued("writable_book_content");
|
||||
/**
|
||||
* Holds the contents and metadata of a Written Book.
|
||||
*/
|
||||
public static final DataComponentType.Valued<WrittenBookContent> WRITTEN_BOOK_CONTENT = valued("written_book_content");
|
||||
public static final DataComponentType.Valued<Tool> TOOL = valued("tool");
|
||||
|
||||
public static final DataComponentType.Valued<Key> TOOLTIP_STYLE = valued("tooltip_style");
|
||||
|
||||
/**
|
||||
* Holds the trims applied to an item in recipes
|
||||
*/
|
||||
public static final DataComponentType.Valued<ItemArmorTrim> TRIM = valued("trim");
|
||||
|
||||
/**
|
||||
* If set, the item will not lose any durability when used.
|
||||
*/
|
||||
public static final DataComponentType.Valued<Unbreakable> UNBREAKABLE = valued("unbreakable");
|
||||
|
||||
public static final DataComponentType.Valued<UseCooldown> USE_COOLDOWN = valued("use_cooldown");
|
||||
|
||||
public static final DataComponentType.Valued<UseRemainder> USE_REMAINDER = valued("use_remainder");
|
||||
|
||||
/**
|
||||
* Holds the contents in a Book and Quill.
|
||||
*/
|
||||
public static final DataComponentType.Valued<WritableBookContent> WRITABLE_BOOK_CONTENT = valued("writable_book_content");
|
||||
|
||||
/**
|
||||
* Holds the contents and metadata of a Written Book.
|
||||
*/
|
||||
public static final DataComponentType.Valued<WrittenBookContent> WRITTEN_BOOK_CONTENT = valued("written_book_content");
|
||||
// End generate - DataComponentTypes
|
||||
// /**
|
||||
// * Causes an item to not be pickable in the creative menu, currently not very useful.
|
||||
// */
|
||||
// public static final DataComponentType.NonValued CREATIVE_SLOT_LOCK = unvalued("creative_slot_lock");
|
||||
// debug_stick_state - Block Property API
|
||||
// entity_data
|
||||
// bucket_entity_data
|
||||
// block_entity_data
|
||||
/**
|
||||
* Holds the instrument type used by a Goat Horn.
|
||||
*/
|
||||
public static final DataComponentType.Valued<MusicInstrument> INSTRUMENT = valued("instrument");
|
||||
/**
|
||||
* Controls the amplifier amount for an Ominous Bottle's Bad Omen effect.
|
||||
*/
|
||||
public static final DataComponentType.Valued<OminousBottleAmplifier> OMINOUS_BOTTLE_AMPLIFIER = valued("ominous_bottle_amplifier");
|
||||
public static final DataComponentType.Valued<JukeboxPlayable> JUKEBOX_PLAYABLE = valued("jukebox_playable");
|
||||
/**
|
||||
* List of recipes that should be unlocked when using the Knowledge Book item.
|
||||
*/
|
||||
public static final DataComponentType.Valued<List<Key>> RECIPES = valued("recipes");
|
||||
/**
|
||||
* If present, specifies that the Compass is a Lodestone Compass.
|
||||
*/
|
||||
public static final DataComponentType.Valued<LodestoneTracker> LODESTONE_TRACKER = valued("lodestone_tracker");
|
||||
/**
|
||||
* Stores the explosion crafted in a Firework Star.
|
||||
*/
|
||||
public static final DataComponentType.Valued<FireworkEffect> FIREWORK_EXPLOSION = valued("firework_explosion");
|
||||
/**
|
||||
* Stores all explosions crafted into a Firework Rocket, as well as flight duration.
|
||||
*/
|
||||
public static final DataComponentType.Valued<Fireworks> FIREWORKS = valued("fireworks");
|
||||
/**
|
||||
* Controls the skin displayed on a Player Head.
|
||||
*/
|
||||
public static final DataComponentType.Valued<ResolvableProfile> PROFILE = valued("profile");
|
||||
/**
|
||||
* Controls the sound played by a Player Head when placed on a Note Block.
|
||||
*/
|
||||
public static final DataComponentType.Valued<Key> NOTE_BLOCK_SOUND = valued("note_block_sound");
|
||||
/**
|
||||
* Stores the additional patterns applied to a Banner or Shield.
|
||||
*/
|
||||
public static final DataComponentType.Valued<BannerPatternLayers> BANNER_PATTERNS = valued("banner_patterns");
|
||||
/**
|
||||
* Stores the base color for a Shield.
|
||||
*/
|
||||
public static final DataComponentType.Valued<DyeColor> BASE_COLOR = valued("base_color");
|
||||
/**
|
||||
* Stores the Sherds applied to each side of a Decorated Pot.
|
||||
*/
|
||||
public static final DataComponentType.Valued<PotDecorations> POT_DECORATIONS = valued("pot_decorations");
|
||||
/**
|
||||
* Holds the contents of container blocks (Chests, Shulker Boxes) in item form.
|
||||
*/
|
||||
public static final DataComponentType.Valued<ItemContainerContents> CONTAINER = valued("container");
|
||||
/**
|
||||
* Holds block state properties to apply when placing a block.
|
||||
*/
|
||||
public static final DataComponentType.Valued<BlockItemDataProperties> BLOCK_DATA = valued("block_state");
|
||||
// bees
|
||||
// /**
|
||||
// * Holds the lock state of a container-like block,
|
||||
@@ -325,10 +390,6 @@ public final class DataComponentTypes {
|
||||
// * to open this container.
|
||||
// */
|
||||
// public static final DataComponentType.Valued<LockCode> LOCK = valued("lock");
|
||||
/**
|
||||
* Holds the unresolved loot table and seed of a container-like block.
|
||||
*/
|
||||
public static final DataComponentType.Valued<SeededContainerLoot> CONTAINER_LOOT = valued("container_loot");
|
||||
|
||||
private static DataComponentType.NonValued unvalued(final String name) {
|
||||
return (DataComponentType.NonValued) requireNonNull(Registry.DATA_COMPONENT_TYPE.get(NamespacedKey.minecraft(name)), name + " unvalued data component type couldn't be found, this is a bug.");
|
||||
|
||||
@@ -21,9 +21,9 @@ public interface DamageResistant {
|
||||
}
|
||||
|
||||
/**
|
||||
* The types that this damage type is invincible tp.
|
||||
* The types that this damage type is invincible to.
|
||||
*
|
||||
* @return item
|
||||
* @return the key of the tag holding the respective damage types.
|
||||
*/
|
||||
@Contract(value = "-> new", pure = true)
|
||||
TagKey<DamageType> types();
|
||||
|
||||
+21
-18
@@ -21,7 +21,7 @@ public interface ConsumeEffect {
|
||||
* Creates a consume effect that randomly teleports the entity on consumption.
|
||||
*
|
||||
* @param diameter diameter of random teleportation
|
||||
* @return the effect
|
||||
* @return the effect instance
|
||||
*/
|
||||
@Contract(value = "_ -> new", pure = true)
|
||||
static TeleportRandomly teleportRandomlyEffect(final float diameter) {
|
||||
@@ -29,21 +29,21 @@ public interface ConsumeEffect {
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a consume effect that gives status effects on consumption.
|
||||
* Creates a consume effect that removes status effects on consumption.
|
||||
*
|
||||
* @param key the sound effect to play
|
||||
* @return the effect
|
||||
* @param effects the potion effects to remove
|
||||
* @return the effect instance
|
||||
*/
|
||||
@Contract(value = "_ -> new", pure = true)
|
||||
static RemoveStatusEffects removeEffects(final RegistryKeySet<PotionEffectType> key) {
|
||||
return ConsumableTypesBridge.bridge().removeStatusEffects(key);
|
||||
static RemoveStatusEffects removeEffects(final RegistryKeySet<PotionEffectType> effects) {
|
||||
return ConsumableTypesBridge.bridge().removeStatusEffects(effects);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a consume effect that plays a sound on consumption.
|
||||
*
|
||||
* @param key the sound effect to play
|
||||
* @return the effect
|
||||
* @param key the key sound effect to play
|
||||
* @return the effect instance
|
||||
*/
|
||||
@Contract(value = "_ -> new", pure = true)
|
||||
static PlaySound playSoundConsumeEffect(final Key key) {
|
||||
@@ -53,7 +53,7 @@ public interface ConsumeEffect {
|
||||
/**
|
||||
* Creates a consume effect that clears all status effects.
|
||||
*
|
||||
* @return effect instance
|
||||
* @return the effect instance
|
||||
*/
|
||||
@Contract(value = "-> new", pure = true)
|
||||
static ClearAllStatusEffects clearAllStatusEffects() {
|
||||
@@ -61,17 +61,20 @@ public interface ConsumeEffect {
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a consume effect that gives status effects on consumption.
|
||||
* Creates a consume effect that gives potion effects on consumption.
|
||||
*
|
||||
* @param effects the potion effects to apply
|
||||
* @param probability the probability of these effects being applied, between 0 and 1 inclusive.
|
||||
* @return the effect
|
||||
* @param probability the probability of these effects being applied, between 0 and 1 inclusive
|
||||
* @return the effect instance
|
||||
*/
|
||||
@Contract(value = "_, _ -> new", pure = true)
|
||||
static ApplyStatusEffects applyStatusEffects(final List<PotionEffect> effects, final float probability) {
|
||||
return ConsumableTypesBridge.bridge().applyStatusEffects(effects, probability);
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents a consumable effect that randomly teleports the entity on consumption.
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
@ApiStatus.NonExtendable
|
||||
interface TeleportRandomly extends ConsumeEffect {
|
||||
@@ -85,14 +88,14 @@ public interface ConsumeEffect {
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents a consumable effect that removes status effects on consumption
|
||||
* Represents a consumable effect that removes status effects on consumption.
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
@ApiStatus.NonExtendable
|
||||
interface RemoveStatusEffects extends ConsumeEffect {
|
||||
|
||||
/**
|
||||
* Potion effects to remove
|
||||
* Potion effects to remove.
|
||||
*
|
||||
* @return effects
|
||||
*/
|
||||
@@ -107,7 +110,7 @@ public interface ConsumeEffect {
|
||||
interface PlaySound extends ConsumeEffect {
|
||||
|
||||
/**
|
||||
* Sound effect to play in the world
|
||||
* Sound effect to play in the world.
|
||||
*
|
||||
* @return sound effect
|
||||
*/
|
||||
@@ -124,16 +127,16 @@ public interface ConsumeEffect {
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents a consumable effect that applies effects based on a probability on consumption.
|
||||
* Represents a consumable effect that applies potion effects based on a probability on consumption.
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
@ApiStatus.NonExtendable
|
||||
interface ApplyStatusEffects extends ConsumeEffect {
|
||||
|
||||
/**
|
||||
* Effect instances to grant
|
||||
* Potion effect instances to grant.
|
||||
*
|
||||
* @return effect
|
||||
* @return potion effects
|
||||
*/
|
||||
List<PotionEffect> effects();
|
||||
|
||||
|
||||
+4
-1
@@ -4,6 +4,8 @@ package io.papermc.paper.datacomponent.item.consumable;
|
||||
* Represents the hand animation that is used when a player is consuming this item.
|
||||
*/
|
||||
public enum ItemUseAnimation {
|
||||
// Start generate - ItemUseAnimation
|
||||
// @GeneratedFrom 1.21.4
|
||||
NONE,
|
||||
EAT,
|
||||
DRINK,
|
||||
@@ -14,5 +16,6 @@ public enum ItemUseAnimation {
|
||||
SPYGLASS,
|
||||
TOOT_HORN,
|
||||
BRUSH,
|
||||
BUNDLE
|
||||
BUNDLE;
|
||||
// End generate - ItemUseAnimation
|
||||
}
|
||||
@@ -19,11 +19,13 @@ import org.jspecify.annotations.Nullable;
|
||||
* is called anytime the game tries to discover datapacks at any of the
|
||||
* configured locations. This means that if a datapack should stay available to the server,
|
||||
* it must always be discovered whenever this event fires.
|
||||
* <p>An example of a plugin loading a datapack from within it's own jar is below</p>
|
||||
* <p>
|
||||
* An example of a plugin loading a datapack from within its own jar is below,
|
||||
* assuming the datapack is included under {@code resources/pack} folder:
|
||||
* <pre>{@code
|
||||
* public class YourPluginBootstrap implements PluginBootstrap {
|
||||
* @Override
|
||||
* public void bootstrap(BoostrapContext context) {
|
||||
* public void bootstrap(BootstrapContext context) {
|
||||
* final LifecycleEventManager<BootstrapContext> manager = context.getLifecycleManager();
|
||||
* manager.registerEventHandler(LifecycleEvents.DATAPACK_DISCOVERY, event -> {
|
||||
* DatapackRegistrar registrar = event.registrar();
|
||||
@@ -39,6 +41,7 @@ import org.jspecify.annotations.Nullable;
|
||||
* }
|
||||
* }
|
||||
* }</pre>
|
||||
*
|
||||
* @see io.papermc.paper.plugin.lifecycle.event.types.LifecycleEvents#DATAPACK_DISCOVERY
|
||||
*/
|
||||
@ApiStatus.NonExtendable
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
package io.papermc.paper.entity;
|
||||
|
||||
import java.util.Collection;
|
||||
import org.bukkit.entity.Item;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.jetbrains.annotations.Unmodifiable;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
* A result type used by {@link org.bukkit.entity.Player#give(ItemStack...)} and its overloads.
|
||||
*/
|
||||
@NullMarked
|
||||
public interface PlayerGiveResult {
|
||||
|
||||
/**
|
||||
* A collection of itemstacks that were not added to the player's inventory as they did not fit.
|
||||
* The collection is derived from the collections of items to add by creating copies of each stack that was not
|
||||
* fully added to the inventory and assigning the non-added count as their amount.
|
||||
* <p>
|
||||
* Itemstacks found here *may* also be found as item entities in the {@link #drops()} collection, as the
|
||||
* give logic may have dropped them.
|
||||
*
|
||||
* @return the unmodifiable collection of itemstacks that are leftover as they could not be added. Each element is a
|
||||
* copy of the input stack they are derived from.
|
||||
*/
|
||||
@Unmodifiable
|
||||
Collection<ItemStack> leftovers();
|
||||
|
||||
/**
|
||||
* A collection of item entities dropped as a result of this call to {@link org.bukkit.entity.Player#give(ItemStack...)}.
|
||||
* The item entities contained here are not guaranteed to match the {@link #leftovers()} as plugins may cancel the
|
||||
* spawning of item entities.
|
||||
*
|
||||
* @return the unmodifiable collection of dropped item entities.
|
||||
*/
|
||||
@Unmodifiable
|
||||
Collection<Item> drops();
|
||||
|
||||
}
|
||||
@@ -12,10 +12,10 @@ import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
* Called when a player uses sheers on a block.
|
||||
* Called when a player uses shears on a block.
|
||||
* <p>
|
||||
* This event is <b>not</b> called when breaking blocks with shears but instead only when a
|
||||
* player uses the sheer item on a block to garner drops from said block and/or change its state.
|
||||
* This event is <b>not</b> called when a player breaks blocks with shears, but rather when a
|
||||
* player uses the shears on a block to collect drops from it and/or modify its state.
|
||||
* <p>
|
||||
* Examples include shearing a pumpkin to turn it into a carved pumpkin or shearing a beehive to get honeycomb.
|
||||
*/
|
||||
|
||||
+103
@@ -0,0 +1,103 @@
|
||||
package io.papermc.paper.event.entity;
|
||||
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.entity.EntityEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
* Called when an entity attempts to perform a smash attack.
|
||||
*/
|
||||
@NullMarked
|
||||
public class EntityAttemptSmashAttackEvent extends EntityEvent {
|
||||
|
||||
private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
|
||||
private final LivingEntity target;
|
||||
private final ItemStack weapon;
|
||||
private final boolean originalResult;
|
||||
private Result result = Result.DEFAULT;
|
||||
|
||||
@ApiStatus.Internal
|
||||
public EntityAttemptSmashAttackEvent(
|
||||
final LivingEntity attacker,
|
||||
final LivingEntity target,
|
||||
final ItemStack weapon,
|
||||
final boolean originalResult
|
||||
) {
|
||||
super(attacker);
|
||||
this.target = target;
|
||||
this.weapon = weapon;
|
||||
this.originalResult = originalResult;
|
||||
}
|
||||
|
||||
/**
|
||||
* Yields the target of the attempted smash attack.
|
||||
*
|
||||
* @return the target entity
|
||||
*/
|
||||
public LivingEntity getTarget() {
|
||||
return target;
|
||||
}
|
||||
|
||||
/**
|
||||
* Yields a copy of the itemstack used in the smash attack attempt.
|
||||
*
|
||||
* @return the itemstack
|
||||
*/
|
||||
public ItemStack getWeapon() {
|
||||
return weapon.clone();
|
||||
}
|
||||
|
||||
/**
|
||||
* Yields the original result the server computed.
|
||||
*
|
||||
* @return {@code true} if this attempt would have been successful by vanilla's logic, {@code false} otherwise.
|
||||
*/
|
||||
public boolean getOriginalResult() {
|
||||
return originalResult;
|
||||
}
|
||||
|
||||
/**
|
||||
* Yields the effective result of this event.
|
||||
* The result may take one of three values:
|
||||
*
|
||||
* <ul>
|
||||
* <li>{@link Result#ALLOW}: The attempt will succeed.</li>
|
||||
* <li>{@link Result#DENY}: The attempt will fail.</li>
|
||||
* <li>{@link Result#DEFAULT}: The attempt will succeed if {@link #getOriginalResult()} is {@code true} and fail otherwise.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @return the result.
|
||||
*/
|
||||
public Result getResult() {
|
||||
return this.result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Configures a new result for this event.
|
||||
* The passes result may take one of three values:
|
||||
*
|
||||
* <ul>
|
||||
* <li>{@link Result#ALLOW}: The attempt will succeed.</li>
|
||||
* <li>{@link Result#DENY}: The attempt will fail.</li>
|
||||
* <li>{@link Result#DEFAULT}: The attempt will succeed if {@link #getOriginalResult()} is {@code true} and fail otherwise.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @param result the new result of the event.
|
||||
*/
|
||||
public void setResult(final Result result) {
|
||||
this.result = result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return HANDLER_LIST;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return HANDLER_LIST;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
package io.papermc.paper.event.entity;
|
||||
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.entity.EntityEvent;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
* An event that is triggered when an entity receives a potion effect instantly
|
||||
* or when the potion effect is applied on each tick (e.g. every 25 ticks for Poison level 1).
|
||||
* <p>
|
||||
* For example, this event may be called when an entity regenerates health
|
||||
* or takes poison damage as a result of a potion effect.
|
||||
*/
|
||||
@NullMarked
|
||||
public class EntityEffectTickEvent extends EntityEvent implements Cancellable {
|
||||
|
||||
private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
|
||||
private final PotionEffectType type;
|
||||
private final int amplifier;
|
||||
private boolean cancelled;
|
||||
|
||||
@ApiStatus.Internal
|
||||
public EntityEffectTickEvent(final LivingEntity entity, final PotionEffectType type, final int amplifier) {
|
||||
super(entity);
|
||||
this.type = type;
|
||||
this.amplifier = amplifier;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LivingEntity getEntity() {
|
||||
return (LivingEntity) super.getEntity();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the type of the potion effect associated with this event.
|
||||
*
|
||||
* @return the {@link PotionEffectType} of the effect
|
||||
*/
|
||||
public PotionEffectType getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the amplifier level of the potion effect associated with this event.
|
||||
*
|
||||
* @return the amplifier level of the potion effect
|
||||
*/
|
||||
public int getAmplifier() {
|
||||
return amplifier;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return this.cancelled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCancelled(final boolean cancel) {
|
||||
this.cancelled = cancel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return HANDLER_LIST;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return HANDLER_LIST;
|
||||
}
|
||||
}
|
||||
+89
@@ -0,0 +1,89 @@
|
||||
package io.papermc.paper.event.entity;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.entity.EntityEvent;
|
||||
import org.bukkit.inventory.EquipmentSlot;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jetbrains.annotations.Contract;
|
||||
import org.jetbrains.annotations.Unmodifiable;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
* Called whenever a change to an entity's equipment has been detected. This event is called after effects from
|
||||
* attribute modifiers and enchantments have been updated.
|
||||
* <p>
|
||||
* Examples of actions that can trigger this event:
|
||||
* <ul>
|
||||
* <li>An entity being added to a world.</li>
|
||||
* <li>A player logging in.</li>
|
||||
* <li>The durability of an equipment item changing.</li>
|
||||
* <li>A dispenser equipping an item onto an entity.</li>
|
||||
* <li>An entity picking up an armor or weapon item from the ground.</li>
|
||||
* <li>A player changing their equipped armor.</li>
|
||||
* <li>A player changes their currently held item.</li>
|
||||
* </ul>
|
||||
*/
|
||||
@NullMarked
|
||||
public class EntityEquipmentChangedEvent extends EntityEvent {
|
||||
|
||||
private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
|
||||
private final Map<EquipmentSlot, EquipmentChange> equipmentChanges;
|
||||
|
||||
@ApiStatus.Internal
|
||||
public EntityEquipmentChangedEvent(final LivingEntity entity, final Map<EquipmentSlot, EquipmentChange> equipmentChanges) {
|
||||
super(entity);
|
||||
|
||||
this.equipmentChanges = equipmentChanges;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LivingEntity getEntity() {
|
||||
return (LivingEntity) this.entity;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a map of changed slots to their respective equipment changes.
|
||||
*
|
||||
* @return the equipment changes map
|
||||
*/
|
||||
public @Unmodifiable Map<EquipmentSlot, EquipmentChange> getEquipmentChanges() {
|
||||
return Collections.unmodifiableMap(this.equipmentChanges);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return HANDLER_LIST;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return HANDLER_LIST;
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents a change in equipment for a single equipment slot.
|
||||
*/
|
||||
@ApiStatus.NonExtendable
|
||||
public interface EquipmentChange {
|
||||
|
||||
/**
|
||||
* Gets the existing item that is being replaced.
|
||||
*
|
||||
* @return the existing item
|
||||
*/
|
||||
@Contract(pure = true, value = "-> new")
|
||||
ItemStack oldItem();
|
||||
|
||||
/**
|
||||
* Gets the new item that is replacing the existing item.
|
||||
*
|
||||
* @return the new item
|
||||
*/
|
||||
@Contract(pure = true, value = "-> new")
|
||||
ItemStack newItem();
|
||||
}
|
||||
}
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
package io.papermc.paper.event.player;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.player.PlayerEvent;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
* Called when a player is marked as loaded.
|
||||
* <p>
|
||||
* This either happens when the player notifies the server after loading the world (closing the downloading terrain screen)
|
||||
* or when the player has not done so for 60 ticks after joining the server or respawning.
|
||||
*/
|
||||
@NullMarked
|
||||
public class PlayerClientLoadedWorldEvent extends PlayerEvent {
|
||||
|
||||
private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
|
||||
private final boolean timeout;
|
||||
|
||||
@ApiStatus.Internal
|
||||
public PlayerClientLoadedWorldEvent(final Player who, final boolean timeout) {
|
||||
super(who);
|
||||
this.timeout = timeout;
|
||||
}
|
||||
|
||||
/**
|
||||
* True if the event was triggered because the server has not been notified by the player
|
||||
* for 60 ticks after the player joined the server or respawned.
|
||||
*
|
||||
* @return true if the event was triggered because of a timeout
|
||||
*/
|
||||
public boolean isTimeout() {
|
||||
return timeout;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return HANDLER_LIST;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return HANDLER_LIST;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package io.papermc.paper.math;
|
||||
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
* Represents a rotation with specified pitch and yaw values.
|
||||
*/
|
||||
@NullMarked
|
||||
public interface Rotation {
|
||||
/**
|
||||
* Creates a new rotation with the specified yaw and pitch values.
|
||||
*
|
||||
* @param yaw the yaw component of the rotation, measured in degrees
|
||||
* @param pitch the pitch component of the rotation, measured in degrees
|
||||
* @return a new {@code Rotation} instance with the specified yaw and pitch
|
||||
*/
|
||||
static Rotation rotation(float yaw, float pitch) {
|
||||
return new RotationImpl(yaw, pitch);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the pitch component of the rotation, measured in degrees.
|
||||
*
|
||||
* @return the pitch value in degrees
|
||||
*/
|
||||
float pitch();
|
||||
|
||||
/**
|
||||
* Retrieves the yaw component of the rotation, measured in degrees.
|
||||
*
|
||||
* @return the yaw value in degrees
|
||||
*/
|
||||
float yaw();
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
package io.papermc.paper.math;
|
||||
|
||||
record RotationImpl(float yaw, float pitch) implements Rotation {
|
||||
}
|
||||
+112
@@ -0,0 +1,112 @@
|
||||
package io.papermc.paper.raytracing;
|
||||
|
||||
import java.util.function.Predicate;
|
||||
import org.bukkit.FluidCollisionMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.util.Vector;
|
||||
import org.checkerframework.checker.index.qual.NonNegative;
|
||||
import org.jetbrains.annotations.Contract;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
* A builder for configuring a raytrace with a starting location
|
||||
* and direction.
|
||||
*/
|
||||
@NullMarked
|
||||
public interface PositionedRayTraceConfigurationBuilder {
|
||||
|
||||
/**
|
||||
* Sets the starting location.
|
||||
*
|
||||
* @param start the new starting location
|
||||
* @return a reference to this object
|
||||
*/
|
||||
@Contract(value = "_ -> this", mutates = "this")
|
||||
PositionedRayTraceConfigurationBuilder start(Location start);
|
||||
|
||||
/**
|
||||
* Sets the direction.
|
||||
*
|
||||
* @param direction the new direction
|
||||
* @return a reference to this object
|
||||
*/
|
||||
@Contract(value = "_ -> this", mutates = "this")
|
||||
PositionedRayTraceConfigurationBuilder direction(Vector direction);
|
||||
|
||||
/**
|
||||
* Sets the maximum distance.
|
||||
*
|
||||
* @param maxDistance the new maxDistance
|
||||
* @return a reference to this object
|
||||
*/
|
||||
@Contract(value = "_ -> this", mutates = "this")
|
||||
PositionedRayTraceConfigurationBuilder maxDistance(@NonNegative double maxDistance);
|
||||
|
||||
/**
|
||||
* Sets the FluidCollisionMode when looking for block collisions.
|
||||
* <p>
|
||||
* If collisions with passable blocks are ignored, fluid collisions are
|
||||
* ignored as well regardless of the fluid collision mode.
|
||||
*
|
||||
* @param fluidCollisionMode the new FluidCollisionMode
|
||||
* @return a reference to this object
|
||||
*/
|
||||
@Contract(value = "_ -> this", mutates = "this")
|
||||
PositionedRayTraceConfigurationBuilder fluidCollisionMode(FluidCollisionMode fluidCollisionMode);
|
||||
|
||||
/**
|
||||
* Sets whether the raytrace should ignore passable blocks when looking for
|
||||
* block collisions.
|
||||
* <p>
|
||||
* If collisions with passable blocks are ignored, fluid collisions are
|
||||
* ignored as well regardless of the fluid collision mode.
|
||||
* <p>
|
||||
* Portal blocks are only considered passable if the ray starts within them.
|
||||
* Apart from that collisions with portal blocks will be considered even if
|
||||
* collisions with passable blocks are otherwise ignored.
|
||||
*
|
||||
* @param ignorePassableBlocks if the raytrace should ignore passable blocks
|
||||
* @return a reference to this object
|
||||
*/
|
||||
@Contract(value = "_ -> this", mutates = "this")
|
||||
PositionedRayTraceConfigurationBuilder ignorePassableBlocks(boolean ignorePassableBlocks);
|
||||
|
||||
/**
|
||||
* Sets the size of the raytrace when looking for entity collisions.
|
||||
*
|
||||
* @param raySize the new raytrace size
|
||||
* @return a reference to this object
|
||||
*/
|
||||
@Contract(value = "_ -> this", mutates = "this")
|
||||
PositionedRayTraceConfigurationBuilder raySize(@NonNegative double raySize);
|
||||
|
||||
/**
|
||||
* Sets the current entity filter when looking for entity collisions.
|
||||
*
|
||||
* @param entityFilter predicate for entities the ray can potentially collide with
|
||||
* @return a reference to this object
|
||||
*/
|
||||
@Contract(value = "_ -> this", mutates = "this")
|
||||
PositionedRayTraceConfigurationBuilder entityFilter(Predicate<? super Entity> entityFilter);
|
||||
|
||||
/**
|
||||
* Sets the current block filter when looking for block collisions.
|
||||
*
|
||||
* @param blockFilter predicate for blocks the ray can potentially collide with
|
||||
* @return a reference to this object
|
||||
*/
|
||||
@Contract(value = "_ -> this", mutates = "this")
|
||||
PositionedRayTraceConfigurationBuilder blockFilter(Predicate<? super Block> blockFilter);
|
||||
|
||||
/**
|
||||
* Sets the targets for the rayTrace.
|
||||
*
|
||||
* @param first the first target
|
||||
* @param others the other targets
|
||||
* @return a reference to this object
|
||||
*/
|
||||
@Contract(value = "_, _ -> this", mutates = "this")
|
||||
PositionedRayTraceConfigurationBuilder targets(RayTraceTarget first, RayTraceTarget... others);
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package io.papermc.paper.raytracing;
|
||||
|
||||
/**
|
||||
* List of Targets a builder can target.
|
||||
*/
|
||||
public enum RayTraceTarget {
|
||||
ENTITY,
|
||||
BLOCK
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package io.papermc.paper.registry;
|
||||
|
||||
import io.papermc.paper.datacomponent.DataComponentType;
|
||||
import io.papermc.paper.registry.tag.TagKey;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import net.kyori.adventure.key.KeyPattern;
|
||||
import net.kyori.adventure.key.Keyed;
|
||||
@@ -209,7 +210,6 @@ public sealed interface RegistryKey<T> extends Keyed permits RegistryKeyImpl {
|
||||
* @param key the key of the typed key.
|
||||
* @return the constructed typed key.
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
default TypedKey<T> typedKey(final Key key) {
|
||||
return TypedKey.create(this, key);
|
||||
}
|
||||
@@ -220,8 +220,29 @@ public sealed interface RegistryKey<T> extends Keyed permits RegistryKeyImpl {
|
||||
* @param key the string representation of the key that will be passed to {@link Key#key(String)}.
|
||||
* @return the constructed typed key.
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
default TypedKey<T> typedKey(final @KeyPattern String key) {
|
||||
default TypedKey<T> typedKey(@KeyPattern final String key) {
|
||||
return TypedKey.create(this, key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new {@link TagKey} for this registry given the tag key's key.
|
||||
*
|
||||
* @param key the key of the typed key.
|
||||
* @return the constructed tag key.
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
default TagKey<T> tagKey(final Key key) {
|
||||
return TagKey.create(this, key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new {@link TagKey} for this registry given the tag key's key.
|
||||
*
|
||||
* @param key the string representation of the key that will be passed to {@link Key#key(String)}.
|
||||
* @return the constructed tag key.
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
default TagKey<T> tagKey(@KeyPattern final String key) {
|
||||
return TagKey.create(this, key);
|
||||
}
|
||||
}
|
||||
@@ -11,7 +11,6 @@ import org.jspecify.annotations.NullMarked;
|
||||
*
|
||||
* @param <T> the value type for the registry
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
@NullMarked
|
||||
public sealed interface TypedKey<T> extends Key permits TypedKeyImpl {
|
||||
|
||||
@@ -39,7 +38,6 @@ public sealed interface TypedKey<T> extends Key permits TypedKeyImpl {
|
||||
* @param <T> value type
|
||||
* @return a new key for the value key and registry key
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
static <T> TypedKey<T> create(final RegistryKey<T> registryKey, final Key key) {
|
||||
return new TypedKeyImpl<>(key, registryKey);
|
||||
}
|
||||
@@ -53,8 +51,7 @@ public sealed interface TypedKey<T> extends Key permits TypedKeyImpl {
|
||||
* @return a new key for the value key and registry key
|
||||
* @see Key#key(String)
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
static <T> TypedKey<T> create(final RegistryKey<T> registryKey, final @KeyPattern String key) {
|
||||
static <T> TypedKey<T> create(final RegistryKey<T> registryKey, @KeyPattern final String key) {
|
||||
return create(registryKey, Key.key(key));
|
||||
}
|
||||
}
|
||||
@@ -24,11 +24,14 @@ import static io.papermc.paper.registry.event.RegistryEventProviderImpl.create;
|
||||
@NullMarked
|
||||
public final class RegistryEvents {
|
||||
|
||||
// Start generate - RegistryEvents
|
||||
// @GeneratedFrom 1.21.4
|
||||
public static final RegistryEventProvider<GameEvent, GameEventRegistryEntry.Builder> GAME_EVENT = create(RegistryKey.GAME_EVENT);
|
||||
public static final RegistryEventProvider<Enchantment, EnchantmentRegistryEntry.Builder> ENCHANTMENT = create(RegistryKey.ENCHANTMENT);
|
||||
public static final RegistryEventProvider<Art, PaintingVariantRegistryEntry.Builder> PAINTING_VARIANT = create(RegistryKey.PAINTING_VARIANT);
|
||||
public static final RegistryEventProvider<PatternType, BannerPatternRegistryEntry.Builder> BANNER_PATTERN = create(RegistryKey.BANNER_PATTERN);
|
||||
public static final RegistryEventProvider<DamageType, DamageTypeRegistryEntry.Builder> DAMAGE_TYPE = create(RegistryKey.DAMAGE_TYPE);
|
||||
public static final RegistryEventProvider<Enchantment, EnchantmentRegistryEntry.Builder> ENCHANTMENT = create(RegistryKey.ENCHANTMENT);
|
||||
public static final RegistryEventProvider<PatternType, BannerPatternRegistryEntry.Builder> BANNER_PATTERN = create(RegistryKey.BANNER_PATTERN);
|
||||
public static final RegistryEventProvider<Art, PaintingVariantRegistryEntry.Builder> PAINTING_VARIANT = create(RegistryKey.PAINTING_VARIANT);
|
||||
// End generate - RegistryEvents
|
||||
|
||||
private RegistryEvents() {
|
||||
}
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
package io.papermc.paper.registry.tag;
|
||||
|
||||
import io.papermc.paper.registry.RegistryKey;
|
||||
import io.papermc.paper.registry.TypedKey;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import net.kyori.adventure.key.KeyPattern;
|
||||
import net.kyori.adventure.key.Keyed;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jetbrains.annotations.Contract;
|
||||
@@ -15,15 +17,29 @@ public sealed interface TagKey<T> extends Keyed permits TagKeyImpl {
|
||||
* Creates a new tag key for a registry.
|
||||
*
|
||||
* @param registryKey the registry for the tag
|
||||
* @param key the specific key for the tag
|
||||
* @param key the specific key for the tag
|
||||
* @param <T> the registry value type
|
||||
* @return a new tag key
|
||||
* @param <T> the registry value type
|
||||
*/
|
||||
@Contract(value = "_, _ -> new", pure = true)
|
||||
static <T> TagKey<T> create(final RegistryKey<T> registryKey, final Key key) {
|
||||
return new TagKeyImpl<>(registryKey, key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new tag key for a registry.
|
||||
*
|
||||
* @param registryKey the registry for the tag
|
||||
* @param key the string version of a {@link Key} that will be passed to {@link Key#key(String)} for parsing.
|
||||
* @param <T> the registry value type
|
||||
* @return a new tag key
|
||||
* @see Key#key(String)
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
static <T> TagKey<T> create(final RegistryKey<T> registryKey, @KeyPattern final String key) {
|
||||
return create(registryKey, Key.key(key));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the registry key for this tag key.
|
||||
*
|
||||
|
||||
@@ -19,18 +19,20 @@ import org.jspecify.annotations.NullMarked;
|
||||
* tags only point to individual entries and not other nested tags.
|
||||
* <p>
|
||||
* An example of a custom enchant being registered to the vanilla
|
||||
* {@code #minecraft:in_enchanting_table} tag.
|
||||
* {@code #minecraft:in_enchanting_table} tag:
|
||||
* <pre>{@code
|
||||
* class YourBootstrapClass implements PluginBootstrap {
|
||||
*
|
||||
* public static final TypedKey<Enchantment> CUSTOM_POINTY_ENCHANT = EnchantmentKeys.create(Key.key("papermc:pointy"));
|
||||
*
|
||||
* @Override
|
||||
* public void bootstrap(BootstrapContext context) {
|
||||
* LifecycleEventManager<BootstrapContext> manager = context.getLifecycleManager();
|
||||
* final LifecycleEventManager<BootstrapContext> manager = context.getLifecycleManager();
|
||||
* manager.registerEventHandler(LifecycleEvents.TAGS.postFlatten(RegistryKey.ENCHANTMENT), event -> {
|
||||
* final PostFlattenTagRegistrar<Enchantment> registrar = event.registrar();
|
||||
* registrar.addToTag(
|
||||
* EnchantmentTagKeys.IN_ENCHANTING_TABLE,
|
||||
* Set.of(CUSTOM_ENCHANT)
|
||||
* Set.of(CUSTOM_POINTY_ENCHANT)
|
||||
* );
|
||||
* });
|
||||
* }
|
||||
|
||||
@@ -22,9 +22,11 @@ import org.jspecify.annotations.NullMarked;
|
||||
* <pre>{@code
|
||||
* class YourBootstrapClass implements PluginBootstrap {
|
||||
*
|
||||
* public static final TagKey<ItemType> AXE_PICKAXE = ItemTypeTagKeys.create(Key.key("papermc:axe_pickaxe"));
|
||||
*
|
||||
* @Override
|
||||
* public void bootstrap(BootstrapContext context) {
|
||||
* LifecycleEventManager<BootstrapContext> manager = context.getLifecycleManager();
|
||||
* final LifecycleEventManager<BootstrapContext> manager = context.getLifecycleManager();
|
||||
* manager.registerEventHandler(LifecycleEvents.TAGS.preFlatten(RegistryKey.ITEM), event -> {
|
||||
* final PreFlattenTagRegistrar<ItemType> registrar = event.registrar();
|
||||
* registrar.setTag(AXE_PICKAXE, Set.of(
|
||||
|
||||
@@ -2,12 +2,13 @@ package org.bukkit;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.collect.Lists;
|
||||
import io.papermc.paper.registry.RegistryAccess;
|
||||
import io.papermc.paper.registry.RegistryBuilderFactory;
|
||||
import io.papermc.paper.registry.RegistryKey;
|
||||
import io.papermc.paper.registry.data.InlinedRegistryBuilderProvider;
|
||||
import io.papermc.paper.registry.data.PaintingVariantRegistryEntry;
|
||||
import java.util.Locale;
|
||||
import java.util.function.Consumer;
|
||||
import org.bukkit.packs.DataPack;
|
||||
import org.bukkit.util.OldEnum;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -18,8 +19,8 @@ import org.jetbrains.annotations.Nullable;
|
||||
* <p>
|
||||
* The arts listed in this interface are present in the default server
|
||||
* or can be enabled via a {@link FeatureFlag}.
|
||||
* There may be additional arts present in the server, for example from a {@link DataPack}
|
||||
* which can be accessed via {@link Registry#ART}.
|
||||
* There may be additional arts present in the server, for example from a {@link io.papermc.paper.datapack.Datapack}
|
||||
* which can be accessed via {@link RegistryAccess#registryAccess()} and {@link RegistryKey#PAINTING_VARIANT}.
|
||||
*/
|
||||
public interface Art extends OldEnum<Art>, Keyed {
|
||||
|
||||
@@ -34,60 +35,112 @@ public interface Art extends OldEnum<Art>, Keyed {
|
||||
return InlinedRegistryBuilderProvider.instance().createPaintingVariant(value);
|
||||
}
|
||||
|
||||
Art KEBAB = getArt("kebab");
|
||||
Art AZTEC = getArt("aztec");
|
||||
// Start generate - Art
|
||||
// @GeneratedFrom 1.21.4
|
||||
Art ALBAN = getArt("alban");
|
||||
|
||||
Art AZTEC = getArt("aztec");
|
||||
|
||||
Art AZTEC2 = getArt("aztec2");
|
||||
Art BOMB = getArt("bomb");
|
||||
Art PLANT = getArt("plant");
|
||||
Art WASTELAND = getArt("wasteland");
|
||||
Art POOL = getArt("pool");
|
||||
Art COURBET = getArt("courbet");
|
||||
Art SEA = getArt("sea");
|
||||
Art SUNSET = getArt("sunset");
|
||||
Art CREEBET = getArt("creebet");
|
||||
Art WANDERER = getArt("wanderer");
|
||||
Art GRAHAM = getArt("graham");
|
||||
Art MATCH = getArt("match");
|
||||
Art BUST = getArt("bust");
|
||||
Art STAGE = getArt("stage");
|
||||
Art VOID = getArt("void");
|
||||
Art SKULL_AND_ROSES = getArt("skull_and_roses");
|
||||
Art WITHER = getArt("wither");
|
||||
Art FIGHTERS = getArt("fighters");
|
||||
Art POINTER = getArt("pointer");
|
||||
Art PIGSCENE = getArt("pigscene");
|
||||
Art BURNING_SKULL = getArt("burning_skull");
|
||||
Art SKELETON = getArt("skeleton");
|
||||
Art DONKEY_KONG = getArt("donkey_kong");
|
||||
Art EARTH = getArt("earth");
|
||||
Art WIND = getArt("wind");
|
||||
Art WATER = getArt("water");
|
||||
Art FIRE = getArt("fire");
|
||||
Art BAROQUE = getArt("baroque");
|
||||
Art HUMBLE = getArt("humble");
|
||||
Art MEDITATIVE = getArt("meditative");
|
||||
Art PRAIRIE_RIDE = getArt("prairie_ride");
|
||||
Art UNPACKED = getArt("unpacked");
|
||||
|
||||
Art BACKYARD = getArt("backyard");
|
||||
|
||||
Art BAROQUE = getArt("baroque");
|
||||
|
||||
Art BOMB = getArt("bomb");
|
||||
|
||||
Art BOUQUET = getArt("bouquet");
|
||||
|
||||
Art BURNING_SKULL = getArt("burning_skull");
|
||||
|
||||
Art BUST = getArt("bust");
|
||||
|
||||
Art CAVEBIRD = getArt("cavebird");
|
||||
|
||||
Art CHANGING = getArt("changing");
|
||||
|
||||
Art COTAN = getArt("cotan");
|
||||
|
||||
Art COURBET = getArt("courbet");
|
||||
|
||||
Art CREEBET = getArt("creebet");
|
||||
|
||||
Art DONKEY_KONG = getArt("donkey_kong");
|
||||
|
||||
Art EARTH = getArt("earth");
|
||||
|
||||
Art ENDBOSS = getArt("endboss");
|
||||
|
||||
Art FERN = getArt("fern");
|
||||
|
||||
Art FIGHTERS = getArt("fighters");
|
||||
|
||||
Art FINDING = getArt("finding");
|
||||
|
||||
Art FIRE = getArt("fire");
|
||||
|
||||
Art GRAHAM = getArt("graham");
|
||||
|
||||
Art HUMBLE = getArt("humble");
|
||||
|
||||
Art KEBAB = getArt("kebab");
|
||||
|
||||
Art LOWMIST = getArt("lowmist");
|
||||
|
||||
Art MATCH = getArt("match");
|
||||
|
||||
Art MEDITATIVE = getArt("meditative");
|
||||
|
||||
Art ORB = getArt("orb");
|
||||
|
||||
Art OWLEMONS = getArt("owlemons");
|
||||
|
||||
Art PASSAGE = getArt("passage");
|
||||
|
||||
Art PIGSCENE = getArt("pigscene");
|
||||
|
||||
Art PLANT = getArt("plant");
|
||||
|
||||
Art POINTER = getArt("pointer");
|
||||
|
||||
Art POND = getArt("pond");
|
||||
|
||||
Art POOL = getArt("pool");
|
||||
|
||||
Art PRAIRIE_RIDE = getArt("prairie_ride");
|
||||
|
||||
Art SEA = getArt("sea");
|
||||
|
||||
Art SKELETON = getArt("skeleton");
|
||||
|
||||
Art SKULL_AND_ROSES = getArt("skull_and_roses");
|
||||
|
||||
Art STAGE = getArt("stage");
|
||||
|
||||
Art SUNFLOWERS = getArt("sunflowers");
|
||||
|
||||
Art SUNSET = getArt("sunset");
|
||||
|
||||
Art TIDES = getArt("tides");
|
||||
|
||||
Art UNPACKED = getArt("unpacked");
|
||||
|
||||
Art VOID = getArt("void");
|
||||
|
||||
Art WANDERER = getArt("wanderer");
|
||||
|
||||
Art WASTELAND = getArt("wasteland");
|
||||
|
||||
Art WATER = getArt("water");
|
||||
|
||||
Art WIND = getArt("wind");
|
||||
|
||||
Art WITHER = getArt("wither");
|
||||
// End generate - Art
|
||||
|
||||
@NotNull
|
||||
private static Art getArt(@NotNull String key) {
|
||||
return Registry.ART.getOrThrow(NamespacedKey.minecraft(key));
|
||||
return RegistryAccess.registryAccess().getRegistry(RegistryKey.PAINTING_VARIANT).getOrThrow(NamespacedKey.minecraft(key));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -189,7 +242,7 @@ public interface Art extends OldEnum<Art>, Keyed {
|
||||
static Art getByName(@NotNull String name) {
|
||||
Preconditions.checkArgument(name != null, "Name cannot be null");
|
||||
|
||||
return Bukkit.getUnsafe().get(Registry.ART, NamespacedKey.fromString(name.toLowerCase(Locale.ROOT)));
|
||||
return Bukkit.getUnsafe().get(RegistryKey.PAINTING_VARIANT, NamespacedKey.fromString(name.toLowerCase(Locale.ROOT)));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -200,7 +253,7 @@ public interface Art extends OldEnum<Art>, Keyed {
|
||||
@NotNull
|
||||
@Deprecated(since = "1.21.3", forRemoval = true) @org.jetbrains.annotations.ApiStatus.ScheduledForRemoval(inVersion = "1.22") // Paper - will be removed via asm-utils
|
||||
static Art valueOf(@NotNull String name) {
|
||||
Art art = Bukkit.getUnsafe().get(Registry.ART, NamespacedKey.fromString(name.toLowerCase(Locale.ROOT)));
|
||||
Art art = Bukkit.getUnsafe().get(RegistryKey.PAINTING_VARIANT, NamespacedKey.fromString(name.toLowerCase(Locale.ROOT)));
|
||||
Preconditions.checkArgument(art != null, "No art found with the name %s", name);
|
||||
return art;
|
||||
}
|
||||
|
||||
@@ -40,6 +40,7 @@ import org.bukkit.inventory.InventoryHolder;
|
||||
import org.bukkit.inventory.ItemCraftResult;
|
||||
import org.bukkit.inventory.ItemFactory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.MenuType;
|
||||
import org.bukkit.inventory.Merchant;
|
||||
import org.bukkit.inventory.Recipe;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
@@ -1372,7 +1373,11 @@ public final class Bukkit {
|
||||
* Sets the radius, in blocks, around each worlds spawn point to protect.
|
||||
*
|
||||
* @param value new spawn radius, or 0 if none
|
||||
* @deprecated has not functioned for a long time as the spawn radius is defined by the server.properties file.
|
||||
* There is no API replacement for this method. It is generally recommended to implement "protection"-like behaviour
|
||||
* via events or third-party plugin APIs.
|
||||
*/
|
||||
@Deprecated(since = "1.21.4", forRemoval = true)
|
||||
public static void setSpawnRadius(int value) {
|
||||
server.setSpawnRadius(value);
|
||||
}
|
||||
@@ -1925,7 +1930,10 @@ public final class Bukkit {
|
||||
* @param title the title of the corresponding merchant inventory, displayed
|
||||
* when the merchant inventory is viewed
|
||||
* @return a new merchant
|
||||
* @deprecated The title parameter is no-longer needed when used with
|
||||
* {@link MenuType#MERCHANT} and {@link MenuType.Typed#builder()}.
|
||||
*/
|
||||
@Deprecated(since = "1.21.4")
|
||||
public static @NotNull Merchant createMerchant(net.kyori.adventure.text.@Nullable Component title) {
|
||||
return server.createMerchant(title);
|
||||
}
|
||||
@@ -1936,7 +1944,8 @@ public final class Bukkit {
|
||||
* @param title the title of the corresponding merchant inventory, displayed
|
||||
* when the merchant inventory is viewed
|
||||
* @return a new merchant
|
||||
* @deprecated in favour of {@link #createMerchant(net.kyori.adventure.text.Component)}
|
||||
* @deprecated in favour of {@link #createMerchant(net.kyori.adventure.text.Component)}. The title parameter is
|
||||
* no-longer needed when used with {@link MenuType#MERCHANT} and {@link MenuType.Typed#builder()}
|
||||
*/
|
||||
@NotNull
|
||||
@Deprecated // Paper
|
||||
@@ -1944,6 +1953,16 @@ public final class Bukkit {
|
||||
return server.createMerchant(title);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an empty merchant.
|
||||
*
|
||||
* @return a new merchant
|
||||
*/
|
||||
@NotNull
|
||||
public static Merchant createMerchant() {
|
||||
return server.createMerchant();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the amount of consecutive neighbor updates before skipping
|
||||
* additional ones.
|
||||
|
||||
@@ -1,9 +1,14 @@
|
||||
package org.bukkit;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import org.bukkit.entity.Ageable;
|
||||
import io.papermc.paper.datacomponent.DataComponentTypes;
|
||||
import org.bukkit.entity.Allay;
|
||||
import org.bukkit.entity.Animals;
|
||||
import org.bukkit.entity.Armadillo;
|
||||
import org.bukkit.entity.ArmorStand;
|
||||
import org.bukkit.entity.Arrow;
|
||||
import org.bukkit.entity.Cat;
|
||||
import org.bukkit.entity.Creaking;
|
||||
import org.bukkit.entity.Dolphin;
|
||||
import org.bukkit.entity.Egg;
|
||||
import org.bukkit.entity.Entity;
|
||||
@@ -15,6 +20,8 @@ import org.bukkit.entity.Guardian;
|
||||
import org.bukkit.entity.Hoglin;
|
||||
import org.bukkit.entity.IronGolem;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Mob;
|
||||
import org.bukkit.entity.Ocelot;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Rabbit;
|
||||
import org.bukkit.entity.Ravager;
|
||||
@@ -23,7 +30,6 @@ import org.bukkit.entity.Sniffer;
|
||||
import org.bukkit.entity.Snowball;
|
||||
import org.bukkit.entity.Squid;
|
||||
import org.bukkit.entity.Tameable;
|
||||
import org.bukkit.entity.TippedArrow;
|
||||
import org.bukkit.entity.Villager;
|
||||
import org.bukkit.entity.Warden;
|
||||
import org.bukkit.entity.Witch;
|
||||
@@ -32,32 +38,34 @@ import org.bukkit.entity.Zoglin;
|
||||
import org.bukkit.entity.ZombieVillager;
|
||||
import org.bukkit.entity.minecart.ExplosiveMinecart;
|
||||
import org.bukkit.entity.minecart.SpawnerMinecart;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* A list of all Effects that can happen to entities.
|
||||
* A list of all effects that can happen to entities.
|
||||
*/
|
||||
public enum EntityEffect {
|
||||
|
||||
/**
|
||||
* Colored particles from a tipped arrow.
|
||||
* Colored particles from an arrow.
|
||||
*/
|
||||
ARROW_PARTICLES(0, TippedArrow.class),
|
||||
ARROW_PARTICLES(0, Arrow.class),
|
||||
/**
|
||||
* Rabbit jumping.
|
||||
*/
|
||||
RABBIT_JUMP(1, Rabbit.class),
|
||||
/**
|
||||
* Resets a spawner minecart's delay to 200. Does not effect actual spawning
|
||||
* delay, only the speed at which the entity in the spawner spins
|
||||
* Resets a spawner minecart's delay to 200. Does not affect actual spawning
|
||||
* delay, only the speed at which the entity in the spawner spins.
|
||||
*/
|
||||
RESET_SPAWNER_MINECART_DELAY(1, SpawnerMinecart.class),
|
||||
/**
|
||||
* When mobs get hurt.
|
||||
*
|
||||
* @deprecated Use {@link LivingEntity#playHurtAnimation(float)}
|
||||
* @deprecated use {@link LivingEntity#playHurtAnimation(float)}
|
||||
*/
|
||||
@Deprecated(since = "1.20.1")
|
||||
@Deprecated(since = "1.20.1", forRemoval = true)
|
||||
HURT(2, LivingEntity.class),
|
||||
/**
|
||||
* When a mob dies.
|
||||
@@ -65,58 +73,97 @@ public enum EntityEffect {
|
||||
* <b>This will cause client-glitches!</b>
|
||||
*
|
||||
* @deprecated split into individual effects
|
||||
* @see #EGG_BREAK
|
||||
* @see #SNOWBALL_BREAK
|
||||
* @see #PROJECTILE_CRACK
|
||||
* @see #ENTITY_DEATH
|
||||
*/
|
||||
@Deprecated(since = "1.12.2")
|
||||
@Deprecated(since = "1.12.2", forRemoval = true)
|
||||
DEATH(3, Entity.class),
|
||||
/**
|
||||
* Spawns the egg breaking particles
|
||||
* Spawns the egg breaking particles.
|
||||
*
|
||||
* @deprecated use {@link #PROJECTILE_CRACK}
|
||||
*/
|
||||
@Deprecated(since = "1.21.4", forRemoval = true)
|
||||
EGG_BREAK(3, Egg.class),
|
||||
/**
|
||||
* Spawns the snowball breaking particles
|
||||
* Spawns the snowball breaking particles.
|
||||
*
|
||||
* @deprecated use {@link #PROJECTILE_CRACK}
|
||||
*/
|
||||
@Deprecated(since = "1.21.4", forRemoval = true)
|
||||
SNOWBALL_BREAK(3, Snowball.class),
|
||||
/**
|
||||
* Plays the entity death sound and animation
|
||||
* Shows the crack particles when a projectile
|
||||
* hits something.
|
||||
*/
|
||||
PROJECTILE_CRACK(3, Egg.class, Snowball.class),
|
||||
/**
|
||||
* Plays the entity death sound and animation.
|
||||
* <p>
|
||||
* <b>This will cause client-glitches!</b>
|
||||
*/
|
||||
ENTITY_DEATH(3, LivingEntity.class),
|
||||
/**
|
||||
* Plays the fang attack animation
|
||||
* Plays the evoker's fang attack animation.
|
||||
*
|
||||
* @deprecated use {@link #ENTITY_ATTACK}
|
||||
*/
|
||||
@Deprecated(since = "1.21.4", forRemoval = true)
|
||||
FANG_ATTACK(4, EvokerFangs.class),
|
||||
/**
|
||||
* Plays the hoglin attack animation
|
||||
* Plays the hoglin attack animation.
|
||||
*
|
||||
* @deprecated use {@link #ENTITY_ATTACK}
|
||||
*/
|
||||
@Deprecated(since = "1.21.4", forRemoval = true)
|
||||
HOGLIN_ATTACK(4, Hoglin.class),
|
||||
/**
|
||||
* Plays the iron golem attack animation
|
||||
* Plays the iron golem attack animation.
|
||||
*
|
||||
* @deprecated use {@link #ENTITY_ATTACK}
|
||||
*/
|
||||
@Deprecated(since = "1.21.4", forRemoval = true)
|
||||
IRON_GOLEN_ATTACK(4, IronGolem.class),
|
||||
/**
|
||||
* Plays the ravager attack animation
|
||||
* Plays the ravager attack animation.
|
||||
*
|
||||
* @deprecated use {@link #ENTITY_ATTACK}
|
||||
*/
|
||||
@Deprecated(since = "1.21.4", forRemoval = true)
|
||||
RAVAGER_ATTACK(4, Ravager.class),
|
||||
/**
|
||||
* Plays the warden attack animation
|
||||
* Plays the warden attack animation.
|
||||
*
|
||||
* @deprecated use {@link #ENTITY_ATTACK}
|
||||
*/
|
||||
@Deprecated(since = "1.21.4", forRemoval = true)
|
||||
WARDEN_ATTACK(4, Warden.class),
|
||||
/**
|
||||
* Plays the zoglin attack animation
|
||||
* Plays the zoglin attack animation.
|
||||
*
|
||||
* @deprecated use {@link #ENTITY_ATTACK}
|
||||
*/
|
||||
@Deprecated(since = "1.21.4", forRemoval = true)
|
||||
ZOGLIN_ATTACK(4, Zoglin.class),
|
||||
/**
|
||||
* Plays an attack animation for the respective entities.
|
||||
*/
|
||||
ENTITY_ATTACK(4, EvokerFangs.class, Hoglin.class, IronGolem.class, Ravager.class, Warden.class, Zoglin.class, Creaking.class),
|
||||
// 5 - unused
|
||||
/**
|
||||
* The smoke when taming an entity fails.
|
||||
*
|
||||
* @deprecated use {@link EntityEffect#TAMING_FAILED}
|
||||
*/
|
||||
@Deprecated(since = "1.21") // Paper
|
||||
@Deprecated(since = "1.21", forRemoval = true)
|
||||
WOLF_SMOKE(6, Tameable.class),
|
||||
// Paper start - rename "wolf" effects
|
||||
/**
|
||||
* The hearts when taming an entity succeeds.
|
||||
*
|
||||
* @deprecated use {@link EntityEffect#TAMING_SUCCEEDED}
|
||||
*/
|
||||
@Deprecated(since = "1.21", forRemoval = true)
|
||||
WOLF_HEARTS(7, Tameable.class),
|
||||
/**
|
||||
* The smoke when taming an entity fails.
|
||||
*/
|
||||
@@ -125,20 +172,13 @@ public enum EntityEffect {
|
||||
* The hearts when taming an entity succeeds.
|
||||
*/
|
||||
TAMING_SUCCEEDED(7, Tameable.class),
|
||||
// Paper end - rename "wolf" effects
|
||||
/**
|
||||
* The hearts when taming an entity succeeds.
|
||||
* @deprecated use {@link EntityEffect#TAMING_SUCCEEDED}
|
||||
*/
|
||||
@Deprecated(since = "1.21") // Paper
|
||||
WOLF_HEARTS(7, Tameable.class),
|
||||
/**
|
||||
* When a wolf shakes (after being wet).
|
||||
*
|
||||
* @see EntityEffect#WOLF_SHAKE_STOP
|
||||
*/
|
||||
WOLF_SHAKE(8, Wolf.class),
|
||||
// 9 - unused
|
||||
// 9 - internal
|
||||
/**
|
||||
* When an entity eats a LONG_GRASS block.
|
||||
*
|
||||
@@ -146,10 +186,10 @@ public enum EntityEffect {
|
||||
* @see #SHEEP_EAT_GRASS
|
||||
* @see #TNT_MINECART_IGNITE
|
||||
*/
|
||||
@Deprecated(since = "1.12.2")
|
||||
@Deprecated(since = "1.12.2", forRemoval = true)
|
||||
SHEEP_EAT(10, Entity.class),
|
||||
/**
|
||||
* Plays the sheep eating grass animation
|
||||
* Plays the sheep eating grass animation.
|
||||
*/
|
||||
SHEEP_EAT_GRASS(10, Sheep.class),
|
||||
/**
|
||||
@@ -179,7 +219,8 @@ public enum EntityEffect {
|
||||
*/
|
||||
WITCH_MAGIC(15, Witch.class),
|
||||
/**
|
||||
* When a zombie transforms into a villager by shaking violently.
|
||||
* Plays the sound when a zombie villager is
|
||||
* cured.
|
||||
*/
|
||||
ZOMBIE_TRANSFORM(16, ZombieVillager.class),
|
||||
/**
|
||||
@@ -187,9 +228,10 @@ public enum EntityEffect {
|
||||
*/
|
||||
FIREWORK_EXPLODE(17, Firework.class),
|
||||
/**
|
||||
* Hearts from a breeding entity.
|
||||
* Hearts from a breeding entity
|
||||
* or when an Allay duplicates.
|
||||
*/
|
||||
LOVE_HEARTS(18, Ageable.class),
|
||||
LOVE_HEARTS(18, Animals.class, Allay.class),
|
||||
/**
|
||||
* Resets squid rotation.
|
||||
*/
|
||||
@@ -197,7 +239,7 @@ public enum EntityEffect {
|
||||
/**
|
||||
* Silverfish entering block, spawner spawning.
|
||||
*/
|
||||
ENTITY_POOF(20, LivingEntity.class),
|
||||
ENTITY_POOF(20, Mob.class),
|
||||
/**
|
||||
* Guardian plays the attack sound effect.
|
||||
*/
|
||||
@@ -218,9 +260,10 @@ public enum EntityEffect {
|
||||
ARMOR_STAND_HIT(32, ArmorStand.class),
|
||||
/**
|
||||
* Entity hurt by thorns attack.
|
||||
*
|
||||
* @deprecated in favor of {@link LivingEntity#playHurtAnimation(float)} or {@link Entity#broadcastHurtAnimation(java.util.Collection)}
|
||||
*/
|
||||
@Deprecated(since = "1.19.4", forRemoval = true) // Paper
|
||||
@Deprecated(since = "1.19.4", forRemoval = true)
|
||||
THORNS_HURT(33, LivingEntity.class),
|
||||
/**
|
||||
* Iron golem puts away rose.
|
||||
@@ -228,16 +271,27 @@ public enum EntityEffect {
|
||||
IRON_GOLEM_SHEATH(34, IronGolem.class),
|
||||
/**
|
||||
* Totem prevents entity death.
|
||||
*
|
||||
* @deprecated see {@link #PROTECTED_FROM_DEATH}
|
||||
*/
|
||||
@Deprecated(since = "1.21.2", forRemoval = true)
|
||||
TOTEM_RESURRECT(35, LivingEntity.class),
|
||||
/**
|
||||
* Item with {@link DataComponentTypes#DEATH_PROTECTION} prevents entity death.
|
||||
* For player, the item selected will be shown for a moment on the screen, if the
|
||||
* item is not found a totem will appear.
|
||||
*/
|
||||
PROTECTED_FROM_DEATH(35, Entity.class),
|
||||
/**
|
||||
* Entity hurt due to drowning damage.
|
||||
*
|
||||
* @deprecated in favor of {@link LivingEntity#playHurtAnimation(float)} or {@link Entity#broadcastHurtAnimation(java.util.Collection)}
|
||||
*/
|
||||
@Deprecated(since = "1.19.4", forRemoval = true)
|
||||
HURT_DROWN(36, LivingEntity.class),
|
||||
/**
|
||||
* Entity hurt due to explosion damage.
|
||||
*
|
||||
* @deprecated in favor of {@link LivingEntity#playHurtAnimation(float)} or {@link Entity#broadcastHurtAnimation(java.util.Collection)}
|
||||
*/
|
||||
@Deprecated(since = "1.19.4", forRemoval = true)
|
||||
@@ -252,66 +306,94 @@ public enum EntityEffect {
|
||||
RAVAGER_STUNNED(39, Ravager.class),
|
||||
/**
|
||||
* Cat taming failed.
|
||||
*
|
||||
* @deprecated use {@link #TRUSTING_FAILED}
|
||||
*/
|
||||
@Deprecated(since = "1.14", forRemoval = true)
|
||||
CAT_TAME_FAIL(40, Cat.class),
|
||||
/**
|
||||
* Cat taming succeeded.
|
||||
*
|
||||
* @deprecated use {@link #TRUSTING_SUCCEEDED}
|
||||
*/
|
||||
@Deprecated(since = "1.14", forRemoval = true)
|
||||
CAT_TAME_SUCCESS(41, Cat.class),
|
||||
/**
|
||||
* Ocelot trusting failed.
|
||||
*/
|
||||
TRUSTING_FAILED(40, Ocelot.class),
|
||||
/**
|
||||
* Ocelot trusting succeeded.
|
||||
*/
|
||||
TRUSTING_SUCCEEDED(41, Ocelot.class),
|
||||
/**
|
||||
* Villager splashes particles during a raid.
|
||||
*/
|
||||
VILLAGER_SPLASH(42, Villager.class),
|
||||
/**
|
||||
* Player's bad omen effect removed to start or increase raid difficult.
|
||||
*
|
||||
* @deprecated raid system was overhauled in 1.20.5
|
||||
*/
|
||||
@Deprecated(since = "1.20.5", forRemoval = true)
|
||||
PLAYER_BAD_OMEN_RAID(43, Player.class),
|
||||
/**
|
||||
* Entity hurt due to berry bush. Prickly!
|
||||
*
|
||||
* @deprecated in favor of {@link LivingEntity#playHurtAnimation(float)} or {@link Entity#broadcastHurtAnimation(java.util.Collection)}
|
||||
*/
|
||||
@Deprecated(since = "1.19.4", forRemoval = true)
|
||||
HURT_BERRY_BUSH(44, LivingEntity.class),
|
||||
/**
|
||||
* Fox chews the food in its mouth
|
||||
* Fox chews the food in its mouth.
|
||||
*/
|
||||
FOX_CHEW(45, Fox.class),
|
||||
/**
|
||||
* Entity teleported as a result of chorus fruit or as an enderman
|
||||
* Entity teleported as a result of chorus fruit or as an enderman.
|
||||
*/
|
||||
TELEPORT_ENDER(46, LivingEntity.class),
|
||||
/**
|
||||
* Entity breaks item in main hand
|
||||
* Entity breaks item in main hand.
|
||||
*
|
||||
* @see org.bukkit.inventory.EquipmentSlot#HAND
|
||||
*/
|
||||
BREAK_EQUIPMENT_MAIN_HAND(47, LivingEntity.class),
|
||||
/**
|
||||
* Entity breaks item in off hand
|
||||
* Entity breaks item in off hand.
|
||||
*
|
||||
* @see org.bukkit.inventory.EquipmentSlot#OFF_HAND
|
||||
*/
|
||||
BREAK_EQUIPMENT_OFF_HAND(48, LivingEntity.class),
|
||||
/**
|
||||
* Entity breaks item in helmet slot
|
||||
* Entity breaks item in helmet slot.
|
||||
*
|
||||
* @see org.bukkit.inventory.EquipmentSlot#HEAD
|
||||
*/
|
||||
BREAK_EQUIPMENT_HELMET(49, LivingEntity.class),
|
||||
/**
|
||||
* Entity breaks item in chestplate slot
|
||||
* Entity breaks item in chestplate slot.
|
||||
*
|
||||
* @see org.bukkit.inventory.EquipmentSlot#CHEST
|
||||
*/
|
||||
BREAK_EQUIPMENT_CHESTPLATE(50, LivingEntity.class),
|
||||
/**
|
||||
* Entity breaks item in legging slot
|
||||
* Entity breaks item in legging slot.
|
||||
*
|
||||
* @see org.bukkit.inventory.EquipmentSlot#LEGS
|
||||
*/
|
||||
BREAK_EQUIPMENT_LEGGINGS(51, LivingEntity.class),
|
||||
/**
|
||||
* Entity breaks item in boot slot
|
||||
* Entity breaks item in boot slot.
|
||||
*
|
||||
* @see org.bukkit.inventory.EquipmentSlot#FEET
|
||||
*/
|
||||
BREAK_EQUIPMENT_BOOTS(52, LivingEntity.class),
|
||||
/**
|
||||
* Spawns honey block slide particles at the entity's feet
|
||||
* Spawns honey block slide particles at the entity's feet.
|
||||
*/
|
||||
HONEY_BLOCK_SLIDE_PARTICLES(53, Entity.class),
|
||||
/**
|
||||
* Spawns honey block fall particles at the entity's feet
|
||||
* Spawns honey block fall particles at the entity's feet.
|
||||
*/
|
||||
HONEY_BLOCK_FALL_PARTICLES(54, LivingEntity.class),
|
||||
/**
|
||||
@@ -319,110 +401,136 @@ public enum EntityEffect {
|
||||
*/
|
||||
SWAP_HAND_ITEMS(55, LivingEntity.class),
|
||||
/**
|
||||
* Stops a wolf that is currently shaking
|
||||
* Stops a wolf that is currently shaking.
|
||||
*
|
||||
* @see EntityEffect#WOLF_SHAKE
|
||||
*/
|
||||
WOLF_SHAKE_STOP(56, Wolf.class),
|
||||
// 57 - unused
|
||||
/**
|
||||
* Goat lowers its head for ramming
|
||||
* Goat lowers its head for ramming.
|
||||
*
|
||||
* @see #GOAT_RAISE_HEAD
|
||||
*/
|
||||
GOAT_LOWER_HEAD(58, Goat.class),
|
||||
/**
|
||||
* Goat raises its head
|
||||
* Goat raises its head.
|
||||
*
|
||||
* @see #GOAT_LOWER_HEAD
|
||||
*/
|
||||
GOAT_RAISE_HEAD(59, Goat.class),
|
||||
/**
|
||||
* Spawns death smoke particles
|
||||
* Spawns death smoke particles.
|
||||
*/
|
||||
SPAWN_DEATH_SMOKE(60, LivingEntity.class),
|
||||
/**
|
||||
* Warden shakes its tendrils
|
||||
* Warden shakes its tendrils.
|
||||
*/
|
||||
WARDEN_TENDRIL_SHAKE(61, Warden.class),
|
||||
/**
|
||||
* Warden performs sonic attack animation <br>
|
||||
* Does not play the sound or fire the beam
|
||||
* Warden performs sonic attack animation.
|
||||
* <br>
|
||||
* Does not play the sound or fire the beam.
|
||||
*/
|
||||
WARDEN_SONIC_ATTACK(62, Warden.class),
|
||||
/**
|
||||
* Plays sniffer digging sound <br>
|
||||
* Plays sniffer digging sound.
|
||||
* <br>
|
||||
* Sniffer must have a target and be in {@link Sniffer.State#SEARCHING} or
|
||||
* {@link Sniffer.State#DIGGING}
|
||||
* {@link Sniffer.State#DIGGING}.
|
||||
*/
|
||||
SNIFFER_DIG(63, Sniffer.class),
|
||||
// Paper start - add missing EntityEffect
|
||||
/**
|
||||
* Armadillo peeks out of its shell
|
||||
*/
|
||||
ARMADILLO_PEEK(64, org.bukkit.entity.Armadillo.class),
|
||||
ARMADILLO_PEEK(64, Armadillo.class),
|
||||
/**
|
||||
* {@link org.bukkit.inventory.EquipmentSlot#BODY} armor piece breaks
|
||||
* {@link org.bukkit.inventory.EquipmentSlot#BODY} armor piece breaks.
|
||||
*
|
||||
* @deprecated use {@link #BREAK_EQUIPMENT_BODY}
|
||||
*/
|
||||
@Deprecated(since = "1.21.4", forRemoval = true)
|
||||
BODY_BREAK(65, LivingEntity.class),
|
||||
/**
|
||||
* Entity breaks item in body slot.
|
||||
*
|
||||
* @see org.bukkit.inventory.EquipmentSlot#BODY
|
||||
*/
|
||||
BREAK_EQUIPMENT_BODY(65, LivingEntity.class),
|
||||
/**
|
||||
* A creaking transient shaking when being hit.
|
||||
* Does not apply to plain creaking entities as they are not invulnerable like the transient ones spawned by the
|
||||
* creaking heart.
|
||||
*/
|
||||
SHAKE(66, org.bukkit.entity.Creaking.class);
|
||||
// Paper end - add missing EntityEffect
|
||||
SHAKE(66, Creaking.class);
|
||||
|
||||
private final byte data;
|
||||
private final Class<? extends Entity> applicable;
|
||||
private final Set<Class<? extends Entity>> applicableClasses;
|
||||
|
||||
EntityEffect(final int data, /*@NotNull*/ Class<? extends Entity> clazz) {
|
||||
EntityEffect(int data, Class<? extends Entity>... applicableClasses) {
|
||||
Preconditions.checkState(applicableClasses.length > 0, "Unknown applicable classes");
|
||||
this.data = (byte) data;
|
||||
this.applicable = clazz;
|
||||
this.applicableClasses = Set.of(applicableClasses);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the data value of this EntityEffect, may not be unique.
|
||||
* Gets the data value of this entity effect, may not be unique.
|
||||
*
|
||||
* @return The data value
|
||||
* @apiNote Internal Use Only
|
||||
* @return the data value
|
||||
*/
|
||||
@org.jetbrains.annotations.ApiStatus.Internal // Paper
|
||||
@ApiStatus.Internal
|
||||
public byte getData() {
|
||||
return data;
|
||||
return this.data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets entity superclass which this affect is applicable to.
|
||||
* Gets entity superclass which this entity effect is applicable to.
|
||||
*
|
||||
* @return applicable class
|
||||
* @deprecated an entity effect can apply to multiple superclasses, see {@link #getApplicableClasses()}
|
||||
*/
|
||||
@NotNull
|
||||
@Deprecated(since = "1.21.4")
|
||||
public Class<? extends Entity> getApplicable() {
|
||||
return applicable;
|
||||
return this.applicableClasses.iterator().next();
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if this effect is applicable to the given entity.
|
||||
* Gets the entity superclasses which this entity effect is applicable to.
|
||||
*
|
||||
* @return the applicable classes
|
||||
*/
|
||||
@NotNull
|
||||
public Set<Class<? extends Entity>> getApplicableClasses() {
|
||||
return this.applicableClasses;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if this entity effect is applicable to the given entity.
|
||||
*
|
||||
* @param entity the entity to check
|
||||
* @return true if applicable
|
||||
* @return {@code true} if applicable
|
||||
*/
|
||||
public boolean isApplicableTo(@NotNull Entity entity) {
|
||||
Preconditions.checkArgument(entity != null, "Entity cannot be null");
|
||||
|
||||
return isApplicableTo(entity.getClass());
|
||||
return this.isApplicableTo(entity.getClass());
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if this effect is applicable to the given entity class.
|
||||
* Checks if this entity effect is applicable to the given entity class.
|
||||
*
|
||||
* @param clazz the entity class to check
|
||||
* @return true if applicable
|
||||
* @return {@code true} if applicable
|
||||
*/
|
||||
public boolean isApplicableTo(@NotNull Class<? extends Entity> clazz) {
|
||||
Preconditions.checkArgument(clazz != null, "Class cannot be null");
|
||||
|
||||
return applicable.isAssignableFrom(clazz);
|
||||
for (Class<? extends Entity> applicableClass : this.applicableClasses) {
|
||||
if (applicableClass.isAssignableFrom(clazz)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -14,19 +14,19 @@ import org.jetbrains.annotations.ApiStatus;
|
||||
*/
|
||||
public interface FeatureFlag extends Keyed {
|
||||
|
||||
// Paper start - overhaul FeatureFlag API
|
||||
/**
|
||||
* The {@code vanilla} feature flag.
|
||||
*/
|
||||
FeatureFlag VANILLA = create("vanilla");
|
||||
// Start generate - FeatureFlag
|
||||
// @GeneratedFrom 1.21.4
|
||||
@ApiStatus.Experimental
|
||||
FeatureFlag MINECART_IMPROVEMENTS = create("minecart_improvements");
|
||||
|
||||
/**
|
||||
* <strong>AVAILABLE BETWEEN VERSIONS:</strong> 1.19.3 - 1.21.1
|
||||
*
|
||||
* @deprecated not available since 1.21.2
|
||||
*/
|
||||
@Deprecated(since = "1.21.2")
|
||||
FeatureFlag BUNDLE = deprecated("bundle");
|
||||
@ApiStatus.Experimental
|
||||
FeatureFlag REDSTONE_EXPERIMENTS = create("redstone_experiments");
|
||||
|
||||
@ApiStatus.Experimental
|
||||
FeatureFlag TRADE_REBALANCE = create("trade_rebalance");
|
||||
|
||||
FeatureFlag VANILLA = create("vanilla");
|
||||
// End generate - FeatureFlag
|
||||
|
||||
/**
|
||||
* <strong>AVAILABLE BETWEEN VERSIONS:</strong> 1.19 - 1.19.4
|
||||
@@ -37,9 +37,6 @@ public interface FeatureFlag extends Keyed {
|
||||
@Deprecated(since = "1.20")
|
||||
FeatureFlag UPDATE_1_20 = deprecated("update_1_20");
|
||||
|
||||
@ApiStatus.Experimental // Paper - add missing annotation
|
||||
FeatureFlag TRADE_REBALANCE = create("trade_rebalance");
|
||||
|
||||
/**
|
||||
* <strong>AVAILABLE BETWEEN VERSIONS:</strong> 1.20.5 - 1.20.6
|
||||
*
|
||||
@@ -48,6 +45,14 @@ public interface FeatureFlag extends Keyed {
|
||||
@Deprecated(since = "1.21")
|
||||
FeatureFlag UPDATE_121 = deprecated("update_1_21");
|
||||
|
||||
/**
|
||||
* <strong>AVAILABLE BETWEEN VERSIONS:</strong> 1.19.3 - 1.21.1
|
||||
*
|
||||
* @deprecated not available since 1.21.2
|
||||
*/
|
||||
@Deprecated(since = "1.21.2")
|
||||
FeatureFlag BUNDLE = deprecated("bundle");
|
||||
|
||||
/**
|
||||
* <strong>AVAILABLE BETWEEN VERSIONS:</strong> 1.21.2 - 1.21.3
|
||||
*
|
||||
@@ -56,12 +61,6 @@ public interface FeatureFlag extends Keyed {
|
||||
@Deprecated(since = "1.21.4")
|
||||
FeatureFlag WINTER_DROP = deprecated("winter_drop");
|
||||
|
||||
@ApiStatus.Experimental // Paper - add missing annotation
|
||||
FeatureFlag REDSTONE_EXPERIMENTS = create("redstone_experiments");
|
||||
|
||||
@ApiStatus.Experimental // Paper - add missing annotation
|
||||
FeatureFlag MINECART_IMPROVEMENTS = create("minecart_improvements");
|
||||
|
||||
/**
|
||||
* An index of all feature flags.
|
||||
*/
|
||||
|
||||
@@ -2,6 +2,7 @@ package org.bukkit;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.collect.Lists;
|
||||
import io.papermc.paper.registry.RegistryKey;
|
||||
import java.util.Locale;
|
||||
import org.bukkit.util.OldEnum;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -11,27 +12,19 @@ import org.jetbrains.annotations.NotNull;
|
||||
*/
|
||||
public interface Fluid extends OldEnum<Fluid>, Keyed {
|
||||
|
||||
/**
|
||||
* No fluid.
|
||||
*/
|
||||
// Start generate - Fluid
|
||||
// @GeneratedFrom 1.21.4
|
||||
Fluid EMPTY = getFluid("empty");
|
||||
/**
|
||||
* Stationary water.
|
||||
*/
|
||||
Fluid WATER = getFluid("water");
|
||||
/**
|
||||
* Flowing water.
|
||||
*/
|
||||
Fluid FLOWING_WATER = getFluid("flowing_water");
|
||||
/**
|
||||
* Stationary lava.
|
||||
*/
|
||||
Fluid LAVA = getFluid("lava");
|
||||
/**
|
||||
* Flowing lava.
|
||||
*/
|
||||
|
||||
Fluid FLOWING_LAVA = getFluid("flowing_lava");
|
||||
|
||||
Fluid FLOWING_WATER = getFluid("flowing_water");
|
||||
|
||||
Fluid LAVA = getFluid("lava");
|
||||
|
||||
Fluid WATER = getFluid("water");
|
||||
// End generate - Fluid
|
||||
|
||||
@NotNull
|
||||
private static Fluid getFluid(@NotNull String key) {
|
||||
return Registry.FLUID.getOrThrow(NamespacedKey.minecraft(key));
|
||||
@@ -45,7 +38,7 @@ public interface Fluid extends OldEnum<Fluid>, Keyed {
|
||||
@NotNull
|
||||
@Deprecated(since = "1.21.3", forRemoval = true) @org.jetbrains.annotations.ApiStatus.ScheduledForRemoval(inVersion = "1.22") // Paper - will be removed via asm-utils
|
||||
static Fluid valueOf(@NotNull String name) {
|
||||
Fluid fluid = Bukkit.getUnsafe().get(Registry.FLUID, NamespacedKey.fromString(name.toLowerCase(Locale.ROOT)));
|
||||
Fluid fluid = Bukkit.getUnsafe().get(RegistryKey.FLUID, NamespacedKey.fromString(name.toLowerCase(Locale.ROOT)));
|
||||
Preconditions.checkArgument(fluid != null, "No fluid found with the name %s", name);
|
||||
return fluid;
|
||||
}
|
||||
|
||||
@@ -11,107 +11,229 @@ import org.jetbrains.annotations.Nullable;
|
||||
*/
|
||||
public abstract class GameEvent implements Keyed {
|
||||
|
||||
// Start generate - GameEvent
|
||||
// @GeneratedFrom 1.21.4
|
||||
public static final GameEvent BLOCK_ACTIVATE = getEvent("block_activate");
|
||||
|
||||
public static final GameEvent BLOCK_ATTACH = getEvent("block_attach");
|
||||
|
||||
public static final GameEvent BLOCK_CHANGE = getEvent("block_change");
|
||||
|
||||
public static final GameEvent BLOCK_CLOSE = getEvent("block_close");
|
||||
|
||||
public static final GameEvent BLOCK_DEACTIVATE = getEvent("block_deactivate");
|
||||
|
||||
public static final GameEvent BLOCK_DESTROY = getEvent("block_destroy");
|
||||
|
||||
public static final GameEvent BLOCK_DETACH = getEvent("block_detach");
|
||||
|
||||
public static final GameEvent BLOCK_OPEN = getEvent("block_open");
|
||||
|
||||
public static final GameEvent BLOCK_PLACE = getEvent("block_place");
|
||||
@Deprecated(since = "1.19")
|
||||
public static final GameEvent BLOCK_PRESS = getEvent("block_activate");
|
||||
@Deprecated(since = "1.19")
|
||||
public static final GameEvent BLOCK_SWITCH = getEvent("block_activate");
|
||||
@Deprecated(since = "1.19")
|
||||
public static final GameEvent BLOCK_UNPRESS = getEvent("block_deactivate");
|
||||
@Deprecated(since = "1.19")
|
||||
public static final GameEvent BLOCK_UNSWITCH = getEvent("block_deactivate");
|
||||
|
||||
public static final GameEvent CONTAINER_CLOSE = getEvent("container_close");
|
||||
|
||||
public static final GameEvent CONTAINER_OPEN = getEvent("container_open");
|
||||
@Deprecated(since = "1.20")
|
||||
public static final GameEvent DISPENSE_FAIL = getEvent("block_activate");
|
||||
|
||||
public static final GameEvent DRINK = getEvent("drink");
|
||||
@Deprecated(since = "1.19")
|
||||
public static final GameEvent DRINKING_FINISH = getEvent("drink");
|
||||
|
||||
public static final GameEvent EAT = getEvent("eat");
|
||||
@Deprecated(since = "1.19")
|
||||
public static final GameEvent ELYTRA_FREE_FALL = getEvent("elytra_glide");
|
||||
|
||||
public static final GameEvent ELYTRA_GLIDE = getEvent("elytra_glide");
|
||||
public static final GameEvent ENTITY_DAMAGE = getEvent("entity_damage");
|
||||
@Deprecated(since = "1.19")
|
||||
public static final GameEvent ENTITY_DAMAGED = getEvent("entity_damage");
|
||||
public static final GameEvent ENTITY_DIE = getEvent("entity_die");
|
||||
public static final GameEvent ENTITY_DISMOUNT = getEvent("entity_dismount");
|
||||
@Deprecated(since = "1.19")
|
||||
public static final GameEvent ENTITY_DYING = getEvent("entity_die");
|
||||
public static final GameEvent ENTITY_INTERACT = getEvent("entity_interact");
|
||||
public static final GameEvent ENTITY_MOUNT = getEvent("entity_mount");
|
||||
@Deprecated(since = "1.19")
|
||||
public static final GameEvent ENTITY_KILLED = getEvent("entity_die");
|
||||
public static final GameEvent ENTITY_PLACE = getEvent("entity_place");
|
||||
|
||||
public static final GameEvent ENTITY_ACTION = getEvent("entity_action");
|
||||
@Deprecated(since = "1.20.2")
|
||||
public static final GameEvent ENTITY_ROAR = getEvent("entity_action");
|
||||
@Deprecated(since = "1.20.2")
|
||||
public static final GameEvent ENTITY_SHAKE = getEvent("entity_action");
|
||||
|
||||
public static final GameEvent ENTITY_DAMAGE = getEvent("entity_damage");
|
||||
|
||||
public static final GameEvent ENTITY_DIE = getEvent("entity_die");
|
||||
|
||||
public static final GameEvent ENTITY_DISMOUNT = getEvent("entity_dismount");
|
||||
|
||||
public static final GameEvent ENTITY_INTERACT = getEvent("entity_interact");
|
||||
|
||||
public static final GameEvent ENTITY_MOUNT = getEvent("entity_mount");
|
||||
|
||||
public static final GameEvent ENTITY_PLACE = getEvent("entity_place");
|
||||
|
||||
public static final GameEvent EQUIP = getEvent("equip");
|
||||
|
||||
public static final GameEvent EXPLODE = getEvent("explode");
|
||||
|
||||
public static final GameEvent FLAP = getEvent("flap");
|
||||
|
||||
public static final GameEvent FLUID_PICKUP = getEvent("fluid_pickup");
|
||||
|
||||
public static final GameEvent FLUID_PLACE = getEvent("fluid_place");
|
||||
|
||||
public static final GameEvent HIT_GROUND = getEvent("hit_ground");
|
||||
|
||||
public static final GameEvent INSTRUMENT_PLAY = getEvent("instrument_play");
|
||||
|
||||
public static final GameEvent ITEM_INTERACT_FINISH = getEvent("item_interact_finish");
|
||||
|
||||
public static final GameEvent ITEM_INTERACT_START = getEvent("item_interact_start");
|
||||
|
||||
public static final GameEvent JUKEBOX_PLAY = getEvent("jukebox_play");
|
||||
|
||||
public static final GameEvent JUKEBOX_STOP_PLAY = getEvent("jukebox_stop_play");
|
||||
|
||||
public static final GameEvent LIGHTNING_STRIKE = getEvent("lightning_strike");
|
||||
@Deprecated(since = "1.19")
|
||||
public static final GameEvent MOB_INTERACT = getEvent("entity_interact");
|
||||
|
||||
public static final GameEvent NOTE_BLOCK_PLAY = getEvent("note_block_play");
|
||||
@Deprecated(since = "1.20")
|
||||
public static final GameEvent PISTON_CONTRACT = getEvent("block_deactivate");
|
||||
@Deprecated(since = "1.20")
|
||||
public static final GameEvent PISTON_EXTEND = getEvent("block_activate");
|
||||
|
||||
public static final GameEvent PRIME_FUSE = getEvent("prime_fuse");
|
||||
|
||||
public static final GameEvent PROJECTILE_LAND = getEvent("projectile_land");
|
||||
|
||||
public static final GameEvent PROJECTILE_SHOOT = getEvent("projectile_shoot");
|
||||
@Deprecated(since = "1.19")
|
||||
public static final GameEvent RAVAGER_ROAR = getEvent("entity_action");
|
||||
@Deprecated(since = "1.19")
|
||||
public static final GameEvent RING_BELL = getEvent("block_change");
|
||||
public static final GameEvent SCULK_SENSOR_TENDRILS_CLICKING = getEvent("sculk_sensor_tendrils_clicking");
|
||||
public static final GameEvent SHEAR = getEvent("shear");
|
||||
public static final GameEvent SHRIEK = getEvent("shriek");
|
||||
@Deprecated(since = "1.19")
|
||||
public static final GameEvent SHULKER_CLOSE = getEvent("container_close");
|
||||
@Deprecated(since = "1.19")
|
||||
public static final GameEvent SHULKER_OPEN = getEvent("container_open");
|
||||
public static final GameEvent SPLASH = getEvent("splash");
|
||||
public static final GameEvent STEP = getEvent("step");
|
||||
public static final GameEvent SWIM = getEvent("swim");
|
||||
public static final GameEvent TELEPORT = getEvent("teleport");
|
||||
public static final GameEvent UNEQUIP = getEvent("unequip");
|
||||
@Deprecated(since = "1.19")
|
||||
public static final GameEvent WOLF_SHAKING = getEvent("entity_action");
|
||||
|
||||
public static final GameEvent RESONATE_1 = getEvent("resonate_1");
|
||||
|
||||
public static final GameEvent RESONATE_2 = getEvent("resonate_2");
|
||||
|
||||
public static final GameEvent RESONATE_3 = getEvent("resonate_3");
|
||||
|
||||
public static final GameEvent RESONATE_4 = getEvent("resonate_4");
|
||||
|
||||
public static final GameEvent RESONATE_5 = getEvent("resonate_5");
|
||||
|
||||
public static final GameEvent RESONATE_6 = getEvent("resonate_6");
|
||||
|
||||
public static final GameEvent RESONATE_7 = getEvent("resonate_7");
|
||||
|
||||
public static final GameEvent RESONATE_8 = getEvent("resonate_8");
|
||||
|
||||
public static final GameEvent RESONATE_9 = getEvent("resonate_9");
|
||||
|
||||
public static final GameEvent RESONATE_10 = getEvent("resonate_10");
|
||||
|
||||
public static final GameEvent RESONATE_11 = getEvent("resonate_11");
|
||||
|
||||
public static final GameEvent RESONATE_12 = getEvent("resonate_12");
|
||||
|
||||
public static final GameEvent RESONATE_13 = getEvent("resonate_13");
|
||||
|
||||
public static final GameEvent RESONATE_14 = getEvent("resonate_14");
|
||||
|
||||
public static final GameEvent RESONATE_15 = getEvent("resonate_15");
|
||||
|
||||
public static final GameEvent SCULK_SENSOR_TENDRILS_CLICKING = getEvent("sculk_sensor_tendrils_clicking");
|
||||
|
||||
public static final GameEvent SHEAR = getEvent("shear");
|
||||
|
||||
public static final GameEvent SHRIEK = getEvent("shriek");
|
||||
|
||||
public static final GameEvent SPLASH = getEvent("splash");
|
||||
|
||||
public static final GameEvent STEP = getEvent("step");
|
||||
|
||||
public static final GameEvent SWIM = getEvent("swim");
|
||||
|
||||
public static final GameEvent TELEPORT = getEvent("teleport");
|
||||
|
||||
public static final GameEvent UNEQUIP = getEvent("unequip");
|
||||
// End generate - GameEvent
|
||||
/**
|
||||
* @deprecated in favor of {@link #BLOCK_ACTIVATE}
|
||||
*/
|
||||
@Deprecated(since = "1.19")
|
||||
public static final GameEvent BLOCK_PRESS = BLOCK_ACTIVATE;
|
||||
/**
|
||||
* @deprecated in favor of {@link #BLOCK_ACTIVATE}
|
||||
*/
|
||||
@Deprecated(since = "1.19")
|
||||
public static final GameEvent BLOCK_SWITCH = BLOCK_ACTIVATE;
|
||||
/**
|
||||
* @deprecated in favor of {@link #BLOCK_DEACTIVATE}
|
||||
*/
|
||||
@Deprecated(since = "1.19")
|
||||
public static final GameEvent BLOCK_UNPRESS = BLOCK_DEACTIVATE;
|
||||
/**
|
||||
* @deprecated in favor of {@link #BLOCK_DEACTIVATE}
|
||||
*/
|
||||
@Deprecated(since = "1.19")
|
||||
public static final GameEvent BLOCK_UNSWITCH = BLOCK_DEACTIVATE;
|
||||
/**
|
||||
* @deprecated in favor of {@link #BLOCK_ACTIVATE}
|
||||
*/
|
||||
@Deprecated(since = "1.20")
|
||||
public static final GameEvent DISPENSE_FAIL = BLOCK_ACTIVATE;
|
||||
/**
|
||||
* @deprecated in favor of {@link #DRINK}
|
||||
*/
|
||||
@Deprecated(since = "1.19")
|
||||
public static final GameEvent DRINKING_FINISH = DRINK;
|
||||
/**
|
||||
* @deprecated in favor of {@link #ELYTRA_GLIDE}
|
||||
*/
|
||||
@Deprecated(since = "1.19")
|
||||
public static final GameEvent ELYTRA_FREE_FALL = ELYTRA_GLIDE;
|
||||
/**
|
||||
* @deprecated in favor of {@link #ENTITY_DAMAGE}
|
||||
*/
|
||||
@Deprecated(since = "1.19")
|
||||
public static final GameEvent ENTITY_DAMAGED = ENTITY_DAMAGE;
|
||||
/**
|
||||
* @deprecated in favor of {@link #ENTITY_DIE}
|
||||
*/
|
||||
@Deprecated(since = "1.19")
|
||||
public static final GameEvent ENTITY_DYING = ENTITY_DIE;
|
||||
/**
|
||||
* @deprecated in favor of {@link #ENTITY_DIE}
|
||||
*/
|
||||
@Deprecated(since = "1.19")
|
||||
public static final GameEvent ENTITY_KILLED = ENTITY_DIE;
|
||||
/**
|
||||
* @deprecated in favor of {@link #ENTITY_ACTION}
|
||||
*/
|
||||
@Deprecated(since = "1.20.2")
|
||||
public static final GameEvent ENTITY_ROAR = ENTITY_ACTION;
|
||||
/**
|
||||
* @deprecated in favor of {@link #ENTITY_ACTION}
|
||||
*/
|
||||
@Deprecated(since = "1.20.2")
|
||||
public static final GameEvent ENTITY_SHAKE = ENTITY_ACTION;
|
||||
/**
|
||||
* @deprecated in favor of {@link #ENTITY_INTERACT}
|
||||
*/
|
||||
@Deprecated(since = "1.19")
|
||||
public static final GameEvent MOB_INTERACT = ENTITY_INTERACT;
|
||||
/**
|
||||
* @deprecated in favor of {@link #BLOCK_DEACTIVATE}
|
||||
*/
|
||||
@Deprecated(since = "1.20")
|
||||
public static final GameEvent PISTON_CONTRACT = BLOCK_DEACTIVATE;
|
||||
/**
|
||||
* @deprecated in favor of {@link #BLOCK_ACTIVATE}
|
||||
*/
|
||||
@Deprecated(since = "1.20")
|
||||
public static final GameEvent PISTON_EXTEND = BLOCK_ACTIVATE;
|
||||
/**
|
||||
* @deprecated in favor of {@link #ENTITY_ACTION}
|
||||
*/
|
||||
@Deprecated(since = "1.19")
|
||||
public static final GameEvent RAVAGER_ROAR = ENTITY_ACTION;
|
||||
/**
|
||||
* @deprecated in favor of {@link #BLOCK_CHANGE}
|
||||
*/
|
||||
@Deprecated(since = "1.19")
|
||||
public static final GameEvent RING_BELL = BLOCK_CHANGE;
|
||||
/**
|
||||
* @deprecated in favor of {@link #CONTAINER_CLOSE}
|
||||
*/
|
||||
@Deprecated(since = "1.19")
|
||||
public static final GameEvent SHULKER_CLOSE = CONTAINER_CLOSE;
|
||||
/**
|
||||
* @deprecated in favor of {@link #CONTAINER_OPEN}
|
||||
*/
|
||||
@Deprecated(since = "1.19")
|
||||
public static final GameEvent SHULKER_OPEN = CONTAINER_OPEN;
|
||||
/**
|
||||
* @deprecated in favor of {@link #ENTITY_ACTION}
|
||||
*/
|
||||
@Deprecated(since = "1.19")
|
||||
public static final GameEvent WOLF_SHAKING = ENTITY_ACTION;
|
||||
|
||||
/**
|
||||
* Returns a {@link GameEvent} by a {@link NamespacedKey}.
|
||||
*
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package org.bukkit;
|
||||
|
||||
import io.papermc.paper.registry.RegistryAccess;
|
||||
import io.papermc.paper.registry.RegistryKey;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -9,29 +11,50 @@ import org.jetbrains.annotations.NotNull;
|
||||
@ApiStatus.Experimental
|
||||
public interface JukeboxSong extends Keyed, Translatable {
|
||||
|
||||
public static final JukeboxSong THIRTEEN = get("13");
|
||||
public static final JukeboxSong CAT = get("cat");
|
||||
public static final JukeboxSong BLOCKS = get("blocks");
|
||||
public static final JukeboxSong CHIRP = get("chirp");
|
||||
public static final JukeboxSong FAR = get("far");
|
||||
public static final JukeboxSong MALL = get("mall");
|
||||
public static final JukeboxSong MELLOHI = get("mellohi");
|
||||
public static final JukeboxSong STAL = get("stal");
|
||||
public static final JukeboxSong STRAD = get("strad");
|
||||
public static final JukeboxSong WARD = get("ward");
|
||||
public static final JukeboxSong ELEVEN = get("11");
|
||||
public static final JukeboxSong WAIT = get("wait");
|
||||
public static final JukeboxSong PIGSTEP = get("pigstep");
|
||||
public static final JukeboxSong OTHERSIDE = get("otherside");
|
||||
public static final JukeboxSong FIVE = get("5");
|
||||
public static final JukeboxSong RELIC = get("relic");
|
||||
public static final JukeboxSong PRECIPICE = get("precipice");
|
||||
public static final JukeboxSong CREATOR = get("creator");
|
||||
public static final JukeboxSong CREATOR_MUSIC_BOX = get("creator_music_box");
|
||||
// Start generate - JukeboxSong
|
||||
// @GeneratedFrom 1.21.4
|
||||
JukeboxSong ELEVEN = get("11");
|
||||
|
||||
JukeboxSong THIRTEEN = get("13");
|
||||
|
||||
JukeboxSong FIVE = get("5");
|
||||
|
||||
JukeboxSong BLOCKS = get("blocks");
|
||||
|
||||
JukeboxSong CAT = get("cat");
|
||||
|
||||
JukeboxSong CHIRP = get("chirp");
|
||||
|
||||
JukeboxSong CREATOR = get("creator");
|
||||
|
||||
JukeboxSong CREATOR_MUSIC_BOX = get("creator_music_box");
|
||||
|
||||
JukeboxSong FAR = get("far");
|
||||
|
||||
JukeboxSong MALL = get("mall");
|
||||
|
||||
JukeboxSong MELLOHI = get("mellohi");
|
||||
|
||||
JukeboxSong OTHERSIDE = get("otherside");
|
||||
|
||||
JukeboxSong PIGSTEP = get("pigstep");
|
||||
|
||||
JukeboxSong PRECIPICE = get("precipice");
|
||||
|
||||
JukeboxSong RELIC = get("relic");
|
||||
|
||||
JukeboxSong STAL = get("stal");
|
||||
|
||||
JukeboxSong STRAD = get("strad");
|
||||
|
||||
JukeboxSong WAIT = get("wait");
|
||||
|
||||
JukeboxSong WARD = get("ward");
|
||||
// End generate - JukeboxSong
|
||||
|
||||
@NotNull
|
||||
private static JukeboxSong get(@NotNull String key) {
|
||||
return Registry.JUKEBOX_SONG.getOrThrow(NamespacedKey.minecraft(key));
|
||||
return RegistryAccess.registryAccess().getRegistry(RegistryKey.JUKEBOX_SONG).getOrThrow(NamespacedKey.minecraft(key));
|
||||
}
|
||||
|
||||
// Paper start - adventure
|
||||
|
||||
@@ -8,6 +8,7 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.function.Predicate;
|
||||
import io.papermc.paper.math.FinePosition;
|
||||
import io.papermc.paper.math.Rotation;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.configuration.serialization.ConfigurationSerializable;
|
||||
import org.bukkit.entity.Entity;
|
||||
@@ -411,6 +412,19 @@ public class Location implements Cloneable, ConfigurationSerializable, io.paperm
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds rotation to this location. Not world-aware.
|
||||
*
|
||||
* @param rotation the rotation to add.
|
||||
* @return the same location
|
||||
* @see Vector
|
||||
*/
|
||||
@NotNull
|
||||
@Contract(value = "_ -> this", mutates = "this")
|
||||
public Location addRotation(@NotNull Rotation rotation) {
|
||||
return addRotation(rotation.yaw(), rotation.pitch());
|
||||
}
|
||||
|
||||
/**
|
||||
* Subtracts the location by another.
|
||||
*
|
||||
@@ -480,6 +494,19 @@ public class Location implements Cloneable, ConfigurationSerializable, io.paperm
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Subtracts rotation from this location.
|
||||
*
|
||||
* @param rotation the rotation to subtract.
|
||||
* @return the same location
|
||||
* @see Vector
|
||||
*/
|
||||
@NotNull
|
||||
@Contract(value = "_ -> this", mutates = "this")
|
||||
public Location subtractRotation(@NotNull Rotation rotation) {
|
||||
return subtractRotation(rotation.yaw(), rotation.pitch());
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the magnitude of the location, defined as sqrt(x^2+y^2+z^2). The
|
||||
* value of this method is not cached and uses a costly square-root
|
||||
@@ -622,6 +649,20 @@ public class Location implements Cloneable, ConfigurationSerializable, io.paperm
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the rotation of this location and returns itself.
|
||||
* <p>
|
||||
* This mutates this object, clone first.
|
||||
*
|
||||
* @param rotation the new rotation.
|
||||
* @return self (not cloned)
|
||||
*/
|
||||
@NotNull
|
||||
@Contract(value = "_ -> this", mutates = "this")
|
||||
public Location setRotation(@NotNull Rotation rotation) {
|
||||
return setRotation(rotation.yaw(), rotation.pitch());
|
||||
}
|
||||
|
||||
/**
|
||||
* Takes the x/y/z from base and adds the specified x/y/z to it and returns self
|
||||
* <p>
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,6 +1,8 @@
|
||||
package org.bukkit;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import io.papermc.paper.registry.RegistryAccess;
|
||||
import io.papermc.paper.registry.RegistryKey;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -8,15 +10,25 @@ import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public abstract class MusicInstrument implements Keyed, net.kyori.adventure.translation.Translatable { // Paper - translation keys
|
||||
|
||||
public static final MusicInstrument PONDER_GOAT_HORN = getInstrument("ponder_goat_horn");
|
||||
public static final MusicInstrument SING_GOAT_HORN = getInstrument("sing_goat_horn");
|
||||
public static final MusicInstrument SEEK_GOAT_HORN = getInstrument("seek_goat_horn");
|
||||
public static final MusicInstrument FEEL_GOAT_HORN = getInstrument("feel_goat_horn");
|
||||
// Start generate - MusicInstrument
|
||||
// @GeneratedFrom 1.21.4
|
||||
public static final MusicInstrument ADMIRE_GOAT_HORN = getInstrument("admire_goat_horn");
|
||||
|
||||
public static final MusicInstrument CALL_GOAT_HORN = getInstrument("call_goat_horn");
|
||||
public static final MusicInstrument YEARN_GOAT_HORN = getInstrument("yearn_goat_horn");
|
||||
|
||||
public static final MusicInstrument DREAM_GOAT_HORN = getInstrument("dream_goat_horn");
|
||||
|
||||
public static final MusicInstrument FEEL_GOAT_HORN = getInstrument("feel_goat_horn");
|
||||
|
||||
public static final MusicInstrument PONDER_GOAT_HORN = getInstrument("ponder_goat_horn");
|
||||
|
||||
public static final MusicInstrument SEEK_GOAT_HORN = getInstrument("seek_goat_horn");
|
||||
|
||||
public static final MusicInstrument SING_GOAT_HORN = getInstrument("sing_goat_horn");
|
||||
|
||||
public static final MusicInstrument YEARN_GOAT_HORN = getInstrument("yearn_goat_horn");
|
||||
// End generate - MusicInstrument
|
||||
|
||||
/**
|
||||
* Returns a {@link MusicInstrument} by a {@link NamespacedKey}.
|
||||
*
|
||||
@@ -44,7 +56,7 @@ public abstract class MusicInstrument implements Keyed, net.kyori.adventure.tran
|
||||
|
||||
@NotNull
|
||||
private static MusicInstrument getInstrument(@NotNull String key) {
|
||||
return Registry.INSTRUMENT.getOrThrow(NamespacedKey.minecraft(key));
|
||||
return RegistryAccess.registryAccess().getRegistry(RegistryKey.INSTRUMENT).getOrThrow(NamespacedKey.minecraft(key));
|
||||
}
|
||||
|
||||
// Paper start - deprecate getKey
|
||||
|
||||
@@ -11,14 +11,15 @@ import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.permissions.ServerOperator;
|
||||
import org.bukkit.profile.PlayerProfile;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Represents a reference to a player identity and the data belonging to a
|
||||
* player that is stored on the disk and can, thus, be retrieved without the
|
||||
* player needing to be online.
|
||||
*/
|
||||
@NullMarked
|
||||
public interface OfflinePlayer extends ServerOperator, AnimalTamer, ConfigurationSerializable, io.papermc.paper.persistence.PersistentDataViewHolder { // Paper - Add Offline PDC API
|
||||
|
||||
/**
|
||||
@@ -62,7 +63,6 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio
|
||||
* @return Player UUID
|
||||
*/
|
||||
@Override
|
||||
@NotNull
|
||||
public UUID getUniqueId();
|
||||
|
||||
/**
|
||||
@@ -74,7 +74,6 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio
|
||||
*
|
||||
* @return the player's profile
|
||||
*/
|
||||
@NotNull
|
||||
com.destroystokyo.paper.profile.PlayerProfile getPlayerProfile(); // Paper
|
||||
|
||||
/**
|
||||
@@ -91,7 +90,6 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio
|
||||
* @return Ban Entry
|
||||
* @deprecated use {@link #ban(String, Date, String)}
|
||||
*/
|
||||
@NotNull
|
||||
@Deprecated(since = "1.20.4")
|
||||
public default BanEntry banPlayer(@Nullable String reason) {
|
||||
return banPlayer(reason, null, null);
|
||||
@@ -104,7 +102,6 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio
|
||||
* @return Ban Entry
|
||||
* @deprecated use {@link #ban(String, Date, String)}
|
||||
*/
|
||||
@NotNull
|
||||
@Deprecated(since = "1.20.4")
|
||||
public default BanEntry banPlayer(@Nullable String reason, @Nullable String source) {
|
||||
return banPlayer(reason, null, source);
|
||||
@@ -117,9 +114,8 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio
|
||||
* @return Ban Entry
|
||||
* @deprecated use {@link #ban(String, Date, String)}
|
||||
*/
|
||||
@NotNull
|
||||
@Deprecated(since = "1.20.4")
|
||||
public default BanEntry banPlayer(@Nullable String reason, @Nullable java.util.Date expires) {
|
||||
public default BanEntry banPlayer(@Nullable String reason, java.util.@Nullable Date expires) {
|
||||
return banPlayer(reason, expires, null);
|
||||
}
|
||||
|
||||
@@ -131,18 +127,16 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio
|
||||
* @return Ban Entry
|
||||
* @deprecated use {@link #ban(String, Date, String)}
|
||||
*/
|
||||
@NotNull
|
||||
@Deprecated(since = "1.20.4")
|
||||
public default BanEntry banPlayer(@Nullable String reason, @Nullable java.util.Date expires, @Nullable String source) {
|
||||
public default BanEntry banPlayer(@Nullable String reason, java.util.@Nullable Date expires, @Nullable String source) {
|
||||
return banPlayer(reason, expires, source, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated use {@link #ban(String, Date, String)}
|
||||
*/
|
||||
@NotNull
|
||||
@Deprecated(since = "1.20.4")
|
||||
public default BanEntry banPlayer(@Nullable String reason, @Nullable java.util.Date expires, @Nullable String source, boolean kickIfOnline) {
|
||||
public default BanEntry banPlayer(@Nullable String reason, java.util.@Nullable Date expires, @Nullable String source, boolean kickIfOnline) {
|
||||
BanEntry banEntry = Bukkit.getServer().getBanList(BanList.Type.NAME).addBan(getName(), reason, expires, source);
|
||||
if (kickIfOnline && isOnline()) {
|
||||
getPlayer().kickPlayer(reason);
|
||||
@@ -309,7 +303,7 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio
|
||||
* @throws IllegalArgumentException if the statistic requires an
|
||||
* additional parameter
|
||||
*/
|
||||
public void incrementStatistic(@NotNull Statistic statistic) throws IllegalArgumentException;
|
||||
public void incrementStatistic(Statistic statistic) throws IllegalArgumentException;
|
||||
|
||||
/**
|
||||
* Decrements the given statistic for this player.
|
||||
@@ -322,7 +316,7 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio
|
||||
* @throws IllegalArgumentException if the statistic requires an
|
||||
* additional parameter
|
||||
*/
|
||||
public void decrementStatistic(@NotNull Statistic statistic) throws IllegalArgumentException;
|
||||
public void decrementStatistic(Statistic statistic) throws IllegalArgumentException;
|
||||
|
||||
/**
|
||||
* Increments the given statistic for this player.
|
||||
@@ -334,7 +328,7 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio
|
||||
* @throws IllegalArgumentException if the statistic requires an
|
||||
* additional parameter
|
||||
*/
|
||||
public void incrementStatistic(@NotNull Statistic statistic, int amount) throws IllegalArgumentException;
|
||||
public void incrementStatistic(Statistic statistic, int amount) throws IllegalArgumentException;
|
||||
|
||||
/**
|
||||
* Decrements the given statistic for this player.
|
||||
@@ -346,7 +340,7 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio
|
||||
* @throws IllegalArgumentException if the statistic requires an
|
||||
* additional parameter
|
||||
*/
|
||||
public void decrementStatistic(@NotNull Statistic statistic, int amount) throws IllegalArgumentException;
|
||||
public void decrementStatistic(Statistic statistic, int amount) throws IllegalArgumentException;
|
||||
|
||||
/**
|
||||
* Sets the given statistic for this player.
|
||||
@@ -358,7 +352,7 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio
|
||||
* @throws IllegalArgumentException if the statistic requires an
|
||||
* additional parameter
|
||||
*/
|
||||
public void setStatistic(@NotNull Statistic statistic, int newValue) throws IllegalArgumentException;
|
||||
public void setStatistic(Statistic statistic, int newValue) throws IllegalArgumentException;
|
||||
|
||||
/**
|
||||
* Gets the value of the given statistic for this player.
|
||||
@@ -369,7 +363,7 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio
|
||||
* @throws IllegalArgumentException if the statistic requires an
|
||||
* additional parameter
|
||||
*/
|
||||
public int getStatistic(@NotNull Statistic statistic) throws IllegalArgumentException;
|
||||
public int getStatistic(Statistic statistic) throws IllegalArgumentException;
|
||||
|
||||
/**
|
||||
* Increments the given statistic for this player for the given material.
|
||||
@@ -384,7 +378,7 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio
|
||||
* @throws IllegalArgumentException if the given parameter is not valid
|
||||
* for the statistic
|
||||
*/
|
||||
public void incrementStatistic(@NotNull Statistic statistic, @NotNull Material material) throws IllegalArgumentException;
|
||||
public void incrementStatistic(Statistic statistic, Material material) throws IllegalArgumentException;
|
||||
|
||||
/**
|
||||
* Decrements the given statistic for this player for the given material.
|
||||
@@ -399,7 +393,7 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio
|
||||
* @throws IllegalArgumentException if the given parameter is not valid
|
||||
* for the statistic
|
||||
*/
|
||||
public void decrementStatistic(@NotNull Statistic statistic, @NotNull Material material) throws IllegalArgumentException;
|
||||
public void decrementStatistic(Statistic statistic, Material material) throws IllegalArgumentException;
|
||||
|
||||
/**
|
||||
* Gets the value of the given statistic for this player.
|
||||
@@ -412,7 +406,7 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio
|
||||
* @throws IllegalArgumentException if the given parameter is not valid
|
||||
* for the statistic
|
||||
*/
|
||||
public int getStatistic(@NotNull Statistic statistic, @NotNull Material material) throws IllegalArgumentException;
|
||||
public int getStatistic(Statistic statistic, Material material) throws IllegalArgumentException;
|
||||
|
||||
/**
|
||||
* Increments the given statistic for this player for the given material.
|
||||
@@ -426,7 +420,7 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio
|
||||
* @throws IllegalArgumentException if the given parameter is not valid
|
||||
* for the statistic
|
||||
*/
|
||||
public void incrementStatistic(@NotNull Statistic statistic, @NotNull Material material, int amount) throws IllegalArgumentException;
|
||||
public void incrementStatistic(Statistic statistic, Material material, int amount) throws IllegalArgumentException;
|
||||
|
||||
/**
|
||||
* Decrements the given statistic for this player for the given material.
|
||||
@@ -440,7 +434,7 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio
|
||||
* @throws IllegalArgumentException if the given parameter is not valid
|
||||
* for the statistic
|
||||
*/
|
||||
public void decrementStatistic(@NotNull Statistic statistic, @NotNull Material material, int amount) throws IllegalArgumentException;
|
||||
public void decrementStatistic(Statistic statistic, Material material, int amount) throws IllegalArgumentException;
|
||||
|
||||
/**
|
||||
* Sets the given statistic for this player for the given material.
|
||||
@@ -454,7 +448,7 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio
|
||||
* @throws IllegalArgumentException if the given parameter is not valid
|
||||
* for the statistic
|
||||
*/
|
||||
public void setStatistic(@NotNull Statistic statistic, @NotNull Material material, int newValue) throws IllegalArgumentException;
|
||||
public void setStatistic(Statistic statistic, Material material, int newValue) throws IllegalArgumentException;
|
||||
|
||||
/**
|
||||
* Increments the given statistic for this player for the given entity.
|
||||
@@ -469,7 +463,7 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio
|
||||
* @throws IllegalArgumentException if the given parameter is not valid
|
||||
* for the statistic
|
||||
*/
|
||||
public void incrementStatistic(@NotNull Statistic statistic, @NotNull EntityType entityType) throws IllegalArgumentException;
|
||||
public void incrementStatistic(Statistic statistic, EntityType entityType) throws IllegalArgumentException;
|
||||
|
||||
/**
|
||||
* Decrements the given statistic for this player for the given entity.
|
||||
@@ -484,7 +478,7 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio
|
||||
* @throws IllegalArgumentException if the given parameter is not valid
|
||||
* for the statistic
|
||||
*/
|
||||
public void decrementStatistic(@NotNull Statistic statistic, @NotNull EntityType entityType) throws IllegalArgumentException;
|
||||
public void decrementStatistic(Statistic statistic, EntityType entityType) throws IllegalArgumentException;
|
||||
|
||||
/**
|
||||
* Gets the value of the given statistic for this player.
|
||||
@@ -497,7 +491,7 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio
|
||||
* @throws IllegalArgumentException if the given parameter is not valid
|
||||
* for the statistic
|
||||
*/
|
||||
public int getStatistic(@NotNull Statistic statistic, @NotNull EntityType entityType) throws IllegalArgumentException;
|
||||
public int getStatistic(Statistic statistic, EntityType entityType) throws IllegalArgumentException;
|
||||
|
||||
/**
|
||||
* Increments the given statistic for this player for the given entity.
|
||||
@@ -511,7 +505,7 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio
|
||||
* @throws IllegalArgumentException if the given parameter is not valid
|
||||
* for the statistic
|
||||
*/
|
||||
public void incrementStatistic(@NotNull Statistic statistic, @NotNull EntityType entityType, int amount) throws IllegalArgumentException;
|
||||
public void incrementStatistic(Statistic statistic, EntityType entityType, int amount) throws IllegalArgumentException;
|
||||
|
||||
/**
|
||||
* Decrements the given statistic for this player for the given entity.
|
||||
@@ -525,7 +519,7 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio
|
||||
* @throws IllegalArgumentException if the given parameter is not valid
|
||||
* for the statistic
|
||||
*/
|
||||
public void decrementStatistic(@NotNull Statistic statistic, @NotNull EntityType entityType, int amount);
|
||||
public void decrementStatistic(Statistic statistic, EntityType entityType, int amount);
|
||||
|
||||
/**
|
||||
* Sets the given statistic for this player for the given entity.
|
||||
@@ -539,7 +533,7 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio
|
||||
* @throws IllegalArgumentException if the given parameter is not valid
|
||||
* for the statistic
|
||||
*/
|
||||
public void setStatistic(@NotNull Statistic statistic, @NotNull EntityType entityType, int newValue);
|
||||
public void setStatistic(Statistic statistic, EntityType entityType, int newValue);
|
||||
|
||||
/**
|
||||
* Gets the player's last death location.
|
||||
@@ -571,6 +565,6 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio
|
||||
* @see io.papermc.paper.persistence.PersistentDataViewHolder#getPersistentDataContainer()
|
||||
*/
|
||||
@Override
|
||||
io.papermc.paper.persistence.@NotNull PersistentDataContainerView getPersistentDataContainer();
|
||||
io.papermc.paper.persistence.PersistentDataContainerView getPersistentDataContainer();
|
||||
// Paper end - add pdc to offline player
|
||||
}
|
||||
@@ -146,12 +146,10 @@ public enum Particle implements Keyed {
|
||||
/**
|
||||
* Uses {@link BlockData} as DataType
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
BLOCK_CRUMBLE("block_crumble", BlockData.class),
|
||||
/**
|
||||
* Uses {@link Trail} as DataType
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
TRAIL("trail", Trail.class),
|
||||
OMINOUS_SPAWNING("ominous_spawning"),
|
||||
RAID_OMEN("raid_omen"),
|
||||
@@ -276,7 +274,6 @@ public enum Particle implements Keyed {
|
||||
/**
|
||||
* Options which can be applied to trail particles - a location, color and duration.
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
public static class Trail {
|
||||
|
||||
private final Location target;
|
||||
|
||||
@@ -271,7 +271,6 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
|
||||
* @see JukeboxSong
|
||||
* @deprecated use {@link RegistryAccess#getRegistry(RegistryKey)} with {@link RegistryKey#JUKEBOX_SONG}
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
@Deprecated(since = "1.21")
|
||||
Registry<JukeboxSong> JUKEBOX_SONG = legacyRegistryFor(JukeboxSong.class);
|
||||
/**
|
||||
@@ -291,15 +290,15 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
|
||||
*
|
||||
* @see MemoryKey
|
||||
*/
|
||||
Registry<MemoryKey> MEMORY_MODULE_TYPE = new NotARegistry<>() {
|
||||
Registry<MemoryKey<?>> MEMORY_MODULE_TYPE = new NotARegistry<>() {
|
||||
|
||||
@Override
|
||||
public Iterator iterator() {
|
||||
public Iterator<MemoryKey<?>> iterator() {
|
||||
return MemoryKey.values().iterator();
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable MemoryKey get(final NamespacedKey key) {
|
||||
public @Nullable MemoryKey<?> get(final NamespacedKey key) {
|
||||
return MemoryKey.getByKey(key);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -43,6 +43,7 @@ import org.bukkit.inventory.InventoryHolder;
|
||||
import org.bukkit.inventory.ItemCraftResult;
|
||||
import org.bukkit.inventory.ItemFactory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.MenuType;
|
||||
import org.bukkit.inventory.Merchant;
|
||||
import org.bukkit.inventory.Recipe;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
@@ -1218,7 +1219,11 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||
* Sets the radius, in blocks, around each worlds spawn point to protect.
|
||||
*
|
||||
* @param value new spawn radius, or 0 if none
|
||||
* @deprecated has not functioned for a long time as the spawn radius is defined by the server.properties file.
|
||||
* There is no API replacement for this method. It is generally recommended to implement "protection"-like behaviour
|
||||
* via events or third-party plugin APIs.
|
||||
*/
|
||||
@Deprecated(since = "1.21.4", forRemoval = true)
|
||||
public void setSpawnRadius(int value);
|
||||
|
||||
/**
|
||||
@@ -1565,11 +1570,11 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||
* <br>
|
||||
* {@link InventoryType#WORKBENCH} will not process crafting recipes if
|
||||
* created with this method. Use
|
||||
* {@link Player#openWorkbench(Location, boolean)} instead.
|
||||
* {@link MenuType#CRAFTING} instead.
|
||||
* <br>
|
||||
* {@link InventoryType#ENCHANTING} will not process {@link ItemStack}s
|
||||
* for possible enchanting results. Use
|
||||
* {@link Player#openEnchanting(Location, boolean)} instead.
|
||||
* {@link MenuType#ENCHANTMENT} instead.
|
||||
*
|
||||
* @param owner the holder of the inventory, or null to indicate no holder
|
||||
* @param type the type of inventory to create
|
||||
@@ -1592,11 +1597,11 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||
* <br>
|
||||
* {@link InventoryType#WORKBENCH} will not process crafting recipes if
|
||||
* created with this method. Use
|
||||
* {@link Player#openWorkbench(Location, boolean)} instead.
|
||||
* {@link MenuType#CRAFTING} instead.
|
||||
* <br>
|
||||
* {@link InventoryType#ENCHANTING} will not process {@link ItemStack}s
|
||||
* for possible enchanting results. Use
|
||||
* {@link Player#openEnchanting(Location, boolean)} instead.
|
||||
* {@link MenuType#ENCHANTMENT} instead.
|
||||
*
|
||||
* @param owner The holder of the inventory; can be null if there's no holder.
|
||||
* @param type The type of inventory to create.
|
||||
@@ -1620,11 +1625,11 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||
* <br>
|
||||
* {@link InventoryType#WORKBENCH} will not process crafting recipes if
|
||||
* created with this method. Use
|
||||
* {@link Player#openWorkbench(Location, boolean)} instead.
|
||||
* {@link MenuType#CRAFTING} instead.
|
||||
* <br>
|
||||
* {@link InventoryType#ENCHANTING} will not process {@link ItemStack}s
|
||||
* for possible enchanting results. Use
|
||||
* {@link Player#openEnchanting(Location, boolean)} instead.
|
||||
* {@link MenuType#ENCHANTMENT} instead.
|
||||
*
|
||||
* @param owner The holder of the inventory; can be null if there's no holder.
|
||||
* @param type The type of inventory to create.
|
||||
@@ -1691,7 +1696,10 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||
* @param title the title of the corresponding merchant inventory, displayed
|
||||
* when the merchant inventory is viewed
|
||||
* @return a new merchant
|
||||
* @deprecated The title parameter is no-longer needed when used with
|
||||
* {@link MenuType#MERCHANT} and {@link MenuType.Typed#builder()}.
|
||||
*/
|
||||
@Deprecated(since = "1.21.4")
|
||||
@NotNull Merchant createMerchant(net.kyori.adventure.text.@Nullable Component title);
|
||||
// Paper start
|
||||
/**
|
||||
@@ -1700,7 +1708,8 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||
* @param title the title of the corresponding merchant inventory, displayed
|
||||
* when the merchant inventory is viewed
|
||||
* @return a new merchant
|
||||
* @deprecated in favour of {@link #createMerchant(net.kyori.adventure.text.Component)}
|
||||
* @deprecated in favour of {@link #createMerchant(net.kyori.adventure.text.Component)}, The title parameter is
|
||||
* no-longer needed when used with {@link MenuType#MERCHANT} and {@link MenuType.Typed#builder()}.
|
||||
*/
|
||||
@NotNull
|
||||
@Deprecated // Paper
|
||||
@@ -1715,6 +1724,14 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||
*/
|
||||
int getMaxChainedNeighborUpdates();
|
||||
|
||||
/**
|
||||
* Creates an empty merchant.
|
||||
*
|
||||
* @return a new merchant
|
||||
*/
|
||||
@NotNull
|
||||
Merchant createMerchant();
|
||||
|
||||
/**
|
||||
* Gets user-specified limit for number of monsters that can spawn in a
|
||||
* chunk.
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -7,92 +7,95 @@ import org.jetbrains.annotations.NotNull;
|
||||
* Represents a countable statistic, which is tracked by the server.
|
||||
*/
|
||||
public enum Statistic implements Keyed {
|
||||
DAMAGE_DEALT,
|
||||
DAMAGE_TAKEN,
|
||||
DEATHS,
|
||||
MOB_KILLS,
|
||||
PLAYER_KILLS,
|
||||
FISH_CAUGHT,
|
||||
// Start generate - StatisticCustom
|
||||
// @GeneratedFrom 1.21.4
|
||||
ANIMALS_BRED,
|
||||
LEAVE_GAME,
|
||||
JUMP,
|
||||
DROP_COUNT,
|
||||
DROP(Type.ITEM),
|
||||
PICKUP(Type.ITEM),
|
||||
/**
|
||||
* Name is misleading, actually records ticks played.
|
||||
*/
|
||||
PLAY_ONE_MINUTE,
|
||||
TOTAL_WORLD_TIME,
|
||||
WALK_ONE_CM,
|
||||
WALK_ON_WATER_ONE_CM,
|
||||
FALL_ONE_CM,
|
||||
SNEAK_TIME,
|
||||
CLIMB_ONE_CM,
|
||||
FLY_ONE_CM,
|
||||
WALK_UNDER_WATER_ONE_CM,
|
||||
MINECART_ONE_CM,
|
||||
BOAT_ONE_CM,
|
||||
PIG_ONE_CM,
|
||||
HORSE_ONE_CM,
|
||||
SPRINT_ONE_CM,
|
||||
CROUCH_ONE_CM,
|
||||
AVIATE_ONE_CM,
|
||||
MINE_BLOCK(Type.BLOCK),
|
||||
USE_ITEM(Type.ITEM),
|
||||
BREAK_ITEM(Type.ITEM),
|
||||
CRAFT_ITEM(Type.ITEM),
|
||||
KILL_ENTITY(Type.ENTITY),
|
||||
ENTITY_KILLED_BY(Type.ENTITY),
|
||||
TIME_SINCE_DEATH,
|
||||
TALKED_TO_VILLAGER,
|
||||
TRADED_WITH_VILLAGER,
|
||||
CAKE_SLICES_EATEN,
|
||||
CAULDRON_FILLED,
|
||||
CAULDRON_USED,
|
||||
BELL_RING,
|
||||
BOAT_ONE_CM,
|
||||
ARMOR_CLEANED,
|
||||
BANNER_CLEANED,
|
||||
BREWINGSTAND_INTERACTION,
|
||||
BEACON_INTERACTION,
|
||||
DROPPER_INSPECTED,
|
||||
HOPPER_INSPECTED,
|
||||
DISPENSER_INSPECTED,
|
||||
NOTEBLOCK_PLAYED,
|
||||
NOTEBLOCK_TUNED,
|
||||
FLOWER_POTTED,
|
||||
TRAPPED_CHEST_TRIGGERED,
|
||||
ENDERCHEST_OPENED,
|
||||
ITEM_ENCHANTED,
|
||||
RECORD_PLAYED,
|
||||
FURNACE_INTERACTION,
|
||||
CRAFTING_TABLE_INTERACTION,
|
||||
CHEST_OPENED,
|
||||
SLEEP_IN_BED,
|
||||
SHULKER_BOX_OPENED,
|
||||
TIME_SINCE_REST,
|
||||
SWIM_ONE_CM,
|
||||
CLEAN_SHULKER_BOX,
|
||||
CLIMB_ONE_CM,
|
||||
CROUCH_ONE_CM,
|
||||
DAMAGE_ABSORBED,
|
||||
DAMAGE_BLOCKED_BY_SHIELD,
|
||||
DAMAGE_DEALT,
|
||||
DAMAGE_DEALT_ABSORBED,
|
||||
DAMAGE_DEALT_RESISTED,
|
||||
DAMAGE_BLOCKED_BY_SHIELD,
|
||||
DAMAGE_ABSORBED,
|
||||
DAMAGE_RESISTED,
|
||||
CLEAN_SHULKER_BOX,
|
||||
OPEN_BARREL,
|
||||
DAMAGE_TAKEN,
|
||||
DEATHS,
|
||||
DROP_COUNT,
|
||||
CAKE_SLICES_EATEN,
|
||||
ITEM_ENCHANTED,
|
||||
FALL_ONE_CM,
|
||||
CAULDRON_FILLED,
|
||||
FISH_CAUGHT,
|
||||
FLY_ONE_CM,
|
||||
HORSE_ONE_CM,
|
||||
DISPENSER_INSPECTED,
|
||||
DROPPER_INSPECTED,
|
||||
HOPPER_INSPECTED,
|
||||
INTERACT_WITH_ANVIL,
|
||||
BEACON_INTERACTION,
|
||||
INTERACT_WITH_BLAST_FURNACE,
|
||||
INTERACT_WITH_SMOKER,
|
||||
INTERACT_WITH_LECTERN,
|
||||
BREWINGSTAND_INTERACTION,
|
||||
INTERACT_WITH_CAMPFIRE,
|
||||
INTERACT_WITH_CARTOGRAPHY_TABLE,
|
||||
CRAFTING_TABLE_INTERACTION,
|
||||
FURNACE_INTERACTION,
|
||||
INTERACT_WITH_GRINDSTONE,
|
||||
INTERACT_WITH_LECTERN,
|
||||
INTERACT_WITH_LOOM,
|
||||
INTERACT_WITH_SMITHING_TABLE,
|
||||
INTERACT_WITH_SMOKER,
|
||||
INTERACT_WITH_STONECUTTER,
|
||||
BELL_RING,
|
||||
JUMP,
|
||||
LEAVE_GAME,
|
||||
MINECART_ONE_CM,
|
||||
MOB_KILLS,
|
||||
OPEN_BARREL,
|
||||
CHEST_OPENED,
|
||||
ENDERCHEST_OPENED,
|
||||
SHULKER_BOX_OPENED,
|
||||
PIG_ONE_CM,
|
||||
NOTEBLOCK_PLAYED,
|
||||
RECORD_PLAYED,
|
||||
PLAY_ONE_MINUTE,
|
||||
PLAYER_KILLS,
|
||||
FLOWER_POTTED,
|
||||
RAID_TRIGGER,
|
||||
RAID_WIN,
|
||||
INTERACT_WITH_ANVIL,
|
||||
INTERACT_WITH_GRINDSTONE,
|
||||
SLEEP_IN_BED,
|
||||
SNEAK_TIME,
|
||||
SPRINT_ONE_CM,
|
||||
STRIDER_ONE_CM,
|
||||
SWIM_ONE_CM,
|
||||
TALKED_TO_VILLAGER,
|
||||
TARGET_HIT,
|
||||
INTERACT_WITH_SMITHING_TABLE,
|
||||
STRIDER_ONE_CM;
|
||||
TIME_SINCE_DEATH,
|
||||
TIME_SINCE_REST,
|
||||
TOTAL_WORLD_TIME,
|
||||
TRADED_WITH_VILLAGER,
|
||||
TRAPPED_CHEST_TRIGGERED,
|
||||
NOTEBLOCK_TUNED,
|
||||
CAULDRON_USED,
|
||||
WALK_ON_WATER_ONE_CM,
|
||||
WALK_ONE_CM,
|
||||
WALK_UNDER_WATER_ONE_CM,
|
||||
// End generate - StatisticCustom
|
||||
// Start generate - StatisticType
|
||||
// @GeneratedFrom 1.21.4
|
||||
BREAK_ITEM(Type.ITEM),
|
||||
CRAFT_ITEM(Type.ITEM),
|
||||
DROP(Type.ITEM),
|
||||
KILL_ENTITY(Type.ENTITY),
|
||||
ENTITY_KILLED_BY(Type.ENTITY),
|
||||
MINE_BLOCK(Type.BLOCK),
|
||||
PICKUP(Type.ITEM),
|
||||
USE_ITEM(Type.ITEM);
|
||||
// End generate - StatisticType
|
||||
|
||||
private final Type type;
|
||||
private final NamespacedKey key;
|
||||
|
||||
Loaded 100 of 978 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user