onEvent('fluid.registry', (event) => {
    const generalFluids = [
        {
            type: 'thick',
            id: 'molten_glowstone',
            texture: '0xFFBC5E'
        },
        {
            type: 'thin',
            id: 'soul_essence',
            texture: '0x3DD6E1'
        },
        {
            type: 'thick',
            id: 'industrial_adhesives',
            texture: '0x97897D'
        },
        {
            type: 'thin',
            id: 'otherworld_plantoil',
            texture: '0x715090',
            name: 'Otherworld Resin'
        },
        {
            type: 'thick',
            id: 'asphalt',
            texture: '0x303030'
        },
        {
            type: 'thick',
            id: 'energetic_molten_redstone',
            texture: '0x7f0b01'
        },
        {
            type: 'custom',
            id: 'pristine_ether_gas',
            texture: '0xa7efef'
        },
        {
            type: 'thin',
            id: 'witch_water',
            texture: '0x340E64'
        }
    ];

    generalFluids.forEach((fluid) => {

        if(!fluid.name) {
            fluid.name = fluid.id.split('_').map(lower => upperFst(lower)).join(' ');
        }
        let built = event.create(fluid.id).bucketColor(fluid.texture).displayName(fluid.name);

        if (fluid.type == 'thick') {
            built.textureThick(fluid.texture);
        } else if (fluid.type == 'thin') {
            built.textureThin(fluid.texture);
        } else if (fluid.type == 'custom') {
            if(!fluid.still) fluid.still = `kubejs:block/${fluid.id}_still`;
            if(!fluid.flow) fluid.flow = `kubejs:block/${fluid.id}_flow`;
            built.textureStill(fluid.still).textureFlowing(fluid.flow);
        }

    });
});

function upperFst(val) {
    return val.charAt(0).toUpperCase() + val.slice(1);
}
