Package ch.njol.skript.bukkitutil.block
Interface BlockCompat
- All Known Implementing Classes:
NewBlockCompat
public interface BlockCompat
Methods which operate with blocks but are not compatible across some
Minecraft versions.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final BlockCompat
Instance of BlockCompat for current Minecraft version.static final BlockSetter
-
Method Summary
Modifier and TypeMethodDescriptiondefault @Nullable BlockValues
createBlockValues
(org.bukkit.Material type, Map<String, String> states) Creates new block values for given material and state.@Nullable BlockValues
createBlockValues
(org.bukkit.Material type, Map<String, String> states, @Nullable org.bukkit.inventory.ItemStack item, int itemFlags) Creates new block values for given material and state.org.bukkit.block.BlockState
fallingBlockToState
(org.bukkit.entity.FallingBlock entity) Deprecated.This shouldn't be useddefault @Nullable BlockValues
getBlockValues
(org.bukkit.block.Block block) Gets block values from a block.@Nullable BlockValues
getBlockValues
(org.bukkit.block.BlockState block) Deprecated.UsegetBlockValues(BlockData)
instead@Nullable BlockValues
getBlockValues
(org.bukkit.block.data.BlockData blockData) default @Nullable BlockValues
getBlockValues
(org.bukkit.entity.FallingBlock entity) @Nullable BlockValues
getBlockValues
(org.bukkit.inventory.ItemStack stack) Gets block values from a item stack.@Nullable BlockValues
getBlockValues
(org.bukkit.Material material) Gets block setter that understands block values produced by this compatibility layer.boolean
isEmpty
(org.bukkit.Material type) Checks whether the given material implies emptiness.boolean
isLiquid
(org.bukkit.Material type) Checks whether the given material is a liquid.
-
Field Details
-
INSTANCE
Instance of BlockCompat for current Minecraft version. -
SETTER
-
-
Method Details
-
getBlockValues
Deprecated.UsegetBlockValues(BlockData)
insteadGets block values from a block state. They can be compared to other values if needed, but cannot be used to retrieve any other data.- Parameters:
block
- Block state to retrieve value from.- Returns:
- Block values.
-
getBlockValues
Gets block values from a block. They can be compared to other values if needed, but cannot be used to retrieve any other data.- Parameters:
block
- Block to retrieve value from.- Returns:
- Block values.
-
getBlockValues
-
getBlockValues
-
getBlockValues
Gets block values from a item stack. They can be compared to other values if needed, but cannot be used to retrieve any other data.- Parameters:
stack
- Item that would be placed as the block- Returns:
- Block values.
-
fallingBlockToState
Deprecated.This shouldn't be usedCreates a block state from a falling block.- Parameters:
entity
- Falling block entity- Returns:
- Block state.
-
getBlockValues
-
createBlockValues
@Nullable @Nullable BlockValues createBlockValues(org.bukkit.Material type, Map<String, String> states, @Nullable @Nullable org.bukkit.inventory.ItemStack item, int itemFlags) Creates new block values for given material and state. Item, if given, will be used to correct data value etc. when needed.- Parameters:
type
- Block material.states
- Block states, as used in /setblock command in Minecraft.item
- Item form that may or may not provide additional information. Optional, but very useful on 1.12 and older.itemFlags
- Additional information about item. SeeItemFlags
.- Returns:
- Block values, or null if given state was invalid.
-
createBlockValues
@Nullable default @Nullable BlockValues createBlockValues(org.bukkit.Material type, Map<String, String> states) Creates new block values for given material and state.- Parameters:
type
- Block material.states
- Block states, as used in /setblock command in Minecraft.- Returns:
- Block values, or null if given state was invalid.
-
getSetter
BlockSetter getSetter()Gets block setter that understands block values produced by this compatibility layer.- Returns:
- Block setter.
-
isEmpty
boolean isEmpty(org.bukkit.Material type) Checks whether the given material implies emptiness. On Minecraft 1.13+, there are several blocks that do so.- Parameters:
type
- Material of block.- Returns:
- Whether the material implies empty block.
-
isLiquid
boolean isLiquid(org.bukkit.Material type) Checks whether the given material is a liquid.- Parameters:
type
- Material of block.- Returns:
- Whether the material is liquid.
-