mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-08-10 17:55:44 +00:00
Merge pull request #3020 from Alexmaster75/ntmain
i hope this commit wont destroy whole ntm
This commit is contained in:
commit
5a47a351a0
@ -3,6 +3,7 @@ package com.hbm.inventory.gui;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.hbm.inventory.gui.element.GUIElements;
|
||||||
import org.lwjgl.opengl.GL11;
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
import com.hbm.inventory.container.ContainerMachineTurbineGas;
|
import com.hbm.inventory.container.ContainerMachineTurbineGas;
|
||||||
@ -25,96 +26,96 @@ import net.minecraft.nbt.NBTTagCompound;
|
|||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
|
||||||
public class GUIMachineTurbineGas extends GuiInfoContainer {
|
public class GUIMachineTurbineGas extends GuiInfoContainer {
|
||||||
|
|
||||||
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/generators/gui_turbinegas.png");
|
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 static ResourceLocation gauge_tex = new ResourceLocation(RefStrings.MODID + ":textures/gui/gauges/button_big.png");
|
||||||
private TileEntityMachineTurbineGas turbinegas;
|
private TileEntityMachineTurbineGas turbinegas;
|
||||||
|
|
||||||
int yStart;
|
int yStart;
|
||||||
int slidStart;
|
int slidStart;
|
||||||
|
|
||||||
public GUIMachineTurbineGas(InventoryPlayer invPlayer, TileEntityMachineTurbineGas te) {
|
public GUIMachineTurbineGas(InventoryPlayer invPlayer, TileEntityMachineTurbineGas te) {
|
||||||
super(new ContainerMachineTurbineGas(invPlayer, te));
|
super(new ContainerMachineTurbineGas(invPlayer, te));
|
||||||
turbinegas = te;
|
turbinegas = te;
|
||||||
|
|
||||||
this.xSize = 176;
|
this.xSize = 176;
|
||||||
this.ySize = 223;
|
this.ySize = 223;
|
||||||
}
|
}
|
||||||
|
|
||||||
//@Override
|
//@Override
|
||||||
protected void mouseClicked(int x, int y, int i) {
|
protected void mouseClicked(int x, int y, int i) {
|
||||||
|
|
||||||
super.mouseClicked(x, y, i);
|
super.mouseClicked(x, y, i);
|
||||||
|
|
||||||
slidStart = turbinegas.powerSliderPos;
|
slidStart = turbinegas.powerSliderPos;
|
||||||
yStart = y;
|
yStart = y;
|
||||||
|
|
||||||
if(Math.sqrt(Math.pow((x - guiLeft - 88), 2) + Math.pow((y - guiTop - 40), 2)) <= 8) { //start-stop circular button
|
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) {
|
if(turbinegas.counter == 0 || turbinegas.counter == 579) {
|
||||||
|
|
||||||
int state = turbinegas.state - 1; //offline(0) to startup(-1), online(1) to offline(0)
|
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));
|
mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F));
|
||||||
|
|
||||||
NBTTagCompound data = new NBTTagCompound();
|
NBTTagCompound data = new NBTTagCompound();
|
||||||
data.setInteger("state", state);
|
data.setInteger("state", state);
|
||||||
PacketDispatcher.wrapper.sendToServer(new NBTControlPacket(data, turbinegas.xCoord, turbinegas.yCoord, turbinegas.zCoord));
|
PacketDispatcher.wrapper.sendToServer(new NBTControlPacket(data, turbinegas.xCoord, turbinegas.yCoord, turbinegas.zCoord));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(turbinegas.state == 1 && x > guiLeft + 74 && x <= guiLeft + 74 + 29 && y >= guiTop + 86 && y < guiTop + 86 + 13) { //auto mode button
|
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;
|
boolean automode = !turbinegas.autoMode;
|
||||||
mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F));
|
mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F));
|
||||||
|
|
||||||
NBTTagCompound data = new NBTTagCompound();
|
NBTTagCompound data = new NBTTagCompound();
|
||||||
data.setBoolean("autoMode", automode);
|
data.setBoolean("autoMode", automode);
|
||||||
PacketDispatcher.wrapper.sendToServer(new NBTControlPacket(data, turbinegas.xCoord, turbinegas.yCoord, turbinegas.zCoord));
|
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
|
if(turbinegas.state == 1 && (guiTop + 97 - slidStart) <= yStart && (guiTop + 103 - slidStart) > yStart && guiLeft + 36 < x && guiLeft + 52 >= x) { //power slider
|
||||||
|
|
||||||
NBTTagCompound data = new NBTTagCompound();
|
NBTTagCompound data = new NBTTagCompound();
|
||||||
data.setBoolean("autoMode", false); //if you click the slider with automode on, turns off automode
|
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));
|
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));
|
mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void mouseClickMove(int x, int y, int p_146273_3_, long p_146273_4_) {
|
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_);
|
super.mouseClickMove(x, y, p_146273_3_, p_146273_4_);
|
||||||
|
|
||||||
int slidPos = turbinegas.powerSliderPos;
|
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(!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) {
|
if((guiTop + 97 - slidStart) <= yStart && (guiTop + 103 - slidStart) > yStart) {
|
||||||
slidPos = guiTop + 100 - y;
|
slidPos = guiTop + 100 - y;
|
||||||
|
|
||||||
if(slidPos > 60)
|
if(slidPos > 60)
|
||||||
slidPos = 60;
|
slidPos = 60;
|
||||||
else if(slidPos < 0)
|
else if(slidPos < 0)
|
||||||
slidPos = 0;
|
slidPos = 0;
|
||||||
|
|
||||||
NBTTagCompound data = new NBTTagCompound();
|
NBTTagCompound data = new NBTTagCompound();
|
||||||
data.setDouble("slidPos", slidPos);
|
data.setDouble("slidPos", slidPos);
|
||||||
PacketDispatcher.wrapper.sendToServer(new NBTControlPacket(data, turbinegas.xCoord, turbinegas.yCoord, turbinegas.zCoord));
|
PacketDispatcher.wrapper.sendToServer(new NBTControlPacket(data, turbinegas.xCoord, turbinegas.yCoord, turbinegas.zCoord));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawScreen(int mouseX, int mouseY, float f) {
|
public void drawScreen(int mouseX, int mouseY, float f) {
|
||||||
|
|
||||||
super.drawScreen(mouseX, mouseY, f);
|
super.drawScreen(mouseX, mouseY, f);
|
||||||
|
|
||||||
this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 26, guiTop + 108, 142, 16, turbinegas.power, turbinegas.getMaxPower());
|
this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 26, guiTop + 108, 142, 16, turbinegas.power, turbinegas.getMaxPower());
|
||||||
|
|
||||||
if(turbinegas.state == 1) {
|
if(turbinegas.state == 1) {
|
||||||
double consumption = turbinegas.fuelMaxCons.containsKey(turbinegas.tanks[0].getTankType()) ? turbinegas.fuelMaxCons.get(turbinegas.tanks[0].getTankType()) : 5D;
|
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"});
|
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 {
|
else {
|
||||||
this.drawCustomInfoStat(mouseX, mouseY, guiLeft + 36, guiTop + 36, 16, 66, mouseX, mouseY, new String[] {"Generator offline"});
|
this.drawCustomInfoStat(mouseX, mouseY, guiLeft + 36, guiTop + 36, 16, 66, mouseX, mouseY, new String[] {"Generator offline"});
|
||||||
}
|
}
|
||||||
|
|
||||||
if(turbinegas.temp >= 20)
|
if(turbinegas.temp >= 20)
|
||||||
this.drawCustomInfoStat(mouseX, mouseY, guiLeft + 133, guiTop + 23, 8, 72, mouseX, mouseY, new String[] {"Temperature: " + (turbinegas.temp) + "°C"});
|
this.drawCustomInfoStat(mouseX, mouseY, guiLeft + 133, guiTop + 23, 8, 72, mouseX, mouseY, new String[] {"Temperature: " + (turbinegas.temp) + "°C"});
|
||||||
else
|
else
|
||||||
this.drawCustomInfoStat(mouseX, mouseY, guiLeft + 133, guiTop + 23, 8, 72, mouseX, mouseY, new String[] {"Temperature: 20°C"});
|
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[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[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[2].renderTankInfo(this, mouseX, mouseY, guiLeft + 147, guiTop + 61, 16, 36);
|
||||||
turbinegas.tanks[3].renderTankInfo(this, mouseX, mouseY, guiLeft + 147, guiTop + 21, 16, 36);
|
turbinegas.tanks[3].renderTankInfo(this, mouseX, mouseY, guiLeft + 147, guiTop + 21, 16, 36);
|
||||||
|
|
||||||
String[] info = I18nUtil.resolveKeyArray("desc.gui.turbinegas.automode");
|
String[] info = I18nUtil.resolveKeyArray("desc.gui.turbinegas.automode");
|
||||||
this.drawCustomInfoStat(mouseX, mouseY, guiLeft - 16, guiTop + 34, 16, 16, guiLeft - 8, guiTop + 44 + 16, info);
|
this.drawCustomInfoStat(mouseX, mouseY, guiLeft - 16, guiTop + 34, 16, 16, guiLeft - 8, guiTop + 44 + 16, info);
|
||||||
|
|
||||||
List<String> fuels = new ArrayList();
|
List<String> fuels = new ArrayList();
|
||||||
fuels.add(I18nUtil.resolveKey("desc.gui.turbinegas.fuels"));
|
fuels.add(I18nUtil.resolveKey("desc.gui.turbinegas.fuels"));
|
||||||
for(FluidType type : Fluids.getInNiceOrder()) {
|
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);
|
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");
|
String[] warning = I18nUtil.resolveKeyArray("desc.gui.turbinegas.warning");
|
||||||
if(turbinegas.tanks[0].getFill() < 5000 || turbinegas.tanks[1].getFill() < 1000)
|
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);
|
this.drawCustomInfoStat(mouseX, mouseY, guiLeft - 16, guiTop + 34 + 32, 16, 16, guiLeft - 8, guiTop + 44 + 16, warning);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void drawGuiContainerBackgroundLayer(float iinterpolation, int x, int y) {
|
protected void drawGuiContainerBackgroundLayer(float iinterpolation, int x, int y) {
|
||||||
|
|
||||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
|
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
|
||||||
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize); //the main thing
|
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize); //the main thing
|
||||||
|
|
||||||
if(turbinegas.autoMode)
|
if(turbinegas.autoMode)
|
||||||
drawTexturedModalRect(guiLeft + 74, guiTop + 86, 194, 11, 29, 13); //auto mode button
|
drawTexturedModalRect(guiLeft + 74, guiTop + 86, 194, 11, 29, 13); //auto mode button
|
||||||
else
|
else
|
||||||
drawTexturedModalRect(guiLeft + 74, guiTop + 86, 194, 24, 29, 13);
|
drawTexturedModalRect(guiLeft + 74, guiTop + 86, 194, 24, 29, 13);
|
||||||
|
|
||||||
switch(turbinegas.state) {
|
switch(turbinegas.state) {
|
||||||
case 0:
|
case 0:
|
||||||
drawTexturedModalRect(guiLeft + 80, guiTop + 32, 178, 38, 16, 16); //red button
|
drawTexturedModalRect(guiLeft + 80, guiTop + 32, 178, 38, 16, 16); //red button
|
||||||
@ -178,36 +179,36 @@ public class GUIMachineTurbineGas extends GuiInfoContainer {
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
drawTexturedModalRect(guiLeft + 36, guiTop + 97 - turbinegas.powerSliderPos, 178, 0, 16, 6); //power slider
|
drawTexturedModalRect(guiLeft + 36, guiTop + 97 - turbinegas.powerSliderPos, 178, 0, 16, 6); //power slider
|
||||||
|
|
||||||
int power = (int) (turbinegas.power * 142 / turbinegas.maxPower); //power storage
|
int power = (int) (turbinegas.power * 142 / turbinegas.maxPower); //power storage
|
||||||
drawTexturedModalRect(guiLeft + 26, guiTop + 109, 0, 223, power, 16);
|
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);
|
drawThermometer(turbinegas.temp);
|
||||||
|
|
||||||
this.drawInfoPanel(guiLeft - 16, guiTop + 34, 16, 16, 3); //info
|
this.drawInfoPanel(guiLeft - 16, guiTop + 34, 16, 16, 3); //info
|
||||||
this.drawInfoPanel(guiLeft - 16, guiTop + 34 + 16, 16, 16, 2); //fuels
|
this.drawInfoPanel(guiLeft - 16, guiTop + 34 + 16, 16, 16, 2); //fuels
|
||||||
if((turbinegas.tanks[0].getFill()) < 5000 || turbinegas.tanks[1].getFill() < 1000)
|
if((turbinegas.tanks[0].getFill()) < 5000 || turbinegas.tanks[1].getFill() < 1000)
|
||||||
this.drawInfoPanel(guiLeft - 16, guiTop + 34 + 32, 16, 16, 7);
|
this.drawInfoPanel(guiLeft - 16, guiTop + 34 + 32, 16, 16, 7);
|
||||||
if(turbinegas.tanks[0].getFill() == 0 || turbinegas.tanks[1].getFill() == 0)
|
if(turbinegas.tanks[0].getFill() == 0 || turbinegas.tanks[1].getFill() == 0)
|
||||||
this.drawInfoPanel(guiLeft - 16, guiTop + 34 + 32, 16, 16, 6);
|
this.drawInfoPanel(guiLeft - 16, guiTop + 34 + 32, 16, 16, 6);
|
||||||
|
|
||||||
turbinegas.tanks[0].renderTank(guiLeft + 8, guiTop + 65, this.zLevel, 16, 48);
|
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[1].renderTank(guiLeft + 8, guiTop + 103, this.zLevel, 16, 32);
|
||||||
turbinegas.tanks[2].renderTank(guiLeft + 147, guiTop + 98, this.zLevel, 16, 36);
|
turbinegas.tanks[2].renderTank(guiLeft + 147, guiTop + 98, this.zLevel, 16, 36);
|
||||||
turbinegas.tanks[3].renderTank(guiLeft + 147, guiTop + 58, this.zLevel, 16, 36);
|
turbinegas.tanks[3].renderTank(guiLeft + 147, guiTop + 58, this.zLevel, 16, 36);
|
||||||
}
|
}
|
||||||
|
|
||||||
int numberToDisplay = 0; //for startup
|
int numberToDisplay = 0; //for startup
|
||||||
int digitNumber = 0;
|
int digitNumber = 0;
|
||||||
int exponent = 0;
|
int exponent = 0;
|
||||||
|
|
||||||
public void displayStartup() {
|
public void displayStartup() {
|
||||||
|
|
||||||
if(numberToDisplay < 8888888 && turbinegas.counter < 60) { //48 frames needed to complete
|
if(numberToDisplay < 8888888 && turbinegas.counter < 60) { //48 frames needed to complete
|
||||||
|
|
||||||
digitNumber++;
|
digitNumber++;
|
||||||
if(digitNumber == 9) {
|
if(digitNumber == 9) {
|
||||||
digitNumber = 1;
|
digitNumber = 1;
|
||||||
@ -215,66 +216,66 @@ public class GUIMachineTurbineGas extends GuiInfoContainer {
|
|||||||
}
|
}
|
||||||
numberToDisplay += Math.pow(10, exponent);
|
numberToDisplay += Math.pow(10, exponent);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(turbinegas.counter > 50)
|
if(turbinegas.counter > 50)
|
||||||
numberToDisplay = 0;
|
numberToDisplay = 0;
|
||||||
|
|
||||||
drawPowerMeterDisplay(numberToDisplay);
|
drawPowerMeterDisplay(numberToDisplay);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void drawPowerMeterDisplay(int number) { //display code
|
protected void drawPowerMeterDisplay(int number) { //display code
|
||||||
|
|
||||||
int firstDigitX = 65;
|
int firstDigitX = 65;
|
||||||
int firstDigitY = 62;
|
int firstDigitY = 62;
|
||||||
|
|
||||||
int[] digit = new int[7];
|
int[] digit = new int[7];
|
||||||
|
|
||||||
for(int i = 6; i >= 0; i--) { //creates an array of digits that represent the numbers
|
for(int i = 6; i >= 0; i--) { //creates an array of digits that represent the numbers
|
||||||
|
|
||||||
digit[i] = (int) (number % 10);
|
digit[i] = (int) (number % 10);
|
||||||
|
|
||||||
number = number / 10;
|
number = number / 10;
|
||||||
|
|
||||||
drawTexturedModalRect(guiLeft + firstDigitX + i * 7, guiTop + 9 + firstDigitY, 194 + digit[i] * 5, 0, 5, 11);
|
drawTexturedModalRect(guiLeft + firstDigitX + i * 7, guiTop + 9 + firstDigitY, 194 + digit[i] * 5, 0, 5, 11);
|
||||||
}
|
}
|
||||||
|
|
||||||
int uselessZeros = 0;
|
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
|
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)
|
if(digit[i] == 0)
|
||||||
uselessZeros++;
|
uselessZeros++;
|
||||||
else
|
else
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int i = 0; i < uselessZeros; i++) { //turns off the useless zeros
|
for(int i = 0; i < uselessZeros; i++) { //turns off the useless zeros
|
||||||
|
|
||||||
drawTexturedModalRect(guiLeft + firstDigitX + i * 7, guiTop + 9 + firstDigitY, 244, 0, 5, 11);
|
drawTexturedModalRect(guiLeft + firstDigitX + i * 7, guiTop + 9 + firstDigitY, 244, 0, 5, 11);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void drawThermometer(int temp) {
|
protected void drawThermometer(int temp) {
|
||||||
|
|
||||||
int xPos = guiLeft + 136;
|
int xPos = guiLeft + 136;
|
||||||
int yPos = guiTop + 28;
|
int yPos = guiTop + 28;
|
||||||
|
|
||||||
int width = 2;
|
int width = 2;
|
||||||
int height = 64;
|
int height = 64;
|
||||||
|
|
||||||
int maxTemp = 800;
|
int maxTemp = 800;
|
||||||
|
|
||||||
double uMin = (176D / 256D);
|
double uMin = (176D / 256D);
|
||||||
double uMax = (178D / 256D);
|
double uMax = (178D / 256D);
|
||||||
double vMin = ((64D - 64 * temp / maxTemp) / 256D);
|
double vMin = ((64D - 64 * temp / maxTemp) / 256D);
|
||||||
double vMax = (64D / 256D);
|
double vMax = (64D / 256D);
|
||||||
|
|
||||||
GL11.glEnable(GL11.GL_BLEND);
|
GL11.glEnable(GL11.GL_BLEND);
|
||||||
|
|
||||||
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
|
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
|
||||||
|
|
||||||
Tessellator tessellator = Tessellator.instance;
|
Tessellator tessellator = Tessellator.instance;
|
||||||
|
|
||||||
tessellator.startDrawingQuads();
|
tessellator.startDrawingQuads();
|
||||||
tessellator.addVertexWithUV(xPos, yPos + height, this.zLevel, uMin, vMax);
|
tessellator.addVertexWithUV(xPos, yPos + height, this.zLevel, uMin, vMax);
|
||||||
tessellator.addVertexWithUV(xPos + width, yPos + height, this.zLevel, uMax, 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);
|
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
|
@Override
|
||||||
protected void drawGuiContainerForegroundLayer(int i, int j) {
|
protected void drawGuiContainerForegroundLayer(int i, int j) {
|
||||||
//useless piece of shit, at least for now
|
//useless piece of shit, at least for now
|
||||||
String name = this.turbinegas.hasCustomInventoryName() ? this.turbinegas.getInventoryName() : I18n.format(this.turbinegas.getInventoryName());
|
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(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752);
|
||||||
this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 94, 4210752);
|
this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 94, 4210752);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
package com.hbm.inventory.gui;
|
package com.hbm.inventory.gui;
|
||||||
|
|
||||||
|
import com.hbm.inventory.gui.element.GUIElements;
|
||||||
import org.lwjgl.opengl.GL11;
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
import com.hbm.inventory.container.ContainerReactorZirnox;
|
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);
|
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 + 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" });
|
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");
|
String[] coolantText = I18nUtil.resolveKeyArray("desc.gui.zirnox.coolant");
|
||||||
this.drawCustomInfoStat(mouseX, mouseY, guiLeft - 16, guiTop + 36, 16, 16, guiLeft - 8, guiTop + 36 + 16, coolantText);
|
this.drawCustomInfoStat(mouseX, mouseY, guiLeft - 16, guiTop + 36, 16, 16, guiLeft - 8, guiTop + 36 + 16, coolantText);
|
||||||
|
|
||||||
String[] pressureText = I18nUtil.resolveKeyArray("desc.gui.zirnox.pressure");
|
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);
|
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);
|
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
|
||||||
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
|
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
|
||||||
|
|
||||||
int s = zirnox.getGaugeScaled(6, 0);
|
GUIElements.drawSmoothLinearGauge(guiLeft + 162, guiTop + 114, this.zLevel, (double) zirnox.steam.getFill() / zirnox.steam.getMaxFill(), 2, 5, 0.75, 14, 0, 0x7F0000);
|
||||||
drawTexturedModalRect(guiLeft + 160, guiTop + 108, 238, 0 + 12 * s, 18, 12);
|
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);
|
GUIElements.drawSmoothGauge(guiLeft + 169, guiTop + 42, this.zLevel, (double) zirnox.heat/100000, 5, 2, 1, 0x7F0000);
|
||||||
drawTexturedModalRect(guiLeft + 142, guiTop + 108, 238, 0 + 12 * c, 18, 12);
|
GUIElements.drawSmoothGauge(guiLeft + 187, guiTop + 42, this.zLevel, (double) zirnox.pressure/100000, 5, 2, 1, 0x7F0000);
|
||||||
|
|
||||||
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);
|
|
||||||
|
|
||||||
if(zirnox.isOn) {
|
if(zirnox.isOn) {
|
||||||
for(int x = 0; x < 4; x++)
|
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);
|
this.drawInfoPanel(guiLeft - 16, guiTop + 36 + 32 + 16, 16, 16, 6);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,7 +6,6 @@ import org.lwjgl.opengl.GL11;
|
|||||||
|
|
||||||
import com.hbm.inventory.container.ContainerWatz;
|
import com.hbm.inventory.container.ContainerWatz;
|
||||||
import com.hbm.inventory.gui.element.GUIElements;
|
import com.hbm.inventory.gui.element.GUIElements;
|
||||||
import com.hbm.inventory.gui.element.GUIElements.Gauge;
|
|
||||||
import com.hbm.lib.RefStrings;
|
import com.hbm.lib.RefStrings;
|
||||||
import com.hbm.packet.PacketDispatcher;
|
import com.hbm.packet.PacketDispatcher;
|
||||||
import com.hbm.packet.toserver.NBTControlPacket;
|
import com.hbm.packet.toserver.NBTControlPacket;
|
||||||
@ -28,11 +27,11 @@ public class GUIWatz extends GuiInfoContainer {
|
|||||||
public GUIWatz(InventoryPlayer invPlayer, TileEntityWatz watz) {
|
public GUIWatz(InventoryPlayer invPlayer, TileEntityWatz watz) {
|
||||||
super(new ContainerWatz(invPlayer, watz));
|
super(new ContainerWatz(invPlayer, watz));
|
||||||
this.watz = watz;
|
this.watz = watz;
|
||||||
|
|
||||||
this.xSize = 176;
|
this.xSize = 176;
|
||||||
this.ySize = 229;
|
this.ySize = 229;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawScreen(int x, int y, float interp) {
|
public void drawScreen(int x, int y, float interp) {
|
||||||
super.drawScreen(x, y, interp);
|
super.drawScreen(x, y, interp);
|
||||||
@ -44,11 +43,11 @@ public class GUIWatz extends GuiInfoContainer {
|
|||||||
watz.tanks[1].renderTankInfo(this, x, y, guiLeft + 148, guiTop + 23, 6, 45);
|
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);
|
watz.tanks[2].renderTankInfo(this, x, y, guiLeft + 154, guiTop + 23, 6, 45);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void drawGuiContainerForegroundLayer(int i, int j) {
|
protected void drawGuiContainerForegroundLayer(int i, int j) {
|
||||||
this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 93, 4210752);
|
this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 93, 4210752);
|
||||||
|
|
||||||
double scale = 1.25;
|
double scale = 1.25;
|
||||||
String flux = String.format(Locale.US, "%,.1f", watz.fluxDisplay);
|
String flux = String.format(Locale.US, "%,.1f", watz.fluxDisplay);
|
||||||
GL11.glScaled(1 / scale, 1 / scale, 1);
|
GL11.glScaled(1 / scale, 1 / scale, 1);
|
||||||
@ -76,7 +75,7 @@ public class GUIWatz extends GuiInfoContainer {
|
|||||||
GL11.glColor4f(1.0F, col, col, 1.0F);
|
GL11.glColor4f(1.0F, col, col, 1.0F);
|
||||||
drawTexturedModalRect(guiLeft, guiTop, 0, 0, 131, 122);
|
drawTexturedModalRect(guiLeft, guiTop, 0, 0, 131, 122);
|
||||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
|
|
||||||
drawTexturedModalRect(guiLeft + 131, guiTop, 131, 0, 36, 122);
|
drawTexturedModalRect(guiLeft + 131, guiTop, 131, 0, 36, 122);
|
||||||
drawTexturedModalRect(guiLeft, guiTop + 130, 0, 130, xSize, 99);
|
drawTexturedModalRect(guiLeft, guiTop + 130, 0, 130, xSize, 99);
|
||||||
drawTexturedModalRect(guiLeft + 126, guiTop + 31, 176, 31, 9, 60);
|
drawTexturedModalRect(guiLeft + 126, guiTop + 31, 176, 31, 9, 60);
|
||||||
@ -85,8 +84,8 @@ public class GUIWatz extends GuiInfoContainer {
|
|||||||
|
|
||||||
if(watz.isOn) drawTexturedModalRect(guiLeft + 147, guiTop + 8, 176, 0, 8, 8);
|
if(watz.isOn) drawTexturedModalRect(guiLeft + 147, guiTop + 8, 176, 0, 8, 8);
|
||||||
if(watz.isLocked) drawTexturedModalRect(guiLeft + 142, guiTop + 70, 210, 0, 18, 18);
|
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[0].renderTank(guiLeft + 143, guiTop + 69, this.zLevel, 4, 43);
|
||||||
watz.tanks[1].renderTank(guiLeft + 149, 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;
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
|
||||||
public class GUIElements {
|
public class GUIElements {
|
||||||
|
|
||||||
@Deprecated public static enum Gauge {
|
@Deprecated public static enum Gauge {
|
||||||
ROUND_SMALL("small_round", 18, 18, 13);
|
ROUND_SMALL("small_round", 18, 18, 13);
|
||||||
ResourceLocation texture;
|
ResourceLocation texture;
|
||||||
@ -33,7 +33,7 @@ public class GUIElements {
|
|||||||
this.count = count;
|
this.count = count;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated public static void renderGauge(Gauge gauge, double x, double y, double z, double progress) {
|
@Deprecated public static void renderGauge(Gauge gauge, double x, double y, double z, double progress) {
|
||||||
Minecraft.getMinecraft().renderEngine.bindTexture(gauge.texture);
|
Minecraft.getMinecraft().renderEngine.bindTexture(gauge.texture);
|
||||||
int frameNum = (int) Math.round((gauge.count - 1) * progress);
|
int frameNum = (int) Math.round((gauge.count - 1) * progress);
|
||||||
@ -47,7 +47,7 @@ public class GUIElements {
|
|||||||
tess.addVertexWithUV(x, y, z, 0, frameOffset);
|
tess.addVertexWithUV(x, y, z, 0, frameOffset);
|
||||||
tess.draw();
|
tess.draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void drawSmoothGauge(int x, int y, double z, double progress, double tipLength, double backLength, double backSide, int color) {
|
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);
|
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 tip = new Vec3NT();
|
||||||
private static Vec3NT left = new Vec3NT();
|
private static Vec3NT left = new Vec3NT();
|
||||||
private static Vec3NT right = 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) {
|
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);
|
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||||
|
|
||||||
progress = MathHelper.clamp_double(progress, 0, 1);
|
progress = MathHelper.clamp_double(progress, 0, 1);
|
||||||
|
|
||||||
float angle = (float) Math.toRadians(-progress * 270 - 45);
|
float angle = (float) Math.toRadians(-progress * 270 - 45);
|
||||||
tip.setComponents(0, tipLength, 0);
|
tip.setComponents(0, tipLength, 0);
|
||||||
left.setComponents(backSide, -backLength, 0);
|
left.setComponents(backSide, -backLength, 0);
|
||||||
@ -69,7 +69,7 @@ public class GUIElements {
|
|||||||
tip.rotateAroundZ(angle);
|
tip.rotateAroundZ(angle);
|
||||||
left.rotateAroundZ(angle);
|
left.rotateAroundZ(angle);
|
||||||
right.rotateAroundZ(angle);
|
right.rotateAroundZ(angle);
|
||||||
|
|
||||||
Tessellator tess = Tessellator.instance;
|
Tessellator tess = Tessellator.instance;
|
||||||
tess.startDrawing(GL11.GL_TRIANGLES);
|
tess.startDrawing(GL11.GL_TRIANGLES);
|
||||||
tess.setColorOpaque_I(colorOuter);
|
tess.setColorOpaque_I(colorOuter);
|
||||||
@ -82,11 +82,147 @@ public class GUIElements {
|
|||||||
tess.addVertex(x + left.xCoord, y + left.yCoord, z);
|
tess.addVertex(x + left.xCoord, y + left.yCoord, z);
|
||||||
tess.addVertex(x + right.xCoord, y + right.yCoord, z);
|
tess.addVertex(x + right.xCoord, y + right.yCoord, z);
|
||||||
tess.draw();
|
tess.draw();
|
||||||
|
|
||||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
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(xDraw, yDraw + yDelta, zDraw, ((float) (xStart) * var7), ((float) (yStart + yDelta) * var8));
|
||||||
|
tess.addVertexWithUV(xDraw + xMid, yDraw + yMid, zDraw, (float) (xStart + xMid) * var7, (float) (yStart + yMid) * var8);
|
||||||
|
if (addons == 2 || addons == 1) {
|
||||||
|
tess.addVertexWithUV(xDraw, yDraw, zDraw, (float) (xStart) * var7, (float) (yStart) * var8);
|
||||||
|
tess.draw();
|
||||||
|
tess.startDrawing(GL11.GL_TRIANGLES);
|
||||||
|
tess.addVertexWithUV(xDraw, yDraw, zDraw, (float) (xStart) * var7, (float) (yStart) * var8);
|
||||||
|
tess.addVertexWithUV(xDraw + xMid, yDraw + yMid, zDraw, (float) (xStart + xMid) * var7, (float) (yStart + yMid) * var8);
|
||||||
|
}
|
||||||
|
if (addons == 2) {
|
||||||
|
tess.addVertexWithUV(xDraw + xDelta, yDraw, zDraw, (float) (xStart + xDelta) * var7, (float) (yStart) * var8);
|
||||||
|
tess.draw();
|
||||||
|
tess.startDrawing(GL11.GL_TRIANGLES);
|
||||||
|
tess.addVertexWithUV(xDraw + xDelta, yDraw, (double) zDraw, (float) (xStart + xDelta) * var7, (float) (yStart) * var8);
|
||||||
|
tess.addVertexWithUV(xDraw + xMid, yDraw + yMid, zDraw, (float) (xStart + xMid) * var7, (float) (yStart + yMid) * var8);
|
||||||
|
}
|
||||||
|
tess.addVertexWithUV(xDraw + xTarget + xMid, yDraw - yTarget + yMid, zDraw, (float) (xStart + xTarget + xMid) * var7, (float) (yStart - yTarget + yMid) * var8);
|
||||||
|
tess.draw();
|
||||||
|
}
|
||||||
|
|
||||||
public static final int STANDARD_COLOR_BACKGROUND = -0xFEFFFF0;
|
public static final int STANDARD_COLOR_BACKGROUND = -0xFEFFFF0;
|
||||||
public static final int STANDARD_COLOR_LINE0 = 0x505000FF;
|
public static final int STANDARD_COLOR_LINE0 = 0x505000FF;
|
||||||
public static final int STANDARD_COLOR_LINE1 = (STANDARD_COLOR_LINE0 & 0xFEFEFE) >> 1 | STANDARD_COLOR_LINE0 & -0xFEFEFE;
|
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) {
|
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()) {
|
if(!lines.isEmpty()) {
|
||||||
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
|
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
|
||||||
RenderHelper.disableStandardItemLighting();
|
RenderHelper.disableStandardItemLighting();
|
||||||
@ -154,7 +290,7 @@ public class GUIElements {
|
|||||||
drawGradientRect(boundX - 3, boundY - 3, boundX + width + 3, boundY + height + 3, colBG0, colBG1);
|
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 - 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 + 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 - 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 + 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);
|
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) {
|
for(int i = 0; i < lines.size(); ++i) {
|
||||||
String line = (String) lines.get(i);
|
String line = (String) lines.get(i);
|
||||||
font.drawStringWithShadow(line, boundX, boundY, -1);
|
font.drawStringWithShadow(line, boundX, boundY, -1);
|
||||||
|
|
||||||
if(i == 0) boundY += headerOffset;
|
if(i == 0) boundY += headerOffset;
|
||||||
boundY += lineDist;
|
boundY += lineDist;
|
||||||
}
|
}
|
||||||
@ -175,7 +311,7 @@ public class GUIElements {
|
|||||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Colors don't use the RGBA, but rather ARGB (evil route) */
|
/** 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) {
|
protected static void drawGradientRect(int x0, int y0, int x1, int y1, int col0, int col1) {
|
||||||
float a0 = (float) (col0 >> 24 & 255) / 255F;
|
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