Package ch.njol.skript.bukkitutil.block
Class NewBlockCompat
java.lang.Object
ch.njol.skript.bukkitutil.block.NewBlockCompat
- All Implemented Interfaces:
BlockCompat
1.13+ block compat.
-
Field Summary
Fields inherited from interface ch.njol.skript.bukkitutil.block.BlockCompat
INSTANCE, SETTER
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription@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)
Creates a block state from a falling block.@Nullable BlockValues
getBlockValues(org.bukkit.block.BlockState block)
Gets block values from a block state.@Nullable BlockValues
getBlockValues(org.bukkit.inventory.ItemStack stack)
Gets block values from a item stack.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.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface ch.njol.skript.bukkitutil.block.BlockCompat
createBlockValues, getBlockValues, getBlockValues
-
Constructor Details
-
NewBlockCompat
public NewBlockCompat()
-
-
Method Details
-
getBlockValues
Description copied from interface:BlockCompat
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.- Specified by:
getBlockValues
in interfaceBlockCompat
- Parameters:
block
- Block state to retrieve value from.- Returns:
- Block values.
-
getBlockValues
Description copied from interface:BlockCompat
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.- Specified by:
getBlockValues
in interfaceBlockCompat
- Parameters:
stack
- Item that would be placed as the block- Returns:
- Block values.
-
getSetter
Description copied from interface:BlockCompat
Gets block setter that understands block values produced by this compatibility layer.- Specified by:
getSetter
in interfaceBlockCompat
- Returns:
- Block setter.
-
fallingBlockToState
public org.bukkit.block.BlockState fallingBlockToState(org.bukkit.entity.FallingBlock entity)Description copied from interface:BlockCompat
Creates a block state from a falling block.- Specified by:
fallingBlockToState
in interfaceBlockCompat
- Parameters:
entity
- Falling block entity- Returns:
- Block state.
-
createBlockValues
public @Nullable BlockValues createBlockValues(org.bukkit.Material type, Map<String,String> states, @Nullable org.bukkit.inventory.ItemStack item, int itemFlags)Description copied from interface:BlockCompat
Creates new block values for given material and state. Item, if given, will be used to correct data value etc. when needed.- Specified by:
createBlockValues
in interfaceBlockCompat
- 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.
-
isEmpty
public boolean isEmpty(org.bukkit.Material type)Description copied from interface:BlockCompat
Checks whether the given material implies emptiness. On Minecraft 1.13+, there are several blocks that do so.- Specified by:
isEmpty
in interfaceBlockCompat
- Parameters:
type
- Material of block.- Returns:
- Whether the material implies empty block.
-
isLiquid
public boolean isLiquid(org.bukkit.Material type)Description copied from interface:BlockCompat
Checks whether the given material is a liquid.- Specified by:
isLiquid
in interfaceBlockCompat
- Parameters:
type
- Material of block.- Returns:
- Whether the material is liquid.
-