Class Register
java.lang.Object
dev.xdpxi.xdlib.api.v5.Register
Utility class for registering blocks, items, and armor materials in Minecraft.
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidinit()Initializes and tests the registration of a block, an item, and an armor material.static net.minecraft.item.ItemregisterArmorItem(net.minecraft.item.equipment.EquipmentType equipmentType, net.minecraft.item.equipment.ArmorMaterial material, String itemId, String modId) Registers an armor item.static net.minecraft.block.BlockregisterBlock(Function<net.minecraft.block.AbstractBlock.Settings, net.minecraft.block.Block> blockFactory, net.minecraft.block.AbstractBlock.Settings settings, boolean registerItem, String itemId, String modId) Registers a block and optionally its corresponding block item.static net.minecraft.item.ItemregisterItem(Function<net.minecraft.item.Item.Settings, net.minecraft.item.Item> itemFactory, net.minecraft.item.Item.Settings settings, String itemId, String modId) Registers an item in the game.
-
Method Details
-
init
public static void init()Initializes and tests the registration of a block, an item, and an armor material. Logs the results of each registration attempt. -
registerBlock
public static net.minecraft.block.Block registerBlock(Function<net.minecraft.block.AbstractBlock.Settings, net.minecraft.block.Block> blockFactory, net.minecraft.block.AbstractBlock.Settings settings, boolean registerItem, String itemId, String modId) Registers a block and optionally its corresponding block item.- Parameters:
blockFactory- The function to create the block.settings- The block settings.registerItem- Whether to register the block as an item.itemId- The item ID.modId- The mod ID.- Returns:
- The registered block.
-
registerItem
public static net.minecraft.item.Item registerItem(Function<net.minecraft.item.Item.Settings, net.minecraft.item.Item> itemFactory, net.minecraft.item.Item.Settings settings, String itemId, String modId) Registers an item in the game.- Parameters:
itemFactory- A factory function to create an item.settings- The settings for the item.itemId- The unique item ID.modId- The mod ID.- Returns:
- The registered item.
-
registerArmorItem
public static net.minecraft.item.Item registerArmorItem(net.minecraft.item.equipment.EquipmentType equipmentType, net.minecraft.item.equipment.ArmorMaterial material, String itemId, String modId) Registers an armor item.- Parameters:
equipmentType- The type of armor (e.g., helmet, chestplate, etc.).material- The material of the armor.itemId- The unique item ID.modId- The mod ID.- Returns:
- The registered armor item.
-