-
Notifications
You must be signed in to change notification settings - Fork 4
Adding a new type of dust.
With the new API put in place as of version 1.0, new dusts can now be created and registered into the system with ease.
Most of the bigger things are handled for you, like the texture image and the syncing with the client, so all you should have to do is register the dust. However, you do have to define how you obtain the dust on your own.
DustItemManager.registerDust(int value, String proper_name, String idname, int primaryColor, int secondaryColor, int groundColor)
-
Value: Should be unique. Can be anything from 1-999. However 1-4 are currently occupied by the dusts of the old system for migration's sake, so avoid using them. The default-implemented dusts (Plant, gunpowder, etc.) are 100, 200, 300, and 400. They have been spaced out to give you the option of putting custom dusts in-between the default ones.
-
Proper Name: This is the name that will be displayed in the tooltip text for the item. For example: "Plant Runic Dust" It does not have to be unique.
-
ID Name: This is the name the dust will use to identify itself in the language registry. It does have to be unique. DustItemManager automatically registers the item localization string ("tile.idname.name") into Forge/Minecraft's language system, so you don't need to worry about that. The player will never see this, so you don't actually have to worry about what it says or looks like, so long as it is unique. Example: "plantdust"
-
Primary Color: The tinting color of the majority of the dust's texture. As highlighted in the image:
- Secondary Color: The tinting color of the shine on the dust's texture. As highlighted in the image:
- Floor Color: The color that will be used for rendering the dust when placed on the ground.
The system will automatically add the dusts you create to the creative inventory (in order of value), but you yourself must define the method by which players will obtain your dusts. Whether that is a shapeless recipe or an ancient dark magic ritual, you have to write it.
Your dust will simply be DustMod.idust with the damage value equal to the value you gave your custom dust.
Example:
//1xCoal + 2xTallGrass = 4xPlantRunicDust (value:100)
GameRegistry.addShapelessRecipe(new ItemStack(idust, 4, 100),
new ItemStack(Item.coal.shiftedIndex, 1, -1),
new ItemStack(Block.tallGrass, 1, -1),
new ItemStack(Block.tallGrass, 1, -1));
//imports: cpw.mods.fml.common.Mod.PostInit
// cpw.mods.fml.common.registry.GameRegistry
// dustmod.DustItemManager
// dustmod.DustMod
@PostInit
public void modsLoaded(cpw.mods.fml.common.event.FMLPostInitializationEvent evt) {
try {
int value = 350;
//Register the runic dust.
DustItemManager.registerDust(value, "Glowing Runic Dust", "glowrunedust", 0xFFD00D, 0xF7FF00, 0xE8D40C);
//1xCoal + 1xGlowstoneDust = 2x Glowing Runic Dust
GameRegistry.addShapelessRecipe(new ItemStack(DustMod.idust, 2, value)
new ItemStack(Item.coal, 1, -1), new ItemStack(Item.lightStoneDust, 1));
FMLLog.fine("Your_Mod has successfully registered runic dusts with the Runic Dust Mod.");
} catch (Exception ex) {
FMLLog.fine("Your_Mod was unable to register dusts with the Runic Dust Mod.");
}
}