mods.gregtech.material 包含了所有用来处理材料的类。

一个 mods.gregtech.material.Material 的对象代表着格雷科技里的一种材料,并且有一些有用的方法。

参数:

名称类型描述
名称
color
类型
int
描述
材料的 RGB 格式颜色
名称
chemicalFormula
类型
string
描述
材料的化学式
名称
iconSet
类型
MaterialIconSet
描述
生成元数据物品的图标集
名称
components
类型
ImmutableList
描述
这个材料的组成
名称
generationFlagsRaw
类型
long
描述
这个材料的生成标志(详见材料生成标志)
名称
element
类型
Element
描述
这个材料的组成元素

取值器:

名称类型描述
名称
radioactive
类型
bool
描述
如果这个材料有放射性则为True
名称
protons
类型
long
描述
名称
neutrons
类型
long
描述
名称
mass
类型
long
描述
名称
density
类型
long
描述
名称
camelCaseString
类型
string
描述
名称
unlocalizedName
类型
string
描述
名称
localizedName
类型
string
描述
仅限客户端
名称
name(名称)
类型
string
描述
材料注册的名称

方法:

名称(参数)描述
名称(参数)
addFlags(String... flagNames)
描述
添加生成标志
名称(参数)
hasFlag(String 标志名称)
描述
是否有生成标志

MaterialStack 可以由 材料 * 数字,与材料的数量或 FiuldStack 一样。

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

参数:

名称类型描述
名称
fluidTemperature
类型
int
描述

取值器:

名称类型描述
名称
hasFluid
类型
bool
描述
名称
hasPlasma
类型
bool
描述
名称
isGaseous
类型
bool
描述
名称
fluid
类型
ILiquidDefinition
描述
material fluid
名称
plasma
类型
ILiquidDefinition
描述
material plasma fluid

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

参数:

名称类型描述
名称
oreMultiplier
类型
int
描述
Crushed ore output amount multiplier during maceration
名称
byProductMultiplier
类型
int
描述
Byproducts output amount multiplier during pulverization
名称
smeltingMultiplier
类型
int
描述
Smelting item amount multiplier during vanilla item smelting
名称
directSmelting
类型
SolidMaterial
描述
Material to which smelting of this material ore will result
名称
washedIn
类型
FluidMaterial
描述
Material in which this material's ore should be washed to give additional output
名称
separatedInto
类型
DustMaterial
描述
During electromagnetic separation, this material ore will be separated onto this material and material specified by this field
名称
burnTime
类型
int
描述
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

取值器:

名称类型描述
名称
oreByProducts
类型
List
描述
List of ore by products
名称
harvestLevel
类型
int
描述
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.

参数:

名称类型描述
名称
handleMaterial
类型
SolidMaterial
描述
Material specified here will be required as handle to make tool from this material
名称
macerateInto
类型
DustMaterial
描述
Macerating any item of this material will result material specified in this field, default to itself

取值器:

Copy
<th>
  类型
</th>

<th>
  描述
</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>
名称
toolSpeed
toolDurability
toolEnchantments

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)描述
Name (case-insensitive)
DECOMPOSITION_BY_ELECTROLYZING
描述
Enables electrolyzer decomposition recipe generation
Name (case-insensitive)
DECOMPOSITION_BY_CENTRIFUGING
描述
Enables centrifuge decomposition recipe generation
Name (case-insensitive)
BURNING
描述
Add to material if it has constantly burning aura
Name (case-insensitive)
FLAMMABLE
描述
Add to material if it is some kind of flammable
Name (case-insensitive)
EXPLOSIVE
描述
Add to material if it is some kind of explosive
Name (case-insensitive)
NO_UNIFICATION
描述
Add to material to disable it's unification fully
Name (case-insensitive)
NO_RECYCLING
描述
Add to material if any of it's items cannot be recycled to get scrub
Name (case-insensitive)
DISABLE_DECOMPOSITION
描述
Disables decomposition recipe generation for this material and all materials that has it as component
Name (case-insensitive)
DECOMPOSITION_REQUIRES_HYDROGEN
描述
Decomposition recipe requires hydrogen as additional input. Amount is equal to input amount
Name (case-insensitive)
GENERATE_PLATE
描述
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
描述
Generate a dense plate.
Name (case-insensitive)
NO_WORKING
描述
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
描述
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
描述
Add to material if it's impossible to smelt it
Name (case-insensitive)
INDUCTION_SMELTING_LOW_OUTPUT
描述
Add to material if it is outputting less in an Induction Smelter.
Name (case-insensitive)
SMELT_INTO_FLUID
描述
Add to material if it melts into fluid (and it will also generate fluid for this material)
Name (case-insensitive)
EXCLUDE_BLOCK_CRAFTING_RECIPES
描述
Name (case-insensitive)
EXCLUDE_PLATE_COMPRESSOR_RECIPE
描述
Name (case-insensitive)
CRYSTALLISABLE
描述
If this material is crystallisable
Name (case-insensitive)
GENERATE_LENSE
描述
Name (case-insensitive)
HIGH_SIFTER_OUTPUT
描述
Name (case-insensitive)
GENERATE_FLUID_BLOCK
描述
Whenever system should generate fluid block for this fluid material
Name (case-insensitive)
GENERATE_PLASMA
描述
Add this flag to enable plasma generation for this material
Name (case-insensitive)
STATE_GAS
描述
Marks material state as gas
Name (case-insensitive)
GENERATE_ROD
描述
Name (case-insensitive)
GENERATE_GEAR
描述
Name (case-insensitive)
GENERATE_LONG_ROD
描述
Name (case-insensitive)
MORTAR_GRINDABLE
描述
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);