Update to Minecraft 1.21.5

This commit is contained in:
md_5 2025-03-26 03:05:00 +11:00
parent a3d67ef041
commit a6e485c28b
No known key found for this signature in database
GPG key ID: E8E901AC7C617C11
36 changed files with 1282 additions and 65 deletions

View file

@ -5,7 +5,7 @@
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
<version>1.21.4-R0.1-SNAPSHOT</version>
<version>1.21.5-R0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Bukkit</name>

View file

@ -55,6 +55,11 @@ public final class GameRule<T> {
*/
public static final GameRule<Boolean> DO_FIRE_TICK = new GameRule<>("doFireTick", Boolean.class);
/**
* Whether fire should spread and naturally extinguish when there are no players nearby.
*/
public static final GameRule<Boolean> ALLOW_FIRE_TICKS_AWAY_FROM_PLAYER = new GameRule<>("allowFireTicksAwayFromPlayer", Boolean.class);
/**
* Whether players should only be able to craft recipes they've unlocked
* first.
@ -220,6 +225,10 @@ public final class GameRule<T> {
* Whether ender pearls will vanish on player death.
*/
public static final GameRule<Boolean> ENDER_PEARLS_VANISH_ON_DEATH = new GameRule<>("enderPearlsVanishOnDeath", Boolean.class);
/**
* Whether TNT explodes.
*/
public static final GameRule<Boolean> TNT_EXPLODES = new GameRule<>("tntExplodes", Boolean.class);
// Numerical rules
/**

View file

@ -76,6 +76,7 @@ import org.bukkit.block.data.type.Jigsaw;
import org.bukkit.block.data.type.Jukebox;
import org.bukkit.block.data.type.Ladder;
import org.bukkit.block.data.type.Lantern;
import org.bukkit.block.data.type.LeafLitter;
import org.bukkit.block.data.type.Leaves;
import org.bukkit.block.data.type.Lectern;
import org.bukkit.block.data.type.Light;
@ -112,6 +113,7 @@ import org.bukkit.block.data.type.StructureBlock;
import org.bukkit.block.data.type.Switch;
import org.bukkit.block.data.type.TNT;
import org.bukkit.block.data.type.TechnicalPiston;
import org.bukkit.block.data.type.TestBlock;
import org.bukkit.block.data.type.TrapDoor;
import org.bukkit.block.data.type.TrialSpawner;
import org.bukkit.block.data.type.Tripwire;
@ -645,9 +647,13 @@ public enum Material implements Keyed, Translatable, RegistryAware {
COBWEB(9469),
SHORT_GRASS(16335),
FERN(15794),
BUSH(17693),
AZALEA(29386),
FLOWERING_AZALEA(28270),
DEAD_BUSH(22888),
FIREFLY_BUSH(26077),
SHORT_DRY_GRASS(6637),
TALL_DRY_GRASS(14832),
SEAGRASS(23942),
/**
* BlockData: {@link SeaPickle}
@ -717,6 +723,14 @@ public enum Material implements Keyed, Translatable, RegistryAware {
* BlockData: {@link PinkPetals}
*/
PINK_PETALS(10420, PinkPetals.class),
/**
* BlockData: {@link PinkPetals}
*/
WILDFLOWERS(27608, PinkPetals.class),
/**
* BlockData: {@link LeafLitter}
*/
LEAF_LITTER(22095, LeafLitter.class),
MOSS_CARPET(8221),
MOSS_BLOCK(9175),
/**
@ -938,6 +952,7 @@ public enum Material implements Keyed, Translatable, RegistryAware {
* BlockData: {@link Ageable}
*/
CACTUS(12191, Ageable.class),
CACTUS_FLOWER(29751),
CLAY(27880),
/**
* BlockData: {@link Jukebox}
@ -2394,6 +2409,11 @@ public enum Material implements Keyed, Translatable, RegistryAware {
* BlockData: {@link Jigsaw}
*/
JIGSAW(17398, Jigsaw.class),
/**
* BlockData: {@link TestBlock}
*/
TEST_BLOCK(30798, TestBlock.class),
TEST_INSTANCE_BLOCK(16508),
TURTLE_HELMET(30120, 1, 275),
TURTLE_SCUTE(6766),
ARMADILLO_SCUTE(11497),
@ -2605,6 +2625,8 @@ public enum Material implements Keyed, Translatable, RegistryAware {
BOOK(23097),
SLIME_BALL(5242),
EGG(21603, 16),
BLUE_EGG(11157, 16),
BROWN_EGG(14373, 16),
COMPASS(24139),
RECOVERY_COMPASS(12710),
BUNDLE(16835, 1),
@ -5538,6 +5560,8 @@ public enum Material implements Keyed, Translatable, RegistryAware {
case WOLF_ARMOR:
case YELLOW_CARPET:
return EquipmentSlot.BODY;
case SADDLE:
return EquipmentSlot.SADDLE;
default:
return EquipmentSlot.HAND;
// </editor-fold>

View file

@ -129,6 +129,10 @@ public enum Particle implements Keyed, RegistryAware {
SHRIEK("shriek", Integer.class),
CHERRY_LEAVES("cherry_leaves"),
PALE_OAK_LEAVES("pale_oak_leaves"),
/**
* Uses {@link Color} as DataType
*/
TINTED_LEAVES("tinted_leaves", Color.class),
EGG_CRACK("egg_crack"),
DUST_PLUME("dust_plume"),
WHITE_SMOKE("white_smoke"),
@ -161,7 +165,9 @@ public enum Particle implements Keyed, RegistryAware {
/**
* Uses {@link BlockData} as DataType
*/
BLOCK_MARKER("block_marker", BlockData.class);
BLOCK_MARKER("block_marker", BlockData.class),
FIREFLY("firefly"),
;
private final NamespacedKey key;
private final Class<?> dataType;

View file

@ -19,8 +19,11 @@ import org.bukkit.boss.KeyedBossBar;
import org.bukkit.damage.DamageType;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Cat;
import org.bukkit.entity.Chicken;
import org.bukkit.entity.Cow;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Frog;
import org.bukkit.entity.Pig;
import org.bukkit.entity.Villager;
import org.bukkit.entity.Wolf;
import org.bukkit.entity.memory.MemoryKey;
@ -161,6 +164,24 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
* @see Cat.Type
*/
Registry<Cat.Type> CAT_VARIANT = Objects.requireNonNull(Bukkit.getRegistry(Cat.Type.class), "No registry present for Cat Type. This is a bug.");
/**
* Server pig variants.
*
* @see Pig.Variant
*/
Registry<Pig.Variant> PIG_VARIANT = Objects.requireNonNull(Bukkit.getRegistry(Pig.Variant.class), "No registry present for Pig Variant. This is a bug.");
/**
* Server cow variants.
*
* @see Cow.Variant
*/
Registry<Cow.Variant> COW_VARIANT = Objects.requireNonNull(Bukkit.getRegistry(Cow.Variant.class), "No registry present for Cow Variant. This is a bug.");
/**
* Server chicken variants.
*
* @see Chicken.Variant
*/
Registry<Chicken.Variant> CHICKEN_VARIANT = Objects.requireNonNull(Bukkit.getRegistry(Chicken.Variant.class), "No registry present for Chicken Variant. This is a bug.");
/**
* Server enchantments.
*

View file

@ -145,6 +145,8 @@ public interface Sound extends OldEnum<Sound>, Keyed, RegistryAware {
Sound BLOCK_BUBBLE_COLUMN_UPWARDS_INSIDE = getSound("block.bubble_column.upwards_inside");
Sound BLOCK_BUBBLE_COLUMN_WHIRLPOOL_AMBIENT = getSound("block.bubble_column.whirlpool_ambient");
Sound BLOCK_BUBBLE_COLUMN_WHIRLPOOL_INSIDE = getSound("block.bubble_column.whirlpool_inside");
Sound BLOCK_CACTUS_FLOWER_BREAK = getSound("block.cactus_flower.break");
Sound BLOCK_CACTUS_FLOWER_PLACE = getSound("block.cactus_flower.place");
Sound BLOCK_CAKE_ADD_CANDLE = getSound("block.cake.add_candle");
Sound BLOCK_CALCITE_BREAK = getSound("block.calcite.break");
Sound BLOCK_CALCITE_FALL = getSound("block.calcite.fall");
@ -266,6 +268,7 @@ public interface Sound extends OldEnum<Sound>, Keyed, RegistryAware {
Sound BLOCK_CREAKING_HEART_SPAWN = getSound("block.creaking_heart.spawn");
Sound BLOCK_CREAKING_HEART_STEP = getSound("block.creaking_heart.step");
Sound BLOCK_CROP_BREAK = getSound("block.crop.break");
Sound BLOCK_DEADBUSH_IDLE = getSound("block.deadbush.idle");
Sound BLOCK_DECORATED_POT_BREAK = getSound("block.decorated_pot.break");
Sound BLOCK_DECORATED_POT_FALL = getSound("block.decorated_pot.fall");
Sound BLOCK_DECORATED_POT_HIT = getSound("block.decorated_pot.hit");
@ -310,6 +313,7 @@ public interface Sound extends OldEnum<Sound>, Keyed, RegistryAware {
Sound BLOCK_EYEBLOSSOM_OPEN_LONG = getSound("block.eyeblossom.open_long");
Sound BLOCK_FENCE_GATE_CLOSE = getSound("block.fence_gate.close");
Sound BLOCK_FENCE_GATE_OPEN = getSound("block.fence_gate.open");
Sound BLOCK_FIREFLY_BUSH_IDLE = getSound("block.firefly_bush.idle");
Sound BLOCK_FIRE_AMBIENT = getSound("block.fire.ambient");
Sound BLOCK_FIRE_EXTINGUISH = getSound("block.fire.extinguish");
Sound BLOCK_FLOWERING_AZALEA_BREAK = getSound("block.flowering_azalea.break");
@ -378,8 +382,13 @@ public interface Sound extends OldEnum<Sound>, Keyed, RegistryAware {
Sound BLOCK_HONEY_BLOCK_PLACE = getSound("block.honey_block.place");
Sound BLOCK_HONEY_BLOCK_SLIDE = getSound("block.honey_block.slide");
Sound BLOCK_HONEY_BLOCK_STEP = getSound("block.honey_block.step");
Sound BLOCK_IRON_BREAK = getSound("block.iron.break");
Sound BLOCK_IRON_DOOR_CLOSE = getSound("block.iron_door.close");
Sound BLOCK_IRON_DOOR_OPEN = getSound("block.iron_door.open");
Sound BLOCK_IRON_FALL = getSound("block.iron.fall");
Sound BLOCK_IRON_HIT = getSound("block.iron.hit");
Sound BLOCK_IRON_PLACE = getSound("block.iron.place");
Sound BLOCK_IRON_STEP = getSound("block.iron.step");
Sound BLOCK_IRON_TRAPDOOR_CLOSE = getSound("block.iron_trapdoor.close");
Sound BLOCK_IRON_TRAPDOOR_OPEN = getSound("block.iron_trapdoor.open");
Sound BLOCK_LADDER_BREAK = getSound("block.ladder.break");
@ -397,6 +406,11 @@ public interface Sound extends OldEnum<Sound>, Keyed, RegistryAware {
Sound BLOCK_LAVA_AMBIENT = getSound("block.lava.ambient");
Sound BLOCK_LAVA_EXTINGUISH = getSound("block.lava.extinguish");
Sound BLOCK_LAVA_POP = getSound("block.lava.pop");
Sound BLOCK_LEAF_LITTER_BREAK = getSound("block.leaf_litter.break");
Sound BLOCK_LEAF_LITTER_STEP = getSound("block.leaf_litter.step");
Sound BLOCK_LEAF_LITTER_PLACE = getSound("block.leaf_litter.place");
Sound BLOCK_LEAF_LITTER_HIT = getSound("block.leaf_litter.hit");
Sound BLOCK_LEAF_LITTER_FALL = getSound("block.leaf_litter.fall");
Sound BLOCK_LEVER_CLICK = getSound("block.lever.click");
Sound BLOCK_LILY_PAD_PLACE = getSound("block.lily_pad.place");
Sound BLOCK_LODESTONE_BREAK = getSound("block.lodestone.break");
@ -590,8 +604,10 @@ public interface Sound extends OldEnum<Sound>, Keyed, RegistryAware {
Sound BLOCK_SAND_BREAK = getSound("block.sand.break");
Sound BLOCK_SAND_FALL = getSound("block.sand.fall");
Sound BLOCK_SAND_HIT = getSound("block.sand.hit");
Sound BLOCK_SAND_IDLE = getSound("block.sand.idle");
Sound BLOCK_SAND_PLACE = getSound("block.sand.place");
Sound BLOCK_SAND_STEP = getSound("block.sand.step");
Sound BLOCK_SAND_WIND = getSound("block.sand.wind");
Sound BLOCK_SCAFFOLDING_BREAK = getSound("block.scaffolding.break");
Sound BLOCK_SCAFFOLDING_FALL = getSound("block.scaffolding.fall");
Sound BLOCK_SCAFFOLDING_HIT = getSound("block.scaffolding.hit");
@ -1477,11 +1493,46 @@ public interface Sound extends OldEnum<Sound>, Keyed, RegistryAware {
Sound ENTITY_WITHER_SKELETON_STEP = getSound("entity.wither_skeleton.step");
Sound ENTITY_WITHER_SPAWN = getSound("entity.wither.spawn");
Sound ENTITY_WOLF_AMBIENT = getSound("entity.wolf.ambient");
Sound ENTITY_WOLF_ANGRY_AMBIENT = getSound("entity.wolf_angry.ambient");
Sound ENTITY_WOLF_ANGRY_DEATH = getSound("entity.wolf_angry.death");
Sound ENTITY_WOLF_ANGRY_GROWL = getSound("entity.wolf_angry.growl");
Sound ENTITY_WOLF_ANGRY_HURT = getSound("entity.wolf_angry.hurt");
Sound ENTITY_WOLF_ANGRY_PANT = getSound("entity.wolf_angry.pant");
Sound ENTITY_WOLF_ANGRY_WHINE = getSound("entity.wolf_angry.whine");
Sound ENTITY_WOLF_BIG_AMBIENT = getSound("entity.wolf_big.ambient");
Sound ENTITY_WOLF_BIG_DEATH = getSound("entity.wolf_big.death");
Sound ENTITY_WOLF_BIG_GROWL = getSound("entity.wolf_big.growl");
Sound ENTITY_WOLF_BIG_HURT = getSound("entity.wolf_big.hurt");
Sound ENTITY_WOLF_BIG_PANT = getSound("entity.wolf_big.pant");
Sound ENTITY_WOLF_BIG_WHINE = getSound("entity.wolf_big.whine");
Sound ENTITY_WOLF_CUTE_AMBIENT = getSound("entity.wolf_cute.ambient");
Sound ENTITY_WOLF_CUTE_DEATH = getSound("entity.wolf_cute.death");
Sound ENTITY_WOLF_CUTE_GROWL = getSound("entity.wolf_cute.growl");
Sound ENTITY_WOLF_CUTE_HURT = getSound("entity.wolf_cute.hurt");
Sound ENTITY_WOLF_CUTE_PANT = getSound("entity.wolf_cute.pant");
Sound ENTITY_WOLF_CUTE_WHINE = getSound("entity.wolf_cute.whine");
Sound ENTITY_WOLF_DEATH = getSound("entity.wolf.death");
Sound ENTITY_WOLF_GROWL = getSound("entity.wolf.growl");
Sound ENTITY_WOLF_HOWL = getSound("entity.wolf.howl");
Sound ENTITY_WOLF_GRUMPY_AMBIENT = getSound("entity.wolf_grumpy.ambient");
Sound ENTITY_WOLF_GRUMPY_DEATH = getSound("entity.wolf_grumpy.death");
Sound ENTITY_WOLF_GRUMPY_GROWL = getSound("entity.wolf_grumpy.growl");
Sound ENTITY_WOLF_GRUMPY_HURT = getSound("entity.wolf_grumpy.hurt");
Sound ENTITY_WOLF_GRUMPY_PANT = getSound("entity.wolf_grumpy.pant");
Sound ENTITY_WOLF_GRUMPY_WHINE = getSound("entity.wolf_grumpy.whine");
Sound ENTITY_WOLF_HURT = getSound("entity.wolf.hurt");
Sound ENTITY_WOLF_PANT = getSound("entity.wolf.pant");
Sound ENTITY_WOLF_PUGLIN_AMBIENT = getSound("entity.wolf_puglin.ambient");
Sound ENTITY_WOLF_PUGLIN_DEATH = getSound("entity.wolf_puglin.death");
Sound ENTITY_WOLF_PUGLIN_GROWL = getSound("entity.wolf_puglin.growl");
Sound ENTITY_WOLF_PUGLIN_HURT = getSound("entity.wolf_puglin.hurt");
Sound ENTITY_WOLF_PUGLIN_PANT = getSound("entity.wolf_puglin.pant");
Sound ENTITY_WOLF_PUGLIN_WHINE = getSound("entity.wolf_puglin.whine");
Sound ENTITY_WOLF_SAD_AMBIENT = getSound("entity.wolf_sad.ambient");
Sound ENTITY_WOLF_SAD_DEATH = getSound("entity.wolf_sad.death");
Sound ENTITY_WOLF_SAD_GROWL = getSound("entity.wolf_sad.growl");
Sound ENTITY_WOLF_SAD_HURT = getSound("entity.wolf_sad.hurt");
Sound ENTITY_WOLF_SAD_PANT = getSound("entity.wolf_sad.pant");
Sound ENTITY_WOLF_SAD_WHINE = getSound("entity.wolf_sad.whine");
Sound ENTITY_WOLF_SHAKE = getSound("entity.wolf.shake");
Sound ENTITY_WOLF_STEP = getSound("entity.wolf.step");
Sound ENTITY_WOLF_WHINE = getSound("entity.wolf.whine");

View file

@ -452,8 +452,14 @@ public interface Tag<T extends Keyed> extends Keyed {
* Vanilla block tag representing all unstable bottom center blocks.
*/
Tag<Material> UNSTABLE_BOTTOM_CENTER = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("unstable_bottom_center"), Material.class);
/**
* Vanilla block tag representing all blocks which mushrooms may grow on.
*/
Tag<Material> MUSHROOM_GROW_BLOCK = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("mushroom_grow_block"), Material.class);
/**
* Vanilla block tag representing all blocks which may be eaten by sheep.
*/
Tag<Material> EDIBLE_FOR_SHEEP = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("edible_for_sheep"), Material.class);
/**
* Vanilla block tag representing all blocks that burn forever in the
* overworld.
@ -583,6 +589,10 @@ public interface Tag<T extends Keyed> extends Keyed {
* Vanilla block tag representing all blocks that can be efficiently mined with a sword.
*/
Tag<Material> SWORD_EFFICIENT = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("sword_efficient"), Material.class);
/**
* Vanilla block tag representing all blocks that can be instantly mined with a sword.
*/
Tag<Material> SWORD_INSTANTLY_MINES = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("sword_instantly_mines"), Material.class);
/**
* Vanilla block tag representing all blocks which require a diamond tool.
*/
@ -704,6 +714,10 @@ public interface Tag<T extends Keyed> extends Keyed {
* Vanilla block tag representing all blocks which bats will spawn on.
*/
Tag<Material> BATS_SPAWNABLE_ON = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("bats_spawnable_on"), Material.class);
/**
* Vanilla block tag representing all blocks which camels will spawn on.
*/
Tag<Material> CAMELS_SPAWNABLE_ON = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("camels_spawnable_on"), Material.class);
/**
* Vanilla block tag representing all blocks which azaleas will grow on.
*/
@ -723,10 +737,18 @@ public interface Tag<T extends Keyed> extends Keyed {
*/
Tag<Material> MANGROVE_ROOTS_CAN_GROW_THROUGH = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("mangrove_roots_can_grow_through"), Material.class);
/**
* Vanilla block tag representing all blocks which dead bushes may be placed
* Vanilla block tag representing all blocks which dry vegetation may be placed
* on.
*/
Tag<Material> DEAD_BUSH_MAY_PLACE_ON = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("dead_bush_may_place_on"), Material.class);
Tag<Material> DRY_VEGETATION_MAY_PLACE_ON = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("dry_vegetation_may_place_on"), Material.class);
/**
* Vanilla block tag representing all blocks which dead bushes may be placed
* on.
*
* @deprecated use {@link #DRY_VEGETATION_MAY_PLACE_ON}
*/
@Deprecated(since = "1.21.5")
Tag<Material> DEAD_BUSH_MAY_PLACE_ON = DRY_VEGETATION_MAY_PLACE_ON;
/**
* Vanilla block tag representing all blocks which snap dropped goat horns.
*/
@ -735,6 +757,10 @@ public interface Tag<T extends Keyed> extends Keyed {
* Vanilla block tag representing all blocks replaceable by growing trees.
*/
Tag<Material> REPLACEABLE_BY_TREES = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("replaceable_by_trees"), Material.class);
/**
* Vanilla block tag representing all blocks replaceable by growing mushrooms.
*/
Tag<Material> REPLACEABLE_BY_MUSHROOMS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("replaceable_by_mushrooms"), Material.class);
/**
* Vanilla block tag representing blocks which snow cannot survive on.
*/
@ -783,6 +809,10 @@ public interface Tag<T extends Keyed> extends Keyed {
* Vanilla block tag representing solid blocks which do not block hopper operation.
*/
Tag<Material> DOES_NOT_BLOCK_HOPPERS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("does_not_block_hoppers"), Material.class);
/**
* Vanilla block tag representing all blocks that will play ambient desert block sounds.
*/
Tag<Material> PLAYS_AMBIENT_DESERT_BLOCK_SOUNDS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("plays_ambient_desert_block_sounds"), Material.class);
/**
* Vanilla block tag representing all blocks that resemble air.
*/
@ -811,6 +841,10 @@ public interface Tag<T extends Keyed> extends Keyed {
* Vanilla item tag representing all brewing stand fuel items.
*/
Tag<Material> ITEMS_BREWING_FUEL = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("brewing_fuel"), Material.class);
/**
* Vanilla item tag representing all eggs.
*/
Tag<Material> ITEMS_EGGS = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("eggs"), Material.class);
/**
* Vanilla item tag representing all meat.
*/
@ -1155,6 +1189,10 @@ public interface Tag<T extends Keyed> extends Keyed {
* Vanilla item tag representing all bundle items.
*/
Tag<Material> ITEMS_BUNDLES = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("bundles"), Material.class);
/**
* Vanilla item tag representing all booking cloning target items.
*/
Tag<Material> ITEMS_BOOK_CLONING_TARGET = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("book_cloning_target"), Material.class);
/**
* Vanilla item tag representing all skeleton preferred weapons.
*/
@ -1422,6 +1460,14 @@ public interface Tag<T extends Keyed> extends Keyed {
* Vanilla tag representing all projectiles which can be punched back.
*/
Tag<EntityType> ENTITY_TYPES_REDIRECTABLE_PROJECTILE = Bukkit.getTag(REGISTRY_ENTITY_TYPES, NamespacedKey.minecraft("redirectable_projectile"), EntityType.class);
/**
* Vanilla tag representing all projectiles which can be punched back.
*/
Tag<EntityType> ENTITY_TYPES_CAN_EQUIP_SADDLE = Bukkit.getTag(REGISTRY_ENTITY_TYPES, NamespacedKey.minecraft("can_equip_saddle"), EntityType.class);
/**
* Vanilla tag representing all projectiles which can be punched back.
*/
Tag<EntityType> ENTITY_TYPES_CAN_WEAR_HORSE_ARMOR = Bukkit.getTag(REGISTRY_ENTITY_TYPES, NamespacedKey.minecraft("can_wear_horse_armor"), EntityType.class);
/**
* Returns whether or not this tag has an entry for the specified item.

View file

@ -70,6 +70,7 @@ import org.bukkit.block.data.type.Jigsaw;
import org.bukkit.block.data.type.Jukebox;
import org.bukkit.block.data.type.Ladder;
import org.bukkit.block.data.type.Lantern;
import org.bukkit.block.data.type.LeafLitter;
import org.bukkit.block.data.type.Leaves;
import org.bukkit.block.data.type.Lectern;
import org.bukkit.block.data.type.Light;
@ -106,6 +107,7 @@ import org.bukkit.block.data.type.StructureBlock;
import org.bukkit.block.data.type.Switch;
import org.bukkit.block.data.type.TNT;
import org.bukkit.block.data.type.TechnicalPiston;
import org.bukkit.block.data.type.TestBlock;
import org.bukkit.block.data.type.TrapDoor;
import org.bukkit.block.data.type.TrialSpawner;
import org.bukkit.block.data.type.Tripwire;
@ -578,6 +580,9 @@ public interface BlockType extends Keyed, Translatable, RegistryAware {
BlockType.Typed<BlockData> SHORT_GRASS = getBlockType("short_grass");
BlockType.Typed<BlockData> FERN = getBlockType("fern");
BlockType.Typed<BlockData> DEAD_BUSH = getBlockType("dead_bush");
BlockType.Typed<BlockData> BUSH = getBlockType("bush");
BlockType.Typed<BlockData> SHORT_DRY_GRASS = getBlockType("short_dry_grass");
BlockType.Typed<BlockData> TALL_DRY_GRASS = getBlockType("tall_dry_grass");
BlockType.Typed<BlockData> SEAGRASS = getBlockType("seagrass");
/**
* BlockData: {@link Bisected}
@ -958,6 +963,7 @@ public interface BlockType extends Keyed, Translatable, RegistryAware {
* BlockData: {@link Ageable}
*/
BlockType.Typed<Ageable> CACTUS = getBlockType("cactus");
BlockType.Typed<BlockData> CACTUS_FLOWER = getBlockType("cactus_flower");
BlockType.Typed<BlockData> CLAY = getBlockType("clay");
/**
* BlockData: {@link Ageable}
@ -2738,6 +2744,11 @@ public interface BlockType extends Keyed, Translatable, RegistryAware {
* BlockData: {@link Jigsaw}
*/
BlockType.Typed<Jigsaw> JIGSAW = getBlockType("jigsaw");
/**
* BlockData: {@link TestBlock}
*/
BlockType.Typed<TestBlock> TEST_BLOCK = getBlockType("test_block");
BlockType.Typed<BlockData> TEST_INSTANCE_BLOCK = getBlockType("test_instance_block");
/**
* BlockData: {@link Levelled}
*/
@ -3282,6 +3293,14 @@ public interface BlockType extends Keyed, Translatable, RegistryAware {
* BlockData: {@link PinkPetals}
*/
BlockType.Typed<PinkPetals> PINK_PETALS = getBlockType("pink_petals");
/**
* BlockData: {@link PinkPetals}
*/
BlockType.Typed<PinkPetals> WILDFLOWERS = getBlockType("wildflowers");
/**
* BlockData: {@link LeafLitter}
*/
BlockType.Typed<LeafLitter> LEAF_LITTER = getBlockType("leaf_litter");
BlockType.Typed<BlockData> MOSS_CARPET = getBlockType("moss_carpet");
BlockType.Typed<BlockData> MOSS_BLOCK = getBlockType("moss_block");
/**
@ -3418,6 +3437,7 @@ public interface BlockType extends Keyed, Translatable, RegistryAware {
BlockType.Typed<BlockData> CLOSED_EYEBLOSSOM = getBlockType("closed_eyeblossom");
BlockType.Typed<BlockData> POTTED_OPEN_EYEBLOSSOM = getBlockType("potted_open_eyeblossom");
BlockType.Typed<BlockData> POTTED_CLOSED_EYEBLOSSOM = getBlockType("potted_closed_eyeblossom");
BlockType.Typed<BlockData> FIREFLY_BUSH = getBlockType("firefly_bush");
//</editor-fold>
@NotNull

View file

@ -0,0 +1,7 @@
package org.bukkit.block;
/**
* Represents a captured state of a test block.
*/
public interface TestBlock extends TileState {
}

View file

@ -0,0 +1,7 @@
package org.bukkit.block;
/**
* Represents a captured state of a test instance block.
*/
public interface TestInstance extends TileState {
}

View file

@ -2,9 +2,10 @@ package org.bukkit.block.data.type;
import org.bukkit.block.data.Orientable;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
/**
* 'active' is whether the block is active.
* 'creaking_heart_state' indicates the current operational phase of the block.
* <br>
* 'natural' is whether this is a naturally generated block.
*/
@ -15,14 +16,18 @@ public interface CreakingHeart extends Orientable {
* Gets the value of the 'active' property.
*
* @return the 'active' value
* @deprecated use {@link #getCreakingHeartState()}
*/
@Deprecated(since = "1.21.5")
boolean isActive();
/**
* Sets the value of the 'active' property.
*
* @param active the new 'active' value
* @deprecated use {@link #setCreakingHeartState(org.bukkit.block.data.type.CreakingHeart.State)}
*/
@Deprecated(since = "1.21.5")
void setActive(boolean active);
/**
@ -38,4 +43,26 @@ public interface CreakingHeart extends Orientable {
* @param natural the new 'natural' value
*/
void setNatural(boolean natural);
/**
* Gets the value of the 'creaking_heart_state' property.
*
* @return the 'creaking_heart_state' value
*/
@NotNull
State getCreakingHeartState();
/**
* Sets the value of the 'creaking_heart_state' property.
*
* @param state the new 'creaking_heart_state' value
*/
void setCreakingHeartState(@NotNull State state);
public enum State {
UPROOTED,
DORMANT,
AWAKE;
}
}

View file

@ -0,0 +1,30 @@
package org.bukkit.block.data.type;
import org.bukkit.block.data.Directional;
/**
* 'flower_amount' represents the number of petals.
*/
public interface FlowerBed extends Directional {
/**
* Gets the value of the 'flower_amount' property.
*
* @return the 'flower_amount' value
*/
int getFlowerAmount();
/**
* Sets the value of the 'flower_amount' property.
*
* @param flower_amount the new 'flower_amount' value
*/
void setFlowerAmount(int flower_amount);
/**
* Gets the maximum allowed value of the 'flower_amount' property.
*
* @return the maximum 'flower_amount' value
*/
int getMaximumFlowerAmount();
}

View file

@ -0,0 +1,30 @@
package org.bukkit.block.data.type;
import org.bukkit.block.data.Directional;
/**
* 'segment_amount' represents the number of segments.
*/
public interface LeafLitter extends Directional {
/**
* Gets the value of the 'segment_amount' property.
*
* @return the 'segment_amount' value
*/
int getSegmentAmount();
/**
* Sets the value of the 'segment_amount' property.
*
* @param segment_amount the new 'segment_amount' value
*/
void setSegmentAmount(int segment_amount);
/**
* Gets the maximum allowed value of the 'segment_amount' property.
*
* @return the maximum 'segment_amount' value
*/
int getMaximumSegmentAmount();
}

View file

@ -1,30 +1,8 @@
package org.bukkit.block.data.type;
import org.bukkit.block.data.Directional;
/**
* 'flower_amount' represents the number of petals.
* @deprecated use parent class {@link FlowerBed}
*/
public interface PinkPetals extends Directional {
/**
* Gets the value of the 'flower_amount' property.
*
* @return the 'flower_amount' value
*/
int getFlowerAmount();
/**
* Sets the value of the 'flower_amount' property.
*
* @param flower_amount the new 'flower_amount' value
*/
void setFlowerAmount(int flower_amount);
/**
* Gets the maximum allowed value of the 'flower_amount' property.
*
* @return the maximum 'flower_amount' value
*/
int getMaximumFlowerAmount();
@Deprecated(since = "1.21.5")
public interface PinkPetals extends FlowerBed {
}

View file

@ -0,0 +1,48 @@
package org.bukkit.block.data.type;
import org.bukkit.block.data.BlockData;
import org.jetbrains.annotations.NotNull;
/**
* 'mode' indicates what mode this test block is in.
*/
public interface TestBlock extends BlockData {
/**
* Gets the value of the 'mode' property.
*
* @return the 'mode' value
*/
@NotNull
Mode getMode();
/**
* Sets the value of the 'mode' property.
*
* @param mode the new 'mode' value
*/
void setMode(@NotNull Mode mode);
/**
* The mode in which a comparator will operate in.
*/
public enum Mode {
/**
* Triggers a redstone pulse when the test starts.
*/
START,
/**
* Logs a message to the log file when powered by redstone.
*/
LOG,
/**
* Fails the test when powered by redstone.
*/
FAIL,
/**
* Completes the test when powered by redstone.
*/
ACCEPT;
}
}

View file

@ -0,0 +1,6 @@
package org.bukkit.entity;
/**
* Represents a Cow.
*/
public interface AbstractCow extends Animals {}

View file

@ -1,6 +1,55 @@
package org.bukkit.entity;
import org.bukkit.Keyed;
import org.bukkit.NamespacedKey;
import org.bukkit.Registry;
import org.bukkit.registry.RegistryAware;
import org.jetbrains.annotations.NotNull;
/**
* Represents a Chicken.
*/
public interface Chicken extends Animals {}
public interface Chicken extends Animals {
/**
* Get the variant of this chicken.
*
* @return chicken variant
*/
@NotNull
Variant getVariant();
/**
* Set the variant of this chicken.
*
* @param variant chicken variant
*/
void setVariant(@NotNull Variant variant);
/**
* Represents the variant of a chicken.
*/
interface Variant extends Keyed, RegistryAware {
Variant TEMPERATE = getType("temperate");
Variant WARM = getType("warm");
Variant COLD = getType("cold");
/**
* {@inheritDoc}
*
* @see #getKeyOrThrow()
* @see #isRegistered()
* @deprecated A key might not always be present, use {@link #getKeyOrThrow()} instead.
*/
@NotNull
@Override
@Deprecated(since = "1.21.5")
NamespacedKey getKey();
@NotNull
private static Variant getType(@NotNull String key) {
return Registry.CHICKEN_VARIANT.getOrThrow(NamespacedKey.minecraft(key));
}
}
}

View file

@ -1,6 +1,55 @@
package org.bukkit.entity;
import org.bukkit.Keyed;
import org.bukkit.NamespacedKey;
import org.bukkit.Registry;
import org.bukkit.registry.RegistryAware;
import org.jetbrains.annotations.NotNull;
/**
* Represents a Cow.
* Represents a regular Cow.
*/
public interface Cow extends Animals {}
public interface Cow extends AbstractCow {
/**
* Get the variant of this cow.
*
* @return cow variant
*/
@NotNull
Variant getVariant();
/**
* Set the variant of this cow.
*
* @param variant cow variant
*/
void setVariant(@NotNull Variant variant);
/**
* Represents the variant of a cow.
*/
interface Variant extends Keyed, RegistryAware {
Variant TEMPERATE = getType("temperate");
Variant WARM = getType("warm");
Variant COLD = getType("cold");
/**
* {@inheritDoc}
*
* @see #getKeyOrThrow()
* @see #isRegistered()
* @deprecated A key might not always be present, use {@link #getKeyOrThrow()} instead.
*/
@NotNull
@Override
@Deprecated(since = "1.21.5")
NamespacedKey getKey();
@NotNull
private static Variant getType(@NotNull String key) {
return Registry.COW_VARIANT.getOrThrow(NamespacedKey.minecraft(key));
}
}
}

View file

@ -113,7 +113,11 @@ public enum EntityType implements Keyed, Translatable, RegistryAware {
/**
* A flying splash potion.
*/
POTION("potion", ThrownPotion.class, 16),
SPLASH_POTION("splash_potion", SplashPotion.class, 16),
/**
* A flying lingering splash potion.
*/
LINGERING_POTION("lingering_potion", LingeringPotion.class, -1),
/**
* A flying experience bottle.
*/

View file

@ -2,8 +2,5 @@ package org.bukkit.entity;
/**
* Represents a thrown lingering potion bottle
*
* @deprecated lingering status depends on only on the potion item.
*/
@Deprecated(since = "1.20.5")
public interface LingeringPotion extends ThrownPotion { }

View file

@ -6,9 +6,9 @@ import org.bukkit.potion.PotionEffectType;
import org.jetbrains.annotations.NotNull;
/**
* Represents a mushroom {@link Cow}
* Represents a mushroom {@link AbstractCow}
*/
public interface MushroomCow extends Cow {
public interface MushroomCow extends AbstractCow {
/**
* Checks for the presence of custom potion effects to be applied to the

View file

@ -1,6 +1,55 @@
package org.bukkit.entity;
import org.bukkit.Keyed;
import org.bukkit.NamespacedKey;
import org.bukkit.Registry;
import org.bukkit.registry.RegistryAware;
import org.jetbrains.annotations.NotNull;
/**
* Represents a Pig.
*/
public interface Pig extends Steerable, Vehicle { }
public interface Pig extends Steerable, Vehicle {
/**
* Get the variant of this pig.
*
* @return pig variant
*/
@NotNull
Variant getVariant();
/**
* Set the variant of this pig.
*
* @param variant pig variant
*/
void setVariant(@NotNull Variant variant);
/**
* Represents the variant of a pig.
*/
interface Variant extends Keyed, RegistryAware {
Variant TEMPERATE = getType("temperate");
Variant WARM = getType("warm");
Variant COLD = getType("cold");
/**
* {@inheritDoc}
*
* @see #getKeyOrThrow()
* @see #isRegistered()
* @deprecated A key might not always be present, use {@link #getKeyOrThrow()} instead.
*/
@NotNull
@Override
@Deprecated(since = "1.21.5")
NamespacedKey getKey();
@NotNull
private static Variant getType(@NotNull String key) {
return Registry.PIG_VARIANT.getOrThrow(NamespacedKey.minecraft(key));
}
}
}

View file

@ -2,8 +2,5 @@ package org.bukkit.entity;
/**
* Represents a thrown splash potion bottle
*
* @deprecated splash status depends on only on the potion item.
*/
@Deprecated(since = "1.14")
public interface SplashPotion extends ThrownPotion { }

View file

@ -15,7 +15,11 @@ public enum EquipmentSlot {
/**
* Only for certain entities such as horses and wolves.
*/
BODY(() -> EquipmentSlotGroup.ARMOR);
BODY(() -> EquipmentSlotGroup.ARMOR),
/**
* Only for certain entities such as horses and pigs.
*/
SADDLE(() -> EquipmentSlotGroup.ARMOR);
private final Supplier<EquipmentSlotGroup> group; // Supplier because of class loading order, since EquipmentSlot and EquipmentSlotGroup reference each other on class init

View file

@ -26,6 +26,7 @@ public final class EquipmentSlotGroup implements Predicate<EquipmentSlot> {
public static final EquipmentSlotGroup CHEST = get("chest", EquipmentSlot.CHEST);
public static final EquipmentSlotGroup HEAD = get("head", EquipmentSlot.HEAD);
public static final EquipmentSlotGroup ARMOR = get("armor", (test) -> test == EquipmentSlot.FEET || test == EquipmentSlot.LEGS || test == EquipmentSlot.CHEST || test == EquipmentSlot.HEAD, EquipmentSlot.CHEST);
public static final EquipmentSlotGroup SADDLE = get("saddle", EquipmentSlot.SADDLE);
//
private final String key;
private final Predicate<EquipmentSlot> predicate;

View file

@ -1,5 +1,9 @@
package org.bukkit.inventory;
import org.bukkit.NamespacedKey;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.Nullable;
/**
* A ItemFlag can hide some Attributes from ItemStacks
*/
@ -37,5 +41,214 @@ public enum ItemFlag {
/**
* Setting to show/hide armor trim from leather armor.
*/
HIDE_ARMOR_TRIM;
HIDE_ARMOR_TRIM,
// Component flags
@ApiStatus.Experimental
HIDE_CUSTOM_DATA("custom_data"),
@ApiStatus.Experimental
HIDE_MAX_STACK_SIZE("max_stack_size"),
@ApiStatus.Experimental
HIDE_MAX_DAMAGE("max_damage"),
@ApiStatus.Experimental
HIDE_DAMAGE("damage"),
// @ApiStatus.Experimental
// HIDE_UNBREAKABLE("unbreakable"),
@ApiStatus.Experimental
HIDE_CUSTOM_NAME("custom_name"),
@ApiStatus.Experimental
HIDE_ITEM_NAME("item_name"),
@ApiStatus.Experimental
HIDE_ITEM_MODEL("item_model"),
@ApiStatus.Experimental
HIDE_LORE("lore"),
@ApiStatus.Experimental
HIDE_RARITY("rarity"),
@ApiStatus.Experimental
HIDE_ENCHANTMENTS("enchantments"),
@ApiStatus.Experimental
HIDE_CAN_PLACE_ON("can_place_on"),
@ApiStatus.Experimental
HIDE_CAN_BREAK("can_break"),
@ApiStatus.Experimental
HIDE_ATTRIBUTE_MODIFIERS("attribute_modifiers"),
@ApiStatus.Experimental
HIDE_CUSTOM_MODEL_DATA("custom_model_data"),
@ApiStatus.Experimental
HIDE_TOOLTIP_DISPLAY("tooltip_display"),
@ApiStatus.Experimental
HIDE_REPAIR_COST("repair_cost"),
@ApiStatus.Experimental
HIDE_CREATIVE_SLOT_LOCK("creative_slot_lock"),
@ApiStatus.Experimental
HIDE_ENCHANTMENT_GLINT_OVERRIDE("enchantment_glint_override"),
@ApiStatus.Experimental
HIDE_INTANGIBLE_PROJECTILE("intangible_projectile"),
@ApiStatus.Experimental
HIDE_FOOD("food"),
@ApiStatus.Experimental
HIDE_CONSUMABLE("consumable"),
@ApiStatus.Experimental
HIDE_USE_REMAINDER("use_remainder"),
@ApiStatus.Experimental
HIDE_USE_COOLDOWN("use_cooldown"),
@ApiStatus.Experimental
HIDE_DAMAGE_RESISTANT("damage_resistant"),
@ApiStatus.Experimental
HIDE_TOOL("tool"),
@ApiStatus.Experimental
HIDE_WEAPON("weapon"),
@ApiStatus.Experimental
HIDE_ENCHANTABLE("enchantable"),
@ApiStatus.Experimental
HIDE_EQUIPPABLE("equippable"),
@ApiStatus.Experimental
HIDE_REPAIRABLE("repairable"),
@ApiStatus.Experimental
HIDE_GLIDER("glider"),
@ApiStatus.Experimental
HIDE_TOOLTIP_STYLE("tooltip_style"),
@ApiStatus.Experimental
HIDE_DEATH_PROTECTION("death_protection"),
@ApiStatus.Experimental
HIDE_BLOCKS_ATTACKS("blocks_attacks"),
@ApiStatus.Experimental
HIDE_STORED_ENCHANTMENTS("stored_enchantments"),
@ApiStatus.Experimental
HIDE_DYED_COLOR("dyed_color"),
@ApiStatus.Experimental
HIDE_MAP_COLOR("map_color"),
@ApiStatus.Experimental
HIDE_MAP_ID("map_id"),
@ApiStatus.Experimental
HIDE_MAP_DECORATIONS("map_decorations"),
@ApiStatus.Experimental
HIDE_MAP_POST_PROCESSING("map_post_processing"),
@ApiStatus.Experimental
HIDE_CHARGED_PROJECTILES("charged_projectiles"),
@ApiStatus.Experimental
HIDE_BUNDLE_CONTENTS("bundle_contents"),
@ApiStatus.Experimental
HIDE_POTION_CONTENTS("potion_contents"),
@ApiStatus.Experimental
HIDE_POTION_DURATION_SCALE("potion_duration_scale"),
@ApiStatus.Experimental
HIDE_SUSPICIOUS_STEW_EFFECTS("suspicious_stew_effects"),
@ApiStatus.Experimental
HIDE_WRITABLE_BOOK_CONTENT("writable_book_content"),
@ApiStatus.Experimental
HIDE_WRITTEN_BOOK_CONTENT("written_book_content"),
@ApiStatus.Experimental
HIDE_TRIM("trim"),
@ApiStatus.Experimental
HIDE_DEBUG_STICK_STATE("debug_stick_state"),
@ApiStatus.Experimental
HIDE_ENTITY_DATA("entity_data"),
@ApiStatus.Experimental
HIDE_BUCKET_ENTITY_DATA("bucket_entity_data"),
@ApiStatus.Experimental
HIDE_BLOCK_ENTITY_DATA("block_entity_data"),
@ApiStatus.Experimental
HIDE_INSTRUMENT("instrument"),
@ApiStatus.Experimental
HIDE_PROVIDES_TRIM_MATERIAL("provides_trim_material"),
@ApiStatus.Experimental
HIDE_OMINOUS_BOTTLE_AMPLIFIER("ominous_bottle_amplifier"),
@ApiStatus.Experimental
HIDE_JUKEBOX_PLAYABLE("jukebox_playable"),
@ApiStatus.Experimental
HIDE_PROVIDES_BANNER_PATTERNS("provides_banner_patterns"),
@ApiStatus.Experimental
HIDE_RECIPES("recipes"),
@ApiStatus.Experimental
HIDE_LODESTONE_TRACKER("lodestone_tracker"),
@ApiStatus.Experimental
HIDE_FIREWORK_EXPLOSION("firework_explosion"),
@ApiStatus.Experimental
HIDE_FIREWORKS("fireworks"),
@ApiStatus.Experimental
HIDE_PROFILE("profile"),
@ApiStatus.Experimental
HIDE_NOTE_BLOCK_SOUND("note_block_sound"),
@ApiStatus.Experimental
HIDE_BANNER_PATTERNS("banner_patterns"),
@ApiStatus.Experimental
HIDE_BASE_COLOR("base_color"),
@ApiStatus.Experimental
HIDE_POT_DECORATIONS("pot_decorations"),
@ApiStatus.Experimental
HIDE_CONTAINER("container"),
@ApiStatus.Experimental
HIDE_BLOCK_STATE("block_state"),
@ApiStatus.Experimental
HIDE_BEES("bees"),
@ApiStatus.Experimental
HIDE_LOCK("lock"),
@ApiStatus.Experimental
HIDE_CONTAINER_LOOT("container_loot"),
@ApiStatus.Experimental
HIDE_BREAK_SOUND("break_sound"),
@ApiStatus.Experimental
HIDE_VILLAGER_VARIANT("villager/variant"),
@ApiStatus.Experimental
HIDE_WOLF_VARIANT("wolf/variant"),
@ApiStatus.Experimental
HIDE_WOLF_SOUND_VARIANT("wolf/sound_variant"),
@ApiStatus.Experimental
HIDE_WOLF_COLLAR("wolf/collar"),
@ApiStatus.Experimental
HIDE_FOX_VARIANT("fox/variant"),
@ApiStatus.Experimental
HIDE_SALMON_SIZE("salmon/size"),
@ApiStatus.Experimental
HIDE_PARROT_VARIANT("parrot/variant"),
@ApiStatus.Experimental
HIDE_TROPICAL_FISH_PATTERN("tropical_fish/pattern"),
@ApiStatus.Experimental
HIDE_TROPICAL_FISH_BASE_COLOR("tropical_fish/base_color"),
@ApiStatus.Experimental
HIDE_TROPICAL_FISH_PATTERN_COLOR("tropical_fish/pattern_color"),
@ApiStatus.Experimental
HIDE_MOOSHROOM_VARIANT("mooshroom/variant"),
@ApiStatus.Experimental
HIDE_RABBIT_VARIANT("rabbit/variant"),
@ApiStatus.Experimental
HIDE_PIG_VARIANT("pig/variant"),
@ApiStatus.Experimental
HIDE_COW_VARIANT("cow/variant"),
@ApiStatus.Experimental
HIDE_CHICKEN_VARIANT("chicken/variant"),
@ApiStatus.Experimental
HIDE_FROG_VARIANT("frog/variant"),
@ApiStatus.Experimental
HIDE_HORSE_VARIANT("horse/variant"),
@ApiStatus.Experimental
HIDE_PAINTING_VARIANT("painting/variant"),
@ApiStatus.Experimental
HIDE_LLAMA_VARIANT("llama/variant"),
@ApiStatus.Experimental
HIDE_AXOLOTL_VARIANT("axolotl/variant"),
@ApiStatus.Experimental
HIDE_CAT_VARIANT("cat/variant"),
@ApiStatus.Experimental
HIDE_CAT_COLLAR("cat/collar"),
@ApiStatus.Experimental
HIDE_SHEEP_COLOR("sheep/color"),
@ApiStatus.Experimental
HIDE_SHULKER_COLOR("shulker/color");
//
private final NamespacedKey component;
private ItemFlag() {
this.component = null;
}
private ItemFlag(String component) {
this.component = NamespacedKey.minecraft(component);
}
@ApiStatus.Internal
@Nullable
public NamespacedKey getComponent() {
return this.component;
}
}

View file

@ -304,8 +304,12 @@ public interface ItemType extends Keyed, Translatable, RegistryAware {
ItemType.Typed<ItemMeta> SHORT_GRASS = getItemType("short_grass");
ItemType.Typed<ItemMeta> FERN = getItemType("fern");
ItemType.Typed<ItemMeta> AZALEA = getItemType("azalea");
ItemType.Typed<ItemMeta> BUSH = getItemType("bush");
ItemType.Typed<ItemMeta> FLOWERING_AZALEA = getItemType("flowering_azalea");
ItemType.Typed<ItemMeta> DEAD_BUSH = getItemType("dead_bush");
ItemType.Typed<ItemMeta> FIREFLY_BUSH = getItemType("firefly_bush");
ItemType.Typed<ItemMeta> SHORT_DRY_GRASS = getItemType("short_dry_grass");
ItemType.Typed<ItemMeta> TALL_DRY_GRASS = getItemType("tall_dry_grass");
ItemType.Typed<ItemMeta> SEAGRASS = getItemType("seagrass");
ItemType.Typed<ItemMeta> SEA_PICKLE = getItemType("sea_pickle");
ItemType.Typed<ItemMeta> WHITE_WOOL = getItemType("white_wool");
@ -354,6 +358,8 @@ public interface ItemType extends Keyed, Translatable, RegistryAware {
ItemType.Typed<ItemMeta> SUGAR_CANE = getItemType("sugar_cane");
ItemType.Typed<ItemMeta> KELP = getItemType("kelp");
ItemType.Typed<ItemMeta> PINK_PETALS = getItemType("pink_petals");
ItemType.Typed<ItemMeta> WILDFLOWERS = getItemType("wildflowers");
ItemType.Typed<ItemMeta> LEAF_LITTER = getItemType("leaf_litter");
ItemType.Typed<ItemMeta> MOSS_CARPET = getItemType("moss_carpet");
ItemType.Typed<ItemMeta> MOSS_BLOCK = getItemType("moss_block");
ItemType.Typed<ItemMeta> PALE_MOSS_CARPET = getItemType("pale_moss_carpet");
@ -440,6 +446,7 @@ public interface ItemType extends Keyed, Translatable, RegistryAware {
ItemType.Typed<ItemMeta> ICE = getItemType("ice");
ItemType.Typed<ItemMeta> SNOW_BLOCK = getItemType("snow_block");
ItemType.Typed<ItemMeta> CACTUS = getItemType("cactus");
ItemType.Typed<ItemMeta> CACTUS_FLOWER = getItemType("cactus_flower");
ItemType.Typed<ItemMeta> CLAY = getItemType("clay");
/**
* ItemMeta: {@link BlockStateMeta}
@ -1053,6 +1060,14 @@ public interface ItemType extends Keyed, Translatable, RegistryAware {
* ItemMeta: {@link BlockStateMeta}
*/
ItemType.Typed<BlockStateMeta> JIGSAW = getItemType("jigsaw");
/**
* ItemMeta: {@link BlockStateMeta}
*/
ItemType.Typed<BlockStateMeta> TEST_BLOCK = getItemType("test_block");
/**
* ItemMeta: {@link BlockStateMeta}
*/
ItemType.Typed<BlockStateMeta> TEST_INSTANCE_BLOCK = getItemType("test_instance_block");
/**
* ItemMeta: {@link ArmorMeta}
*/
@ -1345,6 +1360,8 @@ public interface ItemType extends Keyed, Translatable, RegistryAware {
ItemType.Typed<ItemMeta> BOOK = getItemType("book");
ItemType.Typed<ItemMeta> SLIME_BALL = getItemType("slime_ball");
ItemType.Typed<ItemMeta> EGG = getItemType("egg");
ItemType.Typed<ItemMeta> BLUE_EGG = getItemType("blue_egg");
ItemType.Typed<ItemMeta> BROWN_EGG = getItemType("brown_egg");
/**
* ItemMeta: {@link CompassMeta}
*/

View file

@ -2,6 +2,7 @@ package org.bukkit.inventory;
import org.bukkit.Material;
import org.bukkit.NamespacedKey;
import org.bukkit.inventory.meta.trim.TrimPattern;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@ -11,6 +12,56 @@ import org.jetbrains.annotations.Nullable;
public class SmithingTrimRecipe extends SmithingRecipe implements ComplexRecipe {
private final RecipeChoice template;
private final TrimPattern trimPattern;
@NotNull
@Deprecated(since = "1.21.5")
private static TrimPattern getTrimPattern(@Nullable RecipeChoice template) {
if (template == null) {
return TrimPattern.SENTRY;
}
return switch (template.getItemStack().getType()) {
case SENTRY_ARMOR_TRIM_SMITHING_TEMPLATE ->
TrimPattern.SENTRY;
case DUNE_ARMOR_TRIM_SMITHING_TEMPLATE ->
TrimPattern.DUNE;
case COAST_ARMOR_TRIM_SMITHING_TEMPLATE ->
TrimPattern.COAST;
case WILD_ARMOR_TRIM_SMITHING_TEMPLATE ->
TrimPattern.WILD;
case WARD_ARMOR_TRIM_SMITHING_TEMPLATE ->
TrimPattern.WARD;
case EYE_ARMOR_TRIM_SMITHING_TEMPLATE ->
TrimPattern.EYE;
case VEX_ARMOR_TRIM_SMITHING_TEMPLATE ->
TrimPattern.VEX;
case TIDE_ARMOR_TRIM_SMITHING_TEMPLATE ->
TrimPattern.TIDE;
case SNOUT_ARMOR_TRIM_SMITHING_TEMPLATE ->
TrimPattern.SNOUT;
case RIB_ARMOR_TRIM_SMITHING_TEMPLATE ->
TrimPattern.RIB;
case SPIRE_ARMOR_TRIM_SMITHING_TEMPLATE ->
TrimPattern.SPIRE;
case WAYFINDER_ARMOR_TRIM_SMITHING_TEMPLATE ->
TrimPattern.WAYFINDER;
case SHAPER_ARMOR_TRIM_SMITHING_TEMPLATE ->
TrimPattern.SHAPER;
case SILENCE_ARMOR_TRIM_SMITHING_TEMPLATE ->
TrimPattern.SILENCE;
case RAISER_ARMOR_TRIM_SMITHING_TEMPLATE ->
TrimPattern.RAISER;
case HOST_ARMOR_TRIM_SMITHING_TEMPLATE ->
TrimPattern.HOST;
case FLOW_ARMOR_TRIM_SMITHING_TEMPLATE ->
TrimPattern.FLOW;
case BOLT_ARMOR_TRIM_SMITHING_TEMPLATE ->
TrimPattern.BOLT;
default ->
TrimPattern.SENTRY;
};
}
/**
* Create a smithing recipe to produce the specified result ItemStack.
@ -19,10 +70,18 @@ public class SmithingTrimRecipe extends SmithingRecipe implements ComplexRecipe
* @param template The template item.
* @param base The base ingredient
* @param addition The addition ingredient
* @see #SmithingTrimRecipe(org.bukkit.NamespacedKey, org.bukkit.inventory.RecipeChoice, org.bukkit.inventory.RecipeChoice, org.bukkit.inventory.RecipeChoice, org.bukkit.inventory.meta.trim.TrimPattern)
* @deprecated trimPattern must be specified
*/
@Deprecated(since = "1.21.5")
public SmithingTrimRecipe(@NotNull NamespacedKey key, @Nullable RecipeChoice template, @Nullable RecipeChoice base, @Nullable RecipeChoice addition) {
this(key, template, base, addition, getTrimPattern(template));
}
public SmithingTrimRecipe(@NotNull NamespacedKey key, @Nullable RecipeChoice template, @Nullable RecipeChoice base, @Nullable RecipeChoice addition, @NotNull TrimPattern trimPattern) {
super(key, new ItemStack(Material.AIR), base, addition);
this.template = template;
this.trimPattern = trimPattern;
}
/**
@ -34,4 +93,9 @@ public class SmithingTrimRecipe extends SmithingRecipe implements ComplexRecipe
public RecipeChoice getTemplate() {
return (template != null) ? template.clone() : null;
}
@NotNull
public TrimPattern getTrimPattern() {
return trimPattern;
}
}

View file

@ -16,6 +16,20 @@ public class TransmuteRecipe extends CraftingRecipe implements ComplexRecipe {
private final RecipeChoice input;
private final RecipeChoice material;
/**
* Create a transmute recipe to produce a result of the specified type.
*
* @param key the unique recipe key
* @param result the transmuted result item
* @param input the input ingredient
* @param material the additional ingredient
*/
public TransmuteRecipe(@NotNull NamespacedKey key, @NotNull ItemStack result, @NotNull RecipeChoice input, @NotNull RecipeChoice material) {
super(key, checkResult(result));
this.input = input;
this.material = material;
}
/**
* Create a transmute recipe to produce a result of the specified type.
*
@ -25,9 +39,7 @@ public class TransmuteRecipe extends CraftingRecipe implements ComplexRecipe {
* @param material the additional ingredient
*/
public TransmuteRecipe(@NotNull NamespacedKey key, @NotNull Material result, @NotNull RecipeChoice input, @NotNull RecipeChoice material) {
super(key, checkResult(new ItemStack(result)));
this.input = input;
this.material = material;
this(key, new ItemStack(result), input, material);
}
/**

View file

@ -6,6 +6,7 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import org.bukkit.NamespacedKey;
import org.bukkit.Sound;
import org.bukkit.Tag;
import org.bukkit.attribute.Attribute;
import org.bukkit.attribute.AttributeModifier;
@ -17,12 +18,14 @@ import org.bukkit.inventory.ItemFactory;
import org.bukkit.inventory.ItemFlag;
import org.bukkit.inventory.ItemRarity;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.components.BlocksAttacksComponent;
import org.bukkit.inventory.meta.components.CustomModelDataComponent;
import org.bukkit.inventory.meta.components.EquippableComponent;
import org.bukkit.inventory.meta.components.FoodComponent;
import org.bukkit.inventory.meta.components.JukeboxPlayableComponent;
import org.bukkit.inventory.meta.components.ToolComponent;
import org.bukkit.inventory.meta.components.UseCooldownComponent;
import org.bukkit.inventory.meta.components.WeaponComponent;
import org.bukkit.inventory.meta.components.consumable.ConsumableComponent;
import org.bukkit.inventory.meta.tags.CustomItemTagContainer;
import org.bukkit.persistence.PersistentDataHolder;
@ -680,6 +683,61 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste
*/
void setTool(@Nullable ToolComponent tool);
/**
* Checks if the weapon is set.
*
* @return if a weapon is set
*/
boolean hasWeapon();
/**
* Gets the weapon set on this item, or creates an empty weapon instance.
* <p>
* The returned component is a snapshot of its current state and does not
* reflect a live view of what is on an item. After changing any value on
* this component, it must be set with {@link #setWeapon(WeaponComponent)} to
* apply the changes.
*
* @return weapon
*/
@NotNull
WeaponComponent getWeapon();
/**
* Sets the item weapon.
*
* @param weapon new weapon
*/
void setWeapon(@Nullable WeaponComponent weapon);
/**
* Checks if the {@link BlocksAttacksComponent} is set.
*
* @return if a {@link BlocksAttacksComponent} is set
*/
boolean hasBlocksAttacks();
/**
* Gets the {@link BlocksAttacksComponent} set on this item, or creates an
* empty {@link BlocksAttacksComponent} instance.
* <p>
* The returned component is a snapshot of its current state and does not
* reflect a live view of what is on an item. After changing any value on
* this component, it must be set with
* {@link #setBlocksAttacks(BlocksAttacksComponent)} to apply the changes.
*
* @return component
*/
@NotNull
BlocksAttacksComponent getBlocksAttacks();
/**
* Sets the item {@link BlocksAttacksComponent}.
*
* @param blocksAttacks new component
*/
void setBlocksAttacks(@Nullable BlocksAttacksComponent blocksAttacks);
/**
* Checks if the equippable is set.
*
@ -736,6 +794,30 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste
*/
void setJukeboxPlayable(@Nullable JukeboxPlayableComponent jukeboxPlayable);
/**
* Gets if the break sound is set.
*
* @return if break sound is set
*/
boolean hasBreakSound();
/**
* Gets the sound to play when the item is broken.
*
* Plugins should check {@link #hasBreakSound()} before calling this method.
*
* @return the sound
*/
@Nullable
Sound getBreakSound();
/**
* Sets the sound to play when the item is broken.
*
* @param sound sound
*/
void setBreakSound(@Nullable Sound sound);
/**
* Checks for the existence of any AttributeModifiers.
*

View file

@ -171,6 +171,31 @@ public interface PotionMeta extends ItemMeta {
*/
void setCustomName(@Nullable String name);
/**
* Checks for existence of a potion duration scale.
*
* @return true if this has a potion duration scale.
*/
boolean hasDurationScale();
/**
* Gets the potion duration scale that is set.
* <p>
* Plugins should check that hasDurationScale() returns <code>true</code>
* before calling this method.
*
* @return the scale factor applied to all potion effect durations
*/
@Nullable
float getDurationScale();
/**
* Gets the potion duration scale.
*
* @param scale the scale factor applied to all potion effect durations
*/
void setDurationScale(@Nullable Float scale);
@Override
PotionMeta clone();
}

View file

@ -0,0 +1,291 @@
package org.bukkit.inventory.meta.components;
import java.util.Collection;
import java.util.List;
import org.bukkit.Sound;
import org.bukkit.Tag;
import org.bukkit.configuration.serialization.ConfigurationSerializable;
import org.bukkit.damage.DamageType;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
* Represents a component which can turn any item into a shield-like item which
* blocks attack damage.
*/
@ApiStatus.Experimental
public interface BlocksAttacksComponent extends ConfigurationSerializable {
/**
* Gets the delay on equip before this item will block attacks.
*
* @return the delay in seconds
*/
float getBlockDelaySeconds();
/**
* Sets the delay on equip before this item will block attacks.
*
* @param seconds the delay in seconds to set
*/
void setBlockDelaySeconds(float seconds);
/**
* Gets the multiplier applied to the item cooldown when attacked by a
* disabling attack.
*
* @return the scale
*/
float getDisableCooldownScale();
/**
* Sets the multiplier applied to the item cooldown when attacked by a
* disabling attack.
*
* @param scale the scale to set. Must be 0 or a positive integer
*/
void setDisableCooldownScale(float scale);
/**
* Get the list of {@link DamageReduction DamageReductions} that apply to
* this item.
*
* @return all damage reductions. The mutability of the returned list cannot
* be guaranteed, but its contents are mutable and can have their values
* changed
*/
@NotNull
List<DamageReduction> getDamageReductions();
/**
* Set the list of {@link DamageReduction DamageReductions} to apply to this
* item. This will remove any existing damage reductions.
*
* @param reductions the reductions to set
*/
void setDamageReductions(@NotNull List<DamageReduction> reductions);
/**
* Add a new damage reduction to this component, which blocks specific types
* of attacks.
*
* @param type the type of attack
* @param base the constant amount of damage to be blocked
* @param factor the proportion of damage to be blocked
* @param horizontalBlockingAngle the maximum angle at which attacks will be
* blocked
* @return the {@link DamageReduction} instance that was added to this item
*/
@NotNull
DamageReduction addDamageReduction(@NotNull DamageType type, float base, float factor, float horizontalBlockingAngle);
/**
* Add a new damage reduction to this component, which blocks specific types
* of attacks.
*
* @param types the types of attack
* @param base the constant amount of damage to be blocked
* @param factor the proportion of damage to be blocked
* @param horizontalBlockingAngle the maximum angle at which attacks will be
* blocked
* @return the {@link DamageReduction} instance that was added to this item
*/
@NotNull
DamageReduction addDamageReduction(@NotNull Collection<DamageType> types, float base, float factor, float horizontalBlockingAngle);
/**
* Add a new damage reduction to this component, which blocks specific types
* of attacks.
*
* @param tag the type of attacks
* @param base the constant amount of damage to be blocked
* @param factor the proportion of damage to be blocked
* @param horizontalBlockingAngle the maximum angle at which attacks will be
* blocked
* @return the {@link DamageReduction} instance that was added to this item
*/
@NotNull
DamageReduction addDamageReduction(@NotNull Tag<DamageType> tag, float base, float factor, float horizontalBlockingAngle);
/**
* Remove the given {@link DamageReduction} from this item.
*
* @param reduction the reduction to remove
* @return true if the reduction was removed, false if this component did
* not contain a matching reduction
*/
boolean removeDamageReduction(@NotNull DamageReduction reduction);
/**
* Gets the amount of damage required to be dealt before damage is also
* applied to the item.
*
* @return threshold damage amount
*/
float getItemDamageThreshold();
/**
* Sets the amount of damage required to be dealt before damage is also
* applied to the item.
*
* @param threshold new threshold damage amount
*/
void setItemDamageThreshold(float threshold);
/**
* Gets the constant amount of damage applied to the item if the threshold
* is reached.
*
* @return base item damage
*/
float getItemDamageBase();
/**
* Sets the constant amount of damage applied to the item if the threshold
* is reached.
*
* @param base new base item damage
*/
void setItemDamageBase(float base);
/**
* Gets the proportion of damage applied to the item if the threshold is
* reached.
*
* @return item damage factor
*/
float getItemDamageFactor();
/**
* Sets the proportion of damage applied to the item if the threshold is
* reached.
*
* @param factor new item damage factor
*/
void setItemDamageFactor(float factor);
/**
* Gets the sound to play when the item blocks an attack.
*
* @return the sound
*/
@Nullable
Sound getBlockSound();
/**
* Sets the sound to play when the item blocks an attack.
*
* @param sound sound or null for current default
*/
void setBlockSound(@Nullable Sound sound);
/**
* Gets the sound to play when the item is disabled.
*
* @return the sound
*/
@Nullable
Sound getDisableSound();
/**
* Sets the sound to play when the item is disabled.
*
* @param sound sound or null for current default
*/
void setDisableSound(@Nullable Sound sound);
/**
* Gets the type of damage that will bypass blocking by this item.
*
* @return damage type
*/
@Nullable
Tag<DamageType> getBypassedBy();
/**
* Sets the type of damage that will bypass blocking by this item.
*
* @param tag the tag, or null to clear
*/
void setBypassedBy(@Nullable Tag<DamageType> tag);
/**
* A damage reduction for a specific set of damage types.
*/
public interface DamageReduction extends ConfigurationSerializable {
/**
* Gets the types to which this reduction applies.
*
* @return the damage types
*/
@Nullable
Collection<DamageType> getTypes();
/**
* Sets the types to which this reduction applies.
*
* @param type the damage types
*/
void setTypes(@Nullable DamageType type);
/**
* Sets the types to which this reduction applies.
*
* @param types the damage types
*/
void setTypes(@Nullable Collection<DamageType> types);
/**
* Sets the types to which this reduction applies.
*
* @param tag the damage tag
*/
void setTypes(@Nullable Tag<DamageType> tag);
/**
* Gets the constant amount of damage to be blocked.
*
* @return base block amount
*/
float getBase();
/**
* Sets the constant amount of damage to be blocked.
*
* @param base new base amount
*/
void setBase(float base);
/**
* Gets the proportion of damage to be blocked.
*
* @return base blocking factor
*/
float getFactor();
/**
* Sets the proportion of damage to be blocked.
*
* @param factor new blocking factor
*/
void setFactor(float factor);
/**
* Gets the maximum angle at which attacks will be blocked (defaults to
* 90).
*
* @return maximum blocking angle
*/
float getHorizontalBlockingAngle();
/**
* Sets the maximum angle at which attacks will be blocked (defaults to
* 90).
*
* @param horizontalBlockingAngle new blocking angle
*/
void setHorizontalBlockingAngle(float horizontalBlockingAngle);
}
}

View file

@ -150,4 +150,18 @@ public interface EquippableComponent extends ConfigurationSerializable {
* @param damage whether the item will be damaged
*/
void setDamageOnHurt(boolean damage);
/**
* Gets if the item will be equipped on interact.
*
* @return whether the item will be equipped
*/
boolean isEquipOnInteract();
/**
* Sets if the item will be equipped on interact.
*
* @param equip whether the item will be equipped
*/
void setEquipOnInteract(boolean equip);
}

View file

@ -26,7 +26,7 @@ public interface JukeboxPlayableComponent extends ConfigurationSerializable {
*
* @return the song key
*/
@NotNull
@Nullable
NamespacedKey getSongKey();
/**
@ -42,18 +42,4 @@ public interface JukeboxPlayableComponent extends ConfigurationSerializable {
* @param song the song key
*/
void setSongKey(@NotNull NamespacedKey song);
/**
* Gets if the song will show in the item tooltip.
*
* @return if the song will show in the tooltip
*/
boolean isShowInTooltip();
/**
* Sets if the song will show in the item tooltip.
*
* @param show true if the song will show in the tooltip
*/
void setShowInTooltip(boolean show);
}

View file

@ -48,6 +48,20 @@ public interface ToolComponent extends ConfigurationSerializable {
*/
void setDamagePerBlock(int damage);
/**
* Get whether this tool can destroy blocks in creative.
*
* @return whether can destroy
*/
boolean canDestroyBlocksInCreative();
/**
* Set whether this tool can destroy blocks in creative.
*
* @param destroy whether can destroy
*/
void setCanDestroyBlocksInCreative(boolean destroy);
/**
* Get the list of {@link ToolRule ToolRules} that apply to this tool.
*

View file

@ -0,0 +1,39 @@
package org.bukkit.inventory.meta.components;
import org.bukkit.configuration.serialization.ConfigurationSerializable;
import org.jetbrains.annotations.ApiStatus;
/**
* Represents a component which can turn any item into a weapon.
*/
@ApiStatus.Experimental
public interface WeaponComponent extends ConfigurationSerializable {
/**
* Get the weapon damage per attack.
*
* @return the damage per attack
*/
int getItemDamagePerAttack();
/**
* Set the weapon damage per attack.
*
* @param damage the damage to set. Must be 0 or a positive integer
*/
void setItemDamagePerAttack(int damage);
/**
* Get the time in seconds which this weapon disabled blocking for.
*
* @return the blocking disable time in seconds
*/
float getDisableBlockingForSeconds();
/**
* Set the time in seconds which this weapon disabled blocking for.
*
* @param time the blocking disable time in seconds
*/
void setDisableBlockingForSeconds(float time);
}