Material Builder
Link to material-builder
If you want to build a material, you will need a Material Builder!
Doesn't sound that hard, does it?
Importing the package
Link to importing-the-package
It might be required for you to import the package if you encounter any issues, so better be safe than sorry and add the import.
import mods.contenttweaker.MaterialBuilder;
Retrieving such an object
Link to retrieving-such-an-object
You can retrieve a new, clear Builder using the MaterialSystem Package:
ZenScript Copyvar mBuilder = mods.contenttweaker.MaterialSystem.getMaterialBuilder();
Set the Material's Properties
Link to set-the-materials-properties
You can set these Properties
ZenMethod | Parameter |
---|---|
ZenMethod setName(name) | Parameter string name |
ZenMethod setColor(color) | Parameter int color |
ZenMethod setColor(color) | Parameter CTColor color |
ZenMethod setHasEffect(hasEffect) | Parameter boolean hasEffect |
All these Methods do 2 things: Firstly, they change the builder's Property, secondly they return the modified builder.
You can see in the example scripts below what this means.
Actually build the Material
Link to actually-build-the-material
Before you can build your material, you need to build it:
ZenScript CopymBuilder.build();
This returns an IMaterial Object.
Example Script
Link to example-script
ZenScript Copyimport mods.contentTweaker.MaterialSystem;
var builder = MaterialSystem.getMaterialBuilder();
builder.setName("Urubuntu");
builder.setColor(000151);
builder.setHasEffect(false);
val urubuntu = builder.build();
val arakantara = MaterialSystem.getMaterialBuilder().setName("Arakantara").setColor(15592941).setHasEffect(true).build();