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
FieldsModifier and TypeFieldDescriptionstatic final BlockCompatInstance of BlockCompat for current Minecraft version.static final BlockSetter -
Method Summary
Modifier and TypeMethodDescriptiondefault @Nullable BlockValuescreateBlockValues(org.bukkit.Material type, Map<String, String> states) Creates new block values for given material and state.@Nullable BlockValuescreateBlockValues(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.BlockStatefallingBlockToState(org.bukkit.entity.FallingBlock entity) Deprecated, for removal: This API element is subject to removal in a future version.This shouldn't be useddefault @Nullable BlockValuesgetBlockValues(org.bukkit.block.Block block) Gets block values from a block.@Nullable BlockValuesgetBlockValues(org.bukkit.block.BlockState block) Deprecated, for removal: This API element is subject to removal in a future version.UsegetBlockValues(BlockData)instead.@Nullable BlockValuesgetBlockValues(org.bukkit.block.data.BlockData blockData) default @Nullable BlockValuesgetBlockValues(org.bukkit.entity.FallingBlock entity) @Nullable BlockValuesgetBlockValues(org.bukkit.inventory.ItemStack stack) Gets block values from a item stack.@Nullable BlockValuesgetBlockValues(org.bukkit.Material material) Gets block setter that understands block values produced by this compatibility layer.booleanisEmpty(org.bukkit.Material type) Checks whether the given material implies emptiness.booleanisLiquid(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(since="2.8.4", forRemoval=true) @Nullable @Nullable BlockValues getBlockValues(org.bukkit.block.BlockState block) Deprecated, for removal: This API element is subject to removal in a future version.UsegetBlockValues(BlockData)instead.Gets 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(since="2.8.4", forRemoval=true) org.bukkit.block.BlockState fallingBlockToState(org.bukkit.entity.FallingBlock entity) Deprecated, for removal: This API element is subject to removal in a future version.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.
-