DecorationBlockInfo - Lemonszz/LKLib GitHub Wiki
DecorationBlockInfo can be found in party.lemons.lklib.util.registry
DecorationBlockInfo is a convenience class that allows you to register Slab, Stair and Wall variants of a given block.
A BlockItem will be automatically created for each block created through DecorationBlockInfo
.
Usage
public class ModBlocks
{
public static final Block APPLE_BLOCK = new AppleBlock();
public static final APPLE_DECORATION = new DecorationBlockInfo("mymodid", "apple", APPLE_BLOCK, FabricBlockSettings.copyOf(APPLE_BLOCK)).all();
public static void init()
{
RegistryHelper.register("mymodid", Registry.BLOCK, Block.class, ModBlocks.class); //See RegistryHelper wiki page for more info
//Register the blocks
APPLE_DECORATION.register(MyMod.ITEM_GROUP);
}
}
After ModBlocks.init()
has been called (from your ModInitalizer
), the decoration blocks will have been registered.
Since we used .all()
, a Slab, Stair and Wall will be generated.
If we wanted to pick and choose which blocks we wanted, we would use the slab()
, stair()
and wall()
methods separatly.
new DecorationBlockInfo("mymodid", "apple", APPLE_BLOCK, FabricBlockSettings.copyOf(APPLE_BLOCK)).slab().stair();
You must call the register
method to register the blocks, the RegistryHelper
does not currently support DecorationBlockInfo
.
Callbacks
DecorationBlockInfo supports callbacks as each block is registered using the DecorationBlockInfo.Callback
interface.
new DecorationBlockInfo("mymodid", "apple", APPLE_BLOCK, FabricBlockSettings.copyOf(APPLE_BLOCK), (block)->{
if(block instanceof StairBlock)
{
System.out.println("Hope they're not rotten!");
}
}).all();