Registration
When ever you want to register new objects in your mod, you can use the registration helpers provided by Amalgamation.
Items
For items you would do this. Then Call it in your initialization method in your main mod class (Designed in 26.2)
package com.example.example_mod.init;
import net.minecraft.world.item.Item;
import org.mythic_goose.amalgamation.library.registry_v1.*;
public class ModItems extends ItemRegistry {
public static RegistryEntry<Item> EXAMPLE_ITEM;
public static RegistryEntry<Item> SPECIAL_EXAMPLE_ITEM;
public static RegistryEntry<BlockItem> EXAMPLE_BLOCK;
public static RegistryEntry<BlockItem> EXAMPLE_MANY_BLOCK;
public static void init() {
EXAMPLE_ITEM = registerItem("example_item", Item::new);
SPECIAL_EXAMPLE_ITEM = registerItem("special_example_item", properties ->
new SpecialExampleItem(properties, exampleIntValue, "exampleStringValue", exampleBooleanValue));
EXAMPLE_BLOCK = registerBlockItem("example_block", ModBlocks.EXAMPLE_BLOCK);
EXAMPLE_MANY_BLOCK = registerBlockItemWithCustomStackSize("example_many_block",
ModBlocks.EXAMPLE_MANY_BLOCK, stackSize); // stackSize between 1 and 100
}
}
Blocks
For blocks you would do this and provide a block item in the ModItems Class. Then Call it in your initialization method in your main mod class (Designed in 26.2)
package com.example.example_mod.init;
import net.minecraft.resources.Identifier;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.state.properties.BlockSetType;
import net.minecraft.world.level.block.state.properties.NoteBlockInstrument;
import net.minecraft.world.level.material.MapColor;
import net.minecraft.world.level.material.PushReaction;
import org.mythic_goose.amalgamation.library.registry_v1.*;
public class ModBlocks extends BlockRegistry {
public static RegistryEntry<Block> EXAMPLE_BLOCK;
public static RegistryEntry<Block> EXAMPLE_MANY_BLOCK;
public static void init() {
EXAMPLE_BLOCK = registerBlock("example_block", properties ->
new Block(properties.mapColor(MapColor.STONE).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(1.5f, 6.0f))); // Example Stone Block
EXAMPLE_MANY_BLOCK = registerBlock("example_many_block", properties ->
new Block(properties.mapColor(MapColor.STONE).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(1.5f, 6.0f))); // Example Stone Block
}
}