Material Builder
Using this package you can create materials that you can then create tools with!
Importing the class
It might be required for you to import the class if you encounter any issues (like casting an Array), so better be safe than sorry and add the import.
import mods.contenttweaker.tconstruct.MaterialBuilder;
Creating a Material
First and foremost you will need to create a Material Builder.
This can be done using the static create method.
Remember, that you will need to register the material after you’ve done your changes.
This can be done with the register
method which will return a Material Representation of the new Material.
Properties
You can set and get these properties using myMaterial.name
.
Property | Type | Additional notes |
---|---|---|
Property identifier | Type string | Additional notes Unique name |
Property color | Type int | Additional notes |
Property hidden | Type bool | Additional notes |
Property liquid | Type ILiquidStack | Additional notes Smeltery output |
Property craftable | Type bool | Additional notes Can be created in the part builder |
Property castable | Type bool | Additional notes Can be created using casts. Requires liquid to be set! |
Property representativeItem | Type IItemStack | Additional notes Shown item in the tinkers’ manual |
Property representativeOre | Type IOreDictEntry | Additional notes Shown if representativeItem is null |
Property shard | Type IItemStack | Additional notes Used instead of the tinker’s shard item in the part builder. |
Property localizedName | Type string | Additional notes The shown name |
Calculated Properties
ItemLocalizer
You can use this function to calculate the material names if you need that to be the case.
Uses a Material Representation of this material and the name of the tool that’s being renamed (e.g. “Mattock”)
Add Material Items
If you use the given item in the part builder, you can set how many materialpoints that will give, or how much the item will repair.
item
is the item that is matched against. You can use Item Conditions but no Transformers.amountNeeded
is the amount of items that is matched against. You can split them over all the slots the toolforge provides, which also allows you to go above 64. In the second example above, you need 4 iron blocks per addition. Defaults to 1.amountMatched
is the amount of material points added peramountNeeded
. In the second example above four iron blocks give two material points. Defaults to 144 (one ingot/one Material value).- If you use the
remove function
, it will remove all trait ingredients that match for the item.
Material Traits
You can add a trait to the material.
All items made from this material will then have this trait.
Uses a String with the identifier of the trait, and an optional dependency
string which will tell you which itemTypes should be affected by the trait.
Alternatively, you can use a Trait Representation, though that only works if the trait is already initialized by the time CoT runs (so most likely only for custom traits).
Possible values for dependency
are:
null
(default) → All items, unless that dep already has other traits."head"
"handle"
"extra"
"bow"
"bowstring"
"projectile"
"shaft"
"fletching"
You can remove materialTraits as well (which is especially useful when doing batch materials).
You remove them using their identifier string and an optional dependency.
If you omit the dependency or use null
all traits with that identifier will be removed.
Material Stats
In order for TiCon to build your materials, it needs to know the material stats.
Only tooltypes whose stat has been added will be built!