Modifying Existing Materials
All periodic table elements are present in GT, but some of them don't have any properties attached. You can also add a BlastProperty for EBF autogenerated recipes. You can also do this for other materials such as Obsidian. Here is how you can add them:
periodic_table_elements.js
const $IngotProperty = Java.loadClass('com.gregtechceu.gtceu.api.data.chemical.material.properties.IngotProperty');
const $DustProperty = Java.loadClass('com.gregtechceu.gtceu.api.data.chemical.material.properties.DustProperty');
const $BlastProperty = Java.loadClass('com.gregtechceu.gtceu.api.data.chemical.material.properties.BlastProperty');
GTCEuStartupEvents.registry('gtceu:material', event => {
// Ingot
GTMaterials.Zirconium.setProperty(PropertyKey.INGOT, new $IngotProperty());
GTMaterials.Obsidian.setProperty(PropertyKey.INGOT, new $IngotProperty());
// Dust
GTMaterials.Selenium.setProperty(PropertyKey.DUST, new $DustProperty());
// Blast Property
GTMaterials.Zirconium.setProperty(PropertyKey.BLAST, new $BlastProperty(8000, 'higher', GTValues.VA(GTValues.MV), 8000));
});
Adding fluids to existing materials requires a bit of work with the new FluidStorage system
fluid_property.js
const $FluidProperty = Java.loadClass('com.gregtechceu.gtceu.api.data.chemical.material.properties.FluidProperty');
const $FluidBuilder = Java.loadClass('com.gregtechceu.gtceu.api.fluids.FluidBuilder');
const $FluidStorageKeys = Java.loadClass('com.gregtechceu.gtceu.api.fluids.store.FluidStorageKeys');
GTCEuStartupEvents.registry('gtceu:material', event => {
addFluid(GTMaterials.Iodine, $FluidStorageKeys.LIQUID); // Can be LIQUID, GAS, PLASMA or MOLTEN
addFluid(GTMaterials.Oganesson, $FluidStorageKeys.GAS);
}
let addFluid = (mat, key) => {
let prop = new $FluidProperty();
prop.getStorage().enqueueRegistration(key, new $FluidBuilder());
mat.setProperty(PropertyKey.FLUID, prop);
}
You can even add an ore to existing materials:
ore_property.js
GTCEuStartupEvents.registry('gtceu:material', event => {
const $OreProperty = Java.loadClass('com.gregtechceu.gtceu.api.data.chemical.material.properties.OreProperty');
// Zinc Ore
GTMaterials.Zinc.setProperty(PropertyKey.ORE, new $OreProperty());
});
You can also add flags to existing materials:
flags.js
GTCEuStartupEvents.registry('gtceu:material', event => {
GTMaterials.Lead.addFlags(GTMaterialFlags.GENERATE_GEAR); // This is for materials already in GTCEU
GTMaterials.get('custom_material_name').addFlags(GTMaterialFlags.GENERATE_FOIL); // This only works for materials added by GTCEU addons
});
Editing the color of an existing material:
material_modification.js
GTCEuStartupEvents.materialModification(event => {
GTMaterials.BismuthBronze.setMaterialARGB(0x82AD92) //(1)
})
- Most methods in the
Material
class can be used in thematerialModification
event