started with one thing...then I ended up doing a lot of shit.

This commit is contained in:
ProfessorProspector 2017-01-08 21:58:02 -08:00
parent 4e6b60e8e7
commit dc160bbd67
42 changed files with 345 additions and 417 deletions

View file

@ -112,7 +112,7 @@ public class GuiBase extends GuiContainer {
factorX = guiLeft;
factorY = guiTop;
}
buttonList.add(new GuiButtonPowerBar(0, x + factorX, y + factorY, this, layer));
buttonList.add(new GuiButtonPowerBar(id, x + factorX, y + factorY, this, layer));
}
//TODO

View file

@ -2,9 +2,7 @@ package techreborn.client.gui;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.entity.player.EntityPlayer;
import reborncore.common.powerSystem.PowerSystem;
import techreborn.tiles.storage.TileBatBox;
public class GuiBatbox extends GuiBase {
@ -30,9 +28,11 @@ public class GuiBatbox extends GuiBase {
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
final Layer layer = Layer.FOREGROUND;
this.builder.drawMultiEnergyBar(this, 81, 28, (int) this.tile.getEnergy(), (int) this.tile.getMaxPower(), mouseX, mouseY, 0, layer);
GlStateManager.pushMatrix();
GlStateManager.scale(0.6, 0.6, 5);
this.drawCentredString(PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) this.tile.getEnergy()) + "/" + PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) this.tile.getMaxPower()) + " " + PowerSystem.getDisplayPower().abbreviation, 35, 0, 58, layer);
GlStateManager.scale(1, 1, 1);
GlStateManager.popMatrix();
this.builder.drawMultiEnergyBar(this, 81, 28, (int) this.tile.getEnergy(), (int) this.tile.getMaxPower(), mouseX, mouseY, 0, layer);
}
}

View file

@ -2,103 +2,74 @@ package techreborn.client.gui;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.translation.I18n;
import reborncore.client.gui.GuiUtil;
import reborncore.client.multiblock.Multiblock;
import reborncore.client.multiblock.MultiblockRenderEvent;
import reborncore.client.multiblock.MultiblockSet;
import reborncore.common.misc.Location;
import reborncore.common.multiblock.CoordTriplet;
import techreborn.client.gui.widget.GuiButtonHologram;
import techreborn.init.ModBlocks;
import techreborn.proxies.ClientProxy;
import techreborn.tiles.multiblock.TileBlastFurnace;
import java.io.IOException;
public class GuiBlastFurnace extends GuiContainer {
public static final ResourceLocation texture = new ResourceLocation("techreborn",
"textures/gui/industrial_blast_furnace.png");
TileBlastFurnace blastfurnace;
public class GuiBlastFurnace extends GuiBase {
public TileBlastFurnace tile;
boolean hasMultiBlock;
public GuiBlastFurnace(final EntityPlayer player, final TileBlastFurnace blastFurnace) {
super(blastFurnace.createContainer(player));
this.xSize = 176;
this.ySize = 167;
this.blastfurnace = blastFurnace;
public GuiBlastFurnace(final EntityPlayer player, final TileBlastFurnace tile) {
super(player, tile, tile.createContainer(player));
this.tile = tile;
}
@Override
public void initGui() {
this.hasMultiBlock = this.blastfurnace.getCachedHeat() != 0;
final int k = (this.width - this.xSize) / 2;
final int l = (this.height - this.ySize) / 2;
final GuiButton button = new GuiButton(212, k + 4, l + 6, 20, 20, "");
this.buttonList.add(button);
super.initGui();
final CoordTriplet coordinates = new CoordTriplet(
this.blastfurnace.getPos().getX() - EnumFacing.getFront(this.blastfurnace.getFacingInt()).getFrontOffsetX() * 2,
this.blastfurnace.getPos().getY() - 1, this.blastfurnace.getPos().getZ()
- EnumFacing.getFront(this.blastfurnace.getFacingInt()).getFrontOffsetZ() * 2);
if (coordinates.equals(MultiblockRenderEvent.anchor) && this.blastfurnace.getHeat() != 0) {
ClientProxy.multiblockRenderEvent.setMultiblock(null);
button.displayString = "B";
} else {
button.displayString = "A";
}
this.hasMultiBlock = this.tile.getCachedHeat() != 0;
}
@Override
protected void drawGuiContainerBackgroundLayer(final float p_146976_1_, final int p_146976_2_, final int p_146976_3_) {
protected void drawGuiContainerBackgroundLayer(final float f, final int mouseX, final int mouseY) {
super.drawGuiContainerBackgroundLayer(f, mouseX, mouseY);
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(GuiBlastFurnace.texture);
final int k = (this.width - this.xSize) / 2;
final int l = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
final GuiBase.Layer layer = Layer.BACKGROUND;
if (this.blastfurnace.getCachedHeat() == 0) {
GuiUtil.drawTooltipBox(k + 30, l + 50 + 12 - 0, 114, 10);
this.fontRendererObj.drawString(I18n.translateToLocal("techreborn.message.missingmultiblock"), k + 38,
l + 52 + 12 - 0, -1);
}
int j = 0;
this.mc.getTextureManager().bindTexture(GuiBlastFurnace.texture);
j = this.blastfurnace.getProgressScaled(24);
if (j > 0) {
this.drawTexturedModalRect(k + 64, l + 37, 176, 14, j + 1, 16);
}
j = this.blastfurnace.getEnergyScaled(12);
if (j > 0) {
this.drawTexturedModalRect(k + 9, l + 36 + 12 - j, 176, 12 - j, 14, j + 2);
}
drawSlot(50, 27, layer);
drawSlot(50, 47, layer);
drawSlot(92, 36, layer);
drawSlot(110, 36, layer);
this.builder.drawJEIButton(this, 150, 4, layer);
}
@Override
protected void drawGuiContainerForegroundLayer(final int p_146979_1_, final int p_146979_2_) {
super.drawGuiContainerForegroundLayer(p_146979_1_, p_146979_2_);
final String name = I18n.translateToLocal("tile.techreborn.blastfurnace.name");
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6,
4210752);
if (this.blastfurnace.getCachedHeat() != 0) {
this.fontRendererObj.drawString("Current Heat: " + this.blastfurnace.getCachedHeat(), 40, 60, 4210752);
protected void drawGuiContainerForegroundLayer(final int mouseX, final int mouseY) {
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
final GuiBase.Layer layer = GuiBase.Layer.FOREGROUND;
this.builder.drawProgressBar(this, this.tile.getProgressScaled(100), 100, 71, 40, mouseX, mouseY, TRBuilder.ProgressDirection.RIGHT, layer);
this.builder.drawMultiEnergyBar(this, 9, 18, (int) this.tile.getEnergy(), (int) this.tile.getMaxPower(), mouseX, mouseY, 0, layer);
this.builder.drawBigHeatBar(this, 31, 71, tile.getCachedHeat(), 3230, layer);
addHologramButton(6, 4, 212, layer);
builder.drawHologramButton(this, 6, 4, mouseX, mouseY, layer);
}
public void addHologramButton(int x, int y, int id, Layer layer) {
if (id == 0)
buttonList.clear();
int factorX = 0;
int factorY = 0;
if (layer == Layer.BACKGROUND) {
factorX = guiLeft;
factorY = guiTop;
}
this.fontRendererObj.drawString(I18n.translateToLocalFormatted("container.inventory", new Object[0]), 8,
this.ySize - 96 + 2, 4210752);
buttonList.add(new GuiButtonHologram(id, x + factorX, y + factorY, this, layer));
}
@Override
@ -106,8 +77,8 @@ public class GuiBlastFurnace extends GuiContainer {
super.actionPerformed(button);
if (button.id == 212) {
if (ClientProxy.multiblockRenderEvent.currentMultiblock == null) {
{// This code here makes a basic multiblock and then sets to the
// selected one.
{
// This code here makes a basic multiblock and then sets to the selected one.
final Multiblock multiblock = new Multiblock();
this.addComponent(0, 0, 0, ModBlocks.MACHINE_CASINGS.getDefaultState(), multiblock);
this.addComponent(1, 0, 0, ModBlocks.MACHINE_CASINGS.getDefaultState(), multiblock);
@ -149,18 +120,16 @@ public class GuiBlastFurnace extends GuiContainer {
final MultiblockSet set = new MultiblockSet(multiblock);
ClientProxy.multiblockRenderEvent.setMultiblock(set);
ClientProxy.multiblockRenderEvent.parent = new Location(this.blastfurnace.getPos().getX(),
this.blastfurnace.getPos().getY(), this.blastfurnace.getPos().getZ(), this.blastfurnace.getWorld());
ClientProxy.multiblockRenderEvent.parent = new Location(this.tile.getPos().getX(),
this.tile.getPos().getY(), this.tile.getPos().getZ(), this.tile.getWorld());
MultiblockRenderEvent.anchor = new BlockPos(
this.blastfurnace.getPos().getX()
- EnumFacing.getFront(this.blastfurnace.getFacingInt()).getFrontOffsetX() * 2,
this.blastfurnace.getPos().getY() - 1, this.blastfurnace.getPos().getZ()
- EnumFacing.getFront(this.blastfurnace.getFacingInt()).getFrontOffsetZ() * 2);
this.tile.getPos().getX()
- EnumFacing.getFront(this.tile.getFacingInt()).getFrontOffsetX() * 2,
this.tile.getPos().getY() - 1, this.tile.getPos().getZ()
- EnumFacing.getFront(this.tile.getFacingInt()).getFrontOffsetZ() * 2);
}
button.displayString = "A";
} else {
ClientProxy.multiblockRenderEvent.setMultiblock(null);
button.displayString = "B";
}
}
}

View file

@ -27,7 +27,7 @@ public class GuiCentrifuge extends GuiBase {
this.drawSlot(120, 44, layer);
this.drawSlot(101, 63, layer);
this.builder.drawJEIButton(this, 150, 4, mouseX, mouseY, layer);
this.builder.drawJEIButton(this, 150, 4, layer);
}
@Override

View file

@ -1,54 +1,36 @@
package techreborn.client.gui;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.translation.I18n;
import techreborn.tiles.teir1.TileCompressor;
public class GuiCompressor extends GuiContainer {
public class GuiCompressor extends GuiBase {
public static final ResourceLocation texture = new ResourceLocation("techreborn", "textures/gui/compressor.png");
TileCompressor tile;
TileCompressor compressor;
public GuiCompressor(final EntityPlayer player, final TileCompressor compressor) {
super(compressor.createContainer(player));
this.xSize = 176;
this.ySize = 167;
this.compressor = compressor;
public GuiCompressor(final EntityPlayer player, final TileCompressor tile) {
super(player, tile, tile.createContainer(player));
this.tile = tile;
}
@Override
protected void drawGuiContainerBackgroundLayer(final float p_146976_1_, final int p_146976_2_, final int p_146976_3_) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(GuiCompressor.texture);
final int k = (this.width - this.xSize) / 2;
final int l = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
protected void drawGuiContainerBackgroundLayer(final float f, final int mouseX, final int mouseY) {
super.drawGuiContainerBackgroundLayer(f, mouseX, mouseY);
final GuiBase.Layer layer = GuiBase.Layer.BACKGROUND;
int j = 0;
//this.drawSlot(8, 72, layer);
j = this.compressor.getProgressScaled(24);
if (j > 0) {
this.drawTexturedModalRect(k + 78, l + 35, 176, 14, j + 1, 16);
}
this.drawSlot(55, 45, layer);
this.drawOutputSlot(101, 45, layer);
j = this.compressor.getEnergyScaled(12);
if (j > 0) {
this.drawTexturedModalRect(k + 24, l + 36 + 12 - j, 176, 12 - j, 14, j + 2);
}
this.builder.drawJEIButton(this, 150, 4, layer);
}
@Override
protected void drawGuiContainerForegroundLayer(final int p_146979_1_, final int p_146979_2_) {
final String name = I18n.translateToLocal("tile.techreborn.compressor.name");
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6,
4210752);
this.fontRendererObj.drawString(I18n.translateToLocalFormatted("container.inventory", new Object[0]), 8,
this.ySize - 96 + 2, 4210752);
protected void drawGuiContainerForegroundLayer(final int mouseX, final int mouseY) {
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
final GuiBase.Layer layer = GuiBase.Layer.FOREGROUND;
this.builder.drawProgressBar(this, this.tile.getProgressScaled(100), 100, 76, 48, mouseX, mouseY, TRBuilder.ProgressDirection.RIGHT, layer);
this.builder.drawMultiEnergyBar(this, 9, 18, (int) this.tile.getEnergy(), (int) this.tile.getMaxPower(), mouseX, mouseY, 0, layer);
}
}

View file

@ -22,7 +22,7 @@ public class GuiElectricFurnace extends GuiBase {
this.drawSlot(55, 45, layer);
this.drawOutputSlot(101, 45, layer);
this.builder.drawJEIButton(this, 150, 4, mouseX, mouseY, layer);
this.builder.drawJEIButton(this, 150, 4, layer);
}
@Override

View file

@ -1,53 +1,36 @@
package techreborn.client.gui;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.translation.I18n;
import techreborn.tiles.teir1.TileExtractor;
public class GuiExtractor extends GuiContainer {
public class GuiExtractor extends GuiBase {
public static final ResourceLocation texture = new ResourceLocation("techreborn", "textures/gui/compressor.png");
TileExtractor tile;
TileExtractor extractor;
public GuiExtractor(final EntityPlayer player, final TileExtractor extractor) {
super(extractor.createContainer(player));
this.xSize = 176;
this.ySize = 167;
this.extractor = extractor;
public GuiExtractor(final EntityPlayer player, final TileExtractor tile) {
super(player, tile, tile.createContainer(player));
this.tile = tile;
}
@Override
protected void drawGuiContainerBackgroundLayer(final float p_146976_1_, final int p_146976_2_, final int p_146976_3_) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(GuiExtractor.texture);
final int k = (this.width - this.xSize) / 2;
final int l = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
protected void drawGuiContainerBackgroundLayer(final float f, final int mouseX, final int mouseY) {
super.drawGuiContainerBackgroundLayer(f, mouseX, mouseY);
final GuiBase.Layer layer = GuiBase.Layer.BACKGROUND;
int j = 0;
//this.drawSlot(8, 72, layer);
j = this.extractor.getProgressScaled(24);
if (j > 0) {
this.drawTexturedModalRect(k + 78, l + 35, 176, 14, j + 1, 16);
}
this.drawSlot(55, 45, layer);
this.drawOutputSlot(101, 45, layer);
j = this.extractor.getEnergyScaled(12);
if (j > 0) {
this.drawTexturedModalRect(k + 24, l + 36 + 12 - j, 176, 12 - j, 14, j + 2);
}
this.builder.drawJEIButton(this, 150, 4, layer);
}
@Override
protected void drawGuiContainerForegroundLayer(final int p_146979_1_, final int p_146979_2_) {
final String name = I18n.translateToLocal("tile.techreborn.extractor.name");
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6,
4210752);
this.fontRendererObj.drawString(I18n.translateToLocalFormatted("container.inventory", new Object[0]), 8,
this.ySize - 96 + 2, 4210752);
protected void drawGuiContainerForegroundLayer(final int mouseX, final int mouseY) {
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
final GuiBase.Layer layer = GuiBase.Layer.FOREGROUND;
this.builder.drawProgressBar(this, this.tile.getProgressScaled(100), 100, 76, 48, mouseX, mouseY, TRBuilder.ProgressDirection.RIGHT, layer);
this.builder.drawMultiEnergyBar(this, 9, 18, (int) this.tile.getEnergy(), (int) this.tile.getMaxPower(), mouseX, mouseY, 0, layer);
}
}

View file

@ -21,7 +21,7 @@ public class GuiGenerator extends GuiBase {
this.drawSlot(80, 54, layer);
this.builder.drawJEIButton(this, 150, 4, mouseX, mouseY, layer);
this.builder.drawJEIButton(this, 150, 4, layer);
}
@Override

View file

@ -1,53 +1,36 @@
package techreborn.client.gui;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.translation.I18n;
import techreborn.tiles.teir1.TileGrinder;
public class GuiGrinder extends GuiContainer {
public class GuiGrinder extends GuiBase {
public static final ResourceLocation texture = new ResourceLocation("techreborn", "textures/gui/grinder.png");
TileGrinder tile;
TileGrinder grinder;
public GuiGrinder(final EntityPlayer player, final TileGrinder grinder) {
super(grinder.createContainer(player));
this.xSize = 176;
this.ySize = 167;
this.grinder = grinder;
public GuiGrinder(final EntityPlayer player, final TileGrinder tile) {
super(player, tile, tile.createContainer(player));
this.tile = tile;
}
@Override
protected void drawGuiContainerBackgroundLayer(final float p_146976_1_, final int p_146976_2_, final int p_146976_3_) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(GuiGrinder.texture);
final int k = (this.width - this.xSize) / 2;
final int l = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
protected void drawGuiContainerBackgroundLayer(final float f, final int mouseX, final int mouseY) {
super.drawGuiContainerBackgroundLayer(f, mouseX, mouseY);
final GuiBase.Layer layer = GuiBase.Layer.BACKGROUND;
int j = 0;
//this.drawSlot(8, 72, layer);
j = this.grinder.getProgressScaled(24);
if (j > 0) {
this.drawTexturedModalRect(k + 80, l + 36, 176, 14, j + 1, 16);
}
this.drawSlot(55, 45, layer);
this.drawOutputSlot(101, 45, layer);
j = this.grinder.getEnergyScaled(12);
if (j > 0) {
this.drawTexturedModalRect(k + 24, l + 36 + 12 - j, 176, 12 - j, 14, j + 2);
}
this.builder.drawJEIButton(this, 150, 4, layer);
}
@Override
protected void drawGuiContainerForegroundLayer(final int p_146979_1_, final int p_146979_2_) {
final String name = I18n.translateToLocal("tile.techreborn.grinder.name");
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6,
4210752);
this.fontRendererObj.drawString(I18n.translateToLocalFormatted("container.inventory", new Object[0]), 8,
this.ySize - 96 + 2, 4210752);
protected void drawGuiContainerForegroundLayer(final int mouseX, final int mouseY) {
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
final GuiBase.Layer layer = GuiBase.Layer.FOREGROUND;
this.builder.drawProgressBar(this, this.tile.getProgressScaled(100), 100, 76, 48, mouseX, mouseY, TRBuilder.ProgressDirection.RIGHT, layer);
this.builder.drawMultiEnergyBar(this, 9, 18, (int) this.tile.getEnergy(), (int) this.tile.getMaxPower(), mouseX, mouseY, 0, layer);
}
}

View file

@ -2,9 +2,7 @@ package techreborn.client.gui;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.entity.player.EntityPlayer;
import reborncore.common.powerSystem.PowerSystem;
import techreborn.tiles.storage.TileMFE;
public class GuiMFE extends GuiBase {
@ -31,9 +29,11 @@ public class GuiMFE extends GuiBase {
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
final Layer layer = Layer.FOREGROUND;
this.builder.drawMultiEnergyBar(this, 81, 28, (int) this.mfe.getEnergy(), (int) this.mfe.getMaxPower(), mouseX, mouseY, 0, layer);
GlStateManager.scale(0.6, 0.6, 5);
GlStateManager.pushMatrix();
GlStateManager.scale(0.6, 0.6, 1);
this.drawCentredString(PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) this.mfe.getEnergy()) + "/" + PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) this.mfe.getMaxPower()) + " " + PowerSystem.getDisplayPower().abbreviation, 35, 0, 58, layer);
GlStateManager.scale(1, 1, 1);
GlStateManager.popMatrix();
this.builder.drawMultiEnergyBar(this, 81, 28, (int) this.mfe.getEnergy(), (int) this.mfe.getMaxPower(), mouseX, mouseY, 0, layer);
}
}

View file

@ -2,9 +2,7 @@ package techreborn.client.gui;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.entity.player.EntityPlayer;
import reborncore.common.powerSystem.PowerSystem;
import techreborn.tiles.storage.TileMFSU;
public class GuiMFSU extends GuiBase {
@ -31,9 +29,11 @@ public class GuiMFSU extends GuiBase {
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
final Layer layer = Layer.FOREGROUND;
this.builder.drawMultiEnergyBar(this, 81, 28, (int) this.mfsu.getEnergy(), (int) this.mfsu.getMaxPower(), mouseX, mouseY, 0, layer);
GlStateManager.scale(0.6, 0.6, 5);
GlStateManager.pushMatrix();
GlStateManager.scale(0.6, 0.6, 1);
this.drawCentredString(PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) this.mfsu.getEnergy()) + "/" + PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) this.mfsu.getMaxPower()) + " " + PowerSystem.getDisplayPower().abbreviation, 35, 0, 58, layer);
GlStateManager.scale(1, 1, 1);
GlStateManager.popMatrix();
this.builder.drawMultiEnergyBar(this, 81, 28, (int) this.mfsu.getEnergy(), (int) this.mfsu.getMaxPower(), mouseX, mouseY, 0, layer);
}
}

View file

@ -1,59 +1,37 @@
package techreborn.client.gui;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.translation.I18n;
import techreborn.tiles.multiblock.TileVacuumFreezer;
public class GuiVacuumFreezer extends GuiContainer {
public class GuiVacuumFreezer extends GuiBase {
public static final ResourceLocation texture = new ResourceLocation("techreborn", "textures/gui/vacuum_freezer.png");
TileVacuumFreezer tile;
TileVacuumFreezer freezer;
public GuiVacuumFreezer(final EntityPlayer player, final TileVacuumFreezer freezer) {
super(freezer.createContainer(player));
this.xSize = 176;
this.ySize = 167;
this.freezer = freezer;
public GuiVacuumFreezer(final EntityPlayer player, final TileVacuumFreezer tile) {
super(player, tile, tile.createContainer(player));
this.tile = tile;
}
@Override
protected void drawGuiContainerBackgroundLayer(final float partialTicks, final int mouseX, final int mouseY) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(GuiVacuumFreezer.texture);
final int k = (this.width - this.xSize) / 2;
final int l = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
protected void drawGuiContainerBackgroundLayer(final float f, final int mouseX, final int mouseY) {
super.drawGuiContainerBackgroundLayer(f, mouseX, mouseY);
final GuiBase.Layer layer = GuiBase.Layer.BACKGROUND;
int j = this.freezer.getProgressScaled(24);
if (j > 0) {
this.drawTexturedModalRect(k + 80, l + 37, 176, 14, j + 1, 16);
}
//this.drawSlot(8, 72, layer);
j = (int) (this.freezer.getEnergy() * 12f / this.freezer.getMaxPower());
if (j > 0) {
this.drawTexturedModalRect(k + 26, l + 36 + 12 - j, 176, 12 - j, 14, j + 2);
}
this.drawSlot(55, 45, layer);
this.drawOutputSlot(101, 45, layer);
if (!this.freezer.getMultiBlock()) {
this.fontRendererObj.drawString(I18n.translateToLocal("techreborn.message.missingmultiblock"), k + 38, l + 52 + 12, -1);
}
j = this.freezer.getEnergyScaled(12);
if (j > 0) {
this.drawTexturedModalRect(k + 26, l + 36 + 12 - j, 176, 12 - j, 14, j + 2);
}
this.builder.drawJEIButton(this, 150, 4, layer);
}
@Override
protected void drawGuiContainerForegroundLayer(final int mouseX, final int mouseY) {
final String name = I18n.translateToLocal("tile.techreborn.vacuumfreezer.name");
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752);
this.fontRendererObj.drawString(I18n.translateToLocalFormatted("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
final GuiBase.Layer layer = GuiBase.Layer.FOREGROUND;
this.builder.drawProgressBar(this, this.tile.getProgressScaled(100), 100, 76, 48, mouseX, mouseY, TRBuilder.ProgressDirection.RIGHT, layer);
this.builder.drawMultiEnergyBar(this, 9, 18, (int) this.tile.getEnergy(), (int) this.tile.getMaxPower(), mouseX, mouseY, 0, layer);
}
}

View file

@ -5,11 +5,13 @@ import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.util.text.translation.I18n;
import net.minecraftforge.fml.client.config.GuiUtils;
import net.minecraftforge.fml.common.Loader;
import reborncore.client.guibuilder.GuiBuilder;
import reborncore.common.powerSystem.PowerSystem;
import techreborn.lib.ModInfo;
import techreborn.proxies.ClientProxy;
import java.util.ArrayList;
import java.util.List;
@ -92,26 +94,18 @@ public class TRBuilder extends GuiBuilder {
}
}
public void drawJEIButton(GuiBase gui, int x, int y, int mouseX, int mouseY, GuiBase.Layer layer) {
public void drawJEIButton(GuiBase gui, int x, int y, GuiBase.Layer layer) {
if (Loader.isModLoaded("jei")) {
if (layer == GuiBase.Layer.BACKGROUND) {
x += gui.getGuiLeft();
y += gui.getGuiTop();
}
if (layer == GuiBase.Layer.FOREGROUND) {
mouseX -= gui.getGuiLeft();
mouseY -= gui.getGuiTop();
}
gui.mc.getTextureManager().bindTexture(GUI_SHEET);
if (isInRect(x, y, 20, 12, mouseX, mouseY)) {
gui.drawTexturedModalRect(x, y, 184, 82, 20, 12);
} else {
gui.drawTexturedModalRect(x, y, 184, 70, 20, 12);
}
gui.drawTexturedModalRect(x, y, 184, 70, 20, 12);
}
}
public void drawBigBlueBar(GuiBase gui, int x, int y, int value, int max, int mouseX, int mouseY, String suffix, GuiBase.Layer layer) {
public void drawHologramButton(GuiBase gui, int x, int y, int mouseX, int mouseY, GuiBase.Layer layer) {
if (layer == GuiBase.Layer.BACKGROUND) {
x += gui.getGuiLeft();
y += gui.getGuiTop();
@ -121,6 +115,26 @@ public class TRBuilder extends GuiBuilder {
mouseY -= gui.getGuiTop();
}
gui.mc.getTextureManager().bindTexture(GUI_SHEET);
if (ClientProxy.multiblockRenderEvent.currentMultiblock == null) {
gui.drawTexturedModalRect(x, y, 184, 94, 20, 12);
} else {
gui.drawTexturedModalRect(x, y, 184, 106, 20, 12);
}
if (isInRect(x, y, 20, 12, mouseX, mouseY)) {
List<String> list = new ArrayList<>();
list.add("Toggle Multiblock Hologram");
GlStateManager.pushMatrix();
net.minecraftforge.fml.client.config.GuiUtils.drawHoveringText(list, mouseX, mouseY, gui.width, gui.height, -1, gui.mc.fontRendererObj);
GlStateManager.popMatrix();
}
}
public void drawBigBlueBar(GuiBase gui, int x, int y, int value, int max, int mouseX, int mouseY, String suffix, GuiBase.Layer layer) {
if (layer == GuiBase.Layer.BACKGROUND) {
x += gui.getGuiLeft();
y += gui.getGuiTop();
}
gui.mc.getTextureManager().bindTexture(GUI_SHEET);
if (!suffix.equals("")) {
suffix = " " + suffix;
}
@ -147,6 +161,25 @@ public class TRBuilder extends GuiBuilder {
}
}
public void drawBigHeatBar(GuiBase gui, int x, int y, int value, int max, GuiBase.Layer layer) {
if (layer == GuiBase.Layer.BACKGROUND) {
x += gui.getGuiLeft();
y += gui.getGuiTop();
}
gui.mc.getTextureManager().bindTexture(GUI_SHEET);
gui.drawTexturedModalRect(x, y, 0, 218, 114, 18);
if (value != 0) {
int j = (int) ((double) value / (double) max * 106);
if (j < 0)
j = 0;
gui.drawTexturedModalRect(x + 4, y + 4, 0, 246, j, 10);
gui.drawCentredString(value + " Heat", y + 5, 0xFFFFFF, layer);
} else {
gui.drawCentredString(I18n.translateToLocal("techreborn.message.missingmultiblock"), y + 5, 0xC60000, layer);
}
}
public void drawBigBlueBar(GuiBase gui, int x, int y, int value, int max, int mouseX, int mouseY, GuiBase.Layer layer) {
drawBigBlueBar(gui, x, y, value, max, mouseX, mouseY, "", layer);
}

View file

@ -0,0 +1,51 @@
package techreborn.client.gui.widget;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.util.math.BlockPos;
import reborncore.client.multiblock.Multiblock;
import techreborn.client.gui.GuiBase;
/**
* Created by Prospector
*/
public class GuiButtonHologram extends GuiButton {
GuiBase.Layer layer;
GuiBase gui;
public GuiButtonHologram(int buttonId, int x, int y, GuiBase gui, GuiBase.Layer layer) {
super(buttonId, x, y, 20, 12, "");
this.layer = layer;
this.gui = gui;
}
@Override
public boolean mousePressed(Minecraft mc, int mouseX, int mouseY) {
if (layer == GuiBase.Layer.FOREGROUND) {
mouseX -= gui.getGuiLeft();
mouseY -= gui.getGuiTop();
}
if (this.enabled && this.visible && mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height) {
return true;
}
return false;
}
public void addComponent(final int x, final int y, final int z, final IBlockState blockState, final Multiblock multiblock) {
multiblock.addComponent(new BlockPos(x, y, z), blockState);
}
@Override
public void drawButtonForegroundLayer(int mouseX, int mouseY) {
}
@Override
public void drawButton(Minecraft mc, int mouseX, int mouseY) {
}
}