---
title: Modifying Existing Materials
---


# 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:

```js title="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

```js title="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');

let addFluid = (mat, key) => {
    let prop = new $FluidProperty();
    prop.getStorage().enqueueRegistration(key, new $FluidBuilder());
    mat.setProperty(PropertyKey.FLUID, prop);
}

GTCEuStartupEvents.registry('gtceu:material', event => {
    addFluid(GTMaterials.Iodine, $FluidStorageKeys.LIQUID); // Can be LIQUID, GAS, PLASMA or MOLTEN
    addFluid(GTMaterials.Oganesson, $FluidStorageKeys.GAS);
});
```

You can even add an ore to existing materials:

```js title="ore_property.js"
GTCEuStartupEvents.registry('gtceu:material', event => {

const $OreProperty = Java.loadClass('com.gregtechceu.gtceu.api.data.chemical.material.properties.OreProperty');

    GTMaterials.Zinc.setProperty(PropertyKey.ORE, new $OreProperty());
    
});
```

Do note that to edit keys that already exist on materials, you have to remove them first:
```js title="modifying_properties.js"
const $WireProperties = Java.loadClass("com.gregtechceu.gtceu.api.data.chemical.material.properties.WireProperties")

GTCEuStartupEvents.registry('gtceu:material', 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:

```js title="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:


```js title="material_modification.js"
GTCEuStartupEvents.materialModification(event => {
    GTMaterials.BismuthBronze.setMaterialARGB(0x82AD92) //(1)
})
```

1. Most methods in the [``Material`` class](https://github.com/GregTechCEu/GregTech-Modern/blob/1.20.1/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/Material.java) can be used in the ``materialModification`` event
