SPIGOT-4569: Add more BlockData API

By: Parker Hawke <hawkeboyz2@hotmail.com>
This commit is contained in:
Bukkit/Spigot 2023-02-11 18:59:06 +11:00
parent d6d7c1a64f
commit f72dbc96cd

View File

@ -7,6 +7,8 @@ import org.bukkit.SoundGroup;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.block.BlockSupport;
import org.bukkit.block.PistonMoveReaction;
import org.bukkit.inventory.ItemStack;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@ -108,6 +110,53 @@ public interface BlockData extends Cloneable {
@NotNull
SoundGroup getSoundGroup();
/**
* Get the amount of light emitted by this state when in the world.
*
* @return the light emission
*/
int getLightEmission();
/**
* Check whether or not this state will occlude other blocks.
* <p>
* Block state occlusion affects visual features of other blocks (e.g. leaves and
* wet sponges will not spawn dripping water particles if an occluding state is
* below it), or whether light will pass through it.
*
* @return true if occluding, false otherwise
*/
boolean isOccluding();
/**
* Check whether or not this state requires a specific item to be used to drop
* items when broken. For example, diamond ore requires an iron pickaxe and will
* not drop diamonds when broken with a wooden or stone pickaxe.
*
* @return true if a more specific item is required for drops, false if any item
* (or an empty hand) will drop items
*/
boolean requiresCorrectToolForDrops();
/**
* Returns if the given item is a preferred choice to break this Block.
*
* In some cases this determines if a block will drop anything or extra
* loot.
*
* @param tool The tool or item used for breaking this block
* @return true if the tool is preferred for breaking this block.
*/
boolean isPreferredTool(@NotNull ItemStack tool);
/**
* Returns the reaction of the block when moved by a piston
*
* @return reaction
*/
@NotNull
PistonMoveReaction getPistonMoveReaction();
/**
* Checks if this state would be properly supported if it were placed at
* the given {@link Block}.
@ -116,7 +165,6 @@ public interface BlockData extends Cloneable {
* capable of surviving on its neighbouring block states.
*
* @param block the block position at which the state would be placed
*
* @return true if the block is supported, false if this state would not survive
* the world conditions
*/