Material
Link to material
Calling the package
Link to calling-the-package
The mods.gregtech.material
package contains all classes you will need to deal with materials.
Material Object
Link to material-object
An object of mods.gregtech.material.Material
represents a material in GregTech, with some useful members you can deal with.
Properties:
Name | Type | Beschreibung |
---|---|---|
Name color | Type int | Beschreibung Color of material in RGB format |
Name chemicalFormula | Type string | Beschreibung Chemical formula of this material |
Name iconSet | Type MaterialIconSet | Beschreibung Icon set for this material meta-items generation |
Name components | Type ImmutableList | Beschreibung List of this material component |
Name generationFlagsRaw | Type long | Beschreibung Generation flags of this material (See MatFlags) |
Name element | Type Element | Beschreibung Element of this material consist of |
Getters:
Name | Type | Beschreibung |
---|---|---|
Name radioactive | Type bool | Beschreibung True if this material is radioactive |
Name protons | Type long | Beschreibung |
Name neutrons | Type long | Beschreibung |
Name mass | Type long | Beschreibung |
Name density | Type long | Beschreibung |
Name camelCaseString | Type string | Beschreibung |
Name unlocalizedName | Type string | Beschreibung |
Name localizedName | Type string | Beschreibung Client-side only |
Name name | Type string | Beschreibung Name in the Material registry |
Methods:
Name (Parameters) | Beschreibung |
---|---|
Name (Parameters) addFlags(String... flagNames) | Beschreibung Add generation flags |
Name (Parameters) hasFlag(String flagName) | Beschreibung Has a generation flag |
MaterialStack
can be created by material * number
, same as Amount of Ingredient or FluidStack.
FluidMaterial
Link to fluidmaterial
FluidMaterial
is a material which contains fluid features. Its superclass is Material
so all members in Material
is still available.
Properties:
Name | Type | Beschreibung |
---|---|---|
Name fluidTemperature | Type int | Beschreibung |
Getters:
Name | Type | Beschreibung |
---|---|---|
Name hasFluid | Type bool | Beschreibung |
Name hasPlasma | Type bool | Beschreibung |
Name isGaseous | Type bool | Beschreibung |
Name fluid | Type ILiquidDefinition | Beschreibung material fluid |
Name plasma | Type ILiquidDefinition | Beschreibung material plasma fluid |
DustMaterial
Link to dustmaterial
DustMaterial
is a material which contains dust features. Its superclass is FluidMaterial
so all members in FluidMaterial
is still available.
Properties:
Name | Type | Beschreibung |
---|---|---|
Name oreMultiplier | Type int | Beschreibung Crushed ore output amount multiplier during maceration |
Name byProductMultiplier | Type int | Beschreibung Byproducts output amount multiplier during pulverization |
Name smeltingMultiplier | Type int | Beschreibung Smelting item amount multiplier during vanilla item smelting |
Name directSmelting | Type SolidMaterial | Beschreibung Material to which smelting of this material ore will result |
Name washedIn | Type FluidMaterial | Beschreibung Material in which this material's ore should be washed to give additional output |
Name separatedInto | Type DustMaterial | Beschreibung During electromagnetic separation, this material ore will be separated onto this material and material specified by this field |
Name burnTime | Type int | Beschreibung 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:
Name | Type | Beschreibung |
---|---|---|
Name oreByProducts | Type List | Beschreibung List of ore by products |
Name harvestLevel | Type int | Beschreibung Tool level needed to harvest block of this material |
SolidMaterial
Link to solidmaterial
SolidMaterial
is a material which contains solid features. Its superclass is DustMaterial
so all members in DustMaterial
is still available.
Properties:
Name | Type | Beschreibung |
---|---|---|
Name handleMaterial | Type SolidMaterial | Beschreibung Material specified here will be required as handle to make tool from this material |
Name macerateInto | Type DustMaterial | Beschreibung Macerating any item of this material will result material specified in this field, default to itself |
Getters:
Copy<th>
Type
</th>
<th>
Beschreibung
</th>
Copy<td>
float
</td>
<td>
Speed of tools made from this material, default 1.0f
</td>
Copy<td>
int
</td>
<td>
Durability of tools made from this material, 0 for materials that can't be used for tools
</td>
Copy<td>
List<EnchantmentData>
</td>
<td>
Enchantment to be applied to tools made from this material
</td>
Name |
---|
toolSpeed |
toolDurability |
toolEnchantments |
IngotMaterial
Link to ingotmaterial
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 Copyvar 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 Copyvar 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) | Beschreibung |
---|---|
Name (case-insensitive) DECOMPOSITION_BY_ELECTROLYZING | Beschreibung Enables electrolyzer decomposition recipe generation |
Name (case-insensitive) DECOMPOSITION_BY_CENTRIFUGING | Beschreibung Enables centrifuge decomposition recipe generation |
Name (case-insensitive) BURNING | Beschreibung Add to material if it has constantly burning aura |
Name (case-insensitive) FLAMMABLE | Beschreibung Add to material if it is some kind of flammable |
Name (case-insensitive) EXPLOSIVE | Beschreibung Add to material if it is some kind of explosive |
Name (case-insensitive) NO_UNIFICATION | Beschreibung Add to material to disable it's unification fully |
Name (case-insensitive) NO_RECYCLING | Beschreibung Add to material if any of it's items cannot be recycled to get scrub |
Name (case-insensitive) DISABLE_DECOMPOSITION | Beschreibung Disables decomposition recipe generation for this material and all materials that has it as component |
Name (case-insensitive) DECOMPOSITION_REQUIRES_HYDROGEN | Beschreibung Decomposition recipe requires hydrogen as additional input. Amount is equal to input amount |
Name (case-insensitive) GENERATE_PLATE | Beschreibung 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 | Beschreibung Generate a dense plate. |
Name (case-insensitive) NO_WORKING | Beschreibung 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 | Beschreibung 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 | Beschreibung Add to material if it's impossible to smelt it |
Name (case-insensitive) INDUCTION_SMELTING_LOW_OUTPUT | Beschreibung Add to material if it is outputting less in an Induction Smelter. |
Name (case-insensitive) SMELT_INTO_FLUID | Beschreibung Add to material if it melts into fluid (and it will also generate fluid for this material) |
Name (case-insensitive) EXCLUDE_BLOCK_CRAFTING_RECIPES | Beschreibung |
Name (case-insensitive) EXCLUDE_PLATE_COMPRESSOR_RECIPE | Beschreibung |
Name (case-insensitive) CRYSTALLISABLE | Beschreibung If this material is crystallisable |
Name (case-insensitive) GENERATE_LENSE | Beschreibung |
Name (case-insensitive) HIGH_SIFTER_OUTPUT | Beschreibung |
Name (case-insensitive) GENERATE_FLUID_BLOCK | Beschreibung Whenever system should generate fluid block for this fluid material |
Name (case-insensitive) GENERATE_PLASMA | Beschreibung Add this flag to enable plasma generation for this material |
Name (case-insensitive) STATE_GAS | Beschreibung Marks material state as gas |
Name (case-insensitive) GENERATE_ROD | Beschreibung |
Name (case-insensitive) GENERATE_GEAR | Beschreibung |
Name (case-insensitive) GENERATE_LONG_ROD | Beschreibung |
Name (case-insensitive) MORTAR_GRINDABLE | Beschreibung 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
.
Usage
Link to usage
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);
Beispiel
Link to beispiel
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);