Added colorRenderCache to refinery filter slots
This commit is contained in:
parent
4b80435f3d
commit
76c35e28af
2 changed files with 15 additions and 5 deletions
|
@ -1,6 +1,5 @@
|
||||||
package buildcraft.core.gui;
|
package buildcraft.core.gui;
|
||||||
|
|
||||||
import buildcraft.core.render.FluidRenderer;
|
|
||||||
import net.minecraft.client.renderer.OpenGlHelper;
|
import net.minecraft.client.renderer.OpenGlHelper;
|
||||||
import net.minecraft.client.renderer.RenderHelper;
|
import net.minecraft.client.renderer.RenderHelper;
|
||||||
import net.minecraft.client.renderer.texture.TextureMap;
|
import net.minecraft.client.renderer.texture.TextureMap;
|
||||||
|
@ -9,10 +8,11 @@ import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.Icon;
|
import net.minecraft.util.Icon;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraftforge.fluids.Fluid;
|
import net.minecraftforge.fluids.Fluid;
|
||||||
import net.minecraftforge.fluids.FluidStack;
|
|
||||||
|
|
||||||
import org.lwjgl.opengl.GL11;
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
|
import buildcraft.core.render.FluidRenderer;
|
||||||
|
|
||||||
public abstract class GuiAdvancedInterface extends GuiBuildCraft {
|
public abstract class GuiAdvancedInterface extends GuiBuildCraft {
|
||||||
|
|
||||||
public abstract class AdvancedSlot {
|
public abstract class AdvancedSlot {
|
||||||
|
@ -172,12 +172,13 @@ public abstract class GuiAdvancedInterface extends GuiBuildCraft {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* For the refinery, a king of phantom slot for fluid.
|
* For the refinery, a kind of phantom slot for fluid.
|
||||||
*/
|
*/
|
||||||
//TODO Get this class working well (Now it's just here to let the refinery compil)
|
//TODO Get this class working well (Now it's just here to let the refinery compil)
|
||||||
public class FluidSlot extends AdvancedSlot {
|
public class FluidSlot extends AdvancedSlot {
|
||||||
|
|
||||||
public Fluid fluid;
|
public Fluid fluid;
|
||||||
|
public int colorRenderCache;
|
||||||
|
|
||||||
public FluidSlot(int x, int y) {
|
public FluidSlot(int x, int y) {
|
||||||
super(x, y);
|
super(x, y);
|
||||||
|
@ -185,8 +186,12 @@ public abstract class GuiAdvancedInterface extends GuiBuildCraft {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawSprite(int cornerX, int cornerY) {
|
public void drawSprite(int cornerX, int cornerY) {
|
||||||
if (fluid != null)
|
if (fluid != null) {
|
||||||
FluidRenderer.setColorForFluidStack(new FluidStack(fluid, 100));
|
float red = (float) (colorRenderCache >> 16 & 255) / 255.0F;
|
||||||
|
float green = (float) (colorRenderCache >> 8 & 255) / 255.0F;
|
||||||
|
float blue = (float) (colorRenderCache & 255) / 255.0F;
|
||||||
|
GL11.glColor4f(red, green, blue, 1);
|
||||||
|
}
|
||||||
super.drawSprite(cornerX, cornerY);
|
super.drawSprite(cornerX, cornerY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -82,8 +82,10 @@ public class GuiRefinery extends GuiAdvancedInterface {
|
||||||
}
|
}
|
||||||
|
|
||||||
container.setFilter(position, liquid.getFluid());
|
container.setFilter(position, liquid.getFluid());
|
||||||
|
container.refinery.tankManager.get(position).colorRenderCache = liquid.getFluid().getColor(liquid);
|
||||||
} else {
|
} else {
|
||||||
container.setFilter(position, null);
|
container.setFilter(position, null);
|
||||||
|
container.refinery.tankManager.get(position).colorRenderCache = 0xFFFFFF;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
TileRefinery ref = (TileRefinery) this.tile;
|
TileRefinery ref = (TileRefinery) this.tile;
|
||||||
|
@ -102,7 +104,9 @@ public class GuiRefinery extends GuiAdvancedInterface {
|
||||||
Fluid filter1 = container.getFilter(1);
|
Fluid filter1 = container.getFilter(1);
|
||||||
|
|
||||||
((FluidSlot) slots[0]).fluid = filter0;
|
((FluidSlot) slots[0]).fluid = filter0;
|
||||||
|
((FluidSlot) slots[0]).colorRenderCache = container.refinery.tank1.colorRenderCache;
|
||||||
((FluidSlot) slots[1]).fluid = filter1;
|
((FluidSlot) slots[1]).fluid = filter1;
|
||||||
|
((FluidSlot) slots[1]).colorRenderCache = container.refinery.tank2.colorRenderCache;
|
||||||
|
|
||||||
FluidStack liquid0 = null;
|
FluidStack liquid0 = null;
|
||||||
FluidStack liquid1 = null;
|
FluidStack liquid1 = null;
|
||||||
|
@ -118,6 +122,7 @@ public class GuiRefinery extends GuiAdvancedInterface {
|
||||||
|
|
||||||
if (recipe != null) {
|
if (recipe != null) {
|
||||||
((FluidSlot) slots[2]).fluid = recipe.result.getFluid();
|
((FluidSlot) slots[2]).fluid = recipe.result.getFluid();
|
||||||
|
((FluidSlot) slots[2]).colorRenderCache = recipe.result.getFluid().getColor(recipe.result);
|
||||||
} else {
|
} else {
|
||||||
((FluidSlot) slots[2]).fluid = null;
|
((FluidSlot) slots[2]).fluid = null;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue