Materials
First of all, the best docs is the source itself: Source
INFO
This docs goes of GroovyScript version 0.4.0 and GTCEu 2.5.4
What is Material
Material is the basis of CEu. It defines a substance and its properties. It usually takes the form of an element ( i.e. Oxygen) or a compound (i.e. Water), but it can also take the form of something weird like the Eye of Ender.
Which Properties are defined?
The Material specifies whether it has a Fluid property, plasma property, dust property, gem property or ingot property. When it has a specific property, GTCEu will register the corresponding item or fluid automatically. Some properties will require others, like Ingot requiring Dust.
What else does it define?
You can additionally define Colors, Flags (indicators for specific attributes), MaterialIconSet (textures), CableProperties, Element, Formula (tooltips), Components and more. Don't worry, they are not complicated, and will be introduced in detail below.
Retrieving Existing Materials
There are two good ways to do this: the simple way and the not simple way.
The Simple Way
This method requires the Material to first exist. This method goes off of the material's Unlocalized Name, which is the name used before it is translated in a lang file. You can use the /gs hand
command to retrieve the material of items.
// assigns the variable my_material to a Material called Steel.
def my_material = material('steel')
This is a global function.
The Not Simple Way
This method also works exactly the same as before, but the former is much easier and more convenient. It is strongly recommended to use the Simple Way.
// import the Material class to use Materials
import gregtech.api.unification.material.Materials
// assigns the variable my_material to a Material called Steel.
var my_material = Materials.Steel
Getting Material Properties
Getters:
chemicalFormula
returns a string representation of the internal chemical formula (i.e. "H2O")materialRGB
returns the in color of the materialradioactive
returns whether the material is radioactiveprotons
returns the number of protons in the materialneutrons
returns the number of neutrons in the materialmass
returns the total amount of mass in the materialaverageProtons
returns the amount of protons divided by total amount of components in the materialaverageNeutrons
returns the amount of neutrons divided by total amount of components in the materialaverageMass
returns the amount of mass divided by total amount of components in the materialblastTemperature
returns the material's blast furnace temperaturetoCamelCaseString()
returns the string camelCase form of the material's unlocalized name. I.e. a name of "my_material" returns " myMaterial"unlocalizedName
returns the string of the material's unlocalized namelocalizedName
returns the string of the material's localized (translated) namename
returns toString() used on the material internally
Checking if properties exist
hasDust()
returns if the material has the dust propertyhasIngot()
returns if the material has the ingot propertyhasGem()
returns if the material has the gem propertyhasOre()
returns if the material has the ore propertyhasFluid()
returns if the material has the fluid property (this is true when the material has a liquid, gas OR plasma)hasBlastTemp()
returns if the material has the blast propertyhasTools()
returns if the material has the tool propertyhasFluidPipes()
returns if the material has the fluid pipe propertyhasItemPipes()
returns if the material has the item pipe propertyhasWires()
returns if the material has the cable propertyhasProperty(PropertyKey key)
returns if the material has the property of the key