Calling the package

Link to calling-the-package

The mods.gregtech.material package contains all classes you will need to deal with materials.

An object of mods.gregtech.material.Material represents a material in GregTech, with some useful members you can deal with.

Properties:

NameTypeDescription
Name
color
Type
int
Description
Color of material in RGB format
Name
chemicalFormula
Type
string
Description
Chemical formula of this material
Name
iconSet
Type
MaterialIconSet
Description
Icon set for this material meta-items generation
Name
components
Type
ImmutableList
Description
List of this material component
Name
generationFlagsRaw
Type
long
Description
Generation flags of this material (See MatFlags)
Name
element
Type
Element
Description
Element of this material consist of

Getters:

NameTypeDescription
Name
radioactive
Type
bool
Description
True if this material is radioactive
Name
protons
Type
long
Description
Name
neutrons
Type
long
Description
Name
mass
Type
long
Description
Name
density
Type
long
Description
Name
camelCaseString
Type
string
Description
Name
unlocalizedName
Type
string
Description
Name
localizedName
Type
string
Description
Client-side only
Name
name
Type
string
Description
Name in the Material registry

Methods:

Name (Parameters)Description
Name (Parameters)
addFlags(String... flagNames)
Description
Add generation flags
Name (Parameters)
hasFlag(String flagName)
Description
Has a generation flag

MaterialStack can be created by material * number, same as Amount of Ingredient or FluidStack.

FluidMaterial is a material which contains fluid features. Its superclass is Material so all members in Material is still available.

Properties:

NameTypeDescription
Name
fluidTemperature
Type
int
Description

Getters:

NameTypeDescription
Name
hasFluid
Type
bool
Description
Name
hasPlasma
Type
bool
Description
Name
isGaseous
Type
bool
Description
Name
fluid
Type
ILiquidDefinition
Description
material fluid
Name
plasma
Type
ILiquidDefinition
Description
material plasma fluid

DustMaterial is a material which contains dust features. Its superclass is FluidMaterial so all members in FluidMaterial is still available.

Properties:

NameTypeDescription
Name
oreMultiplier
Type
int
Description
Crushed ore output amount multiplier during maceration
Name
byProductMultiplier
Type
int
Description
Byproducts output amount multiplier during pulverization
Name
smeltingMultiplier
Type
int
Description
Smelting item amount multiplier during vanilla item smelting
Name
directSmelting
Type
SolidMaterial
Description
Material to which smelting of this material ore will result
Name
washedIn
Type
FluidMaterial
Description
Material in which this material's ore should be washed to give additional output
Name
separatedInto
Type
DustMaterial
Description
During electromagnetic separation, this material ore will be separated onto this material and material specified by this field
Name
burnTime
Type
int
Description
Burn time of this material when used as fuel in furnace smelting, Zero or negative value indicates that this material cannot be used as fuel

Getters:

NameTypeDescription
Name
oreByProducts
Type
List
Description
List of ore by products
Name
harvestLevel
Type
int
Description
Tool level needed to harvest block of this material

SolidMaterial is a material which contains solid features. Its superclass is DustMaterial so all members in DustMaterial is still available.

Properties:

NameTypeDescription
Name
handleMaterial
Type
SolidMaterial
Description
Material specified here will be required as handle to make tool from this material
Name
macerateInto
Type
DustMaterial
Description
Macerating any item of this material will result material specified in this field, default to itself

Getters:

NameTypeDescription
Name
toolSpeed
Type
float
Description
Speed of tools made from this material, default 1.0f
Name
toolDurability
Type
int
Description
Durability of tools made from this material, 0 for materials that can't be used for tools
Name
toolEnchantments
Type
List
Description
Enchantment to be applied to tools made from this material

IngotMaterial is a mterial which contains ingot features. Its superclass is SolidMaterial so all members in SolidMaterial is still available.

Ingot materials can be used as wire, cable and fluid pipe. Those properties can be set by setCableProperties(long voltage, int baseAmperage, int lossPerBlock) and setFluidPipeProperties(int throughput, int maxTemperature, boolean gasProof).

For example:

ZenScript
Copy
var ingotMaterial = MaterialRegistry.createIngotMaterial(2052, "test", 0x1a2f3e, "ingot", 1);
ingotMaterial.setCableProperties(128, 4, 1); // 128EU/t 4A 1 loss/block

Enchantment data

Link to enchantment-data

gregtech.mods.EnchantmentData can be found in SolidMaterial#toolEnchantments, they are an internal storage of a enchantment with levels.

They can be casted into crafttweaker.enchantments.IEnchantmentDefinition by calling enchantment getter, and level is available with level getter.

To add a enchantment for tools in SolidMaterial, simply calling addToolEnchantment(IEnchantment enchantment), to add a CraftTweaker enchantment data type.

Example for a Fortune I material:

ZenScript
Copy
var material = MaterialRegistry.get("iron"); // Modify iron material
material.addToolEnchantment(<enchantment:minecraft:fortune> * 1); // Create a enchantment object and add it

Material generation flags

Link to material-generation-flags

These flags are applicable to materials.

Name (case-insensitive)Description
Name (case-insensitive)
DECOMPOSITION_BY_ELECTROLYZING
Description
Enables electrolyzer decomposition recipe generation
Name (case-insensitive)
DECOMPOSITION_BY_CENTRIFUGING
Description
Enables centrifuge decomposition recipe generation
Name (case-insensitive)
BURNING
Description
Add to material if it has constantly burning aura
Name (case-insensitive)
FLAMMABLE
Description
Add to material if it is some kind of flammable
Name (case-insensitive)
EXPLOSIVE
Description
Add to material if it is some kind of explosive
Name (case-insensitive)
NO_UNIFICATION
Description
Add to material to disable it's unification fully
Name (case-insensitive)
NO_RECYCLING
Description
Add to material if any of it's items cannot be recycled to get scrub
Name (case-insensitive)
DISABLE_DECOMPOSITION
Description
Disables decomposition recipe generation for this material and all materials that has it as component
Name (case-insensitive)
DECOMPOSITION_REQUIRES_HYDROGEN
Description
Decomposition recipe requires hydrogen as additional input. Amount is equal to input amount
Name (case-insensitive)
GENERATE_PLATE
Description
Generate a plate for this material, If it's dust material, dust compressor recipe into plate will be generated, If it's metal material, bending machine recipes will be generated, If block is found, cutting machine recipe will be also generated
Name (case-insensitive)
GENERATE_DENSE
Description
Generate a dense plate.
Name (case-insensitive)
NO_WORKING
Description
Add to material if it cannot be worked by any other means, than smashing or smelting. This is used for coated Materials.
Name (case-insensitive)
NO_SMASHING
Description
Add to material if it cannot be used for regular Metal working techniques since it is not possible to bend it.
Name (case-insensitive)
NO_SMELTING
Description
Add to material if it's impossible to smelt it
Name (case-insensitive)
INDUCTION_SMELTING_LOW_OUTPUT
Description
Add to material if it is outputting less in an Induction Smelter.
Name (case-insensitive)
SMELT_INTO_FLUID
Description
Add to material if it melts into fluid (and it will also generate fluid for this material)
Name (case-insensitive)
EXCLUDE_BLOCK_CRAFTING_RECIPES
Description
Name (case-insensitive)
EXCLUDE_PLATE_COMPRESSOR_RECIPE
Description
Name (case-insensitive)
CRYSTALLISABLE
Description
If this material is crystallisable
Name (case-insensitive)
GENERATE_LENSE
Description
Name (case-insensitive)
HIGH_SIFTER_OUTPUT
Description
Name (case-insensitive)
GENERATE_FLUID_BLOCK
Description
Whenever system should generate fluid block for this fluid material
Name (case-insensitive)
GENERATE_PLASMA
Description
Add this flag to enable plasma generation for this material
Name (case-insensitive)
STATE_GAS
Description
Marks material state as gas
Name (case-insensitive)
GENERATE_ROD
Description
Name (case-insensitive)
GENERATE_GEAR
Description
Name (case-insensitive)
GENERATE_LONG_ROD
Description
Name (case-insensitive)
MORTAR_GRINDABLE
Description
If this Material is grindable with a simple Mortar

Material icon set

Link to material-icon-set

Icon sets are available in mods.gregtech.material.MaterialIconSet.

  • NONE
  • METALLIC
  • DULL
  • MAGNETIC
  • QUARTZ
  • DIAMOND
  • EMERALD
  • SHINY
  • SHARDS
  • ROUGH
  • FINE
  • SAND
  • FLINT
  • RUBY
  • LAPIS
  • POWDER
  • FLUID
  • GAS
  • LIGNITE
  • OPAL
  • GLASS
  • WOOD
  • LEAF
  • GEM_HORIZONTAL
  • GEM_VERTICAL
  • PAPER
  • NETHERSTAR

Getters are name.

Methods are toString(), and static method getByName(String name).

Material Registry

Link to material-registry

Material registry is a helper to get, list and create materials in the unification system.

You may import the class mods.gregtech.material.MaterialRegistry.

ZenScript
Copy
#loader gregtech
import mods.gregtech.material.MaterialRegistry;

// Note that return type can be null if nothing was found
var material = MaterialRegistry.get(materialName);

// List all materials registered
var materialList = MaterialRegistry.getAllMaterials();

// Set toolDurability to 0 if ingot cannot be used as tool
// Note that an @Optional parameter can be left out, and it's replaced by default 0.
// Means Gem and Ingot material cannot be used as tool by default.
MaterialRegistry.createFluidMaterial(int metaItemSubId, String name, int color, String iconSet, @Optional MaterialStack[] materialComponents);

MaterialRegistry.createDustMaterial(int metaItemSubId, String name, int color, String iconSet, int harvestLevel, @Optional MaterialStack[] materialComponents);

MaterialRegistry.createGemMaterial(int metaItemSubId, String name, int color, String iconSet, int harvestLevel, @Optional MaterialStack[] materialComponents, @Optional float toolSpeed, @Optional int toolDurability);

MaterialRegistry.createIngotMaterial(int metaItemSubId, String name, int color, String iconSet, int harvestLevel, @Optional MaterialStack[] materialComponents, @Optional float toolSpeed, @Optional int toolDurability, @Optional int blastFurnaceTemperature);
ZenScript
Copy
#loader gregtech
import mods.gregtech.material.MaterialRegistry;

val dustMaterial = MaterialRegistry.createDustMaterial(700, "test", 0xFFAA33, "dull", 2);
dustMaterial.addFlags(["GENERATE_ORE", "GENERATE_PLATE"]);

//Creates a gem-material with a tooltip showing the chemical formula
//This automatically generates an electrolyzer recipe to split this material into its constituent parts.
val gemFancy = MaterialRegistry.createGemMaterial(701, "some_fancy_gemstone", 0x0F3E4E2, "gem_horizontal", 1, [<material:beryllium>*4, <material:silicon>*2, <material:oxygen>*9, <material:hydrogen>*2], 1.0, 0);

//Any previouly registered material can be used- including custom ones.
val ingotComplex = MaterialRegistry.createIngotMaterial(702, "complex_alloy", 0xF6872E, "shiny", 1, [<material:copper>*3, <material:electrum>*1, <material:redstone>*9, <material:some_fancy_gemstone>*2], 3.5, 0);