CustomObjects
Introduction
The DynamX API allows you to add your own blocks, items, and armor directly by writing your Java code, without using the content pack system.
Application
To create a block, item, or armor, you can follow the usual modding practice by creating a class that extends and has the following constructor:
Object | Class to Extend | Constructor to Call |
---|---|---|
Item | DynamXItem | DynamXItem(modid, itemName, model) |
Block | DynamXBlock | DynamXBlock(material, modid, blockName, model) |
Armor | DynamXItemArmor | DynamXItemArmor(modid, itemName, model, material, armorType) |
The object will be automatically registered by DynamX, so there's no need for you to do anything on your end. However, remember to set the creative tab for your object; this is not done automatically.
Danger
Don't forget to set the creative tab for your object, as this is not done automatically.
Note that an ObjectInfo is created in the process, which you can modify immediately after creating the block/item/armor.
Customizing the TileEntity of Your Block
You can modify the TileEntity by either overriding the createTileEntity
function or by using the DynamXBlockEvent.CreateTileEntity
event if you don't want to change the block's class, or if it comes from a content pack.
The new TileEntity should extend TEDynamXBlock
, and don't forget to register the TileEntity and its rendering in Minecraft (you can use TESRDynamXBlock
for rendering).