WoodTypeInfo - Lemonszz/LKLib GitHub Wiki

WoodTypeInfo can be found in party.lemons.lklib.util.registry

WoodTypeInfo is a convenience class that allows you to register every wood product expected for a given wood type (Log, plank, stripped varients, Slab, stairs, fence, 4 sided bark, pressure plates, buttons, trapdoors, doors, signs and boats). A BlockItem will be automatically created for each block created through WoodTypeInfo.

Usage

   public class ModBlocks
   {
      public static final WoodTypeInfo EBONY_WOOD_INFO = new WoodTypeInfo("mymodid", MyMod.ITEM_GROUP, "ebony", BlockUtil.settings(Material.WOOD, 1.5F)).all();
      
      public static void init()
      {
         //Currently it's required to set the boat and sign types later than the rest of the info.
         EBONY_WOOD_INFO = EBONY_WOOD_INFO.boat(()->ModBoatTypes.EBONY).sign(ModSigns.EBONY);
         EBONY_WOOD_INFO.register();
      }
   }

After ModBlocks.init() has been called (from your ModInitalizer), the wood blocks (and items) will have been registered. Since we used .all(), every type will be generated. If we wanted to pick and choose which blocks we wanted, we would use the individual methods such as slab(), stair() and pressure_plate() separately.

new WoodTypeInfo("mymodid", MyMod.ITEM_GROUP, "ebony", BlockUtil.settings(Material.WOOD, 1.5F)).fence().stair().slab();

Regardless of which methods you choose, a log, stripped log and plank will be generated.

You must call the register method to register the blocks, the RegistryHelper does not currently support WoodTypeInfo.

Your log will automatically be able to be stripped with an axe.

Callbacks

WoodTypeInfo supports callbacks as each block is registered using the WoodTypeInfo.Callback interface.

      new WoodTypeInfo("mymodid", MyMod.ITEM_GROUP, "ebony", BlockUtil.settings(Material.WOOD, 1.5F), (block)->{
         if(block instanceof StairBlock)
         {
            System.out.println("Very dark!");
         }
      }).all();