mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
80 lines
3.5 KiB
Java
80 lines
3.5 KiB
Java
package com.hbm.inventory.gui;
|
|
|
|
import org.lwjgl.opengl.GL11;
|
|
|
|
import com.hbm.inventory.FluidTank;
|
|
import com.hbm.inventory.container.ContainerITER;
|
|
import com.hbm.lib.RefStrings;
|
|
import com.hbm.packet.AuxButtonPacket;
|
|
import com.hbm.packet.PacketDispatcher;
|
|
import com.hbm.tileentity.machine.TileEntityITER;
|
|
|
|
import net.minecraft.client.Minecraft;
|
|
import net.minecraft.client.audio.PositionedSoundRecord;
|
|
import net.minecraft.client.resources.I18n;
|
|
import net.minecraft.entity.player.InventoryPlayer;
|
|
import net.minecraft.util.ResourceLocation;
|
|
|
|
public class GUIITER extends GuiInfoContainer {
|
|
|
|
public static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/reactors/gui_fusion_multiblock.png");
|
|
private TileEntityITER iter;
|
|
|
|
public GUIITER(InventoryPlayer invPlayer, TileEntityITER laser) {
|
|
super(new ContainerITER(invPlayer, laser));
|
|
this.iter = laser;
|
|
|
|
this.xSize = 176;
|
|
this.ySize = 222;
|
|
}
|
|
|
|
@Override
|
|
public void drawScreen(int mouseX, int mouseY, float f) {
|
|
super.drawScreen(mouseX, mouseY, f);
|
|
|
|
this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 71, guiTop + 108, 34, 16, iter.power, iter.maxPower);
|
|
|
|
iter.tanks[0].renderTankInfo(this, mouseX, mouseY, guiLeft + 26, guiTop + 54, 16, 52); //Water
|
|
iter.tanks[1].renderTankInfo(this, mouseX, mouseY, guiLeft + 134, guiTop + 54, 16, 52); //Steam
|
|
iter.plasma.renderTankInfo(this, mouseX, mouseY, guiLeft + 71, guiTop + 54, 52, 52); //Plasma
|
|
}
|
|
|
|
protected void mouseClicked(int x, int y, int i) {
|
|
super.mouseClicked(x, y, i);
|
|
|
|
if(guiLeft + 52 <= x && guiLeft + 52 + 18 > x && guiTop + 107 < y && guiTop + 107 + 18 >= y) {
|
|
|
|
//toggle the magnets
|
|
mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F));
|
|
PacketDispatcher.wrapper.sendToServer(new AuxButtonPacket(iter.xCoord, iter.yCoord, iter.zCoord, 0, 0));
|
|
}
|
|
}
|
|
|
|
@Override
|
|
protected void drawGuiContainerForegroundLayer(int i, int j) {
|
|
String name = this.iter.hasCustomInventoryName() ? this.iter.getInventoryName() : I18n.format(this.iter.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 - 96 + 2, 4210752);
|
|
}
|
|
|
|
@Override
|
|
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
|
|
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
|
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
|
|
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
|
|
|
|
//TODO: progress bars and button
|
|
|
|
for(int t = 0; t < 2; t++) {
|
|
Minecraft.getMinecraft().getTextureManager().bindTexture(iter.tanks[t].getSheet());
|
|
iter.tanks[t].renderTank(this, guiLeft + 26 + 108 * t, guiTop + 106, iter.tanks[t].getTankType().textureX() * FluidTank.x, iter.tanks[t].getTankType().textureY() * FluidTank.y, 16, 52);
|
|
}
|
|
|
|
Minecraft.getMinecraft().getTextureManager().bindTexture(iter.plasma.getSheet());
|
|
iter.plasma.renderTank(this, guiLeft + 71, guiTop + 88, iter.plasma.getTankType().textureX() * FluidTank.x, iter.plasma.getTankType().textureY() * FluidTank.y, 16, 52);
|
|
iter.plasma.renderTank(this, guiLeft + 71 + 16, guiTop + 88, iter.plasma.getTankType().textureX() * FluidTank.x, iter.plasma.getTankType().textureY() * FluidTank.y, 16, 52);
|
|
iter.plasma.renderTank(this, guiLeft + 71 + 32, guiTop + 88, iter.plasma.getTankType().textureX() * FluidTank.x, iter.plasma.getTankType().textureY() * FluidTank.y, 2, 52);
|
|
}
|
|
}
|