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
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
You can retrieve a new, clear Builder using the MaterialSystem Package:
var mBuilder = mods.contenttweaker.MaterialSystem.getMaterialBuilder();
Set the Material’s 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
Before you can build your material, you need to build it:
mBuilder.build();
This returns an IMaterial Object.
Example Script
import 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();