Class Register
java.lang.Object
dev.xdpxi.xdlib.api.v6.Register
Utility class for registering blocks, items, and armor materials in Minecraft.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic net.minecraft.block.Blockstatic net.minecraft.item.Itemstatic net.minecraft.registry.entry.RegistryEntry<net.minecraft.item.ArmorMaterial> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidinit()Initializes and tests the registration of a block, an item, and an armor material.static net.minecraft.block.BlockregisterBlock(Function<net.minecraft.block.AbstractBlock.Settings, net.minecraft.block.Block> blockFactory, net.minecraft.block.AbstractBlock.Settings settings, String blockId, String modId) Registers a block and its corresponding block item in the game.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.static net.minecraft.registry.entry.RegistryEntry<net.minecraft.item.ArmorMaterial> registerMaterial(String id, Map<net.minecraft.item.ArmorItem.Type, Integer> defensePoints, int enchantability, net.minecraft.registry.entry.RegistryEntry<net.minecraft.sound.SoundEvent> equipSound, Supplier<net.minecraft.recipe.Ingredient> repairIngredientSupplier, float toughness, float knockbackResistance, boolean dyeable, String MOD_ID) Registers an armor material in the game.
-
Field Details
-
test_block
public static net.minecraft.block.Block test_block -
test_item
public static net.minecraft.item.Item test_item -
test_material
public static net.minecraft.registry.entry.RegistryEntry<net.minecraft.item.ArmorMaterial> test_material
-
-
Constructor Details
-
Register
public Register()
-
-
Method Details
-
init
public static void init()Initializes and tests the registration of a block, an item, and an armor material. This method is used for testing purposes and 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, String blockId, String modId) Registers a block and its corresponding block item in the game.- Parameters:
blockFactory- A factory function to create a block.settings- The settings for the block.blockId- The unique block 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.
-
registerMaterial
public static net.minecraft.registry.entry.RegistryEntry<net.minecraft.item.ArmorMaterial> registerMaterial(String id, Map<net.minecraft.item.ArmorItem.Type, Integer> defensePoints, int enchantability, net.minecraft.registry.entry.RegistryEntry<net.minecraft.sound.SoundEvent> equipSound, Supplier<net.minecraft.recipe.Ingredient> repairIngredientSupplier, float toughness, float knockbackResistance, boolean dyeable, String MOD_ID) Registers an armor material in the game.- Parameters:
id- The ID of the armor material.defensePoints- A map of armor types to their defense points.enchantability- The enchantability of the armor material.equipSound- The sound played when equipping the armor.repairIngredientSupplier- A supplier for the repair ingredient.toughness- The toughness of the armor material.knockbackResistance- The knockback resistance of the armor material.dyeable- Whether the armor material is dyeable.MOD_ID- The mod ID.- Returns:
- A RegistryEntry containing the registered ArmorMaterial.
-