aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/xmod/gregtech/api/objects/GregtechFluid.java
blob: 56a48602c9779fcfc0dc6102e9c082b960d522da (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package gtPlusPlus.xmod.gregtech.api.objects;

import gregtech.api.GregTech_API;
import gtPlusPlus.core.lib.CORE;
import net.minecraftforge.fluids.Fluid;

public class GregtechFluid extends Fluid implements Runnable {
    public final String mTextureName;
    private final short[] mRGBa;

    public GregtechFluid(String aName, String aTextureName, short[] aRGBa) {
        super(aName);
        mRGBa = aRGBa;
        mTextureName = aTextureName;
        GregTech_API.sGTBlockIconload.add(this);
    }

    @Override
    public int getColor() {
        return (Math.max(0, Math.min(255, mRGBa[0])) << 16) | (Math.max(0, Math.min(255, mRGBa[1])) << 8) | Math.max(0, Math.min(255, mRGBa[2]));
    }

    @Override
    public void run() {
        setIcons(GregTech_API.sBlockIcons.registerIcon(CORE.MODID+ ":" + "fluids/fluid." + mTextureName));
    }
}