Update to Minecraft 1.20.5

By: md_5 <git@md-5.net>
This commit is contained in:
Bukkit/Spigot 2024-04-24 01:15:00 +10:00
parent 899f2acb84
commit f3502f6dac
54 changed files with 1814 additions and 741 deletions

View file

@ -5,7 +5,7 @@
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
<version>1.20.4-R0.1-SNAPSHOT</version>
<version>1.20.5-R0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Bukkit</name>
@ -14,8 +14,7 @@
<properties>
<skipTests>true</skipTests>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<maven.compiler.release>17</maven.compiler.release>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
@ -129,7 +128,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.11.0</version>
<version>3.13.0</version>
<configuration>
<!-- we use the Eclipse compiler as it doesn't need a JDK -->
<compilerId>eclipse</compilerId>
@ -140,7 +139,7 @@
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-compiler-eclipse</artifactId>
<version>2.13.0</version>
<version>2.15.0</version>
</dependency>
</dependencies>
</plugin>

View file

@ -1167,6 +1167,16 @@ public final class Bukkit {
return server.isEnforcingSecureProfiles();
}
/**
* Gets whether this server is allowing connections transferred from other
* servers.
*
* @return true if the server accepts transfers, false otherwise
*/
public static boolean isAcceptingTransfers() {
return server.isAcceptingTransfers();
}
/**
* Gets whether the Server hide online players in server status.
*

View file

@ -3,7 +3,6 @@ package org.bukkit;
import com.google.common.collect.Maps;
import java.util.Map;
import org.bukkit.block.BlockFace;
import org.bukkit.potion.Potion;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@ -137,7 +136,7 @@ public enum Effect {
* Visual effect of a splash potion breaking. Needs potion data value as
* additional info.
*/
POTION_BREAK(2002, Type.VISUAL, Potion.class),
POTION_BREAK(2002, Type.VISUAL, Color.class),
/**
* Visual effect of an instant splash potion breaking. Needs color data
* value as additional info.

View file

@ -278,6 +278,11 @@ public final class GameRule<T> {
*/
public static final GameRule<Integer> PLAYERS_NETHER_PORTAL_CREATIVE_DELAY = new GameRule<>("playersNetherPortalCreativeDelay", Integer.class);
/**
* The number of chunks around spawn which will be kept loaded at all times.
*/
public static final GameRule<Integer> SPAWN_CHUNK_RADIUS = new GameRule<>("spawnChunkRadius", Integer.class);
// All GameRules instantiated above this for organizational purposes
private final String name;
private final Class<T> type;

View file

@ -109,6 +109,7 @@ import org.bukkit.block.data.type.TrialSpawner;
import org.bukkit.block.data.type.Tripwire;
import org.bukkit.block.data.type.TripwireHook;
import org.bukkit.block.data.type.TurtleEgg;
import org.bukkit.block.data.type.Vault;
import org.bukkit.block.data.type.Wall;
import org.bukkit.block.data.type.WallHangingSign;
import org.bukkit.block.data.type.WallSign;
@ -293,6 +294,11 @@ public enum Material implements Keyed, Translatable {
RAW_IRON_BLOCK(32210),
RAW_COPPER_BLOCK(17504),
RAW_GOLD_BLOCK(23246),
/**
* BlockData: {@link Waterlogged}
*/
@MinecraftExperimental
HEAVY_CORE(15788, Waterlogged.class),
AMETHYST_BLOCK(18919),
BUDDING_AMETHYST(13963),
IRON_BLOCK(24754),
@ -620,7 +626,7 @@ public enum Material implements Keyed, Translatable {
CHISELED_SANDSTONE(31763),
CUT_SANDSTONE(6118),
COBWEB(9469),
SHORT_GRASS(6155),
SHORT_GRASS(16335),
FERN(15794),
AZALEA(29386),
FLOWERING_AZALEA(28270),
@ -2319,7 +2325,9 @@ public enum Material implements Keyed, Translatable {
*/
JIGSAW(17398, Jigsaw.class),
TURTLE_HELMET(30120, 1, 275),
SCUTE(11914),
TURTLE_SCUTE(6766),
ARMADILLO_SCUTE(11497),
WOLF_ARMOR(17138, 1, 64),
FLINT_AND_STEEL(28620, 1, 64),
APPLE(7720),
BOW(8745, 1, 384),
@ -2660,12 +2668,15 @@ public enum Material implements Keyed, Translatable {
CAULDRON(26531),
ENDER_EYE(24860),
GLISTERING_MELON_SLICE(20158),
ARMADILLO_SPAWN_EGG(22098),
ALLAY_SPAWN_EGG(7909),
AXOLOTL_SPAWN_EGG(30381),
BAT_SPAWN_EGG(14607),
BEE_SPAWN_EGG(22924),
BLAZE_SPAWN_EGG(4759),
@MinecraftExperimental
BOGGED_SPAWN_EGG(12042),
@MinecraftExperimental
BREEZE_SPAWN_EGG(7580),
CAT_SPAWN_EGG(29583),
CAMEL_SPAWN_EGG(14760),
@ -2741,8 +2752,12 @@ public enum Material implements Keyed, Translatable {
ZOMBIFIED_PIGLIN_SPAWN_EGG(6626),
EXPERIENCE_BOTTLE(12858),
FIRE_CHARGE(4842),
@MinecraftExperimental
WIND_CHARGE(23928),
WRITABLE_BOOK(13393, 1),
WRITTEN_BOOK(24164, 16),
@MinecraftExperimental
MACE(4771, 1, 250),
ITEM_FRAME(27318),
GLOW_ITEM_FRAME(26473),
FLOWER_POT(30567),
@ -2919,6 +2934,8 @@ public enum Material implements Keyed, Translatable {
MOJANG_BANNER_PATTERN(11903, 1),
GLOBE_BANNER_PATTERN(27753, 1),
PIGLIN_BANNER_PATTERN(22028, 1),
FLOW_BANNER_PATTERN(32683, 1),
GUSTER_BANNER_PATTERN(27267, 1),
GOAT_HORN(28237, 1),
/**
* BlockData: {@link Levelled}
@ -3137,6 +3154,10 @@ public enum Material implements Keyed, Translatable {
SILENCE_ARMOR_TRIM_SMITHING_TEMPLATE(7070),
RAISER_ARMOR_TRIM_SMITHING_TEMPLATE(29116),
HOST_ARMOR_TRIM_SMITHING_TEMPLATE(12165),
@MinecraftExperimental
FLOW_ARMOR_TRIM_SMITHING_TEMPLATE(29175),
@MinecraftExperimental
BOLT_ARMOR_TRIM_SMITHING_TEMPLATE(9698),
ANGLER_POTTERY_SHERD(9952),
ARCHER_POTTERY_SHERD(21629),
ARMS_UP_POTTERY_SHERD(5484),
@ -3145,7 +3166,11 @@ public enum Material implements Keyed, Translatable {
BURN_POTTERY_SHERD(21259),
DANGER_POTTERY_SHERD(30506),
EXPLORER_POTTERY_SHERD(5124),
@MinecraftExperimental
FLOW_POTTERY_SHERD(4896),
FRIEND_POTTERY_SHERD(18221),
@MinecraftExperimental
GUSTER_POTTERY_SHERD(28193),
HEART_POTTERY_SHERD(17607),
HEARTBREAK_POTTERY_SHERD(21108),
HOWL_POTTERY_SHERD(24900),
@ -3153,6 +3178,8 @@ public enum Material implements Keyed, Translatable {
MOURNER_POTTERY_SHERD(23993),
PLENTY_POTTERY_SHERD(28236),
PRIZE_POTTERY_SHERD(4341),
@MinecraftExperimental
SCRAPE_POTTERY_SHERD(30034),
SHEAF_POTTERY_SHERD(23652),
SHELTER_POTTERY_SHERD(28390),
SKULL_POTTERY_SHERD(16980),
@ -3244,6 +3271,17 @@ public enum Material implements Keyed, Translatable {
TRIAL_SPAWNER(19902, TrialSpawner.class),
@MinecraftExperimental
TRIAL_KEY(12725),
@MinecraftExperimental
OMINOUS_TRIAL_KEY(4986),
/**
* BlockData: {@link Vault}
*/
@MinecraftExperimental
VAULT(6288, Vault.class),
@MinecraftExperimental
OMINOUS_BOTTLE(26321),
@MinecraftExperimental
BREEZE_ROD(14281),
/**
* BlockData: {@link Levelled}
*/
@ -5243,6 +5281,7 @@ public enum Material implements Keyed, Translatable {
case GRINDSTONE:
case HANGING_ROOTS:
case HAY_BLOCK:
case HEAVY_CORE:
case HEAVY_WEIGHTED_PRESSURE_PLATE:
case HONEYCOMB_BLOCK:
case HONEY_BLOCK:
@ -5765,6 +5804,7 @@ public enum Material implements Keyed, Translatable {
case TURTLE_EGG:
case TWISTING_VINES:
case TWISTING_VINES_PLANT:
case VAULT:
case VERDANT_FROGLIGHT:
case VINE:
case VOID_AIR:
@ -5915,6 +5955,7 @@ public enum Material implements Keyed, Translatable {
case MELON_SLICE:
case MUSHROOM_STEW:
case MUTTON:
case OMINOUS_BOTTLE:
case POISONOUS_POTATO:
case PORKCHOP:
case POTATO:
@ -6842,6 +6883,7 @@ public enum Material implements Keyed, Translatable {
case TUFF_STAIRS:
case TUFF_WALL:
case TURTLE_EGG:
case VAULT:
case VERDANT_FROGLIGHT:
case WARPED_DOOR:
case WARPED_FENCE:
@ -8621,6 +8663,7 @@ public enum Material implements Keyed, Translatable {
case TUBE_CORAL_BLOCK:
case TUFF:
case TUFF_BRICKS:
case VAULT:
case VERDANT_FROGLIGHT:
case WARPED_HYPHAE:
case WARPED_NYLIUM:
@ -9294,6 +9337,7 @@ public enum Material implements Keyed, Translatable {
case SWEET_BERRY_BUSH:
case TNT:
case TRAPPED_CHEST:
case VAULT:
case WARPED_BUTTON:
case WARPED_DOOR:
case WARPED_FENCE:
@ -10255,6 +10299,8 @@ public enum Material implements Keyed, Translatable {
case REDSTONE_BLOCK:
case SPAWNER:
return 5.0F;
case HEAVY_CORE:
return 10.0F;
case ENDER_CHEST:
return 22.5F;
case ANCIENT_DEBRIS:
@ -10264,6 +10310,7 @@ public enum Material implements Keyed, Translatable {
case OBSIDIAN:
case RESPAWN_ANCHOR:
case TRIAL_SPAWNER:
case VAULT:
return 50.0F;
case REINFORCED_DEEPSLATE:
return 55.0F;
@ -11188,6 +11235,7 @@ public enum Material implements Keyed, Translatable {
case END_STONE_BRICK_WALL:
return 9.0F;
case TRIAL_SPAWNER:
case VAULT:
return 50.0F;
case LAVA:
case WATER:
@ -11200,6 +11248,7 @@ public enum Material implements Keyed, Translatable {
case CRYING_OBSIDIAN:
case DAMAGED_ANVIL:
case ENCHANTING_TABLE:
case HEAVY_CORE:
case NETHERITE_BLOCK:
case OBSIDIAN:
case REINFORCED_DEEPSLATE:
@ -11332,6 +11381,28 @@ public enum Material implements Keyed, Translatable {
return EquipmentSlot.FEET;
case SHIELD:
return EquipmentSlot.OFF_HAND;
case BLACK_CARPET:
case BLUE_CARPET:
case BROWN_CARPET:
case CYAN_CARPET:
case DIAMOND_HORSE_ARMOR:
case GOLDEN_HORSE_ARMOR:
case GRAY_CARPET:
case GREEN_CARPET:
case IRON_HORSE_ARMOR:
case LEATHER_HORSE_ARMOR:
case LIGHT_BLUE_CARPET:
case LIGHT_GRAY_CARPET:
case LIME_CARPET:
case MAGENTA_CARPET:
case ORANGE_CARPET:
case PINK_CARPET:
case PURPLE_CARPET:
case RED_CARPET:
case WHITE_CARPET:
case WOLF_ARMOR:
case YELLOW_CARPET:
return EquipmentSlot.BODY;
default:
return EquipmentSlot.HAND;
// </editor-fold>

View file

@ -22,8 +22,10 @@ public enum Particle implements Keyed {
SMOKE_LARGE("large_smoke"),
SPELL("effect"),
SPELL_INSTANT("instant_effect"),
SPELL_MOB("entity_effect"),
SPELL_MOB_AMBIENT("ambient_entity_effect"),
/**
* Uses {@link Color} as DataType
*/
SPELL_MOB("entity_effect", Color.class),
SPELL_WITCH("witch"),
DRIP_WATER("dripping_water"),
DRIP_LAVA("dripping_lava"),
@ -136,11 +138,32 @@ public enum Particle implements Keyed {
@MinecraftExperimental
GUST("gust"),
@MinecraftExperimental
GUST_EMITTER("gust_emitter"),
SMALL_GUST("small_gust"),
@MinecraftExperimental
GUST_DUST("gust_dust"),
GUST_EMITTER_LARGE("gust_emitter_large"),
@MinecraftExperimental
GUST_EMITTER_SMALL("gust_emitter_small"),
@MinecraftExperimental
TRIAL_SPAWNER_DETECTION("trial_spawner_detection"),
@MinecraftExperimental
TRIAL_SPAWNER_DETECTION_OMINOUS("trial_spawner_detection_ominous"),
@MinecraftExperimental
VAULT_CONNECTION("vault_connection"),
@MinecraftExperimental
INFESTED("infested"),
@MinecraftExperimental
ITEM_COBWEB("item_cobweb"),
/**
* Uses {@link BlockData} as DataType
*/
@MinecraftExperimental
DUST_PILLAR("dust_pillar", BlockData.class),
@MinecraftExperimental
OMINOUS_SPAWNING("ominous_spawning"),
@MinecraftExperimental
RAID_OMEN("raid_omen"),
@MinecraftExperimental
TRIAL_OMEN("trial_omen"),
/**
* Uses {@link BlockData} as DataType
*/

View file

@ -20,12 +20,14 @@ import org.bukkit.entity.Cat;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Frog;
import org.bukkit.entity.Villager;
import org.bukkit.entity.Wolf;
import org.bukkit.entity.memory.MemoryKey;
import org.bukkit.generator.structure.Structure;
import org.bukkit.generator.structure.StructureType;
import org.bukkit.inventory.meta.trim.TrimMaterial;
import org.bukkit.inventory.meta.trim.TrimPattern;
import org.bukkit.loot.LootTables;
import org.bukkit.map.MapCursor;
import org.bukkit.potion.PotionEffectType;
import org.bukkit.potion.PotionType;
import org.jetbrains.annotations.ApiStatus;
@ -264,6 +266,19 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
* @see Frog.Variant
*/
Registry<Frog.Variant> FROG_VARIANT = new SimpleRegistry<>(Frog.Variant.class);
/**
* Wolf variants.
*
* @see Wolf.Variant
*/
Registry<Wolf.Variant> WOLF_VARIANT = new SimpleRegistry<>(Wolf.Variant.class);
/**
* Map cursor types.
*
* @see MapCursor.Type
*/
@ApiStatus.Internal
Registry<MapCursor.Type> MAP_DECORATION_TYPE = new SimpleRegistry<>(MapCursor.Type.class);
/**
* Game events.
*

View file

@ -998,6 +998,14 @@ public interface Server extends PluginMessageRecipient {
*/
public boolean isEnforcingSecureProfiles();
/**
* Gets whether this server is allowing connections transferred from other
* servers.
*
* @return true if the server accepts transfers, false otherwise
*/
public boolean isAcceptingTransfers();
/**
* Gets whether the Server hide online players in server status.
*

View file

@ -203,6 +203,11 @@ public enum Sound implements Keyed {
BLOCK_CHISELED_BOOKSHELF_STEP("block.chiseled_bookshelf.step"),
BLOCK_CHORUS_FLOWER_DEATH("block.chorus_flower.death"),
BLOCK_CHORUS_FLOWER_GROW("block.chorus_flower.grow"),
BLOCK_COBWEB_BREAK("block.cobweb.break"),
BLOCK_COBWEB_FALL("block.cobweb.fall"),
BLOCK_COBWEB_HIT("block.cobweb.hit"),
BLOCK_COBWEB_PLACE("block.cobweb.place"),
BLOCK_COBWEB_STEP("block.cobweb.step"),
BLOCK_COMPARATOR_CLICK("block.comparator.click"),
BLOCK_COMPOSTER_EMPTY("block.composter.empty"),
BLOCK_COMPOSTER_FILL("block.composter.fill"),
@ -354,6 +359,16 @@ public enum Sound implements Keyed {
BLOCK_HANGING_SIGN_PLACE("block.hanging_sign.place"),
BLOCK_HANGING_SIGN_STEP("block.hanging_sign.step"),
BLOCK_HANGING_SIGN_WAXED_INTERACT_FAIL("block.hanging_sign.waxed_interact_fail"),
@MinecraftExperimental
BLOCK_HEAVY_CORE_BREAK("block.heavy_core.break"),
@MinecraftExperimental
BLOCK_HEAVY_CORE_FALL("block.heavy_core.fall"),
@MinecraftExperimental
BLOCK_HEAVY_CORE_HIT("block.heavy_core.hit"),
@MinecraftExperimental
BLOCK_HEAVY_CORE_PLACE("block.heavy_core.place"),
@MinecraftExperimental
BLOCK_HEAVY_CORE_STEP("block.heavy_core.step"),
BLOCK_HONEY_BLOCK_BREAK("block.honey_block.break"),
BLOCK_HONEY_BLOCK_FALL("block.honey_block.fall"),
BLOCK_HONEY_BLOCK_HIT("block.honey_block.hit"),
@ -684,10 +699,16 @@ public enum Sound implements Keyed {
BLOCK_SWEET_BERRY_BUSH_PICK_BERRIES("block.sweet_berry_bush.pick_berries"),
BLOCK_SWEET_BERRY_BUSH_PLACE("block.sweet_berry_bush.place"),
@MinecraftExperimental
BLOCK_TRIAL_SPAWNER_ABOUT_TO_SPAWN_ITEM("block.trial_spawner.about_to_spawn_item"),
@MinecraftExperimental
BLOCK_TRIAL_SPAWNER_AMBIENT("block.trial_spawner.ambient"),
@MinecraftExperimental
BLOCK_TRIAL_SPAWNER_AMBIENT_CHARGED("block.trial_spawner.ambient_charged"),
@MinecraftExperimental
BLOCK_TRIAL_SPAWNER_BREAK("block.trial_spawner.break"),
@MinecraftExperimental
BLOCK_TRIAL_SPAWNER_CHARGE_ACTIVATE("block.trial_spawner.charge_activate"),
@MinecraftExperimental
BLOCK_TRIAL_SPAWNER_CLOSE_SHUTTER("block.trial_spawner.close_shutter"),
@MinecraftExperimental
BLOCK_TRIAL_SPAWNER_DETECT_PLAYER("block.trial_spawner.detect_player"),
@ -702,6 +723,10 @@ public enum Sound implements Keyed {
@MinecraftExperimental
BLOCK_TRIAL_SPAWNER_PLACE("block.trial_spawner.place"),
@MinecraftExperimental
BLOCK_TRIAL_SPAWNER_SPAWN_ITEM("block.trial_spawner.spawn_item"),
@MinecraftExperimental
BLOCK_TRIAL_SPAWNER_SPAWN_ITEM_BEGIN("block.trial_spawner.spawn_item_begin"),
@MinecraftExperimental
BLOCK_TRIAL_SPAWNER_SPAWN_MOB("block.trial_spawner.spawn_mob"),
@MinecraftExperimental
BLOCK_TRIAL_SPAWNER_STEP("block.trial_spawner.step"),
@ -724,6 +749,32 @@ public enum Sound implements Keyed {
BLOCK_TUFF_HIT("block.tuff.hit"),
BLOCK_TUFF_PLACE("block.tuff.place"),
BLOCK_TUFF_STEP("block.tuff.step"),
@MinecraftExperimental
BLOCK_VAULT_ACTIVATE("block.vault.activate"),
@MinecraftExperimental
BLOCK_VAULT_AMBIENT("block.vault.ambient"),
@MinecraftExperimental
BLOCK_VAULT_BREAK("block.vault.break"),
@MinecraftExperimental
BLOCK_VAULT_CLOSE_SHUTTER("block.vault.close_shutter"),
@MinecraftExperimental
BLOCK_VAULT_DEACTIVATE("block.vault.deactivate"),
@MinecraftExperimental
BLOCK_VAULT_EJECT_ITEM("block.vault.eject_item"),
@MinecraftExperimental
BLOCK_VAULT_FALL("block.vault.fall"),
@MinecraftExperimental
BLOCK_VAULT_HIT("block.vault.hit"),
@MinecraftExperimental
BLOCK_VAULT_INSERT_ITEM("block.vault.insert_item"),
@MinecraftExperimental
BLOCK_VAULT_INSERT_ITEM_FAIL("block.vault.insert_item_fail"),
@MinecraftExperimental
BLOCK_VAULT_OPEN_SHUTTER("block.vault.open_shutter"),
@MinecraftExperimental
BLOCK_VAULT_PLACE("block.vault.place"),
@MinecraftExperimental
BLOCK_VAULT_STEP("block.vault.step"),
BLOCK_VINE_BREAK("block.vine.break"),
BLOCK_VINE_FALL("block.vine.fall"),
BLOCK_VINE_HIT("block.vine.hit"),
@ -746,6 +797,7 @@ public enum Sound implements Keyed {
BLOCK_WET_GRASS_PLACE("block.wet_grass.place"),
BLOCK_WET_GRASS_STEP("block.wet_grass.step"),
BLOCK_WET_SPONGE_BREAK("block.wet_sponge.break"),
BLOCK_WET_SPONGE_DRIES("block.wet_sponge.dries"),
BLOCK_WET_SPONGE_FALL("block.wet_sponge.fall"),
BLOCK_WET_SPONGE_HIT("block.wet_sponge.hit"),
BLOCK_WET_SPONGE_PLACE("block.wet_sponge.place"),
@ -776,6 +828,19 @@ public enum Sound implements Keyed {
ENTITY_ALLAY_ITEM_GIVEN("entity.allay.item_given"),
ENTITY_ALLAY_ITEM_TAKEN("entity.allay.item_taken"),
ENTITY_ALLAY_ITEM_THROWN("entity.allay.item_thrown"),
ENTITY_ARMADILLO_AMBIENT("entity.armadillo.ambient"),
ENTITY_ARMADILLO_BRUSH("entity.armadillo.brush"),
ENTITY_ARMADILLO_DEATH("entity.armadillo.death"),
ENTITY_ARMADILLO_EAT("entity.armadillo.eat"),
ENTITY_ARMADILLO_HURT("entity.armadillo.hurt"),
ENTITY_ARMADILLO_HURT_REDUCED("entity.armadillo.hurt_reduced"),
ENTITY_ARMADILLO_LAND("entity.armadillo.land"),
ENTITY_ARMADILLO_PEEK("entity.armadillo.peek"),
ENTITY_ARMADILLO_ROLL("entity.armadillo.roll"),
ENTITY_ARMADILLO_SCUTE_DROP("entity.armadillo.scute_drop"),
ENTITY_ARMADILLO_STEP("entity.armadillo.step"),
ENTITY_ARMADILLO_UNROLL_FINISH("entity.armadillo.unroll_finish"),
ENTITY_ARMADILLO_UNROLL_START("entity.armadillo.unroll_start"),
ENTITY_ARMOR_STAND_BREAK("entity.armor_stand.break"),
ENTITY_ARMOR_STAND_FALL("entity.armor_stand.fall"),
ENTITY_ARMOR_STAND_HIT("entity.armor_stand.hit"),
@ -809,8 +874,22 @@ public enum Sound implements Keyed {
ENTITY_BOAT_PADDLE_LAND("entity.boat.paddle_land"),
ENTITY_BOAT_PADDLE_WATER("entity.boat.paddle_water"),
@MinecraftExperimental
ENTITY_BOGGED_AMBIENT("entity.bogged.ambient"),
@MinecraftExperimental
ENTITY_BOGGED_DEATH("entity.bogged.death"),
@MinecraftExperimental
ENTITY_BOGGED_HURT("entity.bogged.hurt"),
@MinecraftExperimental
ENTITY_BOGGED_SHEAR("entity.bogged.shear"),
@MinecraftExperimental
ENTITY_BOGGED_STEP("entity.bogged.step"),
@MinecraftExperimental
ENTITY_BREEZE_CHARGE("entity.breeze.charge"),
@MinecraftExperimental
ENTITY_BREEZE_DEATH("entity.breeze.death"),
@MinecraftExperimental
ENTITY_BREEZE_DEFLECT("entity.breeze.deflect"),
@MinecraftExperimental
ENTITY_BREEZE_HURT("entity.breeze.hurt"),
@MinecraftExperimental
ENTITY_BREEZE_IDLE_AIR("entity.breeze.idle_air"),
@ -826,6 +905,10 @@ public enum Sound implements Keyed {
ENTITY_BREEZE_SHOOT("entity.breeze.shoot"),
@MinecraftExperimental
ENTITY_BREEZE_SLIDE("entity.breeze.slide"),
@MinecraftExperimental
ENTITY_BREEZE_WHIRL("entity.breeze.whirl"),
@MinecraftExperimental
ENTITY_BREEZE_WIND_BURST("entity.breeze.wind_burst"),
ENTITY_CAMEL_AMBIENT("entity.camel.ambient"),
ENTITY_CAMEL_DASH("entity.camel.dash"),
ENTITY_CAMEL_DASH_READY("entity.camel.dash_ready"),
@ -879,6 +962,7 @@ public enum Sound implements Keyed {
ENTITY_DONKEY_DEATH("entity.donkey.death"),
ENTITY_DONKEY_EAT("entity.donkey.eat"),
ENTITY_DONKEY_HURT("entity.donkey.hurt"),
ENTITY_DONKEY_JUMP("entity.donkey.jump"),
ENTITY_DRAGON_FIREBALL_EXPLODE("entity.dragon_fireball.explode"),
ENTITY_DROWNED_AMBIENT("entity.drowned.ambient"),
ENTITY_DROWNED_AMBIENT_WATER("entity.drowned.ambient_water"),
@ -970,8 +1054,6 @@ public enum Sound implements Keyed {
ENTITY_GENERIC_SMALL_FALL("entity.generic.small_fall"),
ENTITY_GENERIC_SPLASH("entity.generic.splash"),
ENTITY_GENERIC_SWIM("entity.generic.swim"),
@MinecraftExperimental
ENTITY_GENERIC_WIND_BURST("entity.generic.wind_burst"),
ENTITY_GHAST_AMBIENT("entity.ghast.ambient"),
ENTITY_GHAST_DEATH("entity.ghast.death"),
ENTITY_GHAST_HURT("entity.ghast.hurt"),
@ -1101,6 +1183,7 @@ public enum Sound implements Keyed {
ENTITY_MULE_DEATH("entity.mule.death"),
ENTITY_MULE_EAT("entity.mule.eat"),
ENTITY_MULE_HURT("entity.mule.hurt"),
ENTITY_MULE_JUMP("entity.mule.jump"),
ENTITY_OCELOT_AMBIENT("entity.ocelot.ambient"),
ENTITY_OCELOT_DEATH("entity.ocelot.death"),
ENTITY_OCELOT_HURT("entity.ocelot.hurt"),
@ -1124,6 +1207,8 @@ public enum Sound implements Keyed {
ENTITY_PARROT_HURT("entity.parrot.hurt"),
ENTITY_PARROT_IMITATE_BLAZE("entity.parrot.imitate.blaze"),
@MinecraftExperimental
ENTITY_PARROT_IMITATE_BOGGED("entity.parrot.imitate.bogged"),
@MinecraftExperimental
ENTITY_PARROT_IMITATE_BREEZE("entity.parrot.imitate.breeze"),
ENTITY_PARROT_IMITATE_CREEPER("entity.parrot.imitate.creeper"),
ENTITY_PARROT_IMITATE_DROWNED("entity.parrot.imitate.drowned"),
@ -1402,6 +1487,10 @@ public enum Sound implements Keyed {
ENTITY_WARDEN_SONIC_CHARGE("entity.warden.sonic_charge"),
ENTITY_WARDEN_STEP("entity.warden.step"),
ENTITY_WARDEN_TENDRIL_CLICKS("entity.warden.tendril_clicks"),
@MinecraftExperimental
ENTITY_WIND_CHARGE_THROW("entity.wind_charge.throw"),
@MinecraftExperimental
ENTITY_WIND_CHARGE_WIND_BURST("entity.wind_charge.wind_burst"),
ENTITY_WITCH_AMBIENT("entity.witch.ambient"),
ENTITY_WITCH_CELEBRATE("entity.witch.celebrate"),
ENTITY_WITCH_DEATH("entity.witch.death"),
@ -1456,6 +1545,12 @@ public enum Sound implements Keyed {
ENTITY_ZOMBIFIED_PIGLIN_ANGRY("entity.zombified_piglin.angry"),
ENTITY_ZOMBIFIED_PIGLIN_DEATH("entity.zombified_piglin.death"),
ENTITY_ZOMBIFIED_PIGLIN_HURT("entity.zombified_piglin.hurt"),
@MinecraftExperimental
EVENT_MOB_EFFECT_BAD_OMEN("event.mob_effect.bad_omen"),
@MinecraftExperimental
EVENT_MOB_EFFECT_RAID_OMEN("event.mob_effect.raid_omen"),
@MinecraftExperimental
EVENT_MOB_EFFECT_TRIAL_OMEN("event.mob_effect.trial_omen"),
EVENT_RAID_HORN("event.raid.horn"),
INTENTIONALLY_EMPTY("intentionally_empty"),
ITEM_ARMOR_EQUIP_CHAIN("item.armor.equip_chain"),
@ -1467,6 +1562,8 @@ public enum Sound implements Keyed {
ITEM_ARMOR_EQUIP_LEATHER("item.armor.equip_leather"),
ITEM_ARMOR_EQUIP_NETHERITE("item.armor.equip_netherite"),
ITEM_ARMOR_EQUIP_TURTLE("item.armor.equip_turtle"),
ITEM_ARMOR_EQUIP_WOLF("item.armor.equip_wolf"),
ITEM_ARMOR_UNEQUIP_WOLF("item.armor.unequip_wolf"),
ITEM_AXE_SCRAPE("item.axe.scrape"),
ITEM_AXE_STRIP("item.axe.strip"),
ITEM_AXE_WAX_OFF("item.axe.wax_off"),
@ -1528,7 +1625,15 @@ public enum Sound implements Keyed {
ITEM_HONEY_BOTTLE_DRINK("item.honey_bottle.drink"),
ITEM_INK_SAC_USE("item.ink_sac.use"),
ITEM_LODESTONE_COMPASS_LOCK("item.lodestone_compass.lock"),
@MinecraftExperimental
ITEM_MACE_SMASH_AIR("item.mace.smash_air"),
@MinecraftExperimental
ITEM_MACE_SMASH_GROUND("item.mace.smash_ground"),
@MinecraftExperimental
ITEM_MACE_SMASH_GROUND_HEAVY("item.mace.smash_ground_heavy"),
ITEM_NETHER_WART_PLANT("item.nether_wart.plant"),
@MinecraftExperimental
ITEM_OMINOUS_BOTTLE_DISPOSE("item.ominous_bottle.dispose"),
ITEM_SHIELD_BLOCK("item.shield.block"),
ITEM_SHIELD_BREAK("item.shield.break"),
ITEM_SHOVEL_FLATTEN("item.shovel.flatten"),
@ -1543,6 +1648,14 @@ public enum Sound implements Keyed {
ITEM_TRIDENT_RIPTIDE_3("item.trident.riptide_3"),
ITEM_TRIDENT_THROW("item.trident.throw"),
ITEM_TRIDENT_THUNDER("item.trident.thunder"),
@MinecraftExperimental
ITEM_WOLF_ARMOR_BREAK("item.wolf_armor.break"),
@MinecraftExperimental
ITEM_WOLF_ARMOR_CRACK("item.wolf_armor.crack"),
@MinecraftExperimental
ITEM_WOLF_ARMOR_DAMAGE("item.wolf_armor.damage"),
@MinecraftExperimental
ITEM_WOLF_ARMOR_REPAIR("item.wolf_armor.repair"),
MUSIC_CREATIVE("music.creative"),
MUSIC_CREDITS("music.credits"),
MUSIC_DISC_11("music_disc.11"),

View file

@ -260,6 +260,10 @@ public interface Tag<T extends Keyed> extends Keyed {
* Vanilla block tag representing all terracotta.
*/
Tag<Material> TERRACOTTA = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("terracotta"), Material.class);
/**
* Vanilla block tag representing all badlands terracotta.
*/
Tag<Material> BADLANDS_TERRACOTTA = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("badlands_terracotta"), Material.class);
/**
* Vanilla block tag representing all concrete powder.
*/
@ -583,6 +587,30 @@ public interface Tag<T extends Keyed> extends Keyed {
* Vanilla block tag representing all blocks which require a stone tool.
*/
Tag<Material> NEEDS_STONE_TOOL = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("needs_stone_tool"), Material.class);
/**
* Vanilla block tag representing all blocks which will not drop items with a netherite tool.
*/
Tag<Material> INCORRECT_FOR_NETHERITE_TOOL = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("incorrect_for_netherite_tool"), Material.class);
/**
* Vanilla block tag representing all blocks which will not drop items with a diamond tool.
*/
Tag<Material> INCORRECT_FOR_DIAMOND_TOOL = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("incorrect_for_diamond_tool"), Material.class);
/**
* Vanilla block tag representing all blocks which will not drop items with a iron tool.
*/
Tag<Material> INCORRECT_FOR_IRON_TOOL = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("incorrect_for_iron_tool"), Material.class);
/**
* Vanilla block tag representing all blocks which will not drop items with a stone tool.
*/
Tag<Material> INCORRECT_FOR_STONE_TOOL = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("incorrect_for_stone_tool"), Material.class);
/**
* Vanilla block tag representing all blocks which will not drop items with a gold tool.
*/
Tag<Material> INCORRECT_FOR_GOLD_TOOL = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("incorrect_for_gold_tool"), Material.class);
/**
* Vanilla block tag representing all blocks which will not drop items with a wooden tool.
*/
Tag<Material> INCORRECT_FOR_WOODEN_TOOL = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("incorrect_for_wooden_tool"), Material.class);
/**
* Vanilla block tag representing all blocks which will not be replaced by
* world generation features.
@ -623,6 +651,10 @@ public interface Tag<T extends Keyed> extends Keyed {
* Vanilla block tag representing all blocks which animals will spawn on.
*/
Tag<Material> ANIMALS_SPAWNABLE_ON = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("animals_spawnable_on"), Material.class);
/**
* Vanilla block tag representing all blocks which armadillos will spawn on.
*/
Tag<Material> ARMADILLO_SPAWNABLE_ON = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("armadillo_spawnable_on"), Material.class);
/**
* Vanilla block tag representing all blocks which axolotls will spawn on.
*/
@ -731,6 +763,14 @@ public interface Tag<T extends Keyed> extends Keyed {
* Vanilla block tag representing all blocks which do not destroy farmland when placed.
*/
Tag<Material> MAINTAINS_FARMLAND = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("maintains_farmland"), Material.class);
/**
* Vanilla block tag representing all blocks which block wind charge explosions.
*/
Tag<Material> BLOCKS_WIND_CHARGE_EXPLOSIONS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("blocks_wind_charge_explosions"), Material.class);
/**
* 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);
/**
* Key for the built in item registry.
*/
@ -743,14 +783,136 @@ public interface Tag<T extends Keyed> extends Keyed {
* Vanilla item tag representing all items ignored by piglin babies.
*/
Tag<Material> IGNORED_BY_PIGLIN_BABIES = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("ignored_by_piglin_babies"), Material.class);
/**
* Vanilla item tag representing all meat.
*/
Tag<Material> ITEMS_MEAT = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("meat"), Material.class);
/**
* Vanilla item tag representing all sniffer food.
*/
Tag<Material> ITEMS_SNIFFER_FOOD = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("sniffer_food"), Material.class);
/**
* Vanilla item tag representing all piglin food.
*/
Tag<Material> PIGLIN_FOOD = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("piglin_food"), Material.class);
Tag<Material> ITEMS_PIGLIN_FOOD = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("piglin_food"), Material.class);
/**
* Vanilla item tag representing all piglin food.
*
* @deprecated use {@link #ITEMS_PIGLIN_FOOD}
*/
@Deprecated
Tag<Material> PIGLIN_FOOD = ITEMS_PIGLIN_FOOD;
/**
* Vanilla item tag representing all fox food.
*/
Tag<Material> FOX_FOOD = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("fox_food"), Material.class);
Tag<Material> ITEMS_FOX_FOOD = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("fox_food"), Material.class);
/**
* Vanilla item tag representing all fox food.
*
* @deprecated use {@link #ITEMS_FOX_FOOD}
*/
@Deprecated
Tag<Material> FOX_FOOD = ITEMS_FOX_FOOD;
/**
* Vanilla item tag representing all cow food.
*/
Tag<Material> ITEMS_COW_FOOD = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("cow_food"), Material.class);
/**
* Vanilla item tag representing all goat food.
*/
Tag<Material> ITEMS_GOAT_FOOD = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("goat_food"), Material.class);
/**
* Vanilla item tag representing all sheep food.
*/
Tag<Material> ITEMS_SHEEP_FOOD = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("sheep_food"), Material.class);
/**
* Vanilla item tag representing all wolf food.
*/
Tag<Material> ITEMS_WOLF_FOOD = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("wolf_food"), Material.class);
/**
* Vanilla item tag representing all cat food.
*/
Tag<Material> ITEMS_CAT_FOOD = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("cat_food"), Material.class);
/**
* Vanilla item tag representing all horse food.
*/
Tag<Material> ITEMS_HORSE_FOOD = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("horse_food"), Material.class);
/**
* Vanilla item tag representing all horse tempt items.
*/
Tag<Material> ITEMS_HORSE_TEMPT_ITEMS = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("horse_tempt_items"), Material.class);
/**
* Vanilla item tag representing all camel food.
*/
Tag<Material> ITEMS_CAMEL_FOOD = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("camel_food"), Material.class);
/**
* Vanilla item tag representing all armadillo food.
*/
Tag<Material> ITEMS_ARMADILLO_FOOD = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("armadillo_food"), Material.class);
/**
* Vanilla item tag representing all bee food.
*/
Tag<Material> ITEMS_BEE_FOOD = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("bee_food"), Material.class);
/**
* Vanilla item tag representing all chicken food.
*/
Tag<Material> ITEMS_CHICKEN_FOOD = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("chicken_food"), Material.class);
/**
* Vanilla item tag representing all frog food.
*/
Tag<Material> ITEMS_FROG_FOOD = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("frog_food"), Material.class);
/**
* Vanilla item tag representing all hoglin food.
*/
Tag<Material> ITEMS_HOGLIN_FOOD = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("hoglin_food"), Material.class);
/**
* Vanilla item tag representing all llama food.
*/
Tag<Material> ITEMS_LLAMA_FOOD = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("llama_food"), Material.class);
/**
* Vanilla item tag representing all llama tempt items.
*/
Tag<Material> ITEMS_LLAMA_TEMPT_ITEMS = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("llama_tempt_items"), Material.class);
/**
* Vanilla item tag representing all ocelot food.
*/
Tag<Material> ITEMS_OCELOT_FOOD = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("ocelot_food"), Material.class);
/**
* Vanilla item tag representing all panda food.
*/
Tag<Material> ITEMS_PANDA_FOOD = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("panda_food"), Material.class);
/**
* Vanilla item tag representing all pig food.
*/
Tag<Material> ITEMS_PIG_FOOD = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("pig_food"), Material.class);
/**
* Vanilla item tag representing all rabbit food.
*/
Tag<Material> ITEMS_RABBIT_FOOD = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("rabbit_food"), Material.class);
/**
* Vanilla item tag representing all strider food.
*/
Tag<Material> ITEMS_STRIDER_FOOD = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("strider_food"), Material.class);
/**
* Vanilla item tag representing all strider tempt items.
*/
Tag<Material> ITEMS_STRIDER_TEMPT_ITEMS = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("strider_tempt_items"), Material.class);
/**
* Vanilla item tag representing all turtle food.
*/
Tag<Material> ITEMS_TURTLE_FOOD = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("turtle_food"), Material.class);
/**
* Vanilla item tag representing all parrot food.
*/
Tag<Material> ITEMS_PARROT_FOOD = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("parrot_food"), Material.class);
/**
* Vanilla item tag representing all parrot poisonous food.
*/
Tag<Material> ITEMS_PARROT_POISONOUS_FOOD = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("parrot_poisonous_food"), Material.class);
/**
* Vanilla item tag representing all axolotl food.
*/
Tag<Material> ITEMS_AXOLOTL_FOOD = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("axolotl_food"), Material.class);
/**
* Vanilla item tag representing all banner items.
*/
@ -824,6 +986,26 @@ public interface Tag<T extends Keyed> extends Keyed {
* Vanilla item tag representing all items which modify note block sounds when placed on top.
*/
Tag<Material> ITEMS_NOTE_BLOCK_TOP_INSTRUMENTS = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("noteblock_top_instruments"), Material.class);
/**
* Vanilla item tag representing all foot armor.
*/
Tag<Material> ITEMS_FOOT_ARMOR = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("foot_armor"), Material.class);
/**
* Vanilla item tag representing all leg armor.
*/
Tag<Material> ITEMS_LEG_ARMOR = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("leg_armor"), Material.class);
/**
* Vanilla item tag representing all chest armor.
*/
Tag<Material> ITEMS_CHEST_ARMOR = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("chest_armor"), Material.class);
/**
* Vanilla item tag representing all head armor.
*/
Tag<Material> ITEMS_HEAD_ARMOR = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("head_armor"), Material.class);
/**
* Vanilla item tag representing all skulls.
*/
Tag<Material> ITEMS_SKULLS = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("skulls"), Material.class);
/**
* Vanilla item tag representing all trimmable armor items.
*/
@ -836,10 +1018,6 @@ public interface Tag<T extends Keyed> extends Keyed {
* Vanilla item tag representing all trimming templates.
*/
Tag<Material> ITEMS_TRIM_TEMPLATES = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("trim_templates"), Material.class);
/**
* Vanilla item tag representing all food for sniffers.
*/
Tag<Material> ITEMS_SNIFFER_FOOD = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("sniffer_food"), Material.class);
/**
* Vanilla item tag representing all decorated pot sherds.
*/
@ -880,6 +1058,86 @@ public interface Tag<T extends Keyed> extends Keyed {
* Vanilla item tag representing all seeds planteable by villagers.
*/
Tag<Material> ITEMS_VILLAGER_PLANTABLE_SEEDS = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("villager_plantable_seeds"), Material.class);
/**
* Vanilla item tag representing all dyeable items.
*/
Tag<Material> ITEMS_DYEABLE = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("dyeable"), Material.class);
/**
* Vanilla item tag representing all enchantable foot armor.
*/
Tag<Material> ITEMS_ENCHANTABLE_FOOT_ARMOR = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("enchantable/foot_armor"), Material.class);
/**
* Vanilla item tag representing all enchantable leg armor.
*/
Tag<Material> ITEMS_ENCHANTABLE_LEG_ARMOR = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("enchantable/leg_armor"), Material.class);
/**
* Vanilla item tag representing all enchantable chest armor.
*/
Tag<Material> ITEMS_ENCHANTABLE_CHEST_ARMOR = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("enchantable/chest_armor"), Material.class);
/**
* Vanilla item tag representing all enchantable head armor.
*/
Tag<Material> ITEMS_ENCHANTABLE_HEAD_ARMOR = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("enchantable/head_armor"), Material.class);
/**
* Vanilla item tag representing all enchantable armor.
*/
Tag<Material> ITEMS_ENCHANTABLE_ARMOR = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("enchantable/armor"), Material.class);
/**
* Vanilla item tag representing all enchantable swords.
*/
Tag<Material> ITEMS_ENCHANTABLE_SWORD = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("enchantable/sword"), Material.class);
/**
* Vanilla item tag representing all items enchantable with the fire aspect enchantment.
*/
Tag<Material> ITEMS_ENCHANTABLE_FIRE_ASPECT = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("enchantable/fire_aspect"), Material.class);
/**
* Vanilla item tag representing all items enchantable with the sharpness enchantment.
*/
Tag<Material> ITEMS_ENCHANTABLE_SHARP_WEAPON = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("enchantable/sharp_weapon"), Material.class);
/**
* Vanilla item tag representing all enchantable weapons.
*/
Tag<Material> ITEMS_ENCHANTABLE_WEAPON = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("enchantable/weapon"), Material.class);
/**
* Vanilla item tag representing all enchantable mining tools.
*/
Tag<Material> ITEMS_ENCHANTABLE_MINING = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("enchantable/mining"), Material.class);
/**
* Vanilla item tag representing all items enchantable with the mining_loot enchantment.
*/
Tag<Material> ITEMS_ENCHANTABLE_MINING_LOOT = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("enchantable/mining_loot"), Material.class);
/**
* Vanilla item tag representing all items enchantable with fishing enchantments.
*/
Tag<Material> ITEMS_ENCHANTABLE_FISHING = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("enchantable/fishing"), Material.class);
/**
* Vanilla item tag representing all items enchantable with trident enchantments.
*/
Tag<Material> ITEMS_ENCHANTABLE_TRIDENT = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("enchantable/trident"), Material.class);
/**
* Vanilla item tag representing all items enchantable with durability enchantments.
*/
Tag<Material> ITEMS_ENCHANTABLE_DURABILITY = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("enchantable/durability"), Material.class);
/**
* Vanilla item tag representing all items enchantable with bow enchantments.
*/
Tag<Material> ITEMS_ENCHANTABLE_BOW = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("enchantable/bow"), Material.class);
/**
* Vanilla item tag representing all items enchantable with the binding enchantment.
*/
Tag<Material> ITEMS_ENCHANTABLE_EQUIPPABLE = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("enchantable/equippable"), Material.class);
/**
* Vanilla item tag representing all items enchantable with crossbow enchantments.
*/
Tag<Material> ITEMS_ENCHANTABLE_CROSSBOW = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("enchantable/crossbow"), Material.class);
/**
* Vanilla item tag representing all items enchantable with the vanishing enchantment.
*/
Tag<Material> ITEMS_ENCHANTABLE_VANISHING = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("enchantable/vanishing"), Material.class);
/**
* Vanilla item tag representing all items enchantable with mace enchantments.
*/
Tag<Material> ITEMS_ENCHANTABLE_MACE = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("enchantable/mace"), Material.class);
/**
* Vanilla item tag representing all items that confer freeze immunity on
* the wearer.
@ -887,8 +1145,11 @@ public interface Tag<T extends Keyed> extends Keyed {
Tag<Material> FREEZE_IMMUNE_WEARABLES = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("freeze_immune_wearables"), Material.class);
/**
* Vanilla item tag representing all items which tempt axolotls.
*
* @deprecated use {@link #ITEMS_AXOLOTL_FOOD}
*/
Tag<Material> AXOLOTL_TEMPT_ITEMS = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("axolotl_tempt_items"), Material.class);
@Deprecated
Tag<Material> AXOLOTL_TEMPT_ITEMS = ITEMS_AXOLOTL_FOOD;
/**
* Vanilla item tag representing all items which are preferred for
* harvesting clusters (unused).
@ -967,17 +1228,79 @@ public interface Tag<T extends Keyed> extends Keyed {
*/
Tag<EntityType> ENTITY_TYPES_NON_CONTROLLING_RIDER = Bukkit.getTag(REGISTRY_ENTITY_TYPES, NamespacedKey.minecraft("non_controlling_rider"), EntityType.class);
/**
* Vanilla tag representing entities which deflect arrows.
* Vanilla tag representing entities which deflect projectiles.
*/
Tag<EntityType> ENTITY_TYPES_DEFLECTS_ARROWS = Bukkit.getTag(REGISTRY_ENTITY_TYPES, NamespacedKey.minecraft("deflects_arrows"), EntityType.class);
Tag<EntityType> ENTITY_TYPES_DEFLECTS_PROJECTILES = Bukkit.getTag(REGISTRY_ENTITY_TYPES, NamespacedKey.minecraft("deflects_projectiles"), EntityType.class);
/**
* Vanilla tag representing entities which deflect tridents.
* Vanilla tag representing entities which deflect arrows.
* @deprecated use {@link #ENTITY_TYPES_DEFLECTS_PROJECTILES}
*/
Tag<EntityType> ENTITY_TYPES_DEFLECTS_TRIDENTS = Bukkit.getTag(REGISTRY_ENTITY_TYPES, NamespacedKey.minecraft("deflects_tridents"), EntityType.class);
@Deprecated
Tag<EntityType> ENTITY_TYPES_DEFLECTS_ARROWS = ENTITY_TYPES_DEFLECTS_PROJECTILES;
/**
* Vanilla tag representing entities which can turn in boats.
*/
Tag<EntityType> ENTITY_TYPES_CAN_TURN_IN_BOATS = Bukkit.getTag(REGISTRY_ENTITY_TYPES, NamespacedKey.minecraft("can_turn_in_boats"), EntityType.class);
/**
* Vanilla tag representing all entities sensitive to illager enchantments.
*/
Tag<EntityType> ENTITY_TYPES_ILLAGER = Bukkit.getTag(REGISTRY_ENTITY_TYPES, NamespacedKey.minecraft("illager"), EntityType.class);
/**
* Vanilla tag representing all entities sensitive to aquatic enchantments..
*/
Tag<EntityType> ENTITY_TYPES_AQUATIC = Bukkit.getTag(REGISTRY_ENTITY_TYPES, NamespacedKey.minecraft("aquatic"), EntityType.class);
/**
* Vanilla tag representing all entities sensitive to arthropod enchantments..
*/
Tag<EntityType> ENTITY_TYPES_ARTHROPOD = Bukkit.getTag(REGISTRY_ENTITY_TYPES, NamespacedKey.minecraft("arthropod"), EntityType.class);
/**
* Vanilla tag representing all entities which ignores poison and regeneration effects.
*/
Tag<EntityType> ENTITY_TYPES_IGNORES_POISON_AND_REGEN = Bukkit.getTag(REGISTRY_ENTITY_TYPES, NamespacedKey.minecraft("ignores_poison_and_regen"), EntityType.class);
/**
* Vanilla tag representing all entities which are sensitive to inverted healing and harm potion effects.
*/
Tag<EntityType> ENTITY_TYPES_INVERTED_HEALING_AND_HARM = Bukkit.getTag(REGISTRY_ENTITY_TYPES, NamespacedKey.minecraft("inverted_healing_and_harm"), EntityType.class);
/**
* Vanilla tag representing all entities which are friendly with withers.
*/
Tag<EntityType> ENTITY_TYPES_WITHER_FRIENDS = Bukkit.getTag(REGISTRY_ENTITY_TYPES, NamespacedKey.minecraft("wither_friends"), EntityType.class);
/**
* Vanilla tag representing all entities which are friendly with illagers.
*/
Tag<EntityType> ENTITY_TYPES_ILLAGER_FRIENDS = Bukkit.getTag(REGISTRY_ENTITY_TYPES, NamespacedKey.minecraft("illager_friends"), EntityType.class);
/**
* Vanilla tag representing all entities which are not scary for pufferfish.
*/
Tag<EntityType> ENTITY_TYPES_NOT_SCARY_FOR_PUFFERFISH = Bukkit.getTag(REGISTRY_ENTITY_TYPES, NamespacedKey.minecraft("not_scary_for_pufferfish"), EntityType.class);
/**
* Vanilla tag representing all entities which are sensitive to impaling.
*/
Tag<EntityType> ENTITY_TYPES_SENSITIVE_TO_IMPALING = Bukkit.getTag(REGISTRY_ENTITY_TYPES, NamespacedKey.minecraft("sensitive_to_impaling"), EntityType.class);
/**
* Vanilla tag representing all entities which are sensitive to the bane_of_arthropods enchantment.
*/
Tag<EntityType> ENTITY_TYPES_SENSITIVE_TO_BANE_OF_ARTHROPODS = Bukkit.getTag(REGISTRY_ENTITY_TYPES, NamespacedKey.minecraft("sensitive_to_bane_of_arthropods"), EntityType.class);
/**
* Vanilla tag representing all entities which are sensitive to the smite enchantment.
*/
Tag<EntityType> ENTITY_TYPES_SENSITIVE_TO_SMITE = Bukkit.getTag(REGISTRY_ENTITY_TYPES, NamespacedKey.minecraft("sensitive_to_smite"), EntityType.class);
/**
* Vanilla tag representing all entities which do not receive anger from wind charges.
*/
Tag<EntityType> ENTITY_TYPES_NO_ANGER_FROM_WIND_CHARGE = Bukkit.getTag(REGISTRY_ENTITY_TYPES, NamespacedKey.minecraft("no_anger_from_wind_charge"), EntityType.class);
/**
* Vanilla tag representing all entities which are immune from the oozing effect.
*/
Tag<EntityType> ENTITY_TYPES_IMMUNE_TO_OOZING = Bukkit.getTag(REGISTRY_ENTITY_TYPES, NamespacedKey.minecraft("immune_to_oozing"), EntityType.class);
/**
* Vanilla tag representing all entities which are immune from the infested effect.
*/
Tag<EntityType> ENTITY_TYPES_IMMUNE_TO_INFESTED = Bukkit.getTag(REGISTRY_ENTITY_TYPES, NamespacedKey.minecraft("immune_to_infested"), EntityType.class);
/**
* 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);
/**
* Returns whether or not this tag has an entry for the specified item.

View file

@ -1556,7 +1556,9 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
* or not.
*
* @return true if the world's spawn area will be kept loaded into memory.
* @deprecated use {@link GameRule#SPAWN_CHUNK_RADIUS} for finer control
*/
@Deprecated
public boolean getKeepSpawnInMemory();
/**
@ -1565,7 +1567,9 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
*
* @param keepLoaded if true then the world's spawn area will be kept
* loaded into memory.
* @deprecated use {@link GameRule#SPAWN_CHUNK_RADIUS} for finer control
*/
@Deprecated
public void setKeepSpawnInMemory(boolean keepLoaded);
/**

View file

@ -51,6 +51,10 @@ public enum Attribute implements Keyed, Translatable {
* Armor durability bonus of an Entity.
*/
GENERIC_ARMOR_TOUGHNESS("generic.armor_toughness"),
/**
* The fall damage multiplier of an Entity.
*/
GENERIC_FALL_DAMAGE_MULTIPLIER("generic.fall_damage_multiplier"),
/**
* Luck bonus of an Entity.
*/
@ -60,9 +64,37 @@ public enum Attribute implements Keyed, Translatable {
*/
GENERIC_MAX_ABSORPTION("generic.max_absorption"),
/**
* Strength with which a horse will jump.
* The distance which an Entity can fall without damage.
*/
HORSE_JUMP_STRENGTH("horse.jump_strength"),
GENERIC_SAFE_FALL_DISTANCE("generic.safe_fall_distance"),
/**
* The relative scale of an Entity.
*/
GENERIC_SCALE("generic.scale"),
/**
* The height which an Entity can walk over.
*/
GENERIC_STEP_HEIGHT("generic.step_height"),
/**
* The gravity applied to an Entity.
*/
GENERIC_GRAVITY("generic.gravity"),
/**
* Strength with which an Entity will jump.
*/
GENERIC_JUMP_STRENGTH("generic.jump_strength"),
/**
* The block reach distance of a Player.
*/
PLAYER_BLOCK_INTERACTION_RANGE("player.block_interaction_range"),
/**
* The entity reach distance of a Player.
*/
PLAYER_ENTITY_INTERACTION_RANGE("player.entity_interaction_range"),
/**
* Block break speed of a Player.
*/
PLAYER_BLOCK_BREAK_SPEED("player.block_break_speed"),
/**
* Chance of a zombie to spawn reinforcements.
*/

View file

@ -7,6 +7,7 @@ import java.util.Objects;
import java.util.UUID;
import org.bukkit.configuration.serialization.ConfigurationSerializable;
import org.bukkit.inventory.EquipmentSlot;
import org.bukkit.inventory.EquipmentSlotGroup;
import org.bukkit.util.NumberConversions;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@ -20,17 +21,21 @@ public class AttributeModifier implements ConfigurationSerializable {
private final String name;
private final double amount;
private final Operation operation;
private final EquipmentSlot slot;
private final EquipmentSlotGroup slot;
public AttributeModifier(@NotNull String name, double amount, @NotNull Operation operation) {
this(UUID.randomUUID(), name, amount, operation);
}
public AttributeModifier(@NotNull UUID uuid, @NotNull String name, double amount, @NotNull Operation operation) {
this(uuid, name, amount, operation, null);
this(uuid, name, amount, operation, (EquipmentSlotGroup) null);
}
public AttributeModifier(@NotNull UUID uuid, @NotNull String name, double amount, @NotNull Operation operation, @Nullable EquipmentSlot slot) {
this(uuid, name, amount, operation, (slot) == null ? EquipmentSlotGroup.ANY : slot.getGroup());
}
public AttributeModifier(@NotNull UUID uuid, @NotNull String name, double amount, @NotNull Operation operation, @NotNull EquipmentSlotGroup slot) {
Preconditions.checkArgument(uuid != null, "UUID cannot be null");
Preconditions.checkArgument(name != null, "Name cannot be null");
Preconditions.checkArgument(operation != null, "Operation cannot be null");
@ -85,9 +90,22 @@ public class AttributeModifier implements ConfigurationSerializable {
* or null if this modifier is applicable for any slot.
*
* @return the slot
* @deprecated use {@link #getSlotGroup()}
*/
@Nullable
@Deprecated
public EquipmentSlot getSlot() {
return slot.getExample();
}
/**
* Get the {@link EquipmentSlot} this AttributeModifier is active on,
* or null if this modifier is applicable for any slot.
*
* @return the slot
*/
@NotNull
public EquipmentSlotGroup getSlotGroup() {
return slot;
}
@ -99,8 +117,8 @@ public class AttributeModifier implements ConfigurationSerializable {
data.put("name", name);
data.put("operation", operation.ordinal());
data.put("amount", amount);
if (slot != null) {
data.put("slot", slot.name());
if (slot != null && slot != EquipmentSlotGroup.ANY) {
data.put("slot", slot.toString());
}
return data;
}
@ -133,14 +151,24 @@ public class AttributeModifier implements ConfigurationSerializable {
+ ", name=" + this.name
+ ", operation=" + this.operation.name()
+ ", amount=" + this.amount
+ ", slot=" + (this.slot != null ? this.slot.name() : "")
+ ", slot=" + (this.slot != null ? this.slot.toString() : "")
+ "}";
}
@NotNull
public static AttributeModifier deserialize(@NotNull Map<String, Object> args) {
if (args.containsKey("slot")) {
return new AttributeModifier(UUID.fromString((String) args.get("uuid")), (String) args.get("name"), NumberConversions.toDouble(args.get("amount")), Operation.values()[NumberConversions.toInt(args.get("operation"))], EquipmentSlot.valueOf((args.get("slot").toString().toUpperCase())));
EquipmentSlotGroup slotGroup = EquipmentSlotGroup.getByName(args.get("slot").toString().toLowerCase());
if (slotGroup == null) {
slotGroup = EquipmentSlotGroup.ANY;
EquipmentSlot slot = EquipmentSlot.valueOf((args.get("slot").toString().toUpperCase()));
if (slot != null) {
slotGroup = slot.getGroup();
}
}
return new AttributeModifier(UUID.fromString((String) args.get("uuid")), (String) args.get("name"), NumberConversions.toDouble(args.get("amount")), Operation.values()[NumberConversions.toInt(args.get("operation"))], slotGroup);
}
return new AttributeModifier(UUID.fromString((String) args.get("uuid")), (String) args.get("name"), NumberConversions.toDouble(args.get("amount")), Operation.values()[NumberConversions.toInt(args.get("operation"))]);
}

View file

@ -0,0 +1,12 @@
package org.bukkit.block;
import org.bukkit.MinecraftExperimental;
import org.jetbrains.annotations.ApiStatus;
/**
* Represents a captured state of a trial spawner.
*/
@MinecraftExperimental
@ApiStatus.Experimental
public interface Vault extends TileState {
}

View file

@ -3,6 +3,7 @@ package org.bukkit.block.banner;
import java.util.HashMap;
import java.util.Map;
import org.bukkit.Keyed;
import org.bukkit.MinecraftExperimental;
import org.bukkit.NamespacedKey;
import org.bukkit.Registry;
import org.jetbrains.annotations.Contract;
@ -50,7 +51,11 @@ public enum PatternType implements Keyed {
FLOWER("flo", "flower"),
MOJANG("moj", "mojang"),
GLOBE("glb", "globe"),
PIGLIN("pig", "piglin");
PIGLIN("pig", "piglin"),
@MinecraftExperimental
FLOW("flw", "flow"),
@MinecraftExperimental
GUSTER("gus", "guster");
private final String identifier;
private final NamespacedKey key;
@ -82,7 +87,7 @@ public enum PatternType implements Keyed {
* @deprecated magic value
*/
@NotNull
@Deprecated
@Deprecated(forRemoval = true)
public String getIdentifier() {
return identifier;
}
@ -98,7 +103,7 @@ public enum PatternType implements Keyed {
*/
@Contract("null -> null")
@Nullable
@Deprecated
@Deprecated(forRemoval = true)
public static PatternType getByIdentifier(@Nullable String identifier) {
return byString.get(identifier);
}

View file

@ -7,6 +7,8 @@ import org.jetbrains.annotations.NotNull;
/**
* 'trial_spawner_state' indicates the current operational phase of the spawner.
* <br>
* 'ominous' indicates if the block has ominous effects.
*/
@MinecraftExperimental
@ApiStatus.Experimental
@ -27,6 +29,20 @@ public interface TrialSpawner extends BlockData {
*/
void setTrialSpawnerState(@NotNull State state);
/**
* Gets the value of the 'ominous' property.
*
* @return the 'ominous' value
*/
boolean isOminous();
/**
* Sets the value of the 'ominous' property.
*
* @param ominous the new 'ominous' value
*/
void setOminous(boolean ominous);
public enum State {
INACTIVE,

View file

@ -0,0 +1,53 @@
package org.bukkit.block.data.type;
import org.bukkit.MinecraftExperimental;
import org.bukkit.block.data.Directional;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
/**
* 'vault_state' indicates the current operational phase of the vault block.
* <br>
* 'ominous' indicates if the block has ominous effects.
*/
@MinecraftExperimental
@ApiStatus.Experimental
public interface Vault extends Directional {
/**
* Gets the value of the 'vault_state' property.
*
* @return the 'vault_state' value
*/
@NotNull
State getTrialSpawnerState();
/**
* Sets the value of the 'vault_state' property.
*
* @param state the new 'vault_state' value
*/
void setTrialSpawnerState(@NotNull State state);
/**
* Gets the value of the 'ominous' property.
*
* @return the 'ominous' value
*/
boolean isOminous();
/**
* Sets the value of the 'ominous' property.
*
* @param ominous the new 'ominous' value
*/
void setOminous(boolean ominous);
public enum State {
INACTIVE,
ACTIVE,
UNLOCKING,
EJECTING
}
}

View file

@ -1,7 +1,11 @@
package org.bukkit.block.spawner;
import com.google.common.base.Preconditions;
import java.util.Map;
import org.bukkit.entity.EntitySnapshot;
import org.bukkit.inventory.EquipmentSlot;
import org.bukkit.loot.LootTable;
import org.bukkit.loot.LootTables;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@ -13,13 +17,19 @@ public class SpawnerEntry {
private EntitySnapshot snapshot;
private int spawnWeight;
private SpawnRule spawnRule;
private Equipment equipment;
public SpawnerEntry(@NotNull EntitySnapshot snapshot, int spawnWeight, @Nullable SpawnRule spawnRule) {
this(snapshot, spawnWeight, spawnRule, null);
}
public SpawnerEntry(@NotNull EntitySnapshot snapshot, int spawnWeight, @Nullable SpawnRule spawnRule, @Nullable Equipment equipment) {
Preconditions.checkArgument(snapshot != null, "Snapshot cannot be null");
this.snapshot = snapshot;
this.spawnWeight = spawnWeight;
this.spawnRule = spawnRule;
this.equipment = equipment;
}
/**
@ -82,4 +92,75 @@ public class SpawnerEntry {
public void setSpawnRule(@Nullable SpawnRule spawnRule) {
this.spawnRule = spawnRule;
}
/**
* Gets the equipment which will be applied to the spawned entity.
*
* @return the equipment, or null
*/
@Nullable
public Equipment getEquipment() {
return equipment;
}
/**
* Sets the equipment which will be applied to the spawned entity.
*
* @param equipment new equipment, or null
*/
public void setEquipment(@Nullable Equipment equipment) {
this.equipment = equipment;
}
/**
* Represents the equipment loot table applied to a spawned entity.
*/
public static class Equipment {
private LootTable equipmentLootTable;
private final Map<EquipmentSlot, Float> dropChances;
public Equipment(@NotNull LootTable equipmentLootTable, @NotNull Map<EquipmentSlot, Float> dropChances) {
this.equipmentLootTable = equipmentLootTable;
this.dropChances = dropChances;
}
/**
* Set the loot table for the entity.
* <br>
* To remove a loot table use null. Do not use {@link LootTables#EMPTY}
* to clear a LootTable.
*
* @param table this {@link org.bukkit.entity.Mob} will have.
*/
public void setEquipmentLootTable(@NotNull LootTable table) {
this.equipmentLootTable = table;
}
/**
* Gets the loot table for the entity.
* <br>
*
* If an entity does not have a loot table, this will return null, NOT
* an empty loot table.
*
* @return the loot table for this entity.
*/
@NotNull
public LootTable getEquipmentLootTable() {
return this.equipmentLootTable;
}
/**
* Gets a mutable map of the drop chances for each slot of the entity.
* If non-null, the entity's drop chances will be overridden with the
* given value.
*
* @return mutable map of drop chances
*/
@NotNull
public Map<EquipmentSlot, Float> getDropChances() {
return this.dropChances;
}
}
}

View file

@ -51,6 +51,7 @@ public interface DamageType extends Keyed, Translatable {
public static final DamageType ARROW = getDamageType("arrow");
public static final DamageType TRIDENT = getDamageType("trident");
public static final DamageType MOB_PROJECTILE = getDamageType("mob_projectile");
public static final DamageType SPIT = getDamageType("spit");
public static final DamageType FIREWORKS = getDamageType("fireworks");
public static final DamageType FIREBALL = getDamageType("fireball");
public static final DamageType UNATTRIBUTED_FIREBALL = getDamageType("unattributed_fireball");

View file

@ -3,6 +3,7 @@ package org.bukkit.enchantments;
import com.google.common.base.Preconditions;
import com.google.common.collect.Lists;
import org.bukkit.Keyed;
import org.bukkit.MinecraftExperimental;
import org.bukkit.NamespacedKey;
import org.bukkit.Registry;
import org.bukkit.Translatable;
@ -103,7 +104,7 @@ public abstract class Enchantment implements Keyed, Translatable {
/**
* Increases damage against targets when using a sweep attack
*/
public static final Enchantment SWEEPING_EDGE = getEnchantment("sweeping");
public static final Enchantment SWEEPING_EDGE = getEnchantment("sweeping_edge");
/**
* Increases the rate at which you mine/dig
@ -192,6 +193,24 @@ public abstract class Enchantment implements Keyed, Translatable {
*/
public static final Enchantment PIERCING = getEnchantment("piercing");
/**
* Increases fall damage of maces
*/
@MinecraftExperimental
public static final Enchantment DENSITY = getEnchantment("density");
/**
* Reduces armor effectiveness against maces
*/
@MinecraftExperimental
public static final Enchantment BREACH = getEnchantment("breach");
/**
* Emits wind burst upon hitting enemy
*/
@MinecraftExperimental
public static final Enchantment WIND_BURST = getEnchantment("wind_burst");
/**
* Allows mending the item using experience orbs
*/
@ -250,8 +269,10 @@ public abstract class Enchantment implements Keyed, Translatable {
* Gets the type of {@link ItemStack} that may fit this Enchantment.
*
* @return Target type of the Enchantment
* @deprecated enchantment groupings are now managed by tags, not categories
*/
@NotNull
@Deprecated
public abstract EnchantmentTarget getItemTarget();
/**
@ -373,8 +394,8 @@ public abstract class Enchantment implements Keyed, Translatable {
return "bane_of_arthropods";
case "loot_bonus_mobs":
return "looting";
case "sweeping_edge":
return "sweeping";
case "sweeping":
return "sweeping_edge";
case "dig_speed":
return "efficiency";
case "durability":

View file

@ -0,0 +1,18 @@
package org.bukkit.entity;
import org.bukkit.MinecraftExperimental;
import org.jetbrains.annotations.ApiStatus;
/**
* Represents a Wind Charge.
*/
@MinecraftExperimental
@ApiStatus.Experimental
public interface AbstractWindCharge extends Fireball {
/**
* Immediately explode this WindCharge.
*/
public void explode();
}

View file

@ -3,7 +3,6 @@ package org.bukkit.entity;
import java.util.List;
import org.bukkit.Color;
import org.bukkit.Particle;
import org.bukkit.potion.PotionData;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import org.bukkit.potion.PotionType;
@ -146,38 +145,19 @@ public interface AreaEffectCloud extends Entity {
*/
<T> void setParticle(@NotNull Particle particle, @Nullable T data);
/**
* Sets the underlying potion data
*
* @param data PotionData to set the base potion state to
* @deprecated Upgraded / extended potions are now their own {@link PotionType} use {@link #setBasePotionType} instead.
*/
@Deprecated
void setBasePotionData(@NotNull PotionData data);
/**
* Returns the potion data about the base potion
*
* @return a PotionData object
* @deprecated Upgraded / extended potions are now their own {@link PotionType} use {@link #getBasePotionType()} instead.
*/
@NotNull
@Deprecated
PotionData getBasePotionData();
/**
* Sets the underlying potion type
*
* @param type PotionType to set the base potion state to
*/
void setBasePotionType(@NotNull PotionType type);
void setBasePotionType(@Nullable PotionType type);
/**
* Returns the potion type about the base potion
*
* @return a PotionType object
*/
@NotNull
@Nullable
PotionType getBasePotionType();
/**

View file

@ -0,0 +1,8 @@
package org.bukkit.entity;
/**
* Represents an Armadillo.
*/
public interface Armadillo extends Animals {
}

View file

@ -2,7 +2,6 @@ package org.bukkit.entity;
import java.util.List;
import org.bukkit.Color;
import org.bukkit.potion.PotionData;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import org.bukkit.potion.PotionType;
@ -11,38 +10,19 @@ import org.jetbrains.annotations.Nullable;
public interface Arrow extends AbstractArrow {
/**
* Sets the underlying potion data
*
* @param data PotionData to set the base potion state to
* @deprecated Upgraded / extended potions are now their own {@link PotionType} use {@link #setBasePotionType} instead.
*/
@Deprecated
void setBasePotionData(@NotNull PotionData data);
/**
* Returns the potion data about the base potion
*
* @return a PotionData object
* @deprecated Upgraded / extended potions are now their own {@link PotionType} use {@link #getBasePotionType()} instead.
*/
@NotNull
@Deprecated
PotionData getBasePotionData();
/**
* Sets the underlying potion type
*
* @param type PotionType to set the base potion state to
*/
void setBasePotionType(@NotNull PotionType type);
void setBasePotionType(@Nullable PotionType type);
/**
* Returns the potion type about the base potion
*
* @return a PotionType object
*/
@NotNull
@Nullable
PotionType getBasePotionType();
/**

View file

@ -0,0 +1,12 @@
package org.bukkit.entity;
import org.bukkit.MinecraftExperimental;
import org.jetbrains.annotations.ApiStatus;
/**
* Represents a Bogged Skeleton.
*/
@MinecraftExperimental
@ApiStatus.Experimental
public interface Bogged extends AbstractSkeleton {
}

View file

@ -0,0 +1,13 @@
package org.bukkit.entity;
import org.bukkit.MinecraftExperimental;
import org.jetbrains.annotations.ApiStatus;
/**
* Represents a Wind Charge.
*/
@MinecraftExperimental
@ApiStatus.Experimental
public interface BreezeWindCharge extends AbstractWindCharge {
}

View file

@ -292,6 +292,16 @@ public enum EntityType implements Keyed, Translatable {
@MinecraftExperimental
@ApiStatus.Experimental
WIND_CHARGE("wind_charge", WindCharge.class, -1),
@MinecraftExperimental
@ApiStatus.Experimental
BREEZE_WIND_CHARGE("breeze_wind_charge", BreezeWindCharge.class, -1),
ARMADILLO("armadillo", Armadillo.class, -1),
@MinecraftExperimental
@ApiStatus.Experimental
BOGGED("bogged", Bogged.class, -1),
@MinecraftExperimental
@ApiStatus.Experimental
OMINOUS_ITEM_SPAWNER("ominous_item_spawner", OminousItemSpawner.class, -1),
/**
* A fishing line and bobber.
*/

View file

@ -758,8 +758,10 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource
* debuffs.
*
* @return the entity category
* @deprecated entity groupings are now managed by tags, not categories
*/
@NotNull
@Deprecated
public EntityCategory getCategory();
/**

View file

@ -0,0 +1,43 @@
package org.bukkit.entity;
import org.bukkit.MinecraftExperimental;
import org.bukkit.inventory.ItemStack;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.Nullable;
/**
* Represents an ominous item spawner.
*/
@MinecraftExperimental
@ApiStatus.Experimental
public interface OminousItemSpawner extends Entity {
/**
* Gets the item which will be spawned by this spawner.
*
* @return the item
*/
@Nullable
ItemStack getItem();
/**
* Sets the item which will be spawned by this spawner.
*
* @param item the item
*/
void setItem(@Nullable ItemStack item);
/**
* Gets the ticks after which this item will be spawned.
*
* @return total spawn ticks
*/
long getSpawnItemAfterTicks();
/**
* Sets the ticks after which this item will be spawned.
*
* @param ticks total spawn ticks
*/
void setSpawnItemAfterTicks(long ticks);
}

View file

@ -8,6 +8,7 @@ import java.util.Collection;
import java.util.Date;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.CompletableFuture;
import org.bukkit.BanEntry;
import org.bukkit.DyeColor;
import org.bukkit.Effect;
@ -15,6 +16,7 @@ import org.bukkit.GameMode;
import org.bukkit.Instrument;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.NamespacedKey;
import org.bukkit.Note;
import org.bukkit.OfflinePlayer;
import org.bukkit.Particle;
@ -165,6 +167,48 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@Nullable
public InetSocketAddress getAddress();
/**
* Gets if this connection has been transferred from another server.
*
* @return true if the connection has been transferred
*/
public boolean isTransferred();
/**
* Retrieves a cookie from this player.
*
* @param key the key identifying the cookie cookie
* @return a {@link CompletableFuture} that will be completed when the
* Cookie response is received or otherwise available. If the cookie is not
* set in the client, the {@link CompletableFuture} will complete with a
* null value.
*/
@NotNull
@ApiStatus.Experimental
CompletableFuture<byte[]> retrieveCookie(@NotNull NamespacedKey key);
/**
* Stores a cookie in this player's client.
*
* @param key the key identifying the cookie cookie
* @param value the data to store in the cookie
* @throws IllegalStateException if a cookie cannot be stored at this time
*/
@ApiStatus.Experimental
void storeCookie(@NotNull NamespacedKey key, @NotNull byte[] value);
/**
* Requests this player to connect to a different server specified by host
* and port.
*
* @param host the host of the server to transfer to
* @param port the port of the server to transfer to
* @throws IllegalStateException if a transfer cannot take place at this
* time
*/
@ApiStatus.Experimental
void transfer(@NotNull String host, int port);
/**
* Sends this sender a message raw
*

View file

@ -62,6 +62,10 @@ public interface Skeleton extends AbstractSkeleton {
/**
* Stray skeleton. Generally found in ice biomes. Shoots tipped arrows.
*/
STRAY;
STRAY,
/**
* Bogged skeleton.
*/
BOGGED;
}
}

View file

@ -8,11 +8,6 @@ import org.jetbrains.annotations.ApiStatus;
*/
@MinecraftExperimental
@ApiStatus.Experimental
public interface WindCharge extends Fireball {
/**
* Immediately explode this WindCharge.
*/
public void explode();
public interface WindCharge extends AbstractWindCharge {
}

View file

@ -1,6 +1,9 @@
package org.bukkit.entity;
import java.util.Locale;
import org.bukkit.DyeColor;
import org.bukkit.Keyed;
import org.bukkit.NamespacedKey;
import org.jetbrains.annotations.NotNull;
/**
@ -67,4 +70,46 @@ public interface Wolf extends Tameable, Sittable {
* @param interested Whether the wolf is interested
*/
public void setInterested(boolean interested);
/**
* Get the variant of this wolf.
*
* @return wolf variant
*/
@NotNull
Variant getVariant();
/**
* Set the variant of this wolf.
*
* @param variant wolf variant
*/
void setVariant(@NotNull Variant variant);
/**
* Represents the variant of a wolf.
*/
public enum Variant implements Keyed {
PALE,
SPOTTED,
SNOWY,
BLACK,
ASHEN,
RUSTY,
WOODS,
CHESTNUT,
STRIPED;
private final NamespacedKey key;
private Variant() {
this.key = NamespacedKey.minecraft(name().toLowerCase(Locale.ROOT));
}
@NotNull
@Override
public NamespacedKey getKey() {
return key;
}
}
}

View file

@ -112,7 +112,9 @@ public class EntityShootBowEvent extends EntityEvent implements Cancellable {
* consumed).
*
* @param consumeItem whether or not to consume the item
* @deprecated not currently functional
*/
@Deprecated
public void setConsumeItem(boolean consumeItem) {
this.consumeItem = consumeItem;
}

View file

@ -18,19 +18,26 @@ public class AsyncPlayerPreLoginEvent extends Event {
private final String name;
private final InetAddress ipAddress;
private final UUID uniqueId;
private final boolean transferred;
@Deprecated
public AsyncPlayerPreLoginEvent(@NotNull final String name, @NotNull final InetAddress ipAddress) {
this(name, ipAddress, null);
}
@Deprecated
public AsyncPlayerPreLoginEvent(@NotNull final String name, @NotNull final InetAddress ipAddress, @NotNull final UUID uniqueId) {
this(name, ipAddress, uniqueId, false);
}
public AsyncPlayerPreLoginEvent(@NotNull final String name, @NotNull final InetAddress ipAddress, @NotNull final UUID uniqueId, boolean transferred) {
super(true);
this.result = Result.ALLOWED;
this.message = "";
this.name = name;
this.ipAddress = ipAddress;
this.uniqueId = uniqueId;
this.transferred = transferred;
}
/**
@ -163,6 +170,15 @@ public class AsyncPlayerPreLoginEvent extends Event {
return uniqueId;
}
/**
* Gets if this connection has been transferred from another server.
*
* @return true if the connection has been transferred
*/
public boolean isTransferred() {
return transferred;
}
@NotNull
@Override
public HandlerList getHandlers() {

View file

@ -1,11 +1,35 @@
package org.bukkit.inventory;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
public enum EquipmentSlot {
HAND,
OFF_HAND,
FEET,
LEGS,
CHEST,
HEAD
HAND(EquipmentSlotGroup.MAINHAND),
OFF_HAND(EquipmentSlotGroup.OFFHAND),
FEET(EquipmentSlotGroup.FEET),
LEGS(EquipmentSlotGroup.LEGS),
CHEST(EquipmentSlotGroup.CHEST),
HEAD(EquipmentSlotGroup.HEAD),
/**
* Only for certain entities such as horses and wolves.
*/
BODY(EquipmentSlotGroup.ARMOR);
private final EquipmentSlotGroup group;
private EquipmentSlot(/*@NotNull*/ EquipmentSlotGroup group) {
this.group = group;
}
/**
* Gets the {@link EquipmentSlotGroup} corresponding to this slot.
*
* @return corresponding {@link EquipmentSlotGroup}
*/
@NotNull
@ApiStatus.Internal
public EquipmentSlotGroup getGroup() {
return group;
}
}

View file

@ -0,0 +1,86 @@
package org.bukkit.inventory;
import com.google.common.base.Preconditions;
import java.util.HashMap;
import java.util.Map;
import java.util.function.Predicate;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
* Represents a group of {@link EquipmentSlot}.
*/
@ApiStatus.Experimental
public final class EquipmentSlotGroup implements Predicate<EquipmentSlot> {
private static final Map<String, EquipmentSlotGroup> BY_NAME = new HashMap<>();
//
public static final EquipmentSlotGroup ANY = get("any", (test) -> true, EquipmentSlot.HAND);
public static final EquipmentSlotGroup MAINHAND = get("mainhand", EquipmentSlot.HAND);
public static final EquipmentSlotGroup OFFHAND = get("offhand", EquipmentSlot.OFF_HAND);
public static final EquipmentSlotGroup HAND = get("hand", (test) -> test == EquipmentSlot.HAND || test == EquipmentSlot.OFF_HAND, EquipmentSlot.HAND);
public static final EquipmentSlotGroup FEET = get("feet", EquipmentSlot.FEET);
public static final EquipmentSlotGroup LEGS = get("legs", EquipmentSlot.LEGS);
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);
//
private final String key;
private final Predicate<EquipmentSlot> predicate;
private final EquipmentSlot example;
private EquipmentSlotGroup(@NotNull String key, @NotNull Predicate<EquipmentSlot> predicate, @NotNull EquipmentSlot example) {
this.key = key;
this.predicate = predicate;
this.example = example;
BY_NAME.put(key, this);
}
@Override
public boolean test(@NotNull EquipmentSlot test) {
return this.predicate.test(test);
}
@Override
public String toString() {
return this.key;
}
/**
* Gets an {@link EquipmentSlot} which is an example of a slot in this
* group.
*
* @return an example slot
* @deprecated for internal compatibility use only
*/
@NotNull
@Deprecated
@ApiStatus.Internal
public EquipmentSlot getExample() {
return example;
}
/**
* Gets the {@link EquipmentSlotGroup} corresponding to the given string.
*
* @param name group name
* @return associated group or null
*/
@Nullable
@ApiStatus.Internal
public static EquipmentSlotGroup getByName(@NotNull String name) {
Preconditions.checkArgument(name != null, "Name cannot be null");
return BY_NAME.get(name.toLowerCase(java.util.Locale.ENGLISH));
}
private static EquipmentSlotGroup get(@NotNull String key, @NotNull EquipmentSlot slot) {
return get(key, (test) -> test == slot, slot);
}
private static EquipmentSlotGroup get(@NotNull String key, @NotNull Predicate<EquipmentSlot> predicate, @NotNull EquipmentSlot example) {
return new EquipmentSlotGroup(key, predicate, example);
}
}

View file

@ -0,0 +1,25 @@
package org.bukkit.inventory;
/**
* A item's rarity determines the default color of its name. This enum is
* ordered from least rare to most rare.
*/
public enum ItemRarity {
/**
* White item name.
*/
COMMON,
/**
* Yellow item name.
*/
UNCOMMON,
/**
* Aqua item name.
*/
RARE,
/**
* Light purple item name.
*/
EPIC;
}

View file

@ -1,32 +1,11 @@
package org.bukkit.inventory.meta;
import java.util.List;
import org.bukkit.DyeColor;
import org.bukkit.block.banner.Pattern;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public interface BannerMeta extends ItemMeta {
/**
* Returns the base color for this banner
*
* @return the base color
* @deprecated banner color is now stored as the data value, not meta.
*/
@Deprecated
@Nullable
DyeColor getBaseColor();
/**
* Sets the base color for this banner
*
* @param color the base color
* @deprecated banner color is now stored as the data value, not meta.
*/
@Deprecated
void setBaseColor(@Nullable DyeColor color);
/**
* Returns a list of patterns on this banner
*

View file

@ -1,15 +1,14 @@
package org.bukkit.inventory.meta;
import java.util.List;
import org.bukkit.Material;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
* Represents a book ({@link Material#WRITABLE_BOOK} or {@link
* Material#WRITTEN_BOOK}) that can have a title, an author, and pages.
* Represents a {@link Material#WRITTEN_BOOK}) that can have a title, an author,
* and pages.
*/
public interface BookMeta extends ItemMeta {
public interface BookMeta extends WritableBookMeta {
/**
* Represents the generation (or level of copying) of a written book
@ -111,77 +110,6 @@ public interface BookMeta extends ItemMeta {
*/
void setGeneration(@Nullable Generation generation);
/**
* Checks for the existence of pages in the book.
*
* @return true if the book has pages
*/
boolean hasPages();
/**
* Gets the specified page in the book. The given page must exist.
* <p>
* Pages are 1-indexed.
*
* @param page the page number to get, in range [1, getPageCount()]
* @return the page from the book
*/
@NotNull
String getPage(int page);
/**
* Sets the specified page in the book. Pages of the book must be
* contiguous.
* <p>
* The data can be up to 1024 characters in length, additional characters
* are truncated.
* <p>
* Pages are 1-indexed.
*
* @param page the page number to set, in range [1, getPageCount()]
* @param data the data to set for that page
*/
void setPage(int page, @NotNull String data);
/**
* Gets all the pages in the book.
*
* @return list of all the pages in the book
*/
@NotNull
List<String> getPages();
/**
* Clears the existing book pages, and sets the book to use the provided
* pages. Maximum 100 pages with 1024 characters per page.
*
* @param pages A list of pages to set the book to use
*/
void setPages(@NotNull List<String> pages);
/**
* Clears the existing book pages, and sets the book to use the provided
* pages. Maximum 100 pages with 1024 characters per page.
*
* @param pages A list of strings, each being a page
*/
void setPages(@NotNull String... pages);
/**
* Adds new pages to the end of the book. Up to a maximum of 100 pages with
* 1024 characters per page.
*
* @param pages A list of strings, each being a page
*/
void addPage(@NotNull String... pages);
/**
* Gets the number of pages in the book.
*
* @return the number of pages in the book
*/
int getPageCount();
@Override
@NotNull
BookMeta clone();

View file

@ -1,6 +1,7 @@
package org.bukkit.inventory.meta;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
* Represents an item that has durability and can take damage.
@ -28,6 +29,29 @@ public interface Damageable extends ItemMeta {
*/
void setDamage(int damage);
/**
* Checks to see if this item has a maximum amount of damage.
*
* @return true if this has maximum amount of damage
*/
boolean hasMaxDamage();
/**
* Gets the maximum amount of damage.
*
* Plugins should check {@link #hasMaxDamage()} before calling this method.
*
* @return the maximum amount of damage
*/
int getMaxDamage();
/**
* Sets the maximum amount of damage.
*
* @param maxDamage maximum amount of damage
*/
void setMaxDamage(@Nullable Integer maxDamage);
@NotNull
@Override
Damageable clone();

View file

@ -11,6 +11,8 @@ import org.bukkit.configuration.serialization.ConfigurationSerializable;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.inventory.EquipmentSlot;
import org.bukkit.inventory.ItemFlag;
import org.bukkit.inventory.ItemRarity;
import org.bukkit.inventory.meta.components.FoodComponent;
import org.bukkit.inventory.meta.tags.CustomItemTagContainer;
import org.bukkit.persistence.PersistentDataHolder;
import org.jetbrains.annotations.ApiStatus;
@ -50,11 +52,47 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste
*/
void setDisplayName(@Nullable String name);
/**
* Checks for existence of an item name.
* <br>
* Item name differs from display name in that it is cannot be edited by an
* anvil, is not styled with italics, and does not show labels.
*
* @return true if this has an item name
*/
boolean hasItemName();
/**
* Gets the item name that is set.
* <br>
* Item name differs from display name in that it is cannot be edited by an
* anvil, is not styled with italics, and does not show labels.
* <p>
* Plugins should check that hasItemName() returns <code>true</code> before
* calling this method.
*
* @return the item name that is set
*/
@NotNull
String getItemName();
/**
* Sets the item name.
* <br>
* Item name differs from display name in that it is cannot be edited by an
* anvil, is not styled with italics, and does not show labels.
*
* @param name the name to set
*/
void setItemName(@Nullable String name);
/**
* Checks for existence of a localized name.
*
* @return true if this has a localized name
* @deprecated meta no longer exists
*/
@Deprecated(forRemoval = true)
boolean hasLocalizedName();
/**
@ -64,15 +102,19 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste
* before calling this method.
*
* @return the localized name that is set
* @deprecated meta no longer exists
*/
@NotNull
@Deprecated(forRemoval = true)
String getLocalizedName();
/**
* Sets the localized name.
*
* @param name the name to set
* @deprecated meta no longer exists
*/
@Deprecated(forRemoval = true)
void setLocalizedName(@Nullable String name);
/**
@ -231,6 +273,22 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste
*/
boolean hasItemFlag(@NotNull ItemFlag flag);
/**
* Gets if this item has hide_tooltip set. An item with this set will not
* show any tooltip whatsoever.
*
* @return hide_tooltip
*/
boolean isHideTooltip();
/**
* Sets if this item has hide_tooltip set. An item with this set will not
* show any tooltip whatsoever.
*
* @param hideTooltip new hide_tooltip
*/
void setHideTooltip(boolean hideTooltip);
/**
* Return if the unbreakable tag is true. An unbreakable item will not lose
* durability.
@ -246,6 +304,120 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste
*/
void setUnbreakable(boolean unbreakable);
/**
* Gets if an enchantment_glint_override is set.
*
* @return if an enchantment_glint_override is set
*/
boolean hasEnchantmentGlintOverride();
/**
* Sets the enchantment_glint_override. If true, the item will glint, even
* without enchantments; if false, the item will not glint, even with
* enchantments.
*
* Plugins should check {@link #hasEnchantmentGlintOverride()} before
* calling this method.
*
* @return enchantment_glint_override
*/
@NotNull
Boolean getEnchantmentGlintOverride();
/**
* Sets the enchantment_glint_override. If true, the item will glint, even
* without enchantments; if false, the item will not glint, even with
* enchantments. If null, the override will be cleared.
*
* @param override new enchantment_glint_override
*/
void setEnchantmentGlintOverride(@Nullable Boolean override);
/**
* Checks if this item is fire_resistant. If true, it will not burn in fire
* or lava.
*
* @return fire_resistant
*/
boolean isFireResistant();
/**
* Sets if this item is fire_resistant. If true, it will not burn in fire
* or lava.
*
* @param fireResistant fire_resistant
*/
void setFireResistant(boolean fireResistant);
/**
* Gets if the max_stack_size is set.
*
* @return if a max_stack_size is set.
*/
boolean hasMaxStackSize();
/**
* Gets the max_stack_size. This is the maximum amount which an item will
* stack.
*
* @return max_stack_size
*/
int getMaxStackSize();
/**
* Sets the max_stack_size. This is the maximum amount which an item will
* stack.
*
* @param max max_stack_size, between 1 and 99 (inclusive)
*/
void setMaxStackSize(@Nullable Integer max);
/**
* Gets if the rarity is set.
*
* @return rarity
*/
boolean hasRarity();
/**
* Gets the item rarity.
*
* Plugins should check {@link #hasRarity()} before calling this method.
*
* @return rarity
*/
@NotNull
ItemRarity getRarity();
/**
* Sets the item rarity.
*
* @param rarity new rarity
*/
void setRarity(@Nullable ItemRarity rarity);
/**
* Checks if the food is set.
*
* @return if a food is set
*/
boolean hasFood();
/**
* Gets the food set on this item, or creates an empty food instance.
*
* @return food
*/
@NotNull
FoodComponent getFood();
/**
* Sets the item food.
*
* @param food new food
*/
void setFood(@Nullable FoodComponent food);
/**
* Checks for the existence of any AttributeModifiers.
*

View file

@ -0,0 +1,37 @@
package org.bukkit.inventory.meta;
import org.jetbrains.annotations.NotNull;
/**
* Represents a map that can be scalable.
*/
public interface OminousBottleMeta extends ItemMeta {
/**
* Checks for the presence of an amplifier.
*
* @return true if a customer amplifier is applied
*/
boolean hasAmplifier();
/**
* Gets the amplifier amount for an Ominous Bottle's bad omen effect.
* <p>
* Plugins should check that hasAmplifier() returns true before calling this
* method.
*
* @return amplifier
*/
int getAmplifier();
/**
* Sets the amplifier amount for an Ominous Bottle's bad omen effect.
*
* @param amplifier between 0 and 4
*/
void setAmplifier(int amplifier);
@Override
@NotNull
OminousBottleMeta clone();
}

View file

@ -2,7 +2,6 @@ package org.bukkit.inventory.meta;
import java.util.List;
import org.bukkit.Color;
import org.bukkit.potion.PotionData;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import org.bukkit.potion.PotionType;
@ -14,40 +13,28 @@ import org.jetbrains.annotations.Nullable;
*/
public interface PotionMeta extends ItemMeta {
/**
* Sets the underlying potion data
*
* @param data PotionData to set the base potion state to
* @deprecated Upgraded / extended potions are now their own {@link PotionType} use {@link #setBasePotionType} instead.
*/
@Deprecated
void setBasePotionData(@NotNull PotionData data);
/**
* Returns the potion data about the base potion
*
* @return a PotionData object
* @deprecated Upgraded / extended potions are now their own {@link PotionType} use {@link #getBasePotionType()} instead.
*/
@NotNull
@Deprecated
PotionData getBasePotionData();
/**
* Sets the underlying potion type
*
* @param type PotionType to set the base potion state to
*/
void setBasePotionType(@NotNull PotionType type);
void setBasePotionType(@Nullable PotionType type);
/**
* Returns the potion type about the base potion
*
* @return a PotionType object
*/
@NotNull
@Nullable
PotionType getBasePotionType();
/**
* Checks for the presence of a base potion type
*
* @return true if a base potion type is present
*/
boolean hasBasePotionType();
/**
* Checks for the presence of custom potion effects.
*

View file

@ -0,0 +1,87 @@
package org.bukkit.inventory.meta;
import java.util.List;
import org.bukkit.Material;
import org.jetbrains.annotations.NotNull;
/**
* Represents a book ({@link Material#WRITABLE_BOOK} or {@link
* Material#WRITTEN_BOOK}) that can have pages.
*/
public interface WritableBookMeta extends ItemMeta {
/**
* Checks for the existence of pages in the book.
*
* @return true if the book has pages
*/
boolean hasPages();
/**
* Gets the specified page in the book. The given page must exist.
* <p>
* Pages are 1-indexed.
*
* @param page the page number to get, in range [1, getPageCount()]
* @return the page from the book
*/
@NotNull
String getPage(int page);
/**
* Sets the specified page in the book. Pages of the book must be
* contiguous.
* <p>
* The data can be up to 1024 characters in length, additional characters
* are truncated.
* <p>
* Pages are 1-indexed.
*
* @param page the page number to set, in range [1, getPageCount()]
* @param data the data to set for that page
*/
void setPage(int page, @NotNull String data);
/**
* Gets all the pages in the book.
*
* @return list of all the pages in the book
*/
@NotNull
List<String> getPages();
/**
* Clears the existing book pages, and sets the book to use the provided
* pages. Maximum 100 pages with 1024 characters per page.
*
* @param pages A list of pages to set the book to use
*/
void setPages(@NotNull List<String> pages);
/**
* Clears the existing book pages, and sets the book to use the provided
* pages. Maximum 100 pages with 1024 characters per page.
*
* @param pages A list of strings, each being a page
*/
void setPages(@NotNull String... pages);
/**
* Adds new pages to the end of the book. Up to a maximum of 100 pages with
* 1024 characters per page.
*
* @param pages A list of strings, each being a page
*/
void addPage(@NotNull String... pages);
/**
* Gets the number of pages in the book.
*
* @return the number of pages in the book
*/
int getPageCount();
@Override
@NotNull
WritableBookMeta clone();
}

View file

@ -0,0 +1,130 @@
package org.bukkit.inventory.meta.components;
import java.util.List;
import org.bukkit.configuration.serialization.ConfigurationSerializable;
import org.bukkit.potion.PotionEffect;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
/**
* Represents a component which can turn any item into food.
*/
@ApiStatus.Experimental
public interface FoodComponent extends ConfigurationSerializable {
/**
* Gets the food restored by this item when eaten.
*
* @return nutrition value
*/
int getNutrition();
/**
* Sets the food restored by this item when eaten.
*
* @param nutrition new nutrition value, must be non-negative
*/
void setNutrition(int nutrition);
/**
* Gets the saturation restored by this item when eaten.
*
* @return saturation value
*/
float getSaturationModifier();
/**
* Sets the saturation restored by this item when eaten.
*
* @param saturationModifier new saturation value
*/
void setSaturationModifier(float saturationModifier);
/**
* Gets if this item can be eaten even when not hungry.
*
* @return true if always edible
*/
boolean canAlwaysEat();
/**
* Sets if this item can be eaten even when not hungry.
*
* @param canAlwaysEat whether always edible
*/
void setCanAlwaysEat(boolean canAlwaysEat);
/**
* Gets the time in seconds it will take for this item to be eaten.
*
* @return eat time
*/
float getEatSeconds();
/**
* Sets the time in seconds it will take for this item to be eaten.
*
* @param eatSeconds new eat time
*/
void setEatSeconds(float eatSeconds);
/**
* Gets the effects which may be applied by this item when eaten.
*
* @return food effects
*/
@NotNull
List<FoodEffect> getEffects();
/**
* Sets the effects which may be applied by this item when eaten.
*
* @param effects new effects
*/
void setEffects(@NotNull List<FoodEffect> effects);
/**
* Adds an effect which may be applied by this item when eaten.
*
* @param effect the effect
* @param probability the probability of the effect being applied
* @return the added effect
*/
@NotNull
FoodEffect addEffect(@NotNull PotionEffect effect, float probability);
/**
* An effect which may be applied by this item when eaten.
*/
public interface FoodEffect extends ConfigurationSerializable {
/**
* Gets the effect which may be applied.
*
* @return the effect
*/
@NotNull
PotionEffect getEffect();
/**
* Sets the effect which may be applied.
*
* @param effect the new effect
*/
void setEffect(@NotNull PotionEffect effect);
/**
* Gets the probability of this effect being applied.
*
* @return probability
*/
float getProbability();
/**
* Sets the probability of this effect being applied.
*
* @param probability between 0 and 1 inclusive.
*/
void setProbability(float probability);
}
}

View file

@ -0,0 +1,5 @@
/**
* Isolated components which may form part of item meta.
*/
@org.jetbrains.annotations.ApiStatus.Experimental
package org.bukkit.inventory.meta.components;

View file

@ -75,4 +75,12 @@ public interface TrimPattern extends Keyed, Translatable {
* {@link Material#HOST_ARMOR_TRIM_SMITHING_TEMPLATE}.
*/
public static final TrimPattern HOST = Registry.TRIM_PATTERN.get(NamespacedKey.minecraft("host"));
/**
* {@link Material#FLOW_ARMOR_TRIM_SMITHING_TEMPLATE}.
*/
public static final TrimPattern FLOW = Registry.TRIM_PATTERN.get(NamespacedKey.minecraft("flow"));
/**
* {@link Material#BOLT_ARMOR_TRIM_SMITHING_TEMPLATE}.
*/
public static final TrimPattern BOLT = Registry.TRIM_PATTERN.get(NamespacedKey.minecraft("bolt"));
}

View file

@ -37,6 +37,20 @@ public enum LootTables implements Keyed {
@MinecraftExperimental
TRIAL_CHAMBERS_REWARD("chests/trial_chambers/reward"),
@MinecraftExperimental
TRIAL_CHAMBERS_REWARD_COMMON("chests/trial_chambers/reward_common"),
@MinecraftExperimental
TRIAL_CHAMBERS_REWARD_RARE("chests/trial_chambers/reward_rare"),
@MinecraftExperimental
TRIAL_CHAMBERS_REWARD_UNIQUE("chests/trial_chambers/reward_unique"),
@MinecraftExperimental
TRIAL_CHAMBERS_REWARD_OMINOUS("chests/trial_chambers/reward_ominous"),
@MinecraftExperimental
TRIAL_CHAMBERS_REWARD_OMINOUS_COMMON("chests/trial_chambers/reward_ominous_common"),
@MinecraftExperimental
TRIAL_CHAMBERS_REWARD_OMINOUS_RARE("chests/trial_chambers/reward_ominous_rare"),
@MinecraftExperimental
TRIAL_CHAMBERS_REWARD_OMINOUS_UNIQUE("chests/trial_chambers/reward_ominous_unique"),
@MinecraftExperimental
TRIAL_CHAMBERS_SUPPLY("chests/trial_chambers/supply"),
@MinecraftExperimental
TRIAL_CHAMBERS_CORRIDOR("chests/trial_chambers/corridor"),
@ -54,6 +68,12 @@ public enum LootTables implements Keyed {
TRIAL_CHAMBERS_WATER_DISPENSER("dispensers/trial_chambers/water"),
@MinecraftExperimental
TRIAL_CHAMBERS_CORRIDOR_POT("pots/trial_chambers/corridor"),
@MinecraftExperimental
EQUIPMENT_TRIAL_CHAMBER("equipment/trial_chamber"),
@MinecraftExperimental
EQUIPMENT_TRIAL_CHAMBER_RANGED("equipment/trial_chamber_ranged"),
@MinecraftExperimental
EQUIPMENT_TRIAL_CHAMBER_MELEE("equipment/trial_chamber_melee"),
SHIPWRECK_MAP("chests/shipwreck_map"),
SHIPWRECK_SUPPLY("chests/shipwreck_supply"),
SHIPWRECK_TREASURE("chests/shipwreck_treasure"),
@ -177,12 +197,21 @@ public enum LootTables implements Keyed {
TOOLSMITH_GIFT("gameplay/hero_of_the_village/toolsmith_gift"),
WEAPONSMITH_GIFT("gameplay/hero_of_the_village/weaponsmith_gift"),
SNIFFER_DIGGING("gameplay/sniffer_digging"),
PANDA_SNEEZE("gameplay/panda_sneeze"),
PIGLIN_BARTERING("gameplay/piglin_bartering"),
// Spawners
@MinecraftExperimental
TRIAL_CHAMBER_KEY("spawners/trial_chamber/key"),
@MinecraftExperimental
TRIAL_CHAMBER_CONSUMABLES("spawners/trial_chamber/consumables"),
@MinecraftExperimental
OMINOUS_TRIAL_CHAMBER_KEY("spawners/ominous/trial_chamber/key"),
@MinecraftExperimental
OMINOUS_TRIAL_CHAMBER_CONSUMABLES("spawners/ominous/trial_chamber/consumables"),
@MinecraftExperimental
TRIAL_CHAMBER_ITEMS_TO_DROP_WHEN_OMINOUS("spawners/trial_chamber/items_to_drop_when_ominous"),
// Shearing
SHEARING_BOGGED("shearing/bogged"),
// Archaeology
DESERT_WELL_ARCHAEOLOGY("archaeology/desert_well"),
DESERT_PYRAMID_ARCHAEOLOGY("archaeology/desert_pyramid"),

View file

@ -1,5 +1,7 @@
package org.bukkit.map;
import org.bukkit.Keyed;
import org.bukkit.NamespacedKey;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@ -225,47 +227,56 @@ public final class MapCursor {
* index in the file './assets/minecraft/textures/map/map_icons.png' from minecraft.jar or from a
* resource pack.
*/
public enum Type {
WHITE_POINTER(0),
GREEN_POINTER(1),
RED_POINTER(2),
BLUE_POINTER(3),
WHITE_CROSS(4),
RED_MARKER(5),
WHITE_CIRCLE(6),
SMALL_WHITE_CIRCLE(7),
MANSION(8),
TEMPLE(9),
BANNER_WHITE(10),
BANNER_ORANGE(11),
BANNER_MAGENTA(12),
BANNER_LIGHT_BLUE(13),
BANNER_YELLOW(14),
BANNER_LIME(15),
BANNER_PINK(16),
BANNER_GRAY(17),
BANNER_LIGHT_GRAY(18),
BANNER_CYAN(19),
BANNER_PURPLE(20),
BANNER_BLUE(21),
BANNER_BROWN(22),
BANNER_GREEN(23),
BANNER_RED(24),
BANNER_BLACK(25),
RED_X(26),
DESERT_VILLAGE(27),
PLAINS_VILLAGE(28),
SAVANNA_VILLAGE(29),
SNOWY_VILLAGE(30),
TAIGA_VILLAGE(31),
JUNGLE_TEMPLE(32),
SWAMP_HUT(33),
public enum Type implements Keyed {
WHITE_POINTER(0, "player"),
GREEN_POINTER(1, "frame"),
RED_POINTER(2, "red_marker"),
BLUE_POINTER(3, "blue_marker"),
WHITE_CROSS(4, "target_x"),
RED_MARKER(5, "target_point"),
WHITE_CIRCLE(6, "player_off_map"),
SMALL_WHITE_CIRCLE(7, "player_off_limits"),
MANSION(8, "mansion"),
TEMPLE(9, "monument"),
BANNER_WHITE(10, "banner_white"),
BANNER_ORANGE(11, "banner_orange"),
BANNER_MAGENTA(12, "banner_magenta"),
BANNER_LIGHT_BLUE(13, "banner_light_blue"),
BANNER_YELLOW(14, "banner_yellow"),
BANNER_LIME(15, "banner_lime"),
BANNER_PINK(16, "banner_pink"),
BANNER_GRAY(17, "banner_gray"),
BANNER_LIGHT_GRAY(18, "banner_light_gray"),
BANNER_CYAN(19, "banner_cyan"),
BANNER_PURPLE(20, "banner_purple"),
BANNER_BLUE(21, "banner_blue"),
BANNER_BROWN(22, "banner_brown"),
BANNER_GREEN(23, "banner_green"),
BANNER_RED(24, "banner_red"),
BANNER_BLACK(25, "banner_black"),
RED_X(26, "red_x"),
DESERT_VILLAGE(27, "village_desert"),
PLAINS_VILLAGE(28, "village_plains"),
SAVANNA_VILLAGE(29, "village_savanna"),
SNOWY_VILLAGE(30, "village_snowy"),
TAIGA_VILLAGE(31, "village_taiga"),
JUNGLE_TEMPLE(32, "jungle_temple"),
SWAMP_HUT(33, "swamp_hut"),
TRIAL_CHAMBERS(34, "trial_chambers")
;
private byte value;
private final NamespacedKey key;
private Type(int value) {
private Type(int value, String key) {
this.value = (byte) value;
this.key = NamespacedKey.minecraft(key);
}
@NotNull
@Override
public NamespacedKey getKey() {
return key;
}
/**

View file

@ -1,395 +0,0 @@
package org.bukkit.potion;
import com.google.common.base.Preconditions;
import java.util.Collection;
import org.bukkit.Material;
import org.bukkit.entity.LivingEntity;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.PotionMeta;
import org.jetbrains.annotations.NotNull;
/**
* Potion Adapter for pre-1.9 data values
* see @PotionMeta for 1.9+
*/
@Deprecated
public class Potion {
private boolean extended = false;
private boolean splash = false;
private int level = 1;
private PotionType type;
/**
* Construct a new potion of the given type. Unless the type is {@link
* PotionType#WATER}, it will be level one, without extended duration.
* Don't use this constructor to create a no-effect potion other than
* water bottle.
*
* @param type The potion type
*/
public Potion(@NotNull PotionType type) {
Preconditions.checkArgument(type != null, "Null PotionType");
this.type = type;
}
/**
* Create a new potion of the given type and level.
*
* @param type The type of potion.
* @param level The potion's level.
*/
public Potion(@NotNull PotionType type, int level) {
this(type);
Preconditions.checkArgument(type != null, "Type cannot be null");
Preconditions.checkArgument(level > 0 && level < 3, "Level must be 1 or 2");
this.level = level;
}
/**
* Create a new potion of the given type and level.
*
* @param type The type of potion.
* @param level The potion's level.
* @param splash Whether it is a splash potion.
* @deprecated In favour of using {@link #Potion(PotionType)} with {@link
* #splash()}.
*/
@Deprecated
public Potion(@NotNull PotionType type, int level, boolean splash) {
this(type, level);
this.splash = splash;
}
/**
* Create a new potion of the given type and level.
*
* @param type The type of potion.
* @param level The potion's level.
* @param splash Whether it is a splash potion.
* @param extended Whether it has an extended duration.
* @deprecated In favour of using {@link #Potion(PotionType)} with {@link
* #extend()} and possibly {@link #splash()}.
*/
@Deprecated
public Potion(@NotNull PotionType type, int level, boolean splash, boolean extended) {
this(type, level, splash);
this.extended = extended;
}
/**
* Chain this to the constructor to make the potion a splash potion.
*
* @return The potion.
*/
@NotNull
public Potion splash() {
setSplash(true);
return this;
}
/**
* Chain this to the constructor to extend the potion's duration.
*
* @return The potion.
*/
@NotNull
public Potion extend() {
setHasExtendedDuration(true);
return this;
}
/**
* Applies the effects of this potion to the given {@link ItemStack}. The
* ItemStack must be a potion.
*
* @param to The itemstack to apply to
*/
public void apply(@NotNull ItemStack to) {
Preconditions.checkArgument(to != null, "itemstack cannot be null");
Preconditions.checkArgument(to.hasItemMeta(), "given itemstack is not a potion");
Preconditions.checkArgument(to.getItemMeta() instanceof PotionMeta, "given itemstack is not a potion");
PotionMeta meta = (PotionMeta) to.getItemMeta();
meta.setBasePotionData(new PotionData(type, extended, level == 2));
to.setItemMeta(meta);
}
/**
* Applies the effects that would be applied by this potion to the given
* {@link LivingEntity}.
*
* @param to The entity to apply the effects to
* @see LivingEntity#addPotionEffects(Collection)
*/
public void apply(@NotNull LivingEntity to) {
Preconditions.checkArgument(to != null, "entity cannot be null");
to.addPotionEffects(getEffects());
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null || getClass() != obj.getClass()) {
return false;
}
Potion other = (Potion) obj;
return extended == other.extended && splash == other.splash && level == other.level && type == other.type;
}
/**
* Returns a collection of {@link PotionEffect}s that this {@link Potion}
* would confer upon a {@link LivingEntity}.
*
* @return The effects that this potion applies
* @see PotionBrewer#getEffectsFromDamage(int)
* @see Potion#toDamageValue()
*/
@NotNull
public Collection<PotionEffect> getEffects() {
return getBrewer().getEffects(type, level == 2, extended);
}
/**
* Returns the level of this potion.
*
* @return The level of this potion
*/
public int getLevel() {
return level;
}
/**
* Returns the {@link PotionType} of this potion.
*
* @return The type of this potion
*/
@NotNull
public PotionType getType() {
return type;
}
/**
* Returns whether this potion has an extended duration.
*
* @return Whether this potion has extended duration
*/
public boolean hasExtendedDuration() {
return extended;
}
@Override
public int hashCode() {
final int prime = 31;
int result = prime + level;
result = prime * result + (extended ? 1231 : 1237);
result = prime * result + (splash ? 1231 : 1237);
result = prime * result + ((type == null) ? 0 : type.hashCode());
return result;
}
/**
* Returns whether this potion is a splash potion.
*
* @return Whether this is a splash potion
*/
public boolean isSplash() {
return splash;
}
/**
* Set whether this potion has extended duration. This will cause the
* potion to have roughly 8/3 more duration than a regular potion.
*
* @param isExtended Whether the potion should have extended duration
*/
public void setHasExtendedDuration(boolean isExtended) {
Preconditions.checkArgument(type == null || !type.isInstant(), "Instant potions cannot be extended");
extended = isExtended;
}
/**
* Sets whether this potion is a splash potion. Splash potions can be
* thrown for a radius effect.
*
* @param isSplash Whether this is a splash potion
*/
public void setSplash(boolean isSplash) {
splash = isSplash;
}
/**
* Sets the {@link PotionType} of this potion.
*
* @param type The new type of this potion
*/
public void setType(@NotNull PotionType type) {
this.type = type;
}
/**
* Sets the level of this potion.
*
* @param level The new level of this potion
*/
public void setLevel(int level) {
Preconditions.checkArgument(this.type != null, "No-effect potions don't have a level.");
Preconditions.checkArgument(level > 0 && level <= 2, "Level must be between 1 and 2 for this potion");
this.level = level;
}
/**
* Converts this potion to a valid potion damage short, usable for potion
* item stacks.
*
* @return The damage value of this potion
* @deprecated Non-functional
*/
@Deprecated
public short toDamageValue() {
return 0;
}
/**
* Converts this potion to an {@link ItemStack} with the specified amount
* and a correct damage value.
*
* @param amount The amount of the ItemStack
* @return The created ItemStack
*/
@NotNull
public ItemStack toItemStack(int amount) {
Material material;
if (isSplash()) {
material = Material.SPLASH_POTION;
} else {
material = Material.POTION;
}
ItemStack itemStack = new ItemStack(material, amount);
PotionMeta meta = (PotionMeta) itemStack.getItemMeta();
meta.setBasePotionData(new PotionData(type, level == 2, extended));
itemStack.setItemMeta(meta);
return itemStack;
}
private static PotionBrewer brewer;
private static final int EXTENDED_BIT = 0x40;
private static final int POTION_BIT = 0xF;
private static final int SPLASH_BIT = 0x4000;
private static final int TIER_BIT = 0x20;
private static final int TIER_SHIFT = 5;
/**
* Gets the potion from its damage value.
*
* @param damage the damage value
* @return the produced potion
*/
@NotNull
public static Potion fromDamage(int damage) {
PotionType type;
switch (damage & POTION_BIT) {
case 0:
type = PotionType.WATER;
break;
case 1:
type = PotionType.REGEN;
break;
case 2:
type = PotionType.SPEED;
break;
case 3:
type = PotionType.FIRE_RESISTANCE;
break;
case 4:
type = PotionType.POISON;
break;
case 5:
type = PotionType.INSTANT_HEAL;
break;
case 6:
type = PotionType.NIGHT_VISION;
break;
case 8:
type = PotionType.WEAKNESS;
break;
case 9:
type = PotionType.STRENGTH;
break;
case 10:
type = PotionType.SLOWNESS;
break;
case 11:
type = PotionType.JUMP;
break;
case 12:
type = PotionType.INSTANT_DAMAGE;
break;
case 13:
type = PotionType.WATER_BREATHING;
break;
case 14:
type = PotionType.INVISIBILITY;
break;
default:
type = PotionType.WATER;
}
Potion potion;
if (type == null || type == PotionType.WATER) {
potion = new Potion(PotionType.WATER);
} else {
int level = (damage & TIER_BIT) >> TIER_SHIFT;
level++;
potion = new Potion(type, level);
}
if ((damage & SPLASH_BIT) != 0) {
potion = potion.splash();
}
if ((damage & EXTENDED_BIT) != 0) {
potion = potion.extend();
}
return potion;
}
@NotNull
public static Potion fromItemStack(@NotNull ItemStack item) {
Preconditions.checkArgument(item != null, "item cannot be null");
if (item.getType() != Material.POTION)
throw new IllegalArgumentException("item is not a potion");
return fromDamage(item.getDurability());
}
/**
* Returns an instance of {@link PotionBrewer}.
*
* @return An instance of PotionBrewer
*/
@NotNull
public static PotionBrewer getBrewer() {
return brewer;
}
/**
* Sets the current instance of {@link PotionBrewer}. Generally not to be
* used from within a plugin.
*
* @param other The new PotionBrewer
*/
public static void setPotionBrewer(@NotNull PotionBrewer other) {
if (brewer != null)
throw new IllegalArgumentException("brewer can only be set internally");
brewer = other;
}
/**
* Gets the potion from its name id.
*
* @return the name id
* @deprecated Non-functional
*/
@Deprecated
public int getNameId() {
return 0;
}
}

View file

@ -1,93 +0,0 @@
package org.bukkit.potion;
import com.google.common.base.Preconditions;
import org.jetbrains.annotations.NotNull;
/**
* @deprecated Upgraded / extended potions are now their own {@link PotionType} use them instead.
*/
@Deprecated
public final class PotionData {
private final PotionType type;
private final boolean extended;
private final boolean upgraded;
/**
* Instantiates a final PotionData object to contain information about a
* Potion
*
* @param type the type of the Potion
* @param extended whether the potion is extended PotionType#isExtendable()
* must be true
* @param upgraded whether the potion is upgraded PotionType#isUpgradable()
* must be true
*/
public PotionData(@NotNull PotionType type, boolean extended, boolean upgraded) {
Preconditions.checkArgument(type != null, "Potion Type must not be null");
Preconditions.checkArgument(!upgraded || type.isUpgradeable(), "Potion Type is not upgradable");
Preconditions.checkArgument(!extended || type.isExtendable(), "Potion Type is not extendable");
Preconditions.checkArgument(!upgraded || !extended, "Potion cannot be both extended and upgraded");
Preconditions.checkArgument(!type.getKey().getKey().startsWith("strong_"), "Strong potion type cannot be used directly, got %s", type.getKey());
Preconditions.checkArgument(!type.getKey().getKey().startsWith("long_"), "Extended potion type cannot be used directly, got %s", type.getKey());
this.type = type;
this.extended = extended;
this.upgraded = upgraded;
}
public PotionData(@NotNull PotionType type) {
this(type, false, false);
}
/**
* Gets the type of the potion, Type matches up with each kind of craftable
* potion
*
* @return the potion type
*/
@NotNull
public PotionType getType() {
return type;
}
/**
* Checks if the potion is in an upgraded state. This refers to whether or
* not the potion is Tier 2, such as Potion of Fire Resistance II.
*
* @return true if the potion is upgraded;
*/
public boolean isUpgraded() {
return upgraded;
}
/**
* Checks if the potion is in an extended state. This refers to the extended
* duration potions
*
* @return true if the potion is extended
*/
public boolean isExtended() {
return extended;
}
@Override
public int hashCode() {
int hash = 7;
hash = 23 * hash + (this.type != null ? this.type.hashCode() : 0);
hash = 23 * hash + (this.extended ? 1 : 0);
hash = 23 * hash + (this.upgraded ? 1 : 0);
return hash;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null || getClass() != obj.getClass()) {
return false;
}
PotionData other = (PotionData) obj;
return (this.upgraded == other.upgraded) && (this.extended == other.extended) && (this.type == other.type);
}
}

View file

@ -173,7 +173,7 @@ public abstract class PotionEffectType implements Keyed, Translatable {
public static final PotionEffectType DOLPHINS_GRACE = getPotionEffectType(30, "dolphins_grace");
/**
* Triggers a raid when the player enters a village.<br>
* Triggers an ominous event when the player enters a village or trial chambers.<br>
* oof.
*/
public static final PotionEffectType BAD_OMEN = getPotionEffectType(31, "bad_omen");
@ -189,6 +189,36 @@ public abstract class PotionEffectType implements Keyed, Translatable {
*/
public static final PotionEffectType DARKNESS = getPotionEffectType(33, "darkness");
/**
* Causes trial spawners to become ominous.
*/
public static final PotionEffectType TRIAL_OMEN = getPotionEffectType(34, "trial_omen");
/**
* Triggers a raid when a player enters a village.
*/
public static final PotionEffectType RAID_OMEN = getPotionEffectType(35, "raid_omen");
/**
* Emits a wind burst upon death.
*/
public static final PotionEffectType WIND_CHARGED = getPotionEffectType(36, "wind_charged");
/**
* Creates cobwebs upon death.
*/
public static final PotionEffectType WEAVING = getPotionEffectType(37, "weaving");
/**
* Causes slimes to spawn upon death.
*/
public static final PotionEffectType OOZING = getPotionEffectType(38, "oozing");
/**
* Chance of spawning silverfish when hurt.
*/
public static final PotionEffectType INFESTED = getPotionEffectType(39, "infested");
@NotNull
private static PotionEffectType getPotionEffectType(int typeId, @NotNull String key) {
NamespacedKey namespacedKey = NamespacedKey.minecraft(key);

View file

@ -5,6 +5,7 @@ import java.util.List;
import java.util.function.Supplier;
import org.bukkit.Bukkit;
import org.bukkit.Keyed;
import org.bukkit.MinecraftExperimental;
import org.bukkit.NamespacedKey;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
@ -15,7 +16,6 @@ import org.jetbrains.annotations.Nullable;
* the Creative mode inventory
*/
public enum PotionType implements Keyed {
UNCRAFTABLE("empty"),
WATER("water"),
MUNDANE("mundane"),
THICK("thick"),
@ -58,6 +58,14 @@ public enum PotionType implements Keyed {
STRONG_TURTLE_MASTER("strong_turtle_master"),
SLOW_FALLING("slow_falling"),
LONG_SLOW_FALLING("long_slow_falling"),
@MinecraftExperimental
WIND_CHARGED("wind_charged"),
@MinecraftExperimental
WEAVING("weaving"),
@MinecraftExperimental
OOZING("oozing"),
@MinecraftExperimental
INFESTED("infested"),
;
private final NamespacedKey key;