Package dev.piglin.piglinworldapi.block
Class CustomBlock
java.lang.Object
dev.piglin.piglinworldapi.block.CustomBlock
Your custom block. Extend this class to make a block.
How this works:
There are mushrooms. Many mushrooms. 192 in total (3 types * 64=2^6 boolean fields in BlockState).
Some of them are used (deprecated in Mushroom), some are not.
You can override one mushroom to be your custom block.
We'll take care of any mutations done to the mushroom block (or at least we try to do this)
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract booleanbreakBlock(org.bukkit.block.Block block, org.bukkit.inventory.ItemStack tool)Handle block breakList<org.bukkit.block.Block>onInteract(org.bukkit.event.player.PlayerInteractEvent event)Handle interaction at the blockabstract voidonLoad(org.bukkit.block.Block block)Handle the block load (when the chunk is being loaded)abstract voidonUnload(org.bukkit.block.Block block)Handle the block unload (when the chunk is being unloaded)abstract booleanplaceBlock(org.bukkit.block.Block block)Handle block placement
-
Field Details
-
mushroom
-
-
Constructor Details
-
CustomBlock
- Parameters:
mushroom- The mushroom to use
-
-
Method Details
-
onInteract
Handle interaction at the block- Parameters:
event- The event- Returns:
- gui to open if any
-
breakBlock
public abstract boolean breakBlock(org.bukkit.block.Block block, org.bukkit.inventory.ItemStack tool)Handle block break- Parameters:
block- The blocktool- The tool- Returns:
- true if the block should spawn as an item
-
placeBlock
public abstract boolean placeBlock(org.bukkit.block.Block block)Handle block placement- Parameters:
block- The block- Returns:
- false to cancel
-
onLoad
public abstract void onLoad(org.bukkit.block.Block block)Handle the block load (when the chunk is being loaded)- Parameters:
block- The block
-
onUnload
public abstract void onUnload(org.bukkit.block.Block block)Handle the block unload (when the chunk is being unloaded)- Parameters:
block- The block
-
getBlocks
- Returns:
- Loaded blocks of this type
-