Class RegistrationHelper
java.lang.Object
org.moddingx.libx.registration.RegistrationHelper
A small factory helper that creates
BlockBehaviour.Properties and Item.Properties
with the correct setId call pre-applied, and optionally tracks the created objects for
bulk registration via registerAll().
Intended for manual registration classes (those that do not use @RegisterClass).
Create a static instance and use it to build all property objects:
private static final RegistrationHelper REG = new RegistrationHelper(MyMod.getInstance());
public static final BlockBase myBlock = REG.block("my_block",
props -> new BlockBase(MyMod.getInstance(), props, new Item.Properties()));
public static void init() {
REG.registerAll();
}
For @RegisterClass classes the coremod injects ids automatically — this helper is not needed there.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<T extends net.minecraft.world.level.block.Block>
Tblock(String name, Function<net.minecraft.world.level.block.state.BlockBehaviour.Properties, T> factory) <T extends net.minecraft.world.level.block.Block>
Tblock(String name, net.minecraft.world.level.block.Block base, Function<net.minecraft.world.level.block.state.BlockBehaviour.Properties, T> factory) net.minecraft.world.level.block.state.BlockBehaviour.Propertiesnet.minecraft.world.level.block.state.BlockBehaviour.Properties<T extends net.minecraft.world.item.Item>
Tnet.minecraft.world.item.Item.Propertiesmod()voidRegisters all blocks and items created through this helper with the mods' registration system.
-
Constructor Details
-
RegistrationHelper
-
-
Method Details
-
mod
-
blockOf
-
blockCopy
public net.minecraft.world.level.block.state.BlockBehaviour.Properties blockCopy(String name, net.minecraft.world.level.block.Block base) -
itemOf
-
block
-
block
-
item
-
registerAll
public void registerAll()Registers all blocks and items created through this helper with the mods' registration system. Must be called before the firstRegisterEventfires — typically from the mod class constructor or another early-setup method. Do not call fromFMLCommonSetupEventor later. Calling this method clears the tracked entries, so it is safe to add more entries and call again.
-