Merge pull request #1351 from ItsMeElConquistador/master

Combustion Engine also now uses the colorRenderCache. Closes #1333
This commit is contained in:
CovertJaguar 2013-12-01 22:19:00 -08:00
commit 802f63e858
2 changed files with 26 additions and 11 deletions

View file

@ -11,7 +11,6 @@ import java.util.LinkedList;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.ICrafting;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ResourceLocation;
@ -45,8 +44,8 @@ public class TileEngineIron extends TileEngineWithInventory implements IFluidHan
public static float COOLDOWN_RATE = 0.05F;
public static int MAX_COOLANT_PER_TICK = 40;
int burnTime = 0;
private Tank tankFuel = new Tank("tankFuel", MAX_LIQUID, this);
private Tank tankCoolant = new Tank("tankCoolant", MAX_LIQUID, this);
public Tank tankFuel = new Tank("tankFuel", MAX_LIQUID, this);
public Tank tankCoolant = new Tank("tankCoolant", MAX_LIQUID, this);
private TankManager tankManager = new TankManager();
private Fuel currentFuel = null;
public int penaltyCooling = 0;
@ -292,7 +291,7 @@ public class TileEngineIron extends TileEngineWithInventory implements IFluidHan
tankFuel.getFluid().amount = value;
}
break;
// Fluid coolant amount
// Fluid Coolant amount
case 18:
if (tankCoolant.getFluid() == null) {
tankCoolant.setFluid(new FluidStack(0, value));
@ -300,6 +299,14 @@ public class TileEngineIron extends TileEngineWithInventory implements IFluidHan
tankCoolant.getFluid().amount = value;
}
break;
//Fluid Fuel color
case 19:
tankFuel.colorRenderCache = value;
break;
//Fluid Coolant color
case 20:
tankCoolant.colorRenderCache = value;
break;
}
}
@ -310,6 +317,8 @@ public class TileEngineIron extends TileEngineWithInventory implements IFluidHan
iCrafting.sendProgressBarUpdate(containerEngine, 16, tankCoolant.getFluid() != null ? tankCoolant.getFluid().fluidID : 0);
iCrafting.sendProgressBarUpdate(containerEngine, 17, tankFuel.getFluid() != null ? tankFuel.getFluid().amount : 0);
iCrafting.sendProgressBarUpdate(containerEngine, 18, tankCoolant.getFluid() != null ? tankCoolant.getFluid().amount : 0);
iCrafting.sendProgressBarUpdate(containerEngine, 19, tankFuel.colorRenderCache);
iCrafting.sendProgressBarUpdate(containerEngine, 20, tankCoolant.colorRenderCache);
}
@Override

View file

@ -7,16 +7,16 @@
*/
package buildcraft.energy.gui;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.entity.player.InventoryPlayer;
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.DefaultProps;
import buildcraft.core.fluids.Tank;
import buildcraft.core.utils.StringUtils;
import buildcraft.energy.TileEngineIron;
import buildcraft.energy.TileEngineWithInventory;
@ -47,15 +47,15 @@ public class GuiCombustionEngine extends GuiEngine {
TileEngineIron engine = (TileEngineIron) tile;
if (engine.getScaledBurnTime(58) > 0) {
displayGauge(j, k, 19, 104, engine.getScaledBurnTime(58), engine.getFuel());
displayGauge(j, k, 19, 104, engine.getScaledBurnTime(58), engine.getFuel(), engine.tankFuel);
}
if (engine.getScaledCoolant(58) > 0) {
displayGauge(j, k, 19, 122, engine.getScaledCoolant(58), engine.getCoolant());
displayGauge(j, k, 19, 122, engine.getScaledCoolant(58), engine.getCoolant(), engine.tankCoolant);
}
}
private void displayGauge(int j, int k, int line, int col, int squaled, FluidStack liquid) {
private void displayGauge(int j, int k, int line, int col, int squaled, FluidStack liquid, Tank tank) {
if (liquid == null) {
return;
}
@ -63,11 +63,16 @@ public class GuiCombustionEngine extends GuiEngine {
Icon liquidIcon = null;
Fluid fluid = liquid.getFluid();
int color = tank.colorRenderCache;
if (fluid != null && fluid.getStillIcon() != null) {
liquidIcon = fluid.getStillIcon();
}
mc.renderEngine.bindTexture(BLOCK_TEXTURE);
float red = (float) (color >> 16 & 255) / 255.0F;
float green = (float) (color >> 8 & 255) / 255.0F;
float blue = (float) (color & 255) / 255.0F;
GL11.glColor4f(red, green, blue, 1.0F);
if (liquidIcon != null) {
while (true) {
int x;
@ -89,6 +94,7 @@ public class GuiCombustionEngine extends GuiEngine {
}
}
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
mc.renderEngine.bindTexture(TEXTURE);
drawTexturedModalRect(j + col, k + line, 176, 0, 16, 60);
}