mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-08-10 17:55:44 +00:00
doom commit? who knows
- smooth texture gauge - smooth linear gauge - updated zirnox, ccgt and watz gui (gauges)
This commit is contained in:
parent
6f6ebffd41
commit
ea217756a0
@ -3,6 +3,7 @@ package com.hbm.inventory.gui;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.inventory.gui.element.GUIElements;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.inventory.container.ContainerMachineTurbineGas;
|
||||
@ -25,96 +26,96 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class GUIMachineTurbineGas extends GuiInfoContainer {
|
||||
|
||||
|
||||
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/generators/gui_turbinegas.png");
|
||||
private static ResourceLocation gauge_tex = new ResourceLocation(RefStrings.MODID + ":textures/gui/gauges/button_big.png");
|
||||
private TileEntityMachineTurbineGas turbinegas;
|
||||
|
||||
|
||||
int yStart;
|
||||
int slidStart;
|
||||
|
||||
|
||||
public GUIMachineTurbineGas(InventoryPlayer invPlayer, TileEntityMachineTurbineGas te) {
|
||||
super(new ContainerMachineTurbineGas(invPlayer, te));
|
||||
turbinegas = te;
|
||||
|
||||
|
||||
this.xSize = 176;
|
||||
this.ySize = 223;
|
||||
}
|
||||
|
||||
|
||||
//@Override
|
||||
protected void mouseClicked(int x, int y, int i) {
|
||||
|
||||
|
||||
super.mouseClicked(x, y, i);
|
||||
|
||||
|
||||
slidStart = turbinegas.powerSliderPos;
|
||||
yStart = y;
|
||||
|
||||
|
||||
if(Math.sqrt(Math.pow((x - guiLeft - 88), 2) + Math.pow((y - guiTop - 40), 2)) <= 8) { //start-stop circular button
|
||||
|
||||
|
||||
if(turbinegas.counter == 0 || turbinegas.counter == 579) {
|
||||
|
||||
|
||||
int state = turbinegas.state - 1; //offline(0) to startup(-1), online(1) to offline(0)
|
||||
|
||||
|
||||
mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F));
|
||||
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setInteger("state", state);
|
||||
PacketDispatcher.wrapper.sendToServer(new NBTControlPacket(data, turbinegas.xCoord, turbinegas.yCoord, turbinegas.zCoord));
|
||||
}
|
||||
else
|
||||
else
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(turbinegas.state == 1 && x > guiLeft + 74 && x <= guiLeft + 74 + 29 && y >= guiTop + 86 && y < guiTop + 86 + 13) { //auto mode button
|
||||
|
||||
|
||||
boolean automode = !turbinegas.autoMode;
|
||||
mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F));
|
||||
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setBoolean("autoMode", automode);
|
||||
PacketDispatcher.wrapper.sendToServer(new NBTControlPacket(data, turbinegas.xCoord, turbinegas.yCoord, turbinegas.zCoord));
|
||||
}
|
||||
|
||||
|
||||
if(turbinegas.state == 1 && (guiTop + 97 - slidStart) <= yStart && (guiTop + 103 - slidStart) > yStart && guiLeft + 36 < x && guiLeft + 52 >= x) { //power slider
|
||||
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setBoolean("autoMode", false); //if you click the slider with automode on, turns off automode
|
||||
PacketDispatcher.wrapper.sendToServer(new NBTControlPacket(data, turbinegas.xCoord, turbinegas.yCoord, turbinegas.zCoord));
|
||||
mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void mouseClickMove(int x, int y, int p_146273_3_, long p_146273_4_) {
|
||||
|
||||
|
||||
super.mouseClickMove(x, y, p_146273_3_, p_146273_4_);
|
||||
|
||||
|
||||
int slidPos = turbinegas.powerSliderPos;
|
||||
|
||||
|
||||
if(!turbinegas.autoMode && turbinegas.state == 1 && guiLeft + 36 < x && guiLeft + 52 >= x && guiTop + 37 < y && guiTop + 103 >= y) { //area in which the slider can move
|
||||
|
||||
|
||||
if((guiTop + 97 - slidStart) <= yStart && (guiTop + 103 - slidStart) > yStart) {
|
||||
slidPos = guiTop + 100 - y;
|
||||
|
||||
if(slidPos > 60)
|
||||
|
||||
if(slidPos > 60)
|
||||
slidPos = 60;
|
||||
else if(slidPos < 0)
|
||||
slidPos = 0;
|
||||
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setDouble("slidPos", slidPos);
|
||||
PacketDispatcher.wrapper.sendToServer(new NBTControlPacket(data, turbinegas.xCoord, turbinegas.yCoord, turbinegas.zCoord));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void drawScreen(int mouseX, int mouseY, float f) {
|
||||
|
||||
|
||||
super.drawScreen(mouseX, mouseY, f);
|
||||
|
||||
this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 26, guiTop + 108, 142, 16, turbinegas.power, turbinegas.getMaxPower());
|
||||
|
||||
|
||||
if(turbinegas.state == 1) {
|
||||
double consumption = turbinegas.fuelMaxCons.containsKey(turbinegas.tanks[0].getTankType()) ? turbinegas.fuelMaxCons.get(turbinegas.tanks[0].getTankType()) : 5D;
|
||||
this.drawCustomInfoStat(mouseX, mouseY, guiLeft + 36, guiTop + 36, 16, 66, mouseX, mouseY, new String[] {"Fuel consumption: " + 20 * (consumption * 0.05D + consumption * turbinegas.throttle / 100) + " mb/s"});
|
||||
@ -122,20 +123,20 @@ public class GUIMachineTurbineGas extends GuiInfoContainer {
|
||||
else {
|
||||
this.drawCustomInfoStat(mouseX, mouseY, guiLeft + 36, guiTop + 36, 16, 66, mouseX, mouseY, new String[] {"Generator offline"});
|
||||
}
|
||||
|
||||
|
||||
if(turbinegas.temp >= 20)
|
||||
this.drawCustomInfoStat(mouseX, mouseY, guiLeft + 133, guiTop + 23, 8, 72, mouseX, mouseY, new String[] {"Temperature: " + (turbinegas.temp) + "°C"});
|
||||
else
|
||||
this.drawCustomInfoStat(mouseX, mouseY, guiLeft + 133, guiTop + 23, 8, 72, mouseX, mouseY, new String[] {"Temperature: 20°C"});
|
||||
|
||||
|
||||
turbinegas.tanks[0].renderTankInfo(this, mouseX, mouseY, guiLeft + 8, guiTop + 16, 16, 48);
|
||||
turbinegas.tanks[1].renderTankInfo(this, mouseX, mouseY, guiLeft + 8, guiTop + 70, 16, 32);
|
||||
turbinegas.tanks[2].renderTankInfo(this, mouseX, mouseY, guiLeft + 147, guiTop + 61, 16, 36);
|
||||
turbinegas.tanks[3].renderTankInfo(this, mouseX, mouseY, guiLeft + 147, guiTop + 21, 16, 36);
|
||||
|
||||
|
||||
String[] info = I18nUtil.resolveKeyArray("desc.gui.turbinegas.automode");
|
||||
this.drawCustomInfoStat(mouseX, mouseY, guiLeft - 16, guiTop + 34, 16, 16, guiLeft - 8, guiTop + 44 + 16, info);
|
||||
|
||||
|
||||
List<String> fuels = new ArrayList();
|
||||
fuels.add(I18nUtil.resolveKey("desc.gui.turbinegas.fuels"));
|
||||
for(FluidType type : Fluids.getInNiceOrder()) {
|
||||
@ -144,25 +145,25 @@ public class GUIMachineTurbineGas extends GuiInfoContainer {
|
||||
}
|
||||
}
|
||||
this.drawCustomInfoStat(mouseX, mouseY, guiLeft - 16, guiTop + 34 + 16, 16, 16, guiLeft - 8, guiTop + 44 + 16, fuels);
|
||||
|
||||
|
||||
String[] warning = I18nUtil.resolveKeyArray("desc.gui.turbinegas.warning");
|
||||
if(turbinegas.tanks[0].getFill() < 5000 || turbinegas.tanks[1].getFill() < 1000)
|
||||
this.drawCustomInfoStat(mouseX, mouseY, guiLeft - 16, guiTop + 34 + 32, 16, 16, guiLeft - 8, guiTop + 44 + 16, warning);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float iinterpolation, int x, int y) {
|
||||
|
||||
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
|
||||
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize); //the main thing
|
||||
|
||||
|
||||
if(turbinegas.autoMode)
|
||||
drawTexturedModalRect(guiLeft + 74, guiTop + 86, 194, 11, 29, 13); //auto mode button
|
||||
else
|
||||
drawTexturedModalRect(guiLeft + 74, guiTop + 86, 194, 24, 29, 13);
|
||||
|
||||
|
||||
switch(turbinegas.state) {
|
||||
case 0:
|
||||
drawTexturedModalRect(guiLeft + 80, guiTop + 32, 178, 38, 16, 16); //red button
|
||||
@ -178,36 +179,36 @@ public class GUIMachineTurbineGas extends GuiInfoContainer {
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
drawTexturedModalRect(guiLeft + 36, guiTop + 97 - turbinegas.powerSliderPos, 178, 0, 16, 6); //power slider
|
||||
|
||||
|
||||
int power = (int) (turbinegas.power * 142 / turbinegas.maxPower); //power storage
|
||||
drawTexturedModalRect(guiLeft + 26, guiTop + 109, 0, 223, power, 16);
|
||||
|
||||
drawRPMGauge(turbinegas.rpm);
|
||||
|
||||
GUIElements.drawSmoothTextureModalCircle(guiLeft + 64, guiTop + 16, this.zLevel, 176, 64, 48, 48, (double) turbinegas.rpm / 100);
|
||||
drawThermometer(turbinegas.temp);
|
||||
|
||||
|
||||
this.drawInfoPanel(guiLeft - 16, guiTop + 34, 16, 16, 3); //info
|
||||
this.drawInfoPanel(guiLeft - 16, guiTop + 34 + 16, 16, 16, 2); //fuels
|
||||
if((turbinegas.tanks[0].getFill()) < 5000 || turbinegas.tanks[1].getFill() < 1000)
|
||||
this.drawInfoPanel(guiLeft - 16, guiTop + 34 + 32, 16, 16, 7);
|
||||
if(turbinegas.tanks[0].getFill() == 0 || turbinegas.tanks[1].getFill() == 0)
|
||||
this.drawInfoPanel(guiLeft - 16, guiTop + 34 + 32, 16, 16, 6);
|
||||
|
||||
|
||||
turbinegas.tanks[0].renderTank(guiLeft + 8, guiTop + 65, this.zLevel, 16, 48);
|
||||
turbinegas.tanks[1].renderTank(guiLeft + 8, guiTop + 103, this.zLevel, 16, 32);
|
||||
turbinegas.tanks[2].renderTank(guiLeft + 147, guiTop + 98, this.zLevel, 16, 36);
|
||||
turbinegas.tanks[3].renderTank(guiLeft + 147, guiTop + 58, this.zLevel, 16, 36);
|
||||
}
|
||||
|
||||
|
||||
int numberToDisplay = 0; //for startup
|
||||
int digitNumber = 0;
|
||||
int digitNumber = 0;
|
||||
int exponent = 0;
|
||||
|
||||
|
||||
public void displayStartup() {
|
||||
|
||||
|
||||
if(numberToDisplay < 8888888 && turbinegas.counter < 60) { //48 frames needed to complete
|
||||
|
||||
|
||||
digitNumber++;
|
||||
if(digitNumber == 9) {
|
||||
digitNumber = 1;
|
||||
@ -215,66 +216,66 @@ public class GUIMachineTurbineGas extends GuiInfoContainer {
|
||||
}
|
||||
numberToDisplay += Math.pow(10, exponent);
|
||||
}
|
||||
|
||||
|
||||
if(turbinegas.counter > 50)
|
||||
numberToDisplay = 0;
|
||||
|
||||
|
||||
drawPowerMeterDisplay(numberToDisplay);
|
||||
}
|
||||
|
||||
|
||||
protected void drawPowerMeterDisplay(int number) { //display code
|
||||
|
||||
|
||||
int firstDigitX = 65;
|
||||
int firstDigitY = 62;
|
||||
|
||||
|
||||
int[] digit = new int[7];
|
||||
|
||||
|
||||
for(int i = 6; i >= 0; i--) { //creates an array of digits that represent the numbers
|
||||
|
||||
|
||||
digit[i] = (int) (number % 10);
|
||||
|
||||
|
||||
number = number / 10;
|
||||
|
||||
|
||||
drawTexturedModalRect(guiLeft + firstDigitX + i * 7, guiTop + 9 + firstDigitY, 194 + digit[i] * 5, 0, 5, 11);
|
||||
}
|
||||
|
||||
|
||||
int uselessZeros = 0;
|
||||
|
||||
|
||||
for(int i = 0; i < 6; i++) { //counts how much zeros there are before the number, to display 57 instead of 000057
|
||||
|
||||
|
||||
if(digit[i] == 0)
|
||||
uselessZeros++;
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
for(int i = 0; i < uselessZeros; i++) { //turns off the useless zeros
|
||||
|
||||
|
||||
drawTexturedModalRect(guiLeft + firstDigitX + i * 7, guiTop + 9 + firstDigitY, 244, 0, 5, 11);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected void drawThermometer(int temp) {
|
||||
|
||||
|
||||
int xPos = guiLeft + 136;
|
||||
int yPos = guiTop + 28;
|
||||
|
||||
|
||||
int width = 2;
|
||||
int height = 64;
|
||||
|
||||
|
||||
int maxTemp = 800;
|
||||
|
||||
|
||||
double uMin = (176D / 256D);
|
||||
double uMax = (178D / 256D);
|
||||
double vMin = ((64D - 64 * temp / maxTemp) / 256D);
|
||||
double vMax = (64D / 256D);
|
||||
|
||||
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
|
||||
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
|
||||
|
||||
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
|
||||
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.addVertexWithUV(xPos, yPos + height, this.zLevel, uMin, vMax);
|
||||
tessellator.addVertexWithUV(xPos + width, yPos + height, this.zLevel, uMax, vMax);
|
||||
@ -284,41 +285,41 @@ public class GUIMachineTurbineGas extends GuiInfoContainer {
|
||||
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
}
|
||||
|
||||
protected void drawRPMGauge(int position) {
|
||||
|
||||
int xPos = guiLeft + 64;
|
||||
int yPos = guiTop + 16;
|
||||
|
||||
int squareSideLenght = 48;
|
||||
|
||||
double uMin = (48D / 4848D) * position;
|
||||
double uMax = (48D / 4848D) * (position + 1);
|
||||
double vMin = 0D;
|
||||
double vMax = 1D;
|
||||
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(gauge_tex); //long boi
|
||||
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.addVertexWithUV(xPos, yPos + squareSideLenght, this.zLevel, uMin, vMax);
|
||||
tessellator.addVertexWithUV(xPos + squareSideLenght, yPos + squareSideLenght, this.zLevel, uMax, vMax);
|
||||
tessellator.addVertexWithUV(xPos + squareSideLenght, yPos, this.zLevel,uMax, vMin);
|
||||
tessellator.addVertexWithUV(xPos, yPos, this.zLevel, uMin, vMin);
|
||||
tessellator.draw();
|
||||
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
}
|
||||
|
||||
// protected void drawRPMGauge(int position) {
|
||||
//
|
||||
// int xPos = guiLeft + 64;
|
||||
// int yPos = guiTop + 16;
|
||||
//
|
||||
// int squareSideLenght = 48;
|
||||
//
|
||||
// double uMin = (48D / 4848D) * position;
|
||||
// double uMax = (48D / 4848D) * (position + 1);
|
||||
// double vMin = 0D;
|
||||
// double vMax = 1D;
|
||||
//
|
||||
// GL11.glEnable(GL11.GL_BLEND);
|
||||
//
|
||||
// Minecraft.getMinecraft().getTextureManager().bindTexture(gauge_tex); //long boi
|
||||
//
|
||||
// Tessellator tessellator = Tessellator.instance;
|
||||
//
|
||||
// tessellator.startDrawingQuads();
|
||||
// tessellator.addVertexWithUV(xPos, yPos + squareSideLenght, this.zLevel, uMin, vMax);
|
||||
// tessellator.addVertexWithUV(xPos + squareSideLenght, yPos + squareSideLenght, this.zLevel, uMax, vMax);
|
||||
// tessellator.addVertexWithUV(xPos + squareSideLenght, yPos, this.zLevel,uMax, vMin);
|
||||
// tessellator.addVertexWithUV(xPos, yPos, this.zLevel, uMin, vMin);
|
||||
// tessellator.draw();
|
||||
//
|
||||
// GL11.glDisable(GL11.GL_BLEND);
|
||||
// }
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int i, int j) {
|
||||
//useless piece of shit, at least for now
|
||||
String name = this.turbinegas.hasCustomInventoryName() ? this.turbinegas.getInventoryName() : I18n.format(this.turbinegas.getInventoryName());
|
||||
|
||||
|
||||
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752);
|
||||
this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 94, 4210752);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package com.hbm.inventory.gui;
|
||||
|
||||
import com.hbm.inventory.gui.element.GUIElements;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.inventory.container.ContainerReactorZirnox;
|
||||
@ -39,10 +40,10 @@ public class GUIReactorZirnox extends GuiInfoContainer {
|
||||
zirnox.water.renderTankInfo(this, mouseX, mouseY, guiLeft + 178, guiTop + 108, 18, 12);
|
||||
this.drawCustomInfo(this, mouseX, mouseY, guiLeft + 160, guiTop + 33, 18, 17, new String[] { "Temperature:", " " + Math.round((zirnox.heat) * 0.00001 * 780 + 20) + "°C" });
|
||||
this.drawCustomInfo(this, mouseX, mouseY, guiLeft + 178, guiTop + 33, 18, 17, new String[] { "Pressure:", " " + Math.round((zirnox.pressure) * 0.00001 * 30) + " bar" });
|
||||
|
||||
|
||||
String[] coolantText = I18nUtil.resolveKeyArray("desc.gui.zirnox.coolant");
|
||||
this.drawCustomInfoStat(mouseX, mouseY, guiLeft - 16, guiTop + 36, 16, 16, guiLeft - 8, guiTop + 36 + 16, coolantText);
|
||||
|
||||
|
||||
String[] pressureText = I18nUtil.resolveKeyArray("desc.gui.zirnox.pressure");
|
||||
this.drawCustomInfoStat(mouseX, mouseY, guiLeft - 16, guiTop + 36 + 16, 16, 16, guiLeft - 8, guiTop + 36 + 16 + 16, pressureText);
|
||||
|
||||
@ -92,20 +93,12 @@ public class GUIReactorZirnox extends GuiInfoContainer {
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
|
||||
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
|
||||
|
||||
int s = zirnox.getGaugeScaled(6, 0);
|
||||
drawTexturedModalRect(guiLeft + 160, guiTop + 108, 238, 0 + 12 * s, 18, 12);
|
||||
GUIElements.drawSmoothLinearGauge(guiLeft + 162, guiTop + 114, this.zLevel, (double) zirnox.steam.getFill() / zirnox.steam.getMaxFill(), 2, 5, 0.75, 14, 0, 0x7F0000);
|
||||
GUIElements.drawSmoothLinearGauge(guiLeft + 144, guiTop + 114, this.zLevel, (double) zirnox.carbonDioxide.getFill() / zirnox.carbonDioxide.getMaxFill(), 2, 5, 0.75, 14, 0, 0x7F0000);
|
||||
GUIElements.drawSmoothLinearGauge(guiLeft + 180, guiTop + 114, this.zLevel, (double) zirnox.water.getFill() / zirnox.water.getMaxFill(), 2, 5, 0.75, 14, 0, 0x7F0000);
|
||||
|
||||
int c = zirnox.getGaugeScaled(6, 1);
|
||||
drawTexturedModalRect(guiLeft + 142, guiTop + 108, 238, 0 + 12 * c, 18, 12);
|
||||
|
||||
int w = zirnox.getGaugeScaled(6, 2);
|
||||
drawTexturedModalRect(guiLeft + 178, guiTop + 108, 238, 0 + 12 * w, 18, 12);
|
||||
|
||||
int h = zirnox.getGaugeScaled(12, 3);
|
||||
drawTexturedModalRect(guiLeft + 160, guiTop + 33, 220, 0 + 18 * h, 18, 17);
|
||||
|
||||
int p = zirnox.getGaugeScaled(12, 4);
|
||||
drawTexturedModalRect(guiLeft + 178, guiTop + 33, 220, 0 + 18 * p, 18, 17);
|
||||
GUIElements.drawSmoothGauge(guiLeft + 169, guiTop + 42, this.zLevel, (double) zirnox.heat/100000, 5, 2, 1, 0x7F0000);
|
||||
GUIElements.drawSmoothGauge(guiLeft + 187, guiTop + 42, this.zLevel, (double) zirnox.pressure/100000, 5, 2, 1, 0x7F0000);
|
||||
|
||||
if(zirnox.isOn) {
|
||||
for(int x = 0; x < 4; x++)
|
||||
@ -127,4 +120,4 @@ public class GUIReactorZirnox extends GuiInfoContainer {
|
||||
this.drawInfoPanel(guiLeft - 16, guiTop + 36 + 32 + 16, 16, 16, 6);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -28,11 +28,11 @@ public class GUIWatz extends GuiInfoContainer {
|
||||
public GUIWatz(InventoryPlayer invPlayer, TileEntityWatz watz) {
|
||||
super(new ContainerWatz(invPlayer, watz));
|
||||
this.watz = watz;
|
||||
|
||||
|
||||
this.xSize = 176;
|
||||
this.ySize = 229;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void drawScreen(int x, int y, float interp) {
|
||||
super.drawScreen(x, y, interp);
|
||||
@ -44,11 +44,11 @@ public class GUIWatz extends GuiInfoContainer {
|
||||
watz.tanks[1].renderTankInfo(this, x, y, guiLeft + 148, guiTop + 23, 6, 45);
|
||||
watz.tanks[2].renderTankInfo(this, x, y, guiLeft + 154, guiTop + 23, 6, 45);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int i, int j) {
|
||||
this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 93, 4210752);
|
||||
|
||||
|
||||
double scale = 1.25;
|
||||
String flux = String.format(Locale.US, "%,.1f", watz.fluxDisplay);
|
||||
GL11.glScaled(1 / scale, 1 / scale, 1);
|
||||
@ -76,7 +76,7 @@ public class GUIWatz extends GuiInfoContainer {
|
||||
GL11.glColor4f(1.0F, col, col, 1.0F);
|
||||
drawTexturedModalRect(guiLeft, guiTop, 0, 0, 131, 122);
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
|
||||
|
||||
drawTexturedModalRect(guiLeft + 131, guiTop, 131, 0, 36, 122);
|
||||
drawTexturedModalRect(guiLeft, guiTop + 130, 0, 130, xSize, 99);
|
||||
drawTexturedModalRect(guiLeft + 126, guiTop + 31, 176, 31, 9, 60);
|
||||
@ -85,8 +85,8 @@ public class GUIWatz extends GuiInfoContainer {
|
||||
|
||||
if(watz.isOn) drawTexturedModalRect(guiLeft + 147, guiTop + 8, 176, 0, 8, 8);
|
||||
if(watz.isLocked) drawTexturedModalRect(guiLeft + 142, guiTop + 70, 210, 0, 18, 18);
|
||||
|
||||
GUIElements.renderGauge(Gauge.ROUND_SMALL, guiLeft + 13, guiTop + 100, this.zLevel, 1 - col);
|
||||
|
||||
GUIElements.drawSmoothGauge(guiLeft + 22, guiTop + 109, this.zLevel, (double) 1 - col, 5, 2, 1, 0x7F0000);
|
||||
|
||||
watz.tanks[0].renderTank(guiLeft + 143, guiTop + 69, this.zLevel, 4, 43);
|
||||
watz.tanks[1].renderTank(guiLeft + 149, guiTop + 69, this.zLevel, 4, 43);
|
||||
|
||||
@ -21,7 +21,7 @@ import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class GUIElements {
|
||||
|
||||
|
||||
@Deprecated public static enum Gauge {
|
||||
ROUND_SMALL("small_round", 18, 18, 13);
|
||||
ResourceLocation texture;
|
||||
@ -33,7 +33,7 @@ public class GUIElements {
|
||||
this.count = count;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Deprecated public static void renderGauge(Gauge gauge, double x, double y, double z, double progress) {
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(gauge.texture);
|
||||
int frameNum = (int) Math.round((gauge.count - 1) * progress);
|
||||
@ -47,7 +47,7 @@ public class GUIElements {
|
||||
tess.addVertexWithUV(x, y, z, 0, frameOffset);
|
||||
tess.draw();
|
||||
}
|
||||
|
||||
|
||||
public static void drawSmoothGauge(int x, int y, double z, double progress, double tipLength, double backLength, double backSide, int color) {
|
||||
drawSmoothGauge(x, y, z, progress, tipLength, backLength, backSide, color, 0x000000);
|
||||
}
|
||||
@ -55,12 +55,12 @@ public class GUIElements {
|
||||
private static Vec3NT tip = new Vec3NT();
|
||||
private static Vec3NT left = new Vec3NT();
|
||||
private static Vec3NT right = new Vec3NT();
|
||||
|
||||
|
||||
public static void drawSmoothGauge(int x, int y, double z, double progress, double tipLength, double backLength, double backSide, int color, int colorOuter) {
|
||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||
|
||||
|
||||
progress = MathHelper.clamp_double(progress, 0, 1);
|
||||
|
||||
|
||||
float angle = (float) Math.toRadians(-progress * 270 - 45);
|
||||
tip.setComponents(0, tipLength, 0);
|
||||
left.setComponents(backSide, -backLength, 0);
|
||||
@ -69,7 +69,7 @@ public class GUIElements {
|
||||
tip.rotateAroundZ(angle);
|
||||
left.rotateAroundZ(angle);
|
||||
right.rotateAroundZ(angle);
|
||||
|
||||
|
||||
Tessellator tess = Tessellator.instance;
|
||||
tess.startDrawing(GL11.GL_TRIANGLES);
|
||||
tess.setColorOpaque_I(colorOuter);
|
||||
@ -82,11 +82,147 @@ public class GUIElements {
|
||||
tess.addVertex(x + left.xCoord, y + left.yCoord, z);
|
||||
tess.addVertex(x + right.xCoord, y + right.yCoord, z);
|
||||
tess.draw();
|
||||
|
||||
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||
}
|
||||
|
||||
public static void drawSmoothLinearGauge(int x, int y, double z, double progress, double tipLength, double backLength, double backSide, double scale, float rotation, int color) {
|
||||
drawSmoothLinearGauge(x, y, z, progress, tipLength, backLength, backSide, scale, rotation, color, 0x000000);
|
||||
}
|
||||
|
||||
private static Vec3NT Bleft = new Vec3NT();
|
||||
private static Vec3NT Bright = new Vec3NT();
|
||||
|
||||
public static void drawSmoothLinearGauge(int x, int y, double z, double progress, double tipLength, double backLength, double backSide, double scale, float rotation, int color, int colorOuter) {
|
||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||
|
||||
scale = Math.max(scale, 1);
|
||||
progress = MathHelper.clamp_double(progress, 0, 1) * scale;
|
||||
|
||||
tip.setComponents(0, -tipLength, 0);
|
||||
right.setComponents(-backSide, 0, 0);
|
||||
Bright.setComponents(-backSide, backLength, 0);
|
||||
Bleft.setComponents(backSide, backLength, 0);
|
||||
left.setComponents(backSide, 0, 0);
|
||||
|
||||
float angle = (float) Math.toRadians(-rotation);
|
||||
|
||||
tip.rotateAroundZ(angle);
|
||||
right.rotateAroundZ(angle);
|
||||
Bright.rotateAroundZ(angle);
|
||||
Bleft.rotateAroundZ(angle);
|
||||
left.rotateAroundZ(angle);
|
||||
|
||||
double deltaX = progress * MathHelper.cos(angle);
|
||||
double deltaY = progress * MathHelper.sin(angle);
|
||||
|
||||
Tessellator tess = Tessellator.instance;
|
||||
tess.startDrawing(GL11.GL_POLYGON);
|
||||
tess.setColorOpaque_I(colorOuter);
|
||||
double mult = 1.5;
|
||||
tess.addVertex(x + deltaX + tip.xCoord * mult, y + deltaY + tip.yCoord * mult, z);
|
||||
tess.addVertex(x + deltaX + right.xCoord * mult, y + deltaY + right.yCoord * mult, z);
|
||||
tess.addVertex(x + deltaX + Bright.xCoord * mult, y + deltaY + Bright.yCoord, z);
|
||||
tess.addVertex(x + deltaX + Bleft.xCoord * mult, y + deltaY + Bleft.yCoord, z);
|
||||
tess.addVertex(x + deltaX + left.xCoord * mult, y + deltaY + left.yCoord * mult, z);
|
||||
tess.draw();
|
||||
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
|
||||
tess.startDrawing(GL11.GL_POLYGON);
|
||||
tess.setColorOpaque_I(color);
|
||||
tess.addVertex(x + deltaX + tip.xCoord, y + deltaY + tip.yCoord, z);
|
||||
tess.addVertex(x + deltaX + right.xCoord, y + deltaY + right.yCoord, z);
|
||||
tess.addVertex(x + deltaX + Bright.xCoord, y + deltaY + Bright.yCoord, z);
|
||||
tess.addVertex(x + deltaX + Bleft.xCoord, y + deltaY + Bleft.yCoord, z);
|
||||
tess.addVertex(x + deltaX + left.xCoord, y + deltaY + left.yCoord, z);
|
||||
tess.draw();
|
||||
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||
}
|
||||
|
||||
public static void drawSmoothTextureModalCircle(int xDraw, int yDraw, float zDraw, int xStart, int yStart, int xDelta, int yDelta, double progress) {
|
||||
float var7 = 0.00390625F;
|
||||
float var8 = 0.00390625F;
|
||||
|
||||
progress = MathHelper.clamp_double(progress, 0, 1);
|
||||
float angle = (float) (-progress * 270.0);
|
||||
double theta = Math.toRadians(angle - 135);
|
||||
int addons = 0;
|
||||
double xTarget = 0;
|
||||
double yTarget = 0;
|
||||
|
||||
// addons is just a numeric flag for how many fixed point to add, to generate the triangles
|
||||
if (angle >= -180 && angle < -90) {
|
||||
addons = 1;
|
||||
} else if (angle >= -270 && angle < -180) {
|
||||
addons = 2;
|
||||
}
|
||||
|
||||
// the abysmal control under here is responsible for the positioning of the last point
|
||||
// basically this whole function makes this shape:
|
||||
// + - - - - - - - - - - - +
|
||||
// | \ * * * * * * * * * / |
|
||||
// | * \ * * * * * * * / * |
|
||||
// | * * \ * * * * * / * * |
|
||||
// | * * * \ * * * / * * * |
|
||||
// | * * * * \ * / * * * * |
|
||||
// | * * * * * + * * * * * |
|
||||
// | * * * * / \ * * * * |
|
||||
// | * * * / \ * * * |
|
||||
// | * * / \ * * |
|
||||
// | * / \ * |
|
||||
// | / \ |
|
||||
// + - - - - - - - - - - - +
|
||||
// the "/, \" are the sides, "+" points and "*" rendered part (lower triangle isn't shown)
|
||||
if (angle >= -90) {
|
||||
xTarget = -1;
|
||||
yTarget = -Math.tan(theta);
|
||||
} else if (angle > -135 && angle < -90) {
|
||||
xTarget = Math.tan(Math.PI/2 - theta);
|
||||
yTarget = 1;
|
||||
} else if (angle > -180 && angle < -135) {
|
||||
xTarget = Math.tan(Math.PI/2 - theta);
|
||||
yTarget = 1;
|
||||
} else if (angle <= -180) {
|
||||
xTarget = 1;
|
||||
yTarget = Math.tan(theta);
|
||||
} else if (angle == -135) {
|
||||
xTarget = 0;
|
||||
yTarget = 1;
|
||||
}
|
||||
|
||||
double xMid = (double) xDelta / 2;
|
||||
double yMid = (double) yDelta / 2;
|
||||
|
||||
xTarget *= xMid;
|
||||
yTarget *= yMid;
|
||||
|
||||
Tessellator tess = Tessellator.instance;
|
||||
|
||||
tess.startDrawing(GL11.GL_TRIANGLES); // i should've used GL_POLYGON yes i know, too bad im either too retarded to understand it or OpenGL makes it funky, i already tried
|
||||
tess.addVertexWithUV((double) (xDraw), (double) (yDraw + yDelta), (double) zDraw, (double) ((float) (xStart) * var7), (double) ((float) (yStart + yDelta) * var8));
|
||||
tess.addVertexWithUV((double) (xDraw + xMid), (double) (yDraw + yMid), (double) zDraw, (double) ((float) (xStart + xMid) * var7), (double) ((float) (yStart + yMid) * var8));
|
||||
if (addons == 2 || addons == 1) {
|
||||
tess.addVertexWithUV((double) (xDraw), (double) (yDraw), (double) zDraw, (double) ((float) (xStart) * var7), (double) ((float) (yStart) * var8));
|
||||
tess.draw();
|
||||
tess.startDrawing(GL11.GL_TRIANGLES);
|
||||
tess.addVertexWithUV((double) (xDraw), (double) (yDraw), (double) zDraw, (double) ((float) (xStart) * var7), (double) ((float) (yStart) * var8));
|
||||
tess.addVertexWithUV((double) (xDraw + xMid), (double) (yDraw + yMid), (double) zDraw, (double) ((float) (xStart + xMid) * var7), (double) ((float) (yStart + yMid) * var8));
|
||||
}
|
||||
if (addons == 2) {
|
||||
tess.addVertexWithUV((double) (xDraw + xDelta), (double) (yDraw), (double) zDraw, (double) ((float) (xStart + xDelta) * var7), (double) ((float) (yStart) * var8));
|
||||
tess.draw();
|
||||
tess.startDrawing(GL11.GL_TRIANGLES);
|
||||
tess.addVertexWithUV((double) (xDraw + xDelta), (double) (yDraw), (double) zDraw, (double) ((float) (xStart + xDelta) * var7), (double) ((float) (yStart) * var8));
|
||||
tess.addVertexWithUV((double) (xDraw + xMid), (double) (yDraw + yMid), (double) zDraw, (double) ((float) (xStart + xMid) * var7), (double) ((float) (yStart + yMid) * var8));
|
||||
}
|
||||
tess.addVertexWithUV((double) (xDraw + xTarget + xMid), (double) (yDraw - yTarget + yMid), (double) zDraw, (double) ((float) (xStart + xTarget + xMid) * var7), (double) ((float) (yStart - yTarget + yMid) * var8));
|
||||
tess.draw();
|
||||
}
|
||||
|
||||
public static final int STANDARD_COLOR_BACKGROUND = -0xFEFFFF0;
|
||||
public static final int STANDARD_COLOR_LINE0 = 0x505000FF;
|
||||
public static final int STANDARD_COLOR_LINE1 = (STANDARD_COLOR_LINE0 & 0xFEFEFE) >> 1 | STANDARD_COLOR_LINE0 & -0xFEFEFE;
|
||||
@ -114,7 +250,7 @@ public class GUIElements {
|
||||
}
|
||||
|
||||
public static void drawHoveringText(List lines, int x, int y, FontRenderer font, RenderItem itemRender, int guiWidth, int guiHeight, int headerOffset, int lineDist, int colBG0, int colBG1, int colLine0, int colLine1) {
|
||||
|
||||
|
||||
if(!lines.isEmpty()) {
|
||||
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
@ -154,7 +290,7 @@ public class GUIElements {
|
||||
drawGradientRect(boundX - 3, boundY - 3, boundX + width + 3, boundY + height + 3, colBG0, colBG1);
|
||||
drawGradientRect(boundX - 4, boundY - 3, boundX - 3, boundY + height + 3, colBG0, colBG1);
|
||||
drawGradientRect(boundX + width + 3, boundY - 3, boundX + width + 4, boundY + height + 3, colBG0, colBG1);
|
||||
|
||||
|
||||
drawGradientRect(boundX - 3, boundY - 3 + 1, boundX - 3 + 1, boundY + height + 3 - 1, colLine0, colLine1);
|
||||
drawGradientRect(boundX + width + 2, boundY - 3 + 1, boundX + width + 3, boundY + height + 3 - 1, colLine0, colLine1);
|
||||
drawGradientRect(boundX - 3, boundY - 3, boundX + width + 3, boundY - 3 + 1, colLine0, colLine0);
|
||||
@ -163,7 +299,7 @@ public class GUIElements {
|
||||
for(int i = 0; i < lines.size(); ++i) {
|
||||
String line = (String) lines.get(i);
|
||||
font.drawStringWithShadow(line, boundX, boundY, -1);
|
||||
|
||||
|
||||
if(i == 0) boundY += headerOffset;
|
||||
boundY += lineDist;
|
||||
}
|
||||
@ -175,7 +311,7 @@ public class GUIElements {
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/** Colors don't use the RGBA, but rather ARGB (evil route) */
|
||||
protected static void drawGradientRect(int x0, int y0, int x1, int y1, int col0, int col1) {
|
||||
float a0 = (float) (col0 >> 24 & 255) / 255F;
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 4.5 KiB After Width: | Height: | Size: 8.0 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 7.5 KiB After Width: | Height: | Size: 4.7 KiB |
Loading…
x
Reference in New Issue
Block a user