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;
|
||||
|
||||
import buildcraft.core.render.FluidRenderer;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
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.ResourceLocation;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import buildcraft.core.render.FluidRenderer;
|
||||
|
||||
public abstract class GuiAdvancedInterface extends GuiBuildCraft {
|
||||
|
||||
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)
|
||||
public class FluidSlot extends AdvancedSlot {
|
||||
|
||||
public Fluid fluid;
|
||||
public int colorRenderCache;
|
||||
|
||||
public FluidSlot(int x, int y) {
|
||||
super(x, y);
|
||||
|
@ -185,8 +186,12 @@ public abstract class GuiAdvancedInterface extends GuiBuildCraft {
|
|||
|
||||
@Override
|
||||
public void drawSprite(int cornerX, int cornerY) {
|
||||
if (fluid != null)
|
||||
FluidRenderer.setColorForFluidStack(new FluidStack(fluid, 100));
|
||||
if (fluid != null) {
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
|
@ -82,8 +82,10 @@ public class GuiRefinery extends GuiAdvancedInterface {
|
|||
}
|
||||
|
||||
container.setFilter(position, liquid.getFluid());
|
||||
container.refinery.tankManager.get(position).colorRenderCache = liquid.getFluid().getColor(liquid);
|
||||
} else {
|
||||
container.setFilter(position, null);
|
||||
container.refinery.tankManager.get(position).colorRenderCache = 0xFFFFFF;
|
||||
}
|
||||
} else {
|
||||
TileRefinery ref = (TileRefinery) this.tile;
|
||||
|
@ -102,7 +104,9 @@ public class GuiRefinery extends GuiAdvancedInterface {
|
|||
Fluid filter1 = container.getFilter(1);
|
||||
|
||||
((FluidSlot) slots[0]).fluid = filter0;
|
||||
((FluidSlot) slots[0]).colorRenderCache = container.refinery.tank1.colorRenderCache;
|
||||
((FluidSlot) slots[1]).fluid = filter1;
|
||||
((FluidSlot) slots[1]).colorRenderCache = container.refinery.tank2.colorRenderCache;
|
||||
|
||||
FluidStack liquid0 = null;
|
||||
FluidStack liquid1 = null;
|
||||
|
@ -118,6 +122,7 @@ public class GuiRefinery extends GuiAdvancedInterface {
|
|||
|
||||
if (recipe != null) {
|
||||
((FluidSlot) slots[2]).fluid = recipe.result.getFluid();
|
||||
((FluidSlot) slots[2]).colorRenderCache = recipe.result.getFluid().getColor(recipe.result);
|
||||
} else {
|
||||
((FluidSlot) slots[2]).fluid = null;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue