diff --git a/pom.xml b/pom.xml index 032d6f6b..c7bba1fd 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.bukkit bukkit - 1.21.4-R0.1-SNAPSHOT + 1.21.5-R0.1-SNAPSHOT jar Bukkit diff --git a/src/main/java/org/bukkit/GameRule.java b/src/main/java/org/bukkit/GameRule.java index b3211a70..3cceccbc 100644 --- a/src/main/java/org/bukkit/GameRule.java +++ b/src/main/java/org/bukkit/GameRule.java @@ -55,6 +55,11 @@ public final class GameRule { */ public static final GameRule 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 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 { * Whether ender pearls will vanish on player death. */ public static final GameRule ENDER_PEARLS_VANISH_ON_DEATH = new GameRule<>("enderPearlsVanishOnDeath", Boolean.class); + /** + * Whether TNT explodes. + */ + public static final GameRule TNT_EXPLODES = new GameRule<>("tntExplodes", Boolean.class); // Numerical rules /** diff --git a/src/main/java/org/bukkit/Material.java b/src/main/java/org/bukkit/Material.java index e3ff03b7..e6f41f33 100644 --- a/src/main/java/org/bukkit/Material.java +++ b/src/main/java/org/bukkit/Material.java @@ -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; // diff --git a/src/main/java/org/bukkit/Particle.java b/src/main/java/org/bukkit/Particle.java index daa70791..1c57b275 100644 --- a/src/main/java/org/bukkit/Particle.java +++ b/src/main/java/org/bukkit/Particle.java @@ -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; diff --git a/src/main/java/org/bukkit/Registry.java b/src/main/java/org/bukkit/Registry.java index 22e807ab..306e125b 100644 --- a/src/main/java/org/bukkit/Registry.java +++ b/src/main/java/org/bukkit/Registry.java @@ -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 extends Iterable { * @see Cat.Type */ Registry 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 = 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 = 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 = Objects.requireNonNull(Bukkit.getRegistry(Chicken.Variant.class), "No registry present for Chicken Variant. This is a bug."); /** * Server enchantments. * diff --git a/src/main/java/org/bukkit/Sound.java b/src/main/java/org/bukkit/Sound.java index 329bc43b..9950c381 100644 --- a/src/main/java/org/bukkit/Sound.java +++ b/src/main/java/org/bukkit/Sound.java @@ -145,6 +145,8 @@ public interface Sound extends OldEnum, 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, 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, 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, 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, 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, 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, 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"); diff --git a/src/main/java/org/bukkit/Tag.java b/src/main/java/org/bukkit/Tag.java index fb7d8bb3..52a19188 100644 --- a/src/main/java/org/bukkit/Tag.java +++ b/src/main/java/org/bukkit/Tag.java @@ -452,8 +452,14 @@ public interface Tag extends Keyed { * Vanilla block tag representing all unstable bottom center blocks. */ Tag 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 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 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 extends Keyed { * Vanilla block tag representing all blocks that can be efficiently mined with a sword. */ Tag 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 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 extends Keyed { * Vanilla block tag representing all blocks which bats will spawn on. */ Tag 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 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 extends Keyed { */ Tag 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 DEAD_BUSH_MAY_PLACE_ON = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("dead_bush_may_place_on"), Material.class); + Tag 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 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 extends Keyed { * Vanilla block tag representing all blocks replaceable by growing trees. */ Tag 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 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 extends Keyed { * Vanilla block tag representing solid blocks which do not block hopper operation. */ Tag 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 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 extends Keyed { * Vanilla item tag representing all brewing stand fuel items. */ Tag ITEMS_BREWING_FUEL = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("brewing_fuel"), Material.class); + /** + * Vanilla item tag representing all eggs. + */ + Tag ITEMS_EGGS = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("eggs"), Material.class); /** * Vanilla item tag representing all meat. */ @@ -1155,6 +1189,10 @@ public interface Tag extends Keyed { * Vanilla item tag representing all bundle items. */ Tag ITEMS_BUNDLES = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("bundles"), Material.class); + /** + * Vanilla item tag representing all booking cloning target items. + */ + Tag 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 extends Keyed { * Vanilla tag representing all projectiles which can be punched back. */ Tag 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 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 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. diff --git a/src/main/java/org/bukkit/block/BlockType.java b/src/main/java/org/bukkit/block/BlockType.java index 4f26e656..18661c28 100644 --- a/src/main/java/org/bukkit/block/BlockType.java +++ b/src/main/java/org/bukkit/block/BlockType.java @@ -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 SHORT_GRASS = getBlockType("short_grass"); BlockType.Typed FERN = getBlockType("fern"); BlockType.Typed DEAD_BUSH = getBlockType("dead_bush"); + BlockType.Typed BUSH = getBlockType("bush"); + BlockType.Typed SHORT_DRY_GRASS = getBlockType("short_dry_grass"); + BlockType.Typed TALL_DRY_GRASS = getBlockType("tall_dry_grass"); BlockType.Typed SEAGRASS = getBlockType("seagrass"); /** * BlockData: {@link Bisected} @@ -958,6 +963,7 @@ public interface BlockType extends Keyed, Translatable, RegistryAware { * BlockData: {@link Ageable} */ BlockType.Typed CACTUS = getBlockType("cactus"); + BlockType.Typed CACTUS_FLOWER = getBlockType("cactus_flower"); BlockType.Typed CLAY = getBlockType("clay"); /** * BlockData: {@link Ageable} @@ -2738,6 +2744,11 @@ public interface BlockType extends Keyed, Translatable, RegistryAware { * BlockData: {@link Jigsaw} */ BlockType.Typed JIGSAW = getBlockType("jigsaw"); + /** + * BlockData: {@link TestBlock} + */ + BlockType.Typed TEST_BLOCK = getBlockType("test_block"); + BlockType.Typed 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 PINK_PETALS = getBlockType("pink_petals"); + /** + * BlockData: {@link PinkPetals} + */ + BlockType.Typed WILDFLOWERS = getBlockType("wildflowers"); + /** + * BlockData: {@link LeafLitter} + */ + BlockType.Typed LEAF_LITTER = getBlockType("leaf_litter"); BlockType.Typed MOSS_CARPET = getBlockType("moss_carpet"); BlockType.Typed MOSS_BLOCK = getBlockType("moss_block"); /** @@ -3418,6 +3437,7 @@ public interface BlockType extends Keyed, Translatable, RegistryAware { BlockType.Typed CLOSED_EYEBLOSSOM = getBlockType("closed_eyeblossom"); BlockType.Typed POTTED_OPEN_EYEBLOSSOM = getBlockType("potted_open_eyeblossom"); BlockType.Typed POTTED_CLOSED_EYEBLOSSOM = getBlockType("potted_closed_eyeblossom"); + BlockType.Typed FIREFLY_BUSH = getBlockType("firefly_bush"); // @NotNull diff --git a/src/main/java/org/bukkit/block/TestBlock.java b/src/main/java/org/bukkit/block/TestBlock.java new file mode 100644 index 00000000..bbcd0c92 --- /dev/null +++ b/src/main/java/org/bukkit/block/TestBlock.java @@ -0,0 +1,7 @@ +package org.bukkit.block; + +/** + * Represents a captured state of a test block. + */ +public interface TestBlock extends TileState { +} diff --git a/src/main/java/org/bukkit/block/TestInstance.java b/src/main/java/org/bukkit/block/TestInstance.java new file mode 100644 index 00000000..0e3dc925 --- /dev/null +++ b/src/main/java/org/bukkit/block/TestInstance.java @@ -0,0 +1,7 @@ +package org.bukkit.block; + +/** + * Represents a captured state of a test instance block. + */ +public interface TestInstance extends TileState { +} diff --git a/src/main/java/org/bukkit/block/data/type/CreakingHeart.java b/src/main/java/org/bukkit/block/data/type/CreakingHeart.java index aadd902f..571ca7a4 100644 --- a/src/main/java/org/bukkit/block/data/type/CreakingHeart.java +++ b/src/main/java/org/bukkit/block/data/type/CreakingHeart.java @@ -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. *
* '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; + } } diff --git a/src/main/java/org/bukkit/block/data/type/FlowerBed.java b/src/main/java/org/bukkit/block/data/type/FlowerBed.java new file mode 100644 index 00000000..e7381b50 --- /dev/null +++ b/src/main/java/org/bukkit/block/data/type/FlowerBed.java @@ -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(); +} diff --git a/src/main/java/org/bukkit/block/data/type/LeafLitter.java b/src/main/java/org/bukkit/block/data/type/LeafLitter.java new file mode 100644 index 00000000..dc00e1a5 --- /dev/null +++ b/src/main/java/org/bukkit/block/data/type/LeafLitter.java @@ -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(); +} diff --git a/src/main/java/org/bukkit/block/data/type/PinkPetals.java b/src/main/java/org/bukkit/block/data/type/PinkPetals.java index a84b36f7..850bd356 100644 --- a/src/main/java/org/bukkit/block/data/type/PinkPetals.java +++ b/src/main/java/org/bukkit/block/data/type/PinkPetals.java @@ -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 { } diff --git a/src/main/java/org/bukkit/block/data/type/TestBlock.java b/src/main/java/org/bukkit/block/data/type/TestBlock.java new file mode 100644 index 00000000..e337a9dc --- /dev/null +++ b/src/main/java/org/bukkit/block/data/type/TestBlock.java @@ -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; + } +} diff --git a/src/main/java/org/bukkit/entity/AbstractCow.java b/src/main/java/org/bukkit/entity/AbstractCow.java new file mode 100644 index 00000000..d5cc508d --- /dev/null +++ b/src/main/java/org/bukkit/entity/AbstractCow.java @@ -0,0 +1,6 @@ +package org.bukkit.entity; + +/** + * Represents a Cow. + */ +public interface AbstractCow extends Animals {} diff --git a/src/main/java/org/bukkit/entity/Chicken.java b/src/main/java/org/bukkit/entity/Chicken.java index cb3ec6ef..46507de4 100644 --- a/src/main/java/org/bukkit/entity/Chicken.java +++ b/src/main/java/org/bukkit/entity/Chicken.java @@ -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)); + } + } +} diff --git a/src/main/java/org/bukkit/entity/Cow.java b/src/main/java/org/bukkit/entity/Cow.java index cd4ed4de..4d03adff 100644 --- a/src/main/java/org/bukkit/entity/Cow.java +++ b/src/main/java/org/bukkit/entity/Cow.java @@ -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)); + } + } +} diff --git a/src/main/java/org/bukkit/entity/EntityType.java b/src/main/java/org/bukkit/entity/EntityType.java index db72cee7..67319dab 100644 --- a/src/main/java/org/bukkit/entity/EntityType.java +++ b/src/main/java/org/bukkit/entity/EntityType.java @@ -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. */ diff --git a/src/main/java/org/bukkit/entity/LingeringPotion.java b/src/main/java/org/bukkit/entity/LingeringPotion.java index 949ba841..5aca7cb8 100644 --- a/src/main/java/org/bukkit/entity/LingeringPotion.java +++ b/src/main/java/org/bukkit/entity/LingeringPotion.java @@ -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 { } diff --git a/src/main/java/org/bukkit/entity/MushroomCow.java b/src/main/java/org/bukkit/entity/MushroomCow.java index cef17008..39c19499 100644 --- a/src/main/java/org/bukkit/entity/MushroomCow.java +++ b/src/main/java/org/bukkit/entity/MushroomCow.java @@ -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 diff --git a/src/main/java/org/bukkit/entity/Pig.java b/src/main/java/org/bukkit/entity/Pig.java index cb028371..884bdcd5 100644 --- a/src/main/java/org/bukkit/entity/Pig.java +++ b/src/main/java/org/bukkit/entity/Pig.java @@ -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)); + } + } +} diff --git a/src/main/java/org/bukkit/entity/SplashPotion.java b/src/main/java/org/bukkit/entity/SplashPotion.java index e706a78e..2a210254 100644 --- a/src/main/java/org/bukkit/entity/SplashPotion.java +++ b/src/main/java/org/bukkit/entity/SplashPotion.java @@ -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 { } diff --git a/src/main/java/org/bukkit/inventory/EquipmentSlot.java b/src/main/java/org/bukkit/inventory/EquipmentSlot.java index 5642d8af..992f1511 100644 --- a/src/main/java/org/bukkit/inventory/EquipmentSlot.java +++ b/src/main/java/org/bukkit/inventory/EquipmentSlot.java @@ -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 group; // Supplier because of class loading order, since EquipmentSlot and EquipmentSlotGroup reference each other on class init diff --git a/src/main/java/org/bukkit/inventory/EquipmentSlotGroup.java b/src/main/java/org/bukkit/inventory/EquipmentSlotGroup.java index 1a272fec..824249e8 100644 --- a/src/main/java/org/bukkit/inventory/EquipmentSlotGroup.java +++ b/src/main/java/org/bukkit/inventory/EquipmentSlotGroup.java @@ -26,6 +26,7 @@ public final class EquipmentSlotGroup implements Predicate { 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 predicate; diff --git a/src/main/java/org/bukkit/inventory/ItemFlag.java b/src/main/java/org/bukkit/inventory/ItemFlag.java index 8453bd05..1a79fd83 100644 --- a/src/main/java/org/bukkit/inventory/ItemFlag.java +++ b/src/main/java/org/bukkit/inventory/ItemFlag.java @@ -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; + } } diff --git a/src/main/java/org/bukkit/inventory/ItemType.java b/src/main/java/org/bukkit/inventory/ItemType.java index 7f693668..676c6ddf 100644 --- a/src/main/java/org/bukkit/inventory/ItemType.java +++ b/src/main/java/org/bukkit/inventory/ItemType.java @@ -304,8 +304,12 @@ public interface ItemType extends Keyed, Translatable, RegistryAware { ItemType.Typed SHORT_GRASS = getItemType("short_grass"); ItemType.Typed FERN = getItemType("fern"); ItemType.Typed AZALEA = getItemType("azalea"); + ItemType.Typed BUSH = getItemType("bush"); ItemType.Typed FLOWERING_AZALEA = getItemType("flowering_azalea"); ItemType.Typed DEAD_BUSH = getItemType("dead_bush"); + ItemType.Typed FIREFLY_BUSH = getItemType("firefly_bush"); + ItemType.Typed SHORT_DRY_GRASS = getItemType("short_dry_grass"); + ItemType.Typed TALL_DRY_GRASS = getItemType("tall_dry_grass"); ItemType.Typed SEAGRASS = getItemType("seagrass"); ItemType.Typed SEA_PICKLE = getItemType("sea_pickle"); ItemType.Typed WHITE_WOOL = getItemType("white_wool"); @@ -354,6 +358,8 @@ public interface ItemType extends Keyed, Translatable, RegistryAware { ItemType.Typed SUGAR_CANE = getItemType("sugar_cane"); ItemType.Typed KELP = getItemType("kelp"); ItemType.Typed PINK_PETALS = getItemType("pink_petals"); + ItemType.Typed WILDFLOWERS = getItemType("wildflowers"); + ItemType.Typed LEAF_LITTER = getItemType("leaf_litter"); ItemType.Typed MOSS_CARPET = getItemType("moss_carpet"); ItemType.Typed MOSS_BLOCK = getItemType("moss_block"); ItemType.Typed PALE_MOSS_CARPET = getItemType("pale_moss_carpet"); @@ -440,6 +446,7 @@ public interface ItemType extends Keyed, Translatable, RegistryAware { ItemType.Typed ICE = getItemType("ice"); ItemType.Typed SNOW_BLOCK = getItemType("snow_block"); ItemType.Typed CACTUS = getItemType("cactus"); + ItemType.Typed CACTUS_FLOWER = getItemType("cactus_flower"); ItemType.Typed CLAY = getItemType("clay"); /** * ItemMeta: {@link BlockStateMeta} @@ -1053,6 +1060,14 @@ public interface ItemType extends Keyed, Translatable, RegistryAware { * ItemMeta: {@link BlockStateMeta} */ ItemType.Typed JIGSAW = getItemType("jigsaw"); + /** + * ItemMeta: {@link BlockStateMeta} + */ + ItemType.Typed TEST_BLOCK = getItemType("test_block"); + /** + * ItemMeta: {@link BlockStateMeta} + */ + ItemType.Typed TEST_INSTANCE_BLOCK = getItemType("test_instance_block"); /** * ItemMeta: {@link ArmorMeta} */ @@ -1345,6 +1360,8 @@ public interface ItemType extends Keyed, Translatable, RegistryAware { ItemType.Typed BOOK = getItemType("book"); ItemType.Typed SLIME_BALL = getItemType("slime_ball"); ItemType.Typed EGG = getItemType("egg"); + ItemType.Typed BLUE_EGG = getItemType("blue_egg"); + ItemType.Typed BROWN_EGG = getItemType("brown_egg"); /** * ItemMeta: {@link CompassMeta} */ diff --git a/src/main/java/org/bukkit/inventory/SmithingTrimRecipe.java b/src/main/java/org/bukkit/inventory/SmithingTrimRecipe.java index 4271c54c..740a0c01 100644 --- a/src/main/java/org/bukkit/inventory/SmithingTrimRecipe.java +++ b/src/main/java/org/bukkit/inventory/SmithingTrimRecipe.java @@ -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; + } } diff --git a/src/main/java/org/bukkit/inventory/TransmuteRecipe.java b/src/main/java/org/bukkit/inventory/TransmuteRecipe.java index 5a861679..aab360be 100644 --- a/src/main/java/org/bukkit/inventory/TransmuteRecipe.java +++ b/src/main/java/org/bukkit/inventory/TransmuteRecipe.java @@ -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); } /** diff --git a/src/main/java/org/bukkit/inventory/meta/ItemMeta.java b/src/main/java/org/bukkit/inventory/meta/ItemMeta.java index 9dc6690a..a16f481d 100644 --- a/src/main/java/org/bukkit/inventory/meta/ItemMeta.java +++ b/src/main/java/org/bukkit/inventory/meta/ItemMeta.java @@ -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. + *

+ * 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. + *

+ * 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. * diff --git a/src/main/java/org/bukkit/inventory/meta/PotionMeta.java b/src/main/java/org/bukkit/inventory/meta/PotionMeta.java index b61d2e32..45bfb0a2 100644 --- a/src/main/java/org/bukkit/inventory/meta/PotionMeta.java +++ b/src/main/java/org/bukkit/inventory/meta/PotionMeta.java @@ -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. + *

+ * Plugins should check that hasDurationScale() returns true + * 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(); } diff --git a/src/main/java/org/bukkit/inventory/meta/components/BlocksAttacksComponent.java b/src/main/java/org/bukkit/inventory/meta/components/BlocksAttacksComponent.java new file mode 100644 index 00000000..2c7c12d7 --- /dev/null +++ b/src/main/java/org/bukkit/inventory/meta/components/BlocksAttacksComponent.java @@ -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 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 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 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 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 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 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 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 types); + + /** + * Sets the types to which this reduction applies. + * + * @param tag the damage tag + */ + void setTypes(@Nullable Tag 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); + } +} diff --git a/src/main/java/org/bukkit/inventory/meta/components/EquippableComponent.java b/src/main/java/org/bukkit/inventory/meta/components/EquippableComponent.java index c56e81eb..60eefa4b 100644 --- a/src/main/java/org/bukkit/inventory/meta/components/EquippableComponent.java +++ b/src/main/java/org/bukkit/inventory/meta/components/EquippableComponent.java @@ -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); } diff --git a/src/main/java/org/bukkit/inventory/meta/components/JukeboxPlayableComponent.java b/src/main/java/org/bukkit/inventory/meta/components/JukeboxPlayableComponent.java index 785c6b27..9f61aa8e 100644 --- a/src/main/java/org/bukkit/inventory/meta/components/JukeboxPlayableComponent.java +++ b/src/main/java/org/bukkit/inventory/meta/components/JukeboxPlayableComponent.java @@ -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); } diff --git a/src/main/java/org/bukkit/inventory/meta/components/ToolComponent.java b/src/main/java/org/bukkit/inventory/meta/components/ToolComponent.java index 83de6c9d..edc35288 100644 --- a/src/main/java/org/bukkit/inventory/meta/components/ToolComponent.java +++ b/src/main/java/org/bukkit/inventory/meta/components/ToolComponent.java @@ -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. * diff --git a/src/main/java/org/bukkit/inventory/meta/components/WeaponComponent.java b/src/main/java/org/bukkit/inventory/meta/components/WeaponComponent.java new file mode 100644 index 00000000..239c3d68 --- /dev/null +++ b/src/main/java/org/bukkit/inventory/meta/components/WeaponComponent.java @@ -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); +}