MaterialSystem
The MaterialSystem is used to create new or retrieve existing Materials from within CT.
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.MaterialSystem;
IPartType
Create
Required Parameters:
- String name: The part type’s name → e.g. “dense_gear”
- IRegisterMaterialPart registerMaterialPart → A function that handles how the Material parts will be created.
Retrieve
Required Parameters:
- String name: The part type’s name → e.g. “gear” For a list of all available part types check the part type page.
IMaterial
Create
Unlike the PartType, you cannot directly create a Material, instead you need to use a MaterialBuilder. Check the MaterialBuilder entry for info on what exactly to do with these.
Retrieve
Required Parameters:
- String name: The Material’s name → e.g. “Platinum”
IPart
Create
Unlike the PartType, you cannot directly create a Part, instead you need to use a PartBuilder. Check the Part entry for info on what exactly to do with these.
Retrieve
Required Parameters:
- String name: The Part’s name
IPartDataPiece
Create
Required Parameters:
- String name: The Data Piece’s name
- boolean required: Is the data piece required?
Register multiple MaterialParts
Even though you can also do this using the Material’s own functionality, this Method allows you to register Parts for a given Material
Required Parameters:
- Material material: The material that the registered parts should be made of
- String[] partNames: The names of the parts that should be registered → e.g. [“gear”, “ingot”]
Retrieve already registered things:
You can use these methods to retrieve a map using strings as keys and the object as values:
Method Name | Return Type |
---|---|
Method Name getMaterialParts() | Return Type Map<String, IMaterialPart> |
Method Name getMaterials() | Return Type Map<String, IMaterial> |
Method Name getParts() | Return Type Map<String, IPart> |
Method Name getPartType() | Return Type Map<String, IPartType> |