diff --git a/.gitignore b/.gitignore
index 11038da2..5dd700a9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,6 +3,7 @@
/.project
/.settings
/.checkstyle
+/.factorypath
# netbeans
/nbproject
diff --git a/pom.xml b/pom.xml
index d1d8a7a2..77005216 100644
--- a/pom.xml
+++ b/pom.xml
@@ -5,7 +5,7 @@
The list is formatted as a crafting matrix where the index follow + * the pattern below:
+ * + *+ * [ 0 1 2 ] + * [ 3 4 5 ] + * [ 6 7 8 ] + *+ * + *
The {@link World} and {@link Player} arguments are required to fulfill the Bukkit Crafting + * events.
+ * + *Calls {@link org.bukkit.event.inventory.PrepareItemCraftEvent} to imitate the {@link Player} + * initiating the crafting event.
+ * + * @param craftingMatrix list of items to be crafted from. + * Must not contain more than 9 items. + * @param world The world the crafting takes place in. + * @param player The player to imitate the crafting event on. + * @return resulting {@link ItemCraftResult} containing the resulting item, matrix and any overflow items. + */ + @NotNull + public static ItemCraftResult craftItemResult(@NotNull ItemStack[] craftingMatrix, @NotNull World world, @NotNull Player player) { + return server.craftItemResult(craftingMatrix, world, player); + } + + /** + * Get the crafted item using the list of {@link ItemStack} provided. + * + *The list is formatted as a crafting matrix where the index follow + * the pattern below:
+ * + *+ * [ 0 1 2 ] + * [ 3 4 5 ] + * [ 6 7 8 ] + *+ * + * @param craftingMatrix list of items to be crafted from. + * Must not contain more than 9 items. + * @param world The world the crafting takes place in. + * @return resulting {@link ItemCraftResult} containing the resulting item, matrix and any overflow items. + */ + @NotNull + public static ItemCraftResult craftItemResult(@NotNull ItemStack[] craftingMatrix, @NotNull World world) { + return server.craftItemResult(craftingMatrix, world); + } + + /** * Get the crafted item using the list of {@link ItemStack} provided. * @@ -974,6 +1027,29 @@ public final class Bukkit { return server.craftItem(craftingMatrix, world, player); } + /** + * Get the crafted item using the list of {@link ItemStack} provided. + * + *
The list is formatted as a crafting matrix where the index follow + * the pattern below:
+ * + *+ * [ 0 1 2 ] + * [ 3 4 5 ] + * [ 6 7 8 ] + *+ * + * @param craftingMatrix list of items to be crafted from. + * Must not contain more than 9 items. + * @param world The world the crafting takes place in. + * @return the {@link ItemStack} resulting from the given crafting matrix, if no recipe is found + * an ItemStack of {@link Material#AIR} is returned. + */ + @NotNull + public static ItemStack craftItem(@NotNull ItemStack[] craftingMatrix, @NotNull World world) { + return server.craftItem(craftingMatrix, world); + } + /** * Get an iterator through the list of crafting recipes. * @@ -1864,7 +1940,7 @@ public final class Bukkit { * @return new data instance */ @NotNull - public static B createBlockData(@NotNull BlockType blockType, @Nullable Consumer consumer) { + public static B createBlockData(@NotNull BlockType blockType, @Nullable Consumer super B> consumer) { return server.createBlockData(blockType, consumer); } diff --git a/src/main/java/org/bukkit/EntityEffect.java b/src/main/java/org/bukkit/EntityEffect.java index 1747b912..9db85b2f 100644 --- a/src/main/java/org/bukkit/EntityEffect.java +++ b/src/main/java/org/bukkit/EntityEffect.java @@ -1,25 +1,37 @@ package org.bukkit; +import com.google.common.base.Preconditions; import org.bukkit.entity.Ageable; import org.bukkit.entity.ArmorStand; import org.bukkit.entity.Cat; import org.bukkit.entity.Dolphin; +import org.bukkit.entity.Egg; import org.bukkit.entity.Entity; +import org.bukkit.entity.EvokerFangs; import org.bukkit.entity.Firework; import org.bukkit.entity.Fox; +import org.bukkit.entity.Goat; import org.bukkit.entity.Guardian; +import org.bukkit.entity.Hoglin; import org.bukkit.entity.IronGolem; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.entity.Rabbit; import org.bukkit.entity.Ravager; +import org.bukkit.entity.Sheep; +import org.bukkit.entity.Sniffer; +import org.bukkit.entity.Snowball; import org.bukkit.entity.Squid; import org.bukkit.entity.Tameable; import org.bukkit.entity.TippedArrow; import org.bukkit.entity.Villager; +import org.bukkit.entity.Warden; import org.bukkit.entity.Witch; import org.bukkit.entity.Wolf; +import org.bukkit.entity.Zoglin; import org.bukkit.entity.ZombieVillager; +import org.bukkit.entity.minecart.ExplosiveMinecart; +import org.bukkit.entity.minecart.SpawnerMinecart; import org.jetbrains.annotations.NotNull; /** @@ -35,6 +47,11 @@ public enum EntityEffect { * Rabbit jumping. */ RABBIT_JUMP(1, Rabbit.class), + /** + * Resets a spawner minecart's delay to 200. Does not effect actual spawning + * delay, only the speed at which the entity in the spawner spins + */ + RESET_SPAWNER_MINECART_DELAY(1, SpawnerMinecart.class), /** * When mobs get hurt. * @@ -47,35 +64,86 @@ public enum EntityEffect { *
* This will cause client-glitches! * - * @deprecated although this effect may trigger other events on non-living - * entities, it's only supported usage is on living ones. + * @deprecated split into individual effects + * @see #EGG_BREAK + * @see #SNOWBALL_BREAK + * @see #ENTITY_DEATH */ @Deprecated DEATH(3, Entity.class), - // PAIL - SPIGOT-3641 duplicate - // GOLEM_ATTACK(4, IronGolem.class), + /** + * Spawns the egg breaking particles + */ + EGG_BREAK(3, Egg.class), + /** + * Spawns the snowball breaking particles + */ + SNOWBALL_BREAK(3, Snowball.class), + /** + * Plays the entity death sound and animation + *
+ * This will cause client-glitches! + */ + ENTITY_DEATH(3, LivingEntity.class), + /** + * Plays the fang attack animation + */ + FANG_ATTACK(4, EvokerFangs.class), + /** + * Plays the hoglin attack animation + */ + HOGLIN_ATTACK(4, Hoglin.class), + /** + * Plays the iron golem attack animation + */ + IRON_GOLEN_ATTACK(4, IronGolem.class), + /** + * Plays the ravager attack animation + */ + RAVAGER_ATTACK(4, Ravager.class), + /** + * Plays the warden attack animation + */ + WARDEN_ATTACK(4, Warden.class), + /** + * Plays the zoglin attack animation + */ + ZOGLIN_ATTACK(4, Zoglin.class), // 5 - unused /** - * The smoke when taming a wolf fails. + * The smoke when taming an entity fails. */ WOLF_SMOKE(6, Tameable.class), /** - * The hearts when taming a wolf succeeds. + * The hearts when taming an entity succeeds. */ - WOLF_HEARTS(7, Wolf.class), + WOLF_HEARTS(7, Tameable.class), /** * When a wolf shakes (after being wet). + * + * @see EntityEffect#WOLF_SHAKE_STOP */ WOLF_SHAKE(8, Wolf.class), // 9 - unused /** * When an entity eats a LONG_GRASS block. * - * @deprecated although this effect may trigger other events on non-living - * entities, it's only supported usage is on living ones. + * @deprecated split into individual effects + * @see #SHEEP_EAT_GRASS + * @see #TNT_MINECART_IGNITE */ @Deprecated SHEEP_EAT(10, Entity.class), + /** + * Plays the sheep eating grass animation + */ + SHEEP_EAT_GRASS(10, Sheep.class), + /** + * Causes the TNT minecart to ignite, does not play the ignition sound + *
+ * This will cause client-glitches!
+ */
+ TNT_MINECART_IGNITE(10, ExplosiveMinecart.class),
/**
* When an Iron Golem gives a rose.
*/
@@ -213,7 +281,57 @@ public enum EntityEffect {
/**
* Entity breaks item in boot slot
*/
- BREAK_EQUIPMENT_BOOTS(52, LivingEntity.class);
+ BREAK_EQUIPMENT_BOOTS(52, LivingEntity.class),
+ /**
+ * Spawns honey block slide particles at the entity's feet
+ */
+ HONEY_BLOCK_SLIDE_PARTICLES(53, Entity.class),
+ /**
+ * Spawns honey block fall particles at the entity's feet
+ */
+ HONEY_BLOCK_FALL_PARTICLES(54, LivingEntity.class),
+ /**
+ * Entity swaps the items in their hand and offhand
+ */
+ SWAP_HAND_ITEMS(55, LivingEntity.class),
+ /**
+ * Stops a wolf that is currently shaking
+ *
+ * @see EntityEffect#WOLF_SHAKE
+ */
+ WOLF_SHAKE_STOP(56, Wolf.class),
+ // 57 - unused
+ /**
+ * Goat lowers its head for ramming
+ *
+ * @see #GOAT_RAISE_HEAD
+ */
+ GOAT_LOWER_HEAD(58, Goat.class),
+ /**
+ * Goat raises its head
+ *
+ * @see #GOAT_LOWER_HEAD
+ */
+ GOAT_RAISE_HEAD(59, Goat.class),
+ /**
+ * Spawns death smoke particles
+ */
+ SPAWN_DEATH_SMOKE(60, LivingEntity.class),
+ /**
+ * Warden shakes its tendrils
+ */
+ WARDEN_TENDRIL_SHAKE(61, Warden.class),
+ /**
+ * Warden performs sonic attack animation
+ * Note: The created entity keeps a reference to the world it was
+ * created in, care should be taken that the entity does not outlive the
+ * world instance as this will lead to memory leaks.
+ *
+ * @param The list is formatted as a crafting matrix where the index follow
+ * the pattern below: The list is formatted as a crafting matrix where the index follow
+ * the pattern below: The {@link World} and {@link Player} arguments are required to fulfill the Bukkit Crafting
+ * events. Calls {@link org.bukkit.event.inventory.PrepareItemCraftEvent} to imitate the {@link Player}
+ * initiating the crafting event. The list is formatted as a crafting matrix where the index follow
+ * the pattern below:
+ * Note: Due to display entities having a zero size hitbox, this method will not detect them.
+ * To detect display entities use {@link #rayTraceEntities(Location, Vector, double, double)} with a positive raySize
*
* @param start the start position
* @param direction the ray direction
@@ -702,7 +705,7 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
* @param direction the ray direction
* @param maxDistance the maximum distance
* @param raySize entity bounding boxes will be uniformly expanded (or
- * shrinked) by this value before doing collision checks
+ * shrunk) by this value before doing collision checks
* @return the closest ray trace hit result, or
+ * Note: Due to display entities having a zero size hitbox, this method will not detect them.
+ * To detect display entities use {@link #rayTraceEntities(Location, Vector, double, double, Predicate)} with a positive raySize
*
* @param start the start position
* @param direction the ray direction
@@ -727,7 +733,7 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
* @see #rayTraceEntities(Location, Vector, double, double, Predicate)
*/
@Nullable
- public RayTraceResult rayTraceEntities(@NotNull Location start, @NotNull Vector direction, double maxDistance, @Nullable Predicate
+ * This method will fail silently when called with {@link Instrument#CUSTOM_HEAD}.
+ *
+ * @param loc The location to play the note
+ * @param instrument The instrument
+ * @param note The note
+ */
+ void playNote(@NotNull Location loc, @NotNull Instrument instrument, @NotNull Note note);
+
/**
* Play a Sound at the provided Location in the World.
*
@@ -2137,6 +2155,38 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
*/
void playSound(@NotNull Location location, @NotNull String sound, @NotNull SoundCategory category, float volume, float pitch);
+ /**
+ * Play a Sound at the provided Location in the World. For sounds with multiple
+ * variations passing the same seed will always play the same variation.
+ *
+ * This function will fail silently if Location or Sound are null.
+ *
+ * @param location The location to play the sound
+ * @param sound The sound to play
+ * @param category the category of the sound
+ * @param volume The volume of the sound
+ * @param pitch The pitch of the sound
+ * @param seed The seed for the sound
+ */
+ void playSound(@NotNull Location location, @NotNull Sound sound, @NotNull SoundCategory category, float volume, float pitch, long seed);
+
+ /**
+ * Play a Sound at the provided Location in the World. For sounds with multiple
+ * variations passing the same seed will always play the same variation.
+ *
+ * This function will fail silently if Location or Sound are null. No sound will
+ * be heard by the players if their clients do not have the respective sound for
+ * the value passed.
+ *
+ * @param location The location to play the sound
+ * @param sound The internal sound name to play
+ * @param category the category of the sound
+ * @param volume The volume of the sound
+ * @param pitch The pitch of the sound
+ * @param seed The seed for the sound
+ */
+ void playSound(@NotNull Location location, @NotNull String sound, @NotNull SoundCategory category, float volume, float pitch, long seed);
+
/**
* Play a Sound at the location of the provided entity in the World.
*
@@ -2187,6 +2237,38 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
*/
void playSound(@NotNull Entity entity, @NotNull String sound, @NotNull SoundCategory category, float volume, float pitch);
+ /**
+ * Play a Sound at the location of the provided entity in the World. For sounds
+ * with multiple variations passing the same seed will always play the same
+ * variation.
+ *
+ * This function will fail silently if Entity or Sound are null.
+ *
+ * @param entity The entity to play the sound
+ * @param sound The sound to play
+ * @param category The category of the sound
+ * @param volume The volume of the sound
+ * @param pitch The pitch of the sound
+ * @param seed The seed for the sound
+ */
+ void playSound(@NotNull Entity entity, @NotNull Sound sound, @NotNull SoundCategory category, float volume, float pitch, long seed);
+
+ /**
+ * Play a Sound at the location of the provided entity in the World. For sounds
+ * with multiple variations passing the same seed will always play the same
+ * variation.
+ *
+ * This function will fail silently if Entity or Sound are null.
+ *
+ * @param entity The entity to play the sound
+ * @param sound The sound to play
+ * @param category The category of the sound
+ * @param volume The volume of the sound
+ * @param pitch The pitch of the sound
+ * @param seed The seed for the sound
+ */
+ void playSound(@NotNull Entity entity, @NotNull String sound, @NotNull SoundCategory category, float volume, float pitch, long seed);
+
/**
* Get an array containing the names of all the {@link GameRule}s.
*
diff --git a/src/main/java/org/bukkit/block/BlockType.java b/src/main/java/org/bukkit/block/BlockType.java
index a7832251..5bb9b48c 100644
--- a/src/main/java/org/bukkit/block/BlockType.java
+++ b/src/main/java/org/bukkit/block/BlockType.java
@@ -44,6 +44,7 @@ import org.bukkit.block.data.type.ChiseledBookshelf;
import org.bukkit.block.data.type.Cocoa;
import org.bukkit.block.data.type.CommandBlock;
import org.bukkit.block.data.type.Comparator;
+import org.bukkit.block.data.type.CopperBulb;
import org.bukkit.block.data.type.CoralWallFan;
import org.bukkit.block.data.type.DaylightDetector;
import org.bukkit.block.data.type.DecoratedPot;
@@ -112,7 +113,7 @@ import org.jetbrains.annotations.Nullable;
public interface BlockType extends Keyed, Translatable {
//
+ * All applicable data from the spawner will be copied, such as custom name,
+ * health, and velocity.
+ * All applicable data from the snapshot will be copied, such as custom name,
+ * health, and velocity.
+ * The weight will determine how often this entry is chosen to spawn, higher
+ * weighted entries will spawn more often than lower weighted ones.
- * Generally not to be used from within a plugin.
- *
- * @param enchantment Enchantment to register
- * @deprecated only for backwards compatibility, has no effect.
- */
- @Deprecated
- public static void registerEnchantment(@NotNull Enchantment enchantment) {}
-
- /**
- * Checks if this is accepting Enchantment registrations.
- *
- * @return True if the server Implementation may add enchantments
- * @deprecated only for backwards compatibility, has no effect.
- */
- @Deprecated
- public static boolean isAcceptingRegistrations() {
- return false;
- }
-
- /**
- * Stops accepting any enchantment registrations
- * @deprecated only for backwards compatibility, has no effect.
- */
- @Deprecated
- public static void stopAcceptingRegistrations() {}
-
private static String convertLegacy(String from) {
if (from == null) {
return null;
diff --git a/src/main/java/org/bukkit/enchantments/EnchantmentWrapper.java b/src/main/java/org/bukkit/enchantments/EnchantmentWrapper.java
index 7fee01b0..7ad7bcf9 100644
--- a/src/main/java/org/bukkit/enchantments/EnchantmentWrapper.java
+++ b/src/main/java/org/bukkit/enchantments/EnchantmentWrapper.java
@@ -1,7 +1,5 @@
package org.bukkit.enchantments;
-import org.bukkit.NamespacedKey;
-import org.bukkit.inventory.ItemStack;
import org.jetbrains.annotations.NotNull;
/**
@@ -9,8 +7,8 @@ import org.jetbrains.annotations.NotNull;
* @deprecated only for backwards compatibility, EnchantmentWrapper is no longer used.
*/
@Deprecated
-public class EnchantmentWrapper extends Enchantment {
- public EnchantmentWrapper(@NotNull String name) {
+public abstract class EnchantmentWrapper extends Enchantment {
+ protected EnchantmentWrapper() {
}
/**
@@ -20,54 +18,6 @@ public class EnchantmentWrapper extends Enchantment {
*/
@NotNull
public Enchantment getEnchantment() {
- return Enchantment.getByKey(getKey());
- }
-
- @Override
- public int getMaxLevel() {
- return getEnchantment().getMaxLevel();
- }
-
- @Override
- public int getStartLevel() {
- return getEnchantment().getStartLevel();
- }
-
- @NotNull
- @Override
- public EnchantmentTarget getItemTarget() {
- return getEnchantment().getItemTarget();
- }
-
- @Override
- public boolean canEnchantItem(@NotNull ItemStack item) {
- return getEnchantment().canEnchantItem(item);
- }
-
- @NotNull
- @Override
- public String getName() {
- return getEnchantment().getName();
- }
-
- @Override
- public boolean isTreasure() {
- return getEnchantment().isTreasure();
- }
-
- @Override
- public boolean isCursed() {
- return getEnchantment().isCursed();
- }
-
- @Override
- public boolean conflictsWith(@NotNull Enchantment other) {
- return getEnchantment().conflictsWith(other);
- }
-
- @NotNull
- @Override
- public NamespacedKey getKey() {
- return getEnchantment().getKey();
+ return this;
}
}
diff --git a/src/main/java/org/bukkit/entity/Breeze.java b/src/main/java/org/bukkit/entity/Breeze.java
new file mode 100644
index 00000000..03d9e1f5
--- /dev/null
+++ b/src/main/java/org/bukkit/entity/Breeze.java
@@ -0,0 +1,12 @@
+package org.bukkit.entity;
+
+import org.bukkit.MinecraftExperimental;
+import org.jetbrains.annotations.ApiStatus;
+
+/**
+ * Represents a Breeze. Whoosh!
+ */
+@MinecraftExperimental
+@ApiStatus.Experimental
+public interface Breeze extends Monster {
+}
diff --git a/src/main/java/org/bukkit/entity/Cat.java b/src/main/java/org/bukkit/entity/Cat.java
index a541d961..981ce846 100644
--- a/src/main/java/org/bukkit/entity/Cat.java
+++ b/src/main/java/org/bukkit/entity/Cat.java
@@ -63,7 +63,7 @@ public interface Cat extends Tameable, Sittable {
@NotNull
private static Type getType(@NotNull String key) {
NamespacedKey namespacedKey = NamespacedKey.minecraft(key);
- Type type = Registry.CAT_TYPE.get(namespacedKey);
+ Type type = Registry.CAT_VARIANT.get(namespacedKey);
Preconditions.checkNotNull(type, "No cat type found for %s. This is a bug.", namespacedKey);
return type;
}
@@ -76,7 +76,7 @@ public interface Cat extends Tameable, Sittable {
@NotNull
@Deprecated
public static Type valueOf(@NotNull String name) {
- Type type = Registry.CAT_TYPE.get(NamespacedKey.fromString(name.toLowerCase()));
+ Type type = Registry.CAT_VARIANT.get(NamespacedKey.fromString(name.toLowerCase()));
Preconditions.checkArgument(type != null, "No cat type found with the name %s", name);
return type;
}
@@ -88,7 +88,7 @@ public interface Cat extends Tameable, Sittable {
@NotNull
@Deprecated
public static Type[] values() {
- return Lists.newArrayList(Registry.CAT_TYPE).toArray(new Type[0]);
+ return Lists.newArrayList(Registry.CAT_VARIANT).toArray(new Type[0]);
}
}
}
diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java
index 26631b6d..8ecb97c5 100644
--- a/src/main/java/org/bukkit/entity/Entity.java
+++ b/src/main/java/org/bukkit/entity/Entity.java
@@ -26,6 +26,9 @@ import org.jetbrains.annotations.Nullable;
/**
* Represents a base entity in the world
+ *
+ * Not all methods are guaranteed to work/may have side effects when
+ * {@link #isInWorld()} is false.
*/
public interface Entity extends Metadatable, CommandSender, Nameable, PersistentDataHolder {
@@ -254,6 +257,8 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent
/**
* Mark the entity's removal.
+ *
+ * @throws UnsupportedOperationException if you try to remove a {@link Player} use {@link Player#kickPlayer(String)} in this case instead
*/
public void remove();
@@ -265,8 +270,8 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent
public boolean isDead();
/**
- * Returns false if the entity has died or been despawned for some other
- * reason.
+ * Returns false if the entity has died, been despawned for some other
+ * reason, or has not been added to the world.
*
* @return True if valid.
*/
@@ -714,4 +719,43 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent
*/
@NotNull
SpawnCategory getSpawnCategory();
+
+ /**
+ * Checks if this entity has been spawned in a world.
+ * This method will fail silently when called with {@link Instrument#CUSTOM_HEAD}.
+ * @param loc The location to play the note
* @param instrument The instrument
* @param note The note
*/
@@ -469,6 +469,38 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
*/
public void playSound(@NotNull Location location, @NotNull String sound, @NotNull SoundCategory category, float volume, float pitch);
+ /**
+ * Play a sound for a player at the location. For sounds with multiple
+ * variations passing the same seed will always play the same variation.
+ *
+ * This function will fail silently if Location or Sound are null.
+ *
+ * @param location The location to play the sound
+ * @param sound The sound to play
+ * @param category The category of the sound
+ * @param volume The volume of the sound
+ * @param pitch The pitch of the sound
+ * @param seed The seed for the sound
+ */
+ public void playSound(@NotNull Location location, @NotNull Sound sound, @NotNull SoundCategory category, float volume, float pitch, long seed);
+
+ /**
+ * Play a sound for a player at the location. For sounds with multiple
+ * variations passing the same seed will always play the same variation.
+ *
+ * This function will fail silently if Location or Sound are null. No sound
+ * will be heard by the player if their client does not have the respective
+ * sound for the value passed.
+ *
+ * @param location The location to play the sound
+ * @param sound The internal sound name to play
+ * @param category The category of the sound
+ * @param volume The volume of the sound
+ * @param pitch The pitch of the sound
+ * @param seed The seed for the sound
+ */
+ public void playSound(@NotNull Location location, @NotNull String sound, @NotNull SoundCategory category, float volume, float pitch, long seed);
+
/**
* Play a sound for a player at the location of the entity.
*
@@ -519,6 +551,36 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
*/
public void playSound(@NotNull Entity entity, @NotNull String sound, @NotNull SoundCategory category, float volume, float pitch);
+ /**
+ * Play a sound for a player at the location of the entity. For sounds with
+ * multiple variations passing the same seed will always play the same variation.
+ *
+ * This function will fail silently if Entity or Sound are null.
+ *
+ * @param entity The entity to play the sound
+ * @param sound The sound to play
+ * @param category The category of the sound
+ * @param volume The volume of the sound
+ * @param pitch The pitch of the sound
+ * @param seed The seed for the sound
+ */
+ public void playSound(@NotNull Entity entity, @NotNull Sound sound, @NotNull SoundCategory category, float volume, float pitch, long seed);
+
+ /**
+ * Play a sound for a player at the location of the entity. For sounds with
+ * multiple variations passing the same seed will always play the same variation.
+ *
+ * This function will fail silently if Entity or Sound are null.
+ *
+ * @param entity The entity to play the sound
+ * @param sound The sound to play
+ * @param category The category of the sound
+ * @param volume The volume of the sound
+ * @param pitch The pitch of the sound
+ * @param seed The seed for the sound
+ */
+ public void playSound(@NotNull Entity entity, @NotNull String sound, @NotNull SoundCategory category, float volume, float pitch, long seed);
+
/**
* Stop the specified sound from playing.
*
@@ -1452,6 +1514,53 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
*/
public void setResourcePack(@NotNull String url, @Nullable byte[] hash, @Nullable String prompt, boolean force);
+ /**
+ * Request that the player's client download and switch resource packs.
+ *
+ * The player's client will download the new resource pack asynchronously
+ * in the background, and will automatically switch to it once the
+ * download is complete. If the client has downloaded and cached a
+ * resource pack with the same hash in the past it will not download but
+ * directly apply the cached pack. If the hash is null and the client has
+ * downloaded and cached the same resource pack in the past, it will
+ * perform a file size check against the response content to determine if
+ * the resource pack has changed and needs to be downloaded again. When
+ * this request is sent for the very first time from a given server, the
+ * client will first display a confirmation GUI to the player before
+ * proceeding with the download.
+ *
+ * Notes:
+ *
+ * All applicable data from the egg will be copied, such as custom name, health,
+ * and velocity.
+ * All applicable data from the entity will be copied, such as custom name,
+ * health, and velocity.
- * This method will only return if the found value has the same primitive
+ * This method will only return true if the found value has the same primitive
* data type as the provided key.
*
* Storing a value using a custom {@link PersistentDataType} implementation
@@ -49,22 +49,41 @@ public interface PersistentDataContainer {
* bytes long.
*
* This method is only usable for custom object keys. Overwriting existing
- * tags, like the the display name, will not work as the values are stored
+ * tags, like the display name, will not work as the values are stored
* using your namespace.
*
* @param key the key the value is stored under
- * @param type the type which primitive storage type has to match the value
+ * @param type the type the primative stored value has to match
* @param
+ * This method will return true as long as a value with the given key exists,
+ * regardless of its type.
+ *
+ * This method is only usable for custom object keys. Overwriting existing tags,
+ * like the display name, will not work as the values are stored using your
+ * namespace.
+ *
+ * @param key the key the value is stored under
+ *
+ * @return if a value with the provided key exists
+ *
+ * @throws IllegalArgumentException if the key to look up is null
+ */
+ boolean has(@NotNull NamespacedKey key);
+
/**
* Returns the metadata value that is stored on the
* {@link PersistentDataHolder} instance.
@@ -77,12 +96,12 @@ public interface PersistentDataContainer {
* @return the value or {@code null} if no value was mapped under the given
* value
*
- * @throws NullPointerException if the key to look up is null
- * @throws NullPointerException if the type to cast the found object to is
+ * @throws IllegalArgumentException if the key to look up is null
+ * @throws IllegalArgumentException if the type to cast the found object to is
* null
- * @throws IllegalArgumentException if the value exists under the given key,
- * but cannot be access using the given type
- * @throws IllegalArgumentException if no suitable adapter will be found for
+ * @throws IllegalArgumentException if a value exists under the given key,
+ * but cannot be accessed using the given type
+ * @throws IllegalArgumentException if no suitable adapter was found for
* the {@link
* PersistentDataType#getPrimitiveType()}
*/
@@ -102,21 +121,21 @@ public interface PersistentDataContainer {
* @param
+ * This method only copies custom object keys. Existing tags, like the display
+ * name, will not be copied as the values are stored using your namespace.
+ *
+ * @param other the container to copy to
+ * @param replace whether to replace any matching values in the target container
+ *
+ * @throws IllegalArgumentException if the other container is null
+ */
+ void copyTo(@NotNull PersistentDataContainer other, boolean replace);
+
/**
* Returns the adapter context this tag container uses.
*
diff --git a/src/main/java/org/bukkit/potion/PotionEffectType.java b/src/main/java/org/bukkit/potion/PotionEffectType.java
index 26bd4303..23b3cc17 100644
--- a/src/main/java/org/bukkit/potion/PotionEffectType.java
+++ b/src/main/java/org/bukkit/potion/PotionEffectType.java
@@ -16,7 +16,7 @@ import org.jetbrains.annotations.Nullable;
* Represents a type of potion and its effect on an entity.
*/
public abstract class PotionEffectType implements Keyed {
- protected static final BiMap
- * Generally not to be used from within a plugin.
- *
- * @param type PotionType to register
- * @deprecated only for backwards compatibility, has no effect.
- */
- @Deprecated
- public static void registerPotionEffectType(@NotNull PotionEffectType type) {}
-
- /**
- * Stops accepting any effect type registrations.
- * @deprecated only for backwards compatibility, has no effect.
- */
- @Deprecated
- public static void stopAcceptingRegistrations() {}
-
private static String convertLegacy(String from) {
if (from == null) {
return null;
diff --git a/src/main/java/org/bukkit/potion/PotionEffectTypeWrapper.java b/src/main/java/org/bukkit/potion/PotionEffectTypeWrapper.java
index 0a2df03c..a613debb 100644
--- a/src/main/java/org/bukkit/potion/PotionEffectTypeWrapper.java
+++ b/src/main/java/org/bukkit/potion/PotionEffectTypeWrapper.java
@@ -1,30 +1,13 @@
package org.bukkit.potion;
-import org.bukkit.Color;
-import org.bukkit.NamespacedKey;
import org.jetbrains.annotations.NotNull;
/**
* @deprecated only for backwards compatibility, PotionEffectTypeWrapper is no longer used.
*/
@Deprecated
-public class PotionEffectTypeWrapper extends PotionEffectType {
- protected PotionEffectTypeWrapper(int id) {}
-
- @Override
- public double getDurationModifier() {
- return getType().getDurationModifier();
- }
-
- @Override
- public int getId() {
- return getType().getId();
- }
-
- @NotNull
- @Override
- public String getName() {
- return getType().getName();
+public abstract class PotionEffectTypeWrapper extends PotionEffectType {
+ protected PotionEffectTypeWrapper() {
}
/**
@@ -34,29 +17,6 @@ public class PotionEffectTypeWrapper extends PotionEffectType {
*/
@NotNull
public PotionEffectType getType() {
- return PotionEffectType.getByKey(getKey());
- }
-
- @NotNull
- @Override
- public PotionEffect createEffect(int duration, int amplifier) {
- return getType().createEffect(duration, amplifier);
- }
-
- @Override
- public boolean isInstant() {
- return getType().isInstant();
- }
-
- @NotNull
- @Override
- public Color getColor() {
- return getType().getColor();
- }
-
- @NotNull
- @Override
- public NamespacedKey getKey() {
- return getType().getKey();
+ return this;
}
}
diff --git a/src/main/java/org/bukkit/scheduler/BukkitScheduler.java b/src/main/java/org/bukkit/scheduler/BukkitScheduler.java
index 5aefb7f2..0368e912 100644
--- a/src/main/java/org/bukkit/scheduler/BukkitScheduler.java
+++ b/src/main/java/org/bukkit/scheduler/BukkitScheduler.java
@@ -227,7 +227,7 @@ public interface BukkitScheduler {
* @throws IllegalArgumentException if plugin is null
* @throws IllegalArgumentException if task is null
*/
- public void runTask(@NotNull Plugin plugin, @NotNull Consumer
+ * Does not play the sound or fire the beam
+ */
+ WARDEN_SONIC_ATTACK(62, Warden.class),
+ /**
+ * Plays sniffer digging sound
+ * Sniffer must have a target and be in {@link Sniffer.State#SEARCHING} or
+ * {@link Sniffer.State#DIGGING}
+ */
+ SNIFFER_DIG(63, Sniffer.class);
private final byte data;
private final Class extends Entity> applicable;
@@ -224,7 +342,7 @@ public enum EntityEffect {
}
/**
- * Gets the data value of this EntityEffect
+ * Gets the data value of this EntityEffect, may not be unique.
*
* @return The data value
* @deprecated Magic value
@@ -243,4 +361,28 @@ public enum EntityEffect {
public Class extends Entity> getApplicable() {
return applicable;
}
+
+ /**
+ * Checks if this effect is applicable to the given entity.
+ *
+ * @param entity the entity to check
+ * @return true if applicable
+ */
+ public boolean isApplicableTo(@NotNull Entity entity) {
+ Preconditions.checkArgument(entity != null, "Entity cannot be null");
+
+ return isApplicableTo(entity.getClass());
+ }
+
+ /**
+ * Checks if this effect is applicable to the given entity class.
+ *
+ * @param clazz the entity class to check
+ * @return true if applicable
+ */
+ public boolean isApplicableTo(@NotNull Class extends Entity> clazz) {
+ Preconditions.checkArgument(clazz != null, "Class cannot be null");
+
+ return applicable.isAssignableFrom(clazz);
+ }
}
diff --git a/src/main/java/org/bukkit/FeatureFlag.java b/src/main/java/org/bukkit/FeatureFlag.java
index 1d93e26b..5269df59 100644
--- a/src/main/java/org/bukkit/FeatureFlag.java
+++ b/src/main/java/org/bukkit/FeatureFlag.java
@@ -27,4 +27,7 @@ public interface FeatureFlag extends Keyed {
@MinecraftExperimental
public static final FeatureFlag TRADE_REBALANCE = Bukkit.getUnsafe().getFeatureFlag(NamespacedKey.minecraft("trade_rebalance"));
+
+ @MinecraftExperimental
+ public static final FeatureFlag UPDATE_121 = Bukkit.getUnsafe().getFeatureFlag(NamespacedKey.minecraft("update_1_21"));
}
diff --git a/src/main/java/org/bukkit/GameRule.java b/src/main/java/org/bukkit/GameRule.java
index 3ac563da..cca52670 100644
--- a/src/main/java/org/bukkit/GameRule.java
+++ b/src/main/java/org/bukkit/GameRule.java
@@ -61,6 +61,11 @@ public final class GameRule
+ * Will be null for {@link Instrument#CUSTOM_HEAD}
+ *
+ * @return the sound or null
+ */
+ @Nullable
+ public Sound getSound() {
+ return this.sound;
}
/**
diff --git a/src/main/java/org/bukkit/Material.java b/src/main/java/org/bukkit/Material.java
index 05ff6ef3..b3e282fd 100644
--- a/src/main/java/org/bukkit/Material.java
+++ b/src/main/java/org/bukkit/Material.java
@@ -48,7 +48,9 @@ import org.bukkit.block.data.type.ChiseledBookshelf;
import org.bukkit.block.data.type.Cocoa;
import org.bukkit.block.data.type.CommandBlock;
import org.bukkit.block.data.type.Comparator;
+import org.bukkit.block.data.type.CopperBulb;
import org.bukkit.block.data.type.CoralWallFan;
+import org.bukkit.block.data.type.Crafter;
import org.bukkit.block.data.type.DaylightDetector;
import org.bukkit.block.data.type.DecoratedPot;
import org.bukkit.block.data.type.Dispenser;
@@ -104,6 +106,7 @@ import org.bukkit.block.data.type.Switch;
import org.bukkit.block.data.type.TNT;
import org.bukkit.block.data.type.TechnicalPiston;
import org.bukkit.block.data.type.TrapDoor;
+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;
@@ -140,6 +143,59 @@ public enum Material implements Keyed, Translatable {
POLISHED_DEEPSLATE(31772),
CALCITE(20311),
TUFF(24364),
+ /**
+ * BlockData: {@link Slab}
+ */
+ @MinecraftExperimental
+ TUFF_SLAB(19305, Slab.class),
+ /**
+ * BlockData: {@link Stairs}
+ */
+ @MinecraftExperimental
+ TUFF_STAIRS(11268, Stairs.class),
+ /**
+ * BlockData: {@link Wall}
+ */
+ @MinecraftExperimental
+ TUFF_WALL(24395, Wall.class),
+ @MinecraftExperimental
+ CHISELED_TUFF(15831),
+ @MinecraftExperimental
+ POLISHED_TUFF(17801),
+ /**
+ * BlockData: {@link Slab}
+ */
+ @MinecraftExperimental
+ POLISHED_TUFF_SLAB(31096, Slab.class),
+ /**
+ * BlockData: {@link Stairs}
+ */
+ @MinecraftExperimental
+ POLISHED_TUFF_STAIRS(7964, Stairs.class),
+ /**
+ * BlockData: {@link Wall}
+ */
+ @MinecraftExperimental
+ POLISHED_TUFF_WALL(28886, Wall.class),
+ @MinecraftExperimental
+ TUFF_BRICKS(26276),
+ /**
+ * BlockData: {@link Slab}
+ */
+ @MinecraftExperimental
+ TUFF_BRICK_SLAB(11843, Slab.class),
+ /**
+ * BlockData: {@link Stairs}
+ */
+ @MinecraftExperimental
+ TUFF_BRICK_STAIRS(30753, Stairs.class),
+ /**
+ * BlockData: {@link Wall}
+ */
+ @MinecraftExperimental
+ TUFF_BRICK_WALL(11761, Wall.class),
+ @MinecraftExperimental
+ CHISELED_TUFF_BRICKS(8601),
DRIPSTONE_BLOCK(26227),
/**
* BlockData: {@link Snowable}
@@ -251,6 +307,14 @@ public enum Material implements Keyed, Translatable {
EXPOSED_COPPER(28488),
WEATHERED_COPPER(19699),
OXIDIZED_COPPER(19490),
+ @MinecraftExperimental
+ CHISELED_COPPER(12143),
+ @MinecraftExperimental
+ EXPOSED_CHISELED_COPPER(4570),
+ @MinecraftExperimental
+ WEATHERED_CHISELED_COPPER(30876),
+ @MinecraftExperimental
+ OXIDIZED_CHISELED_COPPER(27719),
CUT_COPPER(32519),
EXPOSED_CUT_COPPER(18000),
WEATHERED_CUT_COPPER(21158),
@@ -291,6 +355,14 @@ public enum Material implements Keyed, Translatable {
WAXED_EXPOSED_COPPER(27989),
WAXED_WEATHERED_COPPER(5960),
WAXED_OXIDIZED_COPPER(25626),
+ @MinecraftExperimental
+ WAXED_CHISELED_COPPER(7500),
+ @MinecraftExperimental
+ WAXED_EXPOSED_CHISELED_COPPER(30658),
+ @MinecraftExperimental
+ WAXED_WEATHERED_CHISELED_COPPER(5970),
+ @MinecraftExperimental
+ WAXED_OXIDIZED_CHISELED_COPPER(7735),
WAXED_CUT_COPPER(11030),
WAXED_EXPOSED_CUT_COPPER(30043),
WAXED_WEATHERED_CUT_COPPER(13823),
@@ -552,7 +624,7 @@ public enum Material implements Keyed, Translatable {
CHISELED_SANDSTONE(31763),
CUT_SANDSTONE(6118),
COBWEB(9469),
- GRASS(6155),
+ SHORT_GRASS(6155),
FERN(15794),
AZALEA(29386),
FLOWERING_AZALEA(28270),
@@ -771,7 +843,7 @@ public enum Material implements Keyed, Translatable {
/**
* BlockData: {@link DecoratedPot}
*/
- DECORATED_POT(8720, 1, DecoratedPot.class),
+ DECORATED_POT(8720, DecoratedPot.class),
MOSSY_COBBLESTONE(21900),
OBSIDIAN(32723),
TORCH(6063),
@@ -2027,6 +2099,46 @@ public enum Material implements Keyed, Translatable {
* BlockData: {@link Door}
*/
WARPED_DOOR(15062, Door.class),
+ /**
+ * BlockData: {@link Door}
+ */
+ @MinecraftExperimental
+ COPPER_DOOR(26809, Door.class),
+ /**
+ * BlockData: {@link Door}
+ */
+ @MinecraftExperimental
+ EXPOSED_COPPER_DOOR(13236, Door.class),
+ /**
+ * BlockData: {@link Door}
+ */
+ @MinecraftExperimental
+ WEATHERED_COPPER_DOOR(10208, Door.class),
+ /**
+ * BlockData: {@link Door}
+ */
+ @MinecraftExperimental
+ OXIDIZED_COPPER_DOOR(5348, Door.class),
+ /**
+ * BlockData: {@link Door}
+ */
+ @MinecraftExperimental
+ WAXED_COPPER_DOOR(9954, Door.class),
+ /**
+ * BlockData: {@link Door}
+ */
+ @MinecraftExperimental
+ WAXED_EXPOSED_COPPER_DOOR(20748, Door.class),
+ /**
+ * BlockData: {@link Door}
+ */
+ @MinecraftExperimental
+ WAXED_WEATHERED_COPPER_DOOR(25073, Door.class),
+ /**
+ * BlockData: {@link Door}
+ */
+ @MinecraftExperimental
+ WAXED_OXIDIZED_COPPER_DOOR(23888, Door.class),
/**
* BlockData: {@link TrapDoor}
*/
@@ -2075,6 +2187,46 @@ public enum Material implements Keyed, Translatable {
* BlockData: {@link TrapDoor}
*/
WARPED_TRAPDOOR(7708, TrapDoor.class),
+ /**
+ * BlockData: {@link TrapDoor}
+ */
+ @MinecraftExperimental
+ COPPER_TRAPDOOR(12110, TrapDoor.class),
+ /**
+ * BlockData: {@link TrapDoor}
+ */
+ @MinecraftExperimental
+ EXPOSED_COPPER_TRAPDOOR(19219, TrapDoor.class),
+ /**
+ * BlockData: {@link TrapDoor}
+ */
+ @MinecraftExperimental
+ WEATHERED_COPPER_TRAPDOOR(28254, TrapDoor.class),
+ /**
+ * BlockData: {@link TrapDoor}
+ */
+ @MinecraftExperimental
+ OXIDIZED_COPPER_TRAPDOOR(26518, TrapDoor.class),
+ /**
+ * BlockData: {@link TrapDoor}
+ */
+ @MinecraftExperimental
+ WAXED_COPPER_TRAPDOOR(12626, TrapDoor.class),
+ /**
+ * BlockData: {@link TrapDoor}
+ */
+ @MinecraftExperimental
+ WAXED_EXPOSED_COPPER_TRAPDOOR(11010, TrapDoor.class),
+ /**
+ * BlockData: {@link TrapDoor}
+ */
+ @MinecraftExperimental
+ WAXED_WEATHERED_COPPER_TRAPDOOR(30709, TrapDoor.class),
+ /**
+ * BlockData: {@link TrapDoor}
+ */
+ @MinecraftExperimental
+ WAXED_OXIDIZED_COPPER_TRAPDOOR(21450, TrapDoor.class),
/**
* BlockData: {@link Gate}
*/
@@ -2475,6 +2627,11 @@ public enum Material implements Keyed, Translatable {
*/
BLACK_BED(20490, 1, Bed.class),
COOKIE(27431),
+ /**
+ * BlockData: {@link Crafter}
+ */
+ @MinecraftExperimental
+ CRAFTER(25243, Crafter.class),
FILLED_MAP(23504),
SHEARS(27971, 1, 238),
MELON_SLICE(5347),
@@ -2512,6 +2669,8 @@ public enum Material implements Keyed, Translatable {
BAT_SPAWN_EGG(14607),
BEE_SPAWN_EGG(22924),
BLAZE_SPAWN_EGG(4759),
+ @MinecraftExperimental
+ BREEZE_SPAWN_EGG(7580),
CAT_SPAWN_EGG(29583),
CAMEL_SPAWN_EGG(14760),
CAVE_SPIDER_SPAWN_EGG(23341),
@@ -3002,6 +3161,93 @@ public enum Material implements Keyed, Translatable {
SHELTER_POTTERY_SHERD(28390),
SKULL_POTTERY_SHERD(16980),
SNORT_POTTERY_SHERD(15921),
+ /**
+ * BlockData: {@link Waterlogged}
+ */
+ @MinecraftExperimental
+ COPPER_GRATE(16221, Waterlogged.class),
+ /**
+ * BlockData: {@link Waterlogged}
+ */
+ @MinecraftExperimental
+ EXPOSED_COPPER_GRATE(7783, Waterlogged.class),
+ /**
+ * BlockData: {@link Waterlogged}
+ */
+ @MinecraftExperimental
+ WEATHERED_COPPER_GRATE(24954, Waterlogged.class),
+ /**
+ * BlockData: {@link Waterlogged}
+ */
+ @MinecraftExperimental
+ OXIDIZED_COPPER_GRATE(14122, Waterlogged.class),
+ /**
+ * BlockData: {@link Waterlogged}
+ */
+ @MinecraftExperimental
+ WAXED_COPPER_GRATE(11230, Waterlogged.class),
+ /**
+ * BlockData: {@link Waterlogged}
+ */
+ @MinecraftExperimental
+ WAXED_EXPOSED_COPPER_GRATE(20520, Waterlogged.class),
+ /**
+ * BlockData: {@link Waterlogged}
+ */
+ @MinecraftExperimental
+ WAXED_WEATHERED_COPPER_GRATE(16533, Waterlogged.class),
+ /**
+ * BlockData: {@link Waterlogged}
+ */
+ @MinecraftExperimental
+ WAXED_OXIDIZED_COPPER_GRATE(32010, Waterlogged.class),
+ /**
+ * BlockData: {@link CopperBulb}
+ */
+ @MinecraftExperimental
+ COPPER_BULB(21370, CopperBulb.class),
+ /**
+ * BlockData: {@link CopperBulb}
+ */
+ @MinecraftExperimental
+ EXPOSED_COPPER_BULB(11944, CopperBulb.class),
+ /**
+ * BlockData: {@link CopperBulb}
+ */
+ @MinecraftExperimental
+ WEATHERED_COPPER_BULB(10800, CopperBulb.class),
+ /**
+ * BlockData: {@link CopperBulb}
+ */
+ @MinecraftExperimental
+ OXIDIZED_COPPER_BULB(22421, CopperBulb.class),
+ /**
+ * BlockData: {@link CopperBulb}
+ */
+ @MinecraftExperimental
+ WAXED_COPPER_BULB(23756, CopperBulb.class),
+ /**
+ * BlockData: {@link CopperBulb}
+ */
+ @MinecraftExperimental
+ WAXED_EXPOSED_COPPER_BULB(5530, CopperBulb.class),
+ /**
+ * BlockData: {@link CopperBulb}
+ */
+ @MinecraftExperimental
+ WAXED_WEATHERED_COPPER_BULB(13239, CopperBulb.class),
+ /**
+ * BlockData: {@link CopperBulb}
+ */
+ @MinecraftExperimental
+ WAXED_OXIDIZED_COPPER_BULB(26892, CopperBulb.class),
+ /**
+ * BlockData: {@link TrialSpawner}
+ */
+ @MinecraftExperimental
+ TRIAL_SPAWNER(19902, TrialSpawner.class),
+ @MinecraftExperimental
+ TRIAL_KEY(12725),
/**
* BlockData: {@link Levelled}
*/
@@ -4508,7 +4754,7 @@ public enum Material implements Keyed, Translatable {
* @return new data instance
*/
@NotNull
- public BlockData createBlockData(@Nullable Consumer
+ * The provided entity must not have already been spawned in a world.
+ *
+ * @param
+ * [ 0 1 2 ]
+ * [ 3 4 5 ]
+ * [ 6 7 8 ]
+ *
+ *
+ * @param craftingMatrix list of items to be crafted from.
+ * Must not contain more than 9 items.
+ * @param world The world the crafting takes place in.
+ * @return the {@link ItemStack} resulting from the given crafting matrix, if no recipe is found
+ * an ItemStack of {@link Material#AIR} is returned.
+ */
+ @NotNull
+ public ItemStack craftItem(@NotNull ItemStack[] craftingMatrix, @NotNull World world);
+
+ /**
+ * Get the crafted item using the list of {@link ItemStack} provided.
+ *
+ *
+ * [ 0 1 2 ]
+ * [ 3 4 5 ]
+ * [ 6 7 8 ]
+ *
+ *
+ *
+ * [ 0 1 2 ]
+ * [ 3 4 5 ]
+ * [ 6 7 8 ]
+ *
+ *
+ * @param craftingMatrix list of items to be crafted from.
+ * Must not contain more than 9 items.
+ * @param world The world the crafting takes place in.
+ * @return resulting {@link ItemCraftResult} containing the resulting item, matrix and any overflow items.
+ */
+ @NotNull
+ public ItemCraftResult craftItemResult(@NotNull ItemStack[] craftingMatrix, @NotNull World world);
+
/**
* Get an iterator through the list of crafting recipes.
*
@@ -1583,7 +1652,7 @@ public interface Server extends PluginMessageRecipient {
* @return new data instance
*/
@NotNull
- public B createBlockData(@NotNull BlockType blockType, @Nullable Consumer consumer);
+ public B createBlockData(@NotNull BlockType blockType, @Nullable Consumer super B> consumer);
/**
* Creates a new {@link BlockData} instance with block type and properties
diff --git a/src/main/java/org/bukkit/Sound.java b/src/main/java/org/bukkit/Sound.java
index fe19ed17..098fbc97 100644
--- a/src/main/java/org/bukkit/Sound.java
+++ b/src/main/java/org/bukkit/Sound.java
@@ -181,6 +181,15 @@ public abstract class Sound extends OldEnumnull
if there
* is no hit
* @see #rayTraceEntities(Location, Vector, double, double, Predicate)
@@ -716,6 +719,9 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
* This may not consider entities in currently unloaded chunks. Some
* implementations may impose artificial restrictions on the maximum
* distance.
+ * null
to consider all entities
* @return the closest ray trace hit result, or null
if there
* is no hit
*/
@Nullable
- public RayTraceResult rayTraceEntities(@NotNull Location start, @NotNull Vector direction, double maxDistance, double raySize, @Nullable Predicatenull
to consider all entities
* @return the closest ray trace hit result with either a block or an
* entity, or null
if there is no hit
*/
@Nullable
- public RayTraceResult rayTrace(@NotNull Location start, @NotNull Vector direction, double maxDistance, @NotNull FluidCollisionMode fluidCollisionMode, boolean ignorePassableBlocks, double raySize, @Nullable Predicate
+ * This will work with cake.
+ *
+ * This will override any entities that have been added with {@link #addPotentialSpawn}
*
* @param creatureType The creature type or null to clear.
*/
@@ -199,4 +206,75 @@ public interface CreatureSpawner extends TileState {
* @see #getSpawnRange()
*/
public void setSpawnRange(int spawnRange);
+
+ /**
+ * Gets the {@link EntitySnapshot} that will be spawned by this spawner or null
+ * if no entities have been assigned to this spawner.
+ *
+ *
+ * @return the entity snapshot or null if no entities have been assigned to this
+ * spawner.
+ */
+ @Nullable
+ public EntitySnapshot getSpawnedEntity();
+
+ /**
+ * Sets the entity that will be spawned by this spawner.
+ * This will override any previous entries that have been added with
+ * {@link #addPotentialSpawn}
+ *
+ *
+ * @param snapshot the entity snapshot
+ */
+ public void setSpawnedEntity(@NotNull EntitySnapshot snapshot);
+
+ /**
+ * Adds a new {@link EntitySnapshot} to the list of entities this spawner can
+ * spawn.
+ *
+ * The {@link SpawnRule} will determine under what conditions this entry can
+ * spawn, passing null will use the default conditions for the given entity.
+ *
+ * @param snapshot the snapshot that will be spawned
+ * @param weight the weight
+ * @param spawnRule the spawn rule for this entity, or null
+ */
+ public void addPotentialSpawn(@NotNull EntitySnapshot snapshot, int weight, @Nullable SpawnRule spawnRule);
+
+ /**
+ * Adds a new {@link SpawnerEntry} to the list of entities this spawner can
+ * spawn.
+ *
+ * @param spawnerEntry the spawner entry to use
+ * @see #addPotentialSpawn(EntitySnapshot, int, SpawnRule)
+ */
+ public void addPotentialSpawn(@NotNull final SpawnerEntry spawnerEntry);
+
+ /**
+ * Sets the list of {@link SpawnerEntry} this spawner can spawn.
+ * This will override any previous entries added with
+ * {@link #addPotentialSpawn}
+ *
+ * @param entries the list of entries
+ */
+ public void setPotentialSpawns(@NotNull final Collection
+ * Changes made to the returned list will not be reflected in the spawner unless
+ * applied with {@link #setPotentialSpawns}
+ *
+ * @return a list of potential spawns from this spawner, or an empty list if no
+ * entities have been assigned to this spawner
+ * @see #getSpawnedType()
+ */
+ @NotNull
+ public List
+ * Similar to {@link Powerable}, 'triggered' indicates whether or not the
+ * dispenser is currently activated.
+ *
+ * 'crafting' is whether crafter's mouth is open and top is glowing.
+ */
+@ApiStatus.Experimental
+@MinecraftExperimental
+public interface Crafter extends BlockData {
+
+ /**
+ * Gets the value of the 'crafting' property.
+ *
+ * @return the 'crafting' value
+ */
+ boolean isCrafting();
+
+ /**
+ * Sets the value of the 'crafting' property.
+ *
+ * @param crafting the new 'crafting' value
+ */
+ void setCrafting(boolean crafting);
+
+ /**
+ * Gets the value of the 'triggered' property.
+ *
+ * @return the 'triggered' value
+ */
+ boolean isTriggered();
+
+ /**
+ * Sets the value of the 'triggered' property.
+ *
+ * @param triggered the new 'triggered' value
+ */
+ void setTriggered(boolean triggered);
+
+ /**
+ * Gets the value of the 'orientation' property.
+ *
+ * @return the 'orientation' value
+ */
+ @NotNull
+ Orientation getOrientation();
+
+ /**
+ * Sets the value of the 'orientation' property.
+ *
+ * @param orientation the new 'orientation' value
+ */
+ void setOrientation(@NotNull Orientation orientation);
+
+ /**
+ * The directions the Crafter can be oriented.
+ */
+ public enum Orientation {
+
+ DOWN_EAST,
+ DOWN_NORTH,
+ DOWN_SOUTH,
+ DOWN_WEST,
+ UP_EAST,
+ UP_NORTH,
+ UP_SOUTH,
+ UP_WEST,
+ WEST_UP,
+ EAST_UP,
+ NORTH_UP,
+ SOUTH_UP;
+ }
+}
diff --git a/src/main/java/org/bukkit/block/data/type/TrialSpawner.java b/src/main/java/org/bukkit/block/data/type/TrialSpawner.java
new file mode 100644
index 00000000..2a205290
--- /dev/null
+++ b/src/main/java/org/bukkit/block/data/type/TrialSpawner.java
@@ -0,0 +1,39 @@
+package org.bukkit.block.data.type;
+
+import org.bukkit.MinecraftExperimental;
+import org.bukkit.block.data.BlockData;
+import org.jetbrains.annotations.ApiStatus;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * 'trial_spawner_state' indicates the current operational phase of the spawner.
+ */
+@MinecraftExperimental
+@ApiStatus.Experimental
+public interface TrialSpawner extends BlockData {
+
+ /**
+ * Gets the value of the 'trial_spawner_state' property.
+ *
+ * @return the 'trial_spawner_state' value
+ */
+ @NotNull
+ State getTrialSpawnerState();
+
+ /**
+ * Sets the value of the 'trial_spawner_state' property.
+ *
+ * @param state the new 'trial_spawner_state' value
+ */
+ void setTrialSpawnerState(@NotNull State state);
+
+ public enum State {
+
+ INACTIVE,
+ WAITING_FOR_PLAYERS,
+ ACTIVE,
+ WAITING_FOR_REWARD_EJECTION,
+ EJECTING_REWARD,
+ COOLDOWN;
+ }
+}
diff --git a/src/main/java/org/bukkit/block/spawner/SpawnRule.java b/src/main/java/org/bukkit/block/spawner/SpawnRule.java
new file mode 100644
index 00000000..c15ce91a
--- /dev/null
+++ b/src/main/java/org/bukkit/block/spawner/SpawnRule.java
@@ -0,0 +1,219 @@
+package org.bukkit.block.spawner;
+
+import com.google.common.base.Preconditions;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import org.bukkit.configuration.serialization.ConfigurationSerializable;
+import org.bukkit.configuration.serialization.SerializableAs;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * Represents a spawn rule that controls what conditions an entity from a
+ * monster spawner can spawn.
+ */
+@SerializableAs("SpawnRule")
+public class SpawnRule implements Cloneable, ConfigurationSerializable {
+
+ private int minBlockLight;
+ private int maxBlockLight;
+ private int minSkyLight;
+ private int maxSkyLight;
+
+ /**
+ * Constructs a new SpawnRule.
+ *
+ * @param minBlockLight The minimum (inclusive) block light required for
+ * spawning to succeed.
+ * @param maxBlockLight The maximum (inclusive) block light required for
+ * spawning to succeed.
+ * @param minSkyLight The minimum (inclusive) sky light required for
+ * spawning to succeed.
+ * @param maxSkyLight The maximum (inclusive) sky light required for
+ * spawning to succeed.
+ */
+ public SpawnRule(int minBlockLight, int maxBlockLight, int minSkyLight, int maxSkyLight) {
+ Preconditions.checkArgument(minBlockLight <= maxBlockLight, "minBlockLight must be <= maxBlockLight (%s <= %s)", minBlockLight, maxBlockLight);
+ Preconditions.checkArgument(minSkyLight <= maxSkyLight, "minSkyLight must be <= maxSkyLight (%s <= %s)", minSkyLight, maxSkyLight);
+ Preconditions.checkArgument(minBlockLight >= 0, "minBlockLight must be >= 0 (given %s)", minBlockLight);
+ Preconditions.checkArgument(maxBlockLight >= 0, "maxBlockLight must be >= 0 (given %s)", maxBlockLight);
+ Preconditions.checkArgument(minSkyLight >= 0, "minSkyLight must be >= 0 (given %s)", minSkyLight);
+ Preconditions.checkArgument(maxSkyLight >= 0, "maxSkyLight must be >= 0 (given %s)", maxSkyLight);
+
+ this.minBlockLight = minBlockLight;
+ this.maxBlockLight = maxBlockLight;
+ this.minSkyLight = minSkyLight;
+ this.maxSkyLight = maxSkyLight;
+ }
+
+ /**
+ * Gets the minimum (inclusive) block light required for spawning to
+ * succeed.
+ *
+ * @return minimum block light
+ */
+ public int getMinBlockLight() {
+ return minBlockLight;
+ }
+
+ /**
+ * Sets the minimum (inclusive) block light required for spawning to
+ * succeed.
+ *
+ * @param minBlockLight minimum block light
+ */
+ public void setMinBlockLight(int minBlockLight) {
+ Preconditions.checkArgument(minBlockLight >= 0, "minBlockLight must be >= 0 (given %s)", minBlockLight);
+ Preconditions.checkArgument(minBlockLight <= maxBlockLight, "minBlockLight must be <= maxBlockLight (%s <= %s)", minBlockLight, maxBlockLight);
+
+ this.minBlockLight = minBlockLight;
+ }
+
+ /**
+ * Gets the maximum (inclusive) block light required for spawning to
+ * succeed.
+ *
+ * @return maximum block light
+ */
+ public int getMaxBlockLight() {
+ return maxBlockLight;
+ }
+
+ /**
+ * Sets the maximum (inclusive) block light required for spawning to
+ * succeed.
+ *
+ * @param maxBlockLight maximum block light
+ */
+ public void setMaxBlockLight(int maxBlockLight) {
+ Preconditions.checkArgument(maxBlockLight >= 0, "maxBlockLight must be >= 0 (given %s)", maxBlockLight);
+
+ this.maxBlockLight = maxBlockLight;
+ }
+
+ /**
+ * Gets the minimum (inclusive) sky light required for spawning to succeed.
+ *
+ * @return minimum sky light
+ */
+ public int getMinSkyLight() {
+ return minSkyLight;
+ }
+
+ /**
+ * Sets the minimum (inclusive) sky light required for spawning to succeed.
+ *
+ * @param minSkyLight minimum sky light
+ */
+ public void setMinSkyLight(int minSkyLight) {
+ Preconditions.checkArgument(minSkyLight >= 0, "minSkyLight must be >= 0 (given %s)", minSkyLight);
+ Preconditions.checkArgument(minSkyLight <= maxSkyLight, "minSkyLight must be <= maxSkyLight (%s <= %s)", minSkyLight, maxSkyLight);
+
+ this.minSkyLight = minSkyLight;
+ }
+
+ /**
+ * Gets the maximum (inclusive) sky light required for spawning to succeed.
+ *
+ * @return maximum sky light
+ */
+ public int getMaxSkyLight() {
+ return maxSkyLight;
+ }
+
+ /**
+ * Sets the maximum (inclusive) sky light required for spawning to succeed.
+ *
+ * @param maxSkyLight maximum sky light
+ */
+ public void setMaxSkyLight(int maxSkyLight) {
+ Preconditions.checkArgument(maxSkyLight >= 0, "maxSkyLight must be >= 0 (given %s)", maxSkyLight);
+
+ this.maxSkyLight = maxSkyLight;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (!(obj instanceof SpawnRule)) {
+ return false;
+ }
+
+ SpawnRule other = (SpawnRule) obj;
+ return minBlockLight == other.minBlockLight && maxBlockLight == other.maxBlockLight && minSkyLight == other.minSkyLight && maxSkyLight == other.maxSkyLight;
+ }
+
+ @Override
+ public int hashCode() {
+ int hash = minBlockLight;
+
+ hash = (hash << 4) + maxBlockLight;
+ hash = (hash << 4) + minSkyLight;
+ hash = (hash << 4) + maxSkyLight;
+
+ return hash;
+ }
+
+ @NotNull
+ @Override
+ public SpawnRule clone() {
+ try {
+ return (SpawnRule) super.clone();
+ } catch (CloneNotSupportedException e) {
+ throw new Error(e);
+ }
+ }
+
+ @Override
+ @NotNull
+ public Map
+ * Entities not spawned in a world will not tick, be sent to players, or be
+ * saved to the server files.
+ *
+ * @return whether the entity has been spawned in a world
+ */
+ boolean isInWorld();
+
+ /**
+ * Crates an {@link EntitySnapshot} representing the current state of this entity.
+ *
+ * @return a snapshot representing this entity or null if one cannot be made
+ */
+ @Nullable
+ @ApiStatus.Experimental
+ EntitySnapshot createSnapshot();
+
+ /**
+ * Creates a copy of this entity and all its data. Does not spawn the copy in
+ * the world.
+ * Note: Players cannot be copied.
+ *
+ * @return a copy of this entity.
+ */
+ @NotNull
+ @ApiStatus.Experimental
+ Entity copy();
+
+ /**
+ * Creates a copy of this entity and all its data. Spawns the copy at the given location.
+ * Note: Players cannot be copied.
+ * @param to the location to copy to
+ * @return a copy of this entity.
+ */
+ @NotNull
+ @ApiStatus.Experimental
+ Entity copy(@NotNull Location to);
}
diff --git a/src/main/java/org/bukkit/entity/EntitySnapshot.java b/src/main/java/org/bukkit/entity/EntitySnapshot.java
new file mode 100644
index 00000000..6f34486a
--- /dev/null
+++ b/src/main/java/org/bukkit/entity/EntitySnapshot.java
@@ -0,0 +1,39 @@
+package org.bukkit.entity;
+
+import org.bukkit.Location;
+import org.bukkit.World;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * Represents an immutable copy of an entity's state. Can be used at any time to
+ * create an instance of the stored entity.
+ */
+public interface EntitySnapshot {
+
+ /**
+ * Creates an entity using this template. Does not spawn the copy in the world.
+ *
+ *
+ * @param world the world to create the entity in
+ * @return a copy of this entity.
+ */
+ @NotNull
+ Entity createEntity(@NotNull World world);
+
+ /**
+ * Creates an entity using this template and spawns it at the provided location.
+ *
+ * @param to the location to copy to
+ * @return the new entity.
+ */
+ @NotNull
+ Entity createEntity(@NotNull Location to);
+
+ /**
+ * Gets the type of entity this template holds.
+ *
+ * @return the type
+ */
+ @NotNull
+ EntityType getEntityType();
+}
diff --git a/src/main/java/org/bukkit/entity/EntityType.java b/src/main/java/org/bukkit/entity/EntityType.java
index 855b4022..0042cefb 100644
--- a/src/main/java/org/bukkit/entity/EntityType.java
+++ b/src/main/java/org/bukkit/entity/EntityType.java
@@ -7,6 +7,7 @@ import com.google.common.collect.Lists;
import org.bukkit.Bukkit;
import org.bukkit.Keyed;
import org.bukkit.Location;
+import org.bukkit.MinecraftExperimental;
import org.bukkit.NamespacedKey;
import org.bukkit.Registry;
import org.bukkit.Translatable;
@@ -21,6 +22,7 @@ import org.bukkit.entity.minecart.StorageMinecart;
import org.bukkit.inventory.ItemStack;
import org.bukkit.potion.PotionEffectType;
import org.bukkit.util.OldEnum;
+import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -288,6 +290,12 @@ public abstract class EntityType
+ * This will work with cake.
*
- * @param loc The location of a note block.
+ * @param loc The location to play the note
* @param instrument The instrument ID.
* @param note The note ID.
* @deprecated Magic value
@@ -404,11 +404,11 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
public void playNote(@NotNull Location loc, byte instrument, byte note);
/**
- * Play a note for a player at a location. This requires a note block
- * at the particular location (as far as the client is concerned). This
- * will not work without a note block. This will not work with cake.
- *
- * @param loc The location of a note block
+ * Play a note for the player at a location.
+ * This will work with cake.
+ *
+ *
+ *
+ * @param id Unique resource pack ID.
+ * @param url The URL from which the client will download the resource
+ * pack. The string must contain only US-ASCII characters and should
+ * be encoded as per RFC 1738.
+ * @param hash The sha1 hash sum of the resource pack file which is used
+ * to apply a cached version of the pack directly without downloading
+ * if it is available. Hast to be 20 bytes long!
+ * @param prompt The optional custom prompt message to be shown to client.
+ * @param force If true, the client will be disconnected from the server
+ * when it declines to use the resource pack.
+ * @throws IllegalArgumentException Thrown if the URL is null.
+ * @throws IllegalArgumentException Thrown if the URL is too long. The
+ * length restriction is an implementation specific arbitrary value.
+ * @throws IllegalArgumentException Thrown if the hash is not 20 bytes
+ * long.
+ */
+ public void setResourcePack(@NotNull UUID id, @NotNull String url, @Nullable byte[] hash, @Nullable String prompt, boolean force);
+
/**
* Gets the Scoreboard displayed to this player
*
diff --git a/src/main/java/org/bukkit/entity/Pose.java b/src/main/java/org/bukkit/entity/Pose.java
index 5122194a..d5e33844 100644
--- a/src/main/java/org/bukkit/entity/Pose.java
+++ b/src/main/java/org/bukkit/entity/Pose.java
@@ -65,5 +65,17 @@ public enum Pose {
/**
* Entity is digging.
*/
- DIGGING;
+ DIGGING,
+ /**
+ * Entity is sliding.
+ */
+ SLIDING,
+ /**
+ * Entity is shooting.
+ */
+ SHOOTING,
+ /**
+ * Entity is inhaling.
+ */
+ INHALING;
}
diff --git a/src/main/java/org/bukkit/entity/WindCharge.java b/src/main/java/org/bukkit/entity/WindCharge.java
new file mode 100644
index 00000000..9294de16
--- /dev/null
+++ b/src/main/java/org/bukkit/entity/WindCharge.java
@@ -0,0 +1,12 @@
+package org.bukkit.entity;
+
+import org.bukkit.MinecraftExperimental;
+import org.jetbrains.annotations.ApiStatus;
+
+/**
+ * Represents a Wind Charge.
+ */
+@MinecraftExperimental
+@ApiStatus.Experimental
+public interface WindCharge extends Fireball {
+}
diff --git a/src/main/java/org/bukkit/event/entity/ExpBottleEvent.java b/src/main/java/org/bukkit/event/entity/ExpBottleEvent.java
index 6417c2fd..997c86b0 100644
--- a/src/main/java/org/bukkit/event/entity/ExpBottleEvent.java
+++ b/src/main/java/org/bukkit/event/entity/ExpBottleEvent.java
@@ -1,8 +1,12 @@
package org.bukkit.event.entity;
+import org.bukkit.block.Block;
+import org.bukkit.block.BlockFace;
+import org.bukkit.entity.Entity;
import org.bukkit.entity.ThrownExpBottle;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
/**
* Called when a ThrownExpBottle hits and releases experience.
@@ -12,8 +16,13 @@ public class ExpBottleEvent extends ProjectileHitEvent {
private int exp;
private boolean showEffect = true;
+ @Deprecated
public ExpBottleEvent(@NotNull final ThrownExpBottle bottle, final int exp) {
- super(bottle);
+ this(bottle, null, null, null, exp);
+ }
+
+ public ExpBottleEvent(@NotNull final ThrownExpBottle bottle, @Nullable Entity hitEntity, @Nullable Block hitBlock, @Nullable BlockFace hitFace, final int exp) {
+ super(bottle, hitEntity, hitBlock, hitFace);
this.exp = exp;
}
diff --git a/src/main/java/org/bukkit/event/entity/LingeringPotionSplashEvent.java b/src/main/java/org/bukkit/event/entity/LingeringPotionSplashEvent.java
index a10dab16..1584c6c4 100644
--- a/src/main/java/org/bukkit/event/entity/LingeringPotionSplashEvent.java
+++ b/src/main/java/org/bukkit/event/entity/LingeringPotionSplashEvent.java
@@ -1,10 +1,14 @@
package org.bukkit.event.entity;
+import org.bukkit.block.Block;
+import org.bukkit.block.BlockFace;
import org.bukkit.entity.AreaEffectCloud;
+import org.bukkit.entity.Entity;
import org.bukkit.entity.ThrownPotion;
import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
/**
* Called when a splash potion hits an area
@@ -14,8 +18,13 @@ public class LingeringPotionSplashEvent extends ProjectileHitEvent implements Ca
private boolean cancelled;
private final AreaEffectCloud entity;
+ @Deprecated
public LingeringPotionSplashEvent(@NotNull final ThrownPotion potion, @NotNull final AreaEffectCloud entity) {
- super(potion);
+ this(potion, null, null, null, entity);
+ }
+
+ public LingeringPotionSplashEvent(@NotNull final ThrownPotion potion, @Nullable Entity hitEntity, @Nullable Block hitBlock, @Nullable BlockFace hitFace, @NotNull final AreaEffectCloud entity) {
+ super(potion, hitEntity, hitBlock, hitFace);
this.entity = entity;
}
diff --git a/src/main/java/org/bukkit/event/entity/PotionSplashEvent.java b/src/main/java/org/bukkit/event/entity/PotionSplashEvent.java
index 80f31a26..bc6ba6c4 100644
--- a/src/main/java/org/bukkit/event/entity/PotionSplashEvent.java
+++ b/src/main/java/org/bukkit/event/entity/PotionSplashEvent.java
@@ -4,11 +4,15 @@ import com.google.common.base.Preconditions;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Map;
+import org.bukkit.block.Block;
+import org.bukkit.block.BlockFace;
+import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.ThrownPotion;
import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
/**
* Called when a splash potion hits an area
@@ -18,9 +22,13 @@ public class PotionSplashEvent extends ProjectileHitEvent implements Cancellable
private boolean cancelled;
private final Map
+ * Different types of recipe book are shown in different GUIs.
+ */
+ public enum RecipeBookType {
+
+ /**
+ * Recipe book seen in crafting table and player inventory.
+ */
+ CRAFTING,
+ /**
+ * Recipe book seen in furnace.
+ */
+ FURNACE,
+ /**
+ * Recipe book seen in blast furnace.
+ */
+ BLAST_FURNACE,
+ /**
+ * Recipe book seen in smoker.
+ */
+ SMOKER;
+ }
+}
diff --git a/src/main/java/org/bukkit/event/player/PlayerResourcePackStatusEvent.java b/src/main/java/org/bukkit/event/player/PlayerResourcePackStatusEvent.java
index b9819565..e2c4f9a0 100644
--- a/src/main/java/org/bukkit/event/player/PlayerResourcePackStatusEvent.java
+++ b/src/main/java/org/bukkit/event/player/PlayerResourcePackStatusEvent.java
@@ -1,5 +1,6 @@
package org.bukkit.event.player;
+import java.util.UUID;
import org.bukkit.entity.Player;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.NotNull;
@@ -11,13 +12,25 @@ import org.jetbrains.annotations.NotNull;
public class PlayerResourcePackStatusEvent extends PlayerEvent {
private static final HandlerList handlers = new HandlerList();
+ private final UUID id;
private final Status status;
- public PlayerResourcePackStatusEvent(@NotNull final Player who, @NotNull Status resourcePackStatus) {
+ public PlayerResourcePackStatusEvent(@NotNull final Player who, @NotNull UUID id, @NotNull Status resourcePackStatus) {
super(who);
+ this.id = id;
this.status = resourcePackStatus;
}
+ /**
+ * Gets the unique ID of this pack.
+ *
+ * @return unique resource pack ID.
+ */
+ @NotNull
+ public UUID getID() {
+ return id;
+ }
+
/**
* Gets the status of this pack.
*
@@ -60,6 +73,22 @@ public class PlayerResourcePackStatusEvent extends PlayerEvent {
/**
* The client accepted the pack and is beginning a download of it.
*/
- ACCEPTED;
+ ACCEPTED,
+ /**
+ * The client successfully downloaded the pack.
+ */
+ DOWNLOADED,
+ /**
+ * The pack URL was invalid.
+ */
+ INVALID_URL,
+ /**
+ * The client was unable to reload the pack.
+ */
+ FAILED_RELOAD,
+ /**
+ * The pack was discarded by the client.
+ */
+ DISCARDED;
}
}
diff --git a/src/main/java/org/bukkit/generator/structure/Structure.java b/src/main/java/org/bukkit/generator/structure/Structure.java
index ca310cfe..65d3d8fd 100644
--- a/src/main/java/org/bukkit/generator/structure/Structure.java
+++ b/src/main/java/org/bukkit/generator/structure/Structure.java
@@ -1,6 +1,7 @@
package org.bukkit.generator.structure;
import org.bukkit.Keyed;
+import org.bukkit.MinecraftExperimental;
import org.bukkit.NamespacedKey;
import org.bukkit.Registry;
import org.jetbrains.annotations.NotNull;
@@ -47,6 +48,8 @@ public abstract class Structure implements Keyed {
public static final Structure RUINED_PORTAL_NETHER = getStructure("ruined_portal_nether");
public static final Structure ANCIENT_CITY = getStructure("ancient_city");
public static final Structure TRAIL_RUINS = getStructure("trail_ruins");
+ @MinecraftExperimental
+ public static final Structure TRIAL_CHAMBERS = getStructure("trial_chambers");
private static Structure getStructure(String name) {
return Registry.STRUCTURE.get(NamespacedKey.minecraft(name));
diff --git a/src/main/java/org/bukkit/inventory/CrafterInventory.java b/src/main/java/org/bukkit/inventory/CrafterInventory.java
new file mode 100644
index 00000000..7cdcd45e
--- /dev/null
+++ b/src/main/java/org/bukkit/inventory/CrafterInventory.java
@@ -0,0 +1,11 @@
+package org.bukkit.inventory;
+
+import org.bukkit.MinecraftExperimental;
+import org.jetbrains.annotations.ApiStatus;
+
+/**
+ * Interface to the inventory of a Crafter.
+ */
+@ApiStatus.Experimental
+@MinecraftExperimental
+public interface CrafterInventory extends Inventory { }
diff --git a/src/main/java/org/bukkit/inventory/ItemCraftResult.java b/src/main/java/org/bukkit/inventory/ItemCraftResult.java
new file mode 100644
index 00000000..ebb4d19e
--- /dev/null
+++ b/src/main/java/org/bukkit/inventory/ItemCraftResult.java
@@ -0,0 +1,38 @@
+package org.bukkit.inventory;
+
+import java.util.List;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * Container class containing the results of a Crafting event.
+ *
+ * This class makes no guarantees about the nature or mutability of the returned
+ * values.
+ */
+public interface ItemCraftResult {
+
+ /**
+ * The resulting {@link ItemStack} that was crafted.
+ *
+ * @return {@link ItemStack} that was crafted.
+ */
+ @NotNull
+ public ItemStack getResult();
+
+ /**
+ * Gets the resulting matrix from the crafting operation.
+ *
+ * @return resulting matrix
+ */
+ @NotNull
+ public ItemStack[] getResultingMatrix();
+
+ /**
+ * Gets the overflowed items for items that don't fit back into the crafting
+ * matrix.
+ *
+ * @return overflow items
+ */
+ @NotNull
+ public List
+ * If an item that is air is passed through an error is thrown.
+ *
+ * @param entity the entity to use as a source of randomness
+ * @param item the item to enchant
+ * @param level the level to use, which is the level in the enchantment table
+ * @param allowTreasures allows treasure enchants, e.g. mending, if true.
+ * @return the modified ItemStack, or a copy if the ItemStack cannot be enchanted directly
+ */
+ @NotNull
+ ItemStack enchantItem(@NotNull final Entity entity, @NotNull final ItemStack item, final int level, final boolean allowTreasures);
+
+ /**
+ * Enchants the given item at the provided level.
+ *
+ * If an item that is air is passed through an error is thrown.
+ *
+ * @param world the world to use as a source of randomness
+ * @param item the item to enchant
+ * @param level the level to use, which is the level in the enchantment table
+ * @param allowTreasures allow the treasure enchants, e.g. mending, if true.
+ * @return the modified ItemStack, or a copy if the ItemStack cannot be
+ * enchanted directly
+ */
+ @NotNull
+ ItemStack enchantItem(@NotNull final World world, @NotNull final ItemStack item, final int level, final boolean allowTreasures);
+
+ /**
+ * Enchants the given item at the provided level.
+ *
+ * If an item that is air is passed through an error is thrown.
+ *
+ * @param item the item to enchant
+ * @param level the level to use, which is the level in the enchantment table
+ * @param allowTreasures allow treasure enchantments, e.g. mending, if true.
+ * @return the modified ItemStack, or a copy if the ItemStack cannot be
+ * enchanted directly
+ */
+ @NotNull
+ ItemStack enchantItem(@NotNull final ItemStack item, final int level, final boolean allowTreasures);
}
diff --git a/src/main/java/org/bukkit/inventory/ItemType.java b/src/main/java/org/bukkit/inventory/ItemType.java
index f008470f..1fc323a5 100644
--- a/src/main/java/org/bukkit/inventory/ItemType.java
+++ b/src/main/java/org/bukkit/inventory/ItemType.java
@@ -28,6 +28,19 @@ public interface ItemType extends Keyed, Translatable {
ItemType POLISHED_DEEPSLATE = getItemType("polished_deepslate");
ItemType CALCITE = getItemType("calcite");
ItemType TUFF = getItemType("tuff");
+ ItemType TUFF_SLAB = getItemType("tuff_slab");
+ ItemType TUFF_STAIRS = getItemType("tuff_stairs");
+ ItemType TUFF_WALL = getItemType("tuff_wall");
+ ItemType CHISELED_TUFF = getItemType("chiseled_tuff");
+ ItemType POLISHED_TUFF = getItemType("polished_tuff");
+ ItemType POLISHED_TUFF_SLAB = getItemType("polished_tuff_slab");
+ ItemType POLISHED_TUFF_STAIRS = getItemType("polished_tuff_stairs");
+ ItemType POLISHED_TUFF_WALL = getItemType("polished_tuff_wall");
+ ItemType TUFF_BRICKS = getItemType("tuff_bricks");
+ ItemType TUFF_BRICK_SLAB = getItemType("tuff_brick_slab");
+ ItemType TUFF_BRICK_STAIRS = getItemType("tuff_brick_stairs");
+ ItemType TUFF_BRICK_WALL = getItemType("tuff_brick_wall");
+ ItemType CHISELED_TUFF_BRICKS = getItemType("chiseled_tuff_bricks");
ItemType DRIPSTONE_BLOCK = getItemType("dripstone_block");
ItemType GRASS_BLOCK = getItemType("grass_block");
ItemType DIRT = getItemType("dirt");
@@ -97,6 +110,10 @@ public interface ItemType extends Keyed, Translatable {
ItemType EXPOSED_COPPER = getItemType("exposed_copper");
ItemType WEATHERED_COPPER = getItemType("weathered_copper");
ItemType OXIDIZED_COPPER = getItemType("oxidized_copper");
+ ItemType CHISELED_COPPER = getItemType("chiseled_copper");
+ ItemType EXPOSED_CHISELED_COPPER = getItemType("exposed_chiseled_copper");
+ ItemType WEATHERED_CHISELED_COPPER = getItemType("weathered_chiseled_copper");
+ ItemType OXIDIZED_CHISELED_COPPER = getItemType("oxidized_chiseled_copper");
ItemType CUT_COPPER = getItemType("cut_copper");
ItemType EXPOSED_CUT_COPPER = getItemType("exposed_cut_copper");
ItemType WEATHERED_CUT_COPPER = getItemType("weathered_cut_copper");
@@ -113,6 +130,10 @@ public interface ItemType extends Keyed, Translatable {
ItemType WAXED_EXPOSED_COPPER = getItemType("waxed_exposed_copper");
ItemType WAXED_WEATHERED_COPPER = getItemType("waxed_weathered_copper");
ItemType WAXED_OXIDIZED_COPPER = getItemType("waxed_oxidized_copper");
+ ItemType WAXED_CHISELED_COPPER = getItemType("waxed_chiseled_copper");
+ ItemType WAXED_EXPOSED_CHISELED_COPPER = getItemType("waxed_exposed_chiseled_copper");
+ ItemType WAXED_WEATHERED_CHISELED_COPPER = getItemType("waxed_weathered_chiseled_copper");
+ ItemType WAXED_OXIDIZED_CHISELED_COPPER = getItemType("waxed_oxidized_chiseled_copper");
ItemType WAXED_CUT_COPPER = getItemType("waxed_cut_copper");
ItemType WAXED_EXPOSED_CUT_COPPER = getItemType("waxed_exposed_cut_copper");
ItemType WAXED_WEATHERED_CUT_COPPER = getItemType("waxed_weathered_cut_copper");
@@ -188,7 +209,7 @@ public interface ItemType extends Keyed, Translatable {
ItemType CHISELED_SANDSTONE = getItemType("chiseled_sandstone");
ItemType CUT_SANDSTONE = getItemType("cut_sandstone");
ItemType COBWEB = getItemType("cobweb");
- ItemType GRASS = getItemType("grass");
+ ItemType SHORT_GRASS = getItemType("short_grass");
ItemType FERN = getItemType("fern");
ItemType AZALEA = getItemType("azalea");
ItemType FLOWERING_AZALEA = getItemType("flowering_azalea");
@@ -715,6 +736,14 @@ public interface ItemType extends Keyed, Translatable {
ItemType BAMBOO_DOOR = getItemType("bamboo_door");
ItemType CRIMSON_DOOR = getItemType("crimson_door");
ItemType WARPED_DOOR = getItemType("warped_door");
+ ItemType COPPER_DOOR = getItemType("copper_door");
+ ItemType EXPOSED_COPPER_DOOR = getItemType("exposed_copper_door");
+ ItemType WEATHERED_COPPER_DOOR = getItemType("weathered_copper_door");
+ ItemType OXIDIZED_COPPER_DOOR = getItemType("oxidized_copper_door");
+ ItemType WAXED_COPPER_DOOR = getItemType("waxed_copper_door");
+ ItemType WAXED_EXPOSED_COPPER_DOOR = getItemType("waxed_exposed_copper_door");
+ ItemType WAXED_WEATHERED_COPPER_DOOR = getItemType("waxed_weathered_copper_door");
+ ItemType WAXED_OXIDIZED_COPPER_DOOR = getItemType("waxed_oxidized_copper_door");
ItemType IRON_TRAPDOOR = getItemType("iron_trapdoor");
ItemType OAK_TRAPDOOR = getItemType("oak_trapdoor");
ItemType SPRUCE_TRAPDOOR = getItemType("spruce_trapdoor");
@@ -727,6 +756,14 @@ public interface ItemType extends Keyed, Translatable {
ItemType BAMBOO_TRAPDOOR = getItemType("bamboo_trapdoor");
ItemType CRIMSON_TRAPDOOR = getItemType("crimson_trapdoor");
ItemType WARPED_TRAPDOOR = getItemType("warped_trapdoor");
+ ItemType COPPER_TRAPDOOR = getItemType("copper_trapdoor");
+ ItemType EXPOSED_COPPER_TRAPDOOR = getItemType("exposed_copper_trapdoor");
+ ItemType WEATHERED_COPPER_TRAPDOOR = getItemType("weathered_copper_trapdoor");
+ ItemType OXIDIZED_COPPER_TRAPDOOR = getItemType("oxidized_copper_trapdoor");
+ ItemType WAXED_COPPER_TRAPDOOR = getItemType("waxed_copper_trapdoor");
+ ItemType WAXED_EXPOSED_COPPER_TRAPDOOR = getItemType("waxed_exposed_copper_trapdoor");
+ ItemType WAXED_WEATHERED_COPPER_TRAPDOOR = getItemType("waxed_weathered_copper_trapdoor");
+ ItemType WAXED_OXIDIZED_COPPER_TRAPDOOR = getItemType("waxed_oxidized_copper_trapdoor");
ItemType OAK_FENCE_GATE = getItemType("oak_fence_gate");
ItemType SPRUCE_FENCE_GATE = getItemType("spruce_fence_gate");
ItemType BIRCH_FENCE_GATE = getItemType("birch_fence_gate");
@@ -956,6 +993,7 @@ public interface ItemType extends Keyed, Translatable {
ItemType RED_BED = getItemType("red_bed");
ItemType BLACK_BED = getItemType("black_bed");
ItemType COOKIE = getItemType("cookie");
+ ItemType CRAFTER = getItemType("crafter");
ItemType FILLED_MAP = getItemType("filled_map");
ItemType SHEARS = getItemType("shears");
ItemType MELON_SLICE = getItemType("melon_slice");
@@ -987,6 +1025,7 @@ public interface ItemType extends Keyed, Translatable {
ItemType BAT_SPAWN_EGG = getItemType("bat_spawn_egg");
ItemType BEE_SPAWN_EGG = getItemType("bee_spawn_egg");
ItemType BLAZE_SPAWN_EGG = getItemType("blaze_spawn_egg");
+ ItemType BREEZE_SPAWN_EGG = getItemType("breeze_spawn_egg");
ItemType CAT_SPAWN_EGG = getItemType("cat_spawn_egg");
ItemType CAMEL_SPAWN_EGG = getItemType("camel_spawn_egg");
ItemType CAVE_SPIDER_SPAWN_EGG = getItemType("cave_spider_spawn_egg");
@@ -1270,6 +1309,24 @@ public interface ItemType extends Keyed, Translatable {
ItemType SHELTER_POTTERY_SHERD = getItemType("shelter_pottery_sherd");
ItemType SKULL_POTTERY_SHERD = getItemType("skull_pottery_sherd");
ItemType SNORT_POTTERY_SHERD = getItemType("snort_pottery_sherd");
+ ItemType COPPER_GRATE = getItemType("copper_grate");
+ ItemType EXPOSED_COPPER_GRATE = getItemType("exposed_copper_grate");
+ ItemType WEATHERED_COPPER_GRATE = getItemType("weathered_copper_grate");
+ ItemType OXIDIZED_COPPER_GRATE = getItemType("oxidized_copper_grate");
+ ItemType WAXED_COPPER_GRATE = getItemType("waxed_copper_grate");
+ ItemType WAXED_EXPOSED_COPPER_GRATE = getItemType("waxed_exposed_copper_grate");
+ ItemType WAXED_WEATHERED_COPPER_GRATE = getItemType("waxed_weathered_copper_grate");
+ ItemType WAXED_OXIDIZED_COPPER_GRATE = getItemType("waxed_oxidized_copper_grate");
+ ItemType COPPER_BULB = getItemType("copper_bulb");
+ ItemType EXPOSED_COPPER_BULB = getItemType("exposed_copper_bulb");
+ ItemType WEATHERED_COPPER_BULB = getItemType("weathered_copper_bulb");
+ ItemType OXIDIZED_COPPER_BULB = getItemType("oxidized_copper_bulb");
+ ItemType WAXED_COPPER_BULB = getItemType("waxed_copper_bulb");
+ ItemType WAXED_EXPOSED_COPPER_BULB = getItemType("waxed_exposed_copper_bulb");
+ ItemType WAXED_WEATHERED_COPPER_BULB = getItemType("waxed_weathered_copper_bulb");
+ ItemType WAXED_OXIDIZED_COPPER_BULB = getItemType("waxed_oxidized_copper_bulb");
+ ItemType TRIAL_SPAWNER = getItemType("trial_spawner");
+ ItemType TRIAL_KEY = getItemType("trial_key");
//
@NotNull
diff --git a/src/main/java/org/bukkit/inventory/meta/SpawnEggMeta.java b/src/main/java/org/bukkit/inventory/meta/SpawnEggMeta.java
index 28a7544d..db60ae90 100644
--- a/src/main/java/org/bukkit/inventory/meta/SpawnEggMeta.java
+++ b/src/main/java/org/bukkit/inventory/meta/SpawnEggMeta.java
@@ -1,8 +1,10 @@
package org.bukkit.inventory.meta;
+import org.bukkit.entity.EntitySnapshot;
import org.bukkit.entity.EntityType;
import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
/**
* Represents a spawn egg and it's spawned type.
@@ -30,6 +32,28 @@ public interface SpawnEggMeta extends ItemMeta {
@Contract("_ -> fail")
void setSpawnedType(EntityType> type);
+ /**
+ * Gets the {@link EntitySnapshot} that will be spawned by this spawn egg or null if no entity
+ * has been set.
+ *
+ *
+ * @return the entity snapshot or null if no entity has been set
+ */
+ @Nullable
+ EntitySnapshot getSpawnedEntity();
+
+ /**
+ * Sets the {@link EntitySnapshot} that will be spawned by this spawn egg.
+ *
+ *
+ * @param snapshot the snapshot
+ */
+ void setSpawnedEntity(@NotNull EntitySnapshot snapshot);
+
@NotNull
@Override
SpawnEggMeta clone();
diff --git a/src/main/java/org/bukkit/loot/LootTables.java b/src/main/java/org/bukkit/loot/LootTables.java
index 4e8479dc..d8721444 100644
--- a/src/main/java/org/bukkit/loot/LootTables.java
+++ b/src/main/java/org/bukkit/loot/LootTables.java
@@ -2,6 +2,7 @@ package org.bukkit.loot;
import org.bukkit.Bukkit;
import org.bukkit.Keyed;
+import org.bukkit.MinecraftExperimental;
import org.bukkit.NamespacedKey;
import org.jetbrains.annotations.NotNull;
@@ -33,6 +34,26 @@ public enum LootTables implements Keyed {
ANCIENT_CITY("chests/ancient_city"),
ANCIENT_CITY_ICE_BOX("chests/ancient_city_ice_box"),
RUINED_PORTAL("chests/ruined_portal"),
+ @MinecraftExperimental
+ TRIAL_CHAMBERS_REWARD("chests/trial_chambers/reward"),
+ @MinecraftExperimental
+ TRIAL_CHAMBERS_SUPPLY("chests/trial_chambers/supply"),
+ @MinecraftExperimental
+ TRIAL_CHAMBERS_CORRIDOR("chests/trial_chambers/corridor"),
+ @MinecraftExperimental
+ TRIAL_CHAMBERS_INTERSECTION("chests/trial_chambers/intersection"),
+ @MinecraftExperimental
+ TRIAL_CHAMBERS_INTERSECTION_BARREL("chests/trial_chambers/intersection_barrel"),
+ @MinecraftExperimental
+ TRIAL_CHAMBERS_ENTRANCE("chests/trial_chambers/entrance"),
+ @MinecraftExperimental
+ TRIAL_CHAMBERS_CORRIDOR_DISPENSER("dispensers/trial_chambers/corridor"),
+ @MinecraftExperimental
+ TRIAL_CHAMBERS_CHAMBER_DISPENSER("dispensers/trial_chambers/chamber"),
+ @MinecraftExperimental
+ TRIAL_CHAMBERS_WATER_DISPENSER("dispensers/trial_chambers/water"),
+ @MinecraftExperimental
+ TRIAL_CHAMBERS_CORRIDOR_POT("pots/trial_chambers/corridor"),
SHIPWRECK_MAP("chests/shipwreck_map"),
SHIPWRECK_SUPPLY("chests/shipwreck_supply"),
SHIPWRECK_TREASURE("chests/shipwreck_treasure"),
@@ -157,6 +178,9 @@ public enum LootTables implements Keyed {
WEAPONSMITH_GIFT("gameplay/hero_of_the_village/weaponsmith_gift"),
SNIFFER_DIGGING("gameplay/sniffer_digging"),
PIGLIN_BARTERING("gameplay/piglin_bartering"),
+ // Spawners
+ TRIAL_CHAMBER_KEY("spawners/trial_chamber/key"),
+ RIAL_CHAMBER_CONSUMABLES("spawners/trial_chamber/consumables"),
// Archaeology
DESERT_WELL_ARCHAEOLOGY("archaeology/desert_well"),
DESERT_PYRAMID_ARCHAEOLOGY("archaeology/desert_pyramid"),
diff --git a/src/main/java/org/bukkit/persistence/PersistentDataContainer.java b/src/main/java/org/bukkit/persistence/PersistentDataContainer.java
index bf2a957b..6c156faf 100644
--- a/src/main/java/org/bukkit/persistence/PersistentDataContainer.java
+++ b/src/main/java/org/bukkit/persistence/PersistentDataContainer.java
@@ -21,15 +21,15 @@ public interface PersistentDataContainer {
*
* @param key the key this value will be stored under
* @param type the type this tag uses
- * @param value the value stored in the tag
+ * @param value the value to store in the tag
* @param