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:
Material Modification Order
Remember to perform material modification after the material you wish to modify has been created.
The java PostMaterialEvent forge event will always fire after all materials have been created.
The kjs GTCEuStartupEvents.materialModification event will always fire after all materials have been created.
@SubscribeEvent
public static void materialModification(PostMaterialEvent 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, BlastProperty.GasTier.HIGHER));
}
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.materialModification(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'));
});
Adding fluids to existing materials:
@SubscribeEvent
public static void materialModification(PostMaterialEvent event) {
GTMaterials.Iodine.setProperty(PropertyKey.FLUID, new FluidProperty(FluidStorageKeys.LIQUID, new FluidBuilder()));
GTMaterials.Oganesson.setProperty(PropertyKey.FLUID, new FluidProperty(FluidStorageKeys.GAS, new FluidBuilder()));
}
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.materialModification(event => {
GTMaterials.Iodine.setProperty(PropertyKey.FLUID, new $FluidProperty($FluidStorageKeys.LIQUID, new $FluidBuilder()));
GTMaterials.Oganesson.setProperty(PropertyKey.FLUID, new $FluidProperty($FluidStorageKeys.GAS, new $FluidBuilder()));
});
You can even add an ore to existing materials:
Do note that to edit keys that already exist on materials, you have to remove them first:
const $WireProperties = Java.loadClass("com.gregtechceu.gtceu.api.data.chemical.material.properties.WireProperties")
GTCEuStartupEvents.materialModification(event => {
GTMaterials.RedAlloy.removeProperty(PropertyKey.WIRE)
GTMaterials.RedAlloy.setProperty(PropertyKey.WIRE, new $WireProperties(8, 1, 0, true))
})
You can also add flags to existing materials:
Editing the color of an existing material:
- Most methods in the
Materialclass can be used in thePostMaterialEvent/materialModificationevent