Merge branch 'BuildCraft-5.0.x' into BuildCraft-5.1.x

This commit is contained in:
SpaceToad 2014-03-19 11:35:14 +01:00
commit e34a4b25a4
2 changed files with 41 additions and 46 deletions

View file

@ -150,7 +150,7 @@ uploadArchives {
// this is the definition of the maven pom.xml. This is simply a DSL to define the XML. Not actual fields or things to set. // this is the definition of the maven pom.xml. This is simply a DSL to define the XML. Not actual fields or things to set.
pom { pom {
groupId = project.group groupId = project.group
version = project.version + '.' + project.buildnumber version = project.version
artifactId = project.archivesBaseName artifactId = project.archivesBaseName
project { project {
name project.archivesBaseName name project.archivesBaseName

View file

@ -8,16 +8,13 @@
*/ */
package buildcraft.energy.gui; package buildcraft.energy.gui;
import org.lwjgl.opengl.GL11; import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.IIcon; import net.minecraft.util.IIcon;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidStack;
import buildcraft.core.DefaultProps; import buildcraft.core.DefaultProps;
import buildcraft.core.fluids.Tank;
import buildcraft.core.render.RenderUtils; import buildcraft.core.render.RenderUtils;
import buildcraft.core.utils.StringUtils; import buildcraft.core.utils.StringUtils;
import buildcraft.energy.TileEngineIron; import buildcraft.energy.TileEngineIron;
@ -45,55 +42,53 @@ public class GuiCombustionEngine extends GuiEngine {
super.drawGuiContainerBackgroundLayer(f, x, y); super.drawGuiContainerBackgroundLayer(f, x, y);
int j = (width - xSize) / 2; int j = (width - xSize) / 2;
int k = (height - ySize) / 2; int k = (height - ySize) / 2;
TileEngineIron engine = (TileEngineIron)tile;
TileEngineIron engine = (TileEngineIron) tile; drawFluid(engine.getFuel(), engine.getScaledBurnTime(58), j + 104, k + 19, 16, 58);
drawFluid(engine.getCoolant(), engine.getScaledCoolant(58), j + 122, k + 19, 16, 58);
if (engine.getScaledBurnTime(58) > 0) { mc.renderEngine.bindTexture(TEXTURE);
displayGauge(j, k, 19, 104, engine.getScaledBurnTime(58), engine.getFuel(), engine.tankFuel); drawTexturedModalRect(j + 104, k + 19, 176, 0, 16, 60);
drawTexturedModalRect(j + 122, k + 19, 176, 0, 16, 60);
} }
if (engine.getScaledCoolant(58) > 0) { private void drawFluid(FluidStack fluid, int level, int x, int y, int width, int height){
displayGauge(j, k, 19, 122, engine.getScaledCoolant(58), engine.getCoolant(), engine.tankCoolant); if(fluid == null || fluid.getFluid() == null) {
}
}
private void displayGauge(int j, int k, int line, int col, int squaled, FluidStack liquid, Tank tank) {
if (liquid == null) {
return; return;
} }
int start = 0; IIcon icon = fluid.getFluid().getIcon(fluid);
IIcon liquidIcon = null;
Fluid fluid = liquid.getFluid();
if (fluid != null && fluid.getStillIcon() != null) {
liquidIcon = fluid.getStillIcon();
}
mc.renderEngine.bindTexture(BLOCK_TEXTURE); mc.renderEngine.bindTexture(BLOCK_TEXTURE);
RenderUtils.setGLColorFromInt(tank.colorRenderCache); RenderUtils.setGLColorFromInt(fluid.getFluid().getColor(fluid));
int fullX = width / 16;
if (liquidIcon != null) { int fullY = height / 16;
while (true) { int lastX = width - fullX * 16;
int x; int lastY = height - fullY * 16;
int fullLvl = (height - level) / 16;
if (squaled > 16) { int lastLvl = (height - level) - fullLvl * 16;
x = 16; for(int i = 0; i < fullX; i++) {
squaled -= 16; for(int j = 0; j < fullY; j++) {
} else { if(j >= fullLvl) {
x = squaled; drawCutIcon(icon, x + i * 16, y + j * 16, 16, 16, j == fullLvl ? lastLvl : 0);
squaled = 0;
}
drawTexturedModelRectFromIcon(j + col, k + line + 58 - x - start, liquidIcon, 16, 16 - (16 - x));
start = start + 16;
if (x == 0 || squaled == 0) {
break;
} }
} }
} }
for(int i = 0; i < fullX; i++) {
drawCutIcon(icon, x + i * 16, y + fullY * 16, 16, lastY, fullLvl == fullY ? lastLvl : 0);
}
for(int i = 0; i < fullY; i++) {
if(i >= fullLvl) {
drawCutIcon(icon, x + fullX * 16, y + i * 16, lastX, 16, i == fullLvl ? lastLvl : 0);
}
}
drawCutIcon(icon, x + fullX * 16, y + fullY * 16, lastX, lastY, fullLvl == fullY ? lastLvl : 0);
}
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); //The magic is here
mc.renderEngine.bindTexture(TEXTURE); private void drawCutIcon(IIcon icon, int x, int y, int width, int height, int cut){
drawTexturedModalRect(j + col, k + line, 176, 0, 16, 60); Tessellator tess = Tessellator.instance;
tess.startDrawingQuads();
tess.addVertexWithUV(x, y + height, zLevel, icon.getMinU(), icon.getInterpolatedV(height));
tess.addVertexWithUV(x + width, y + height, zLevel, icon.getInterpolatedU(width), icon.getInterpolatedV(height));
tess.addVertexWithUV(x + width, y + cut, zLevel, icon.getInterpolatedU(width), icon.getInterpolatedV(cut));
tess.addVertexWithUV(x, y + cut, zLevel, icon.getMinU(), icon.getInterpolatedV(cut));
tess.draw();
} }
} }