Start redoing Matter Fabricator gui

(cherry picked from commit 5c6bc6c)
This commit is contained in:
ProfessorProspector 2017-03-13 18:49:28 +00:00 committed by modmuss50
parent 2dffd85ccc
commit 82927ae405
No known key found for this signature in database
GPG key ID: 773D17BE8BF49C82
15 changed files with 75 additions and 46 deletions

View file

@ -60,6 +60,22 @@ public class GuiBase extends GuiContainer {
builder.drawSlot(this, x - 1, y - 1);
}
protected void drawScrapSlot(int x, int y, Layer layer) {
if (layer == Layer.BACKGROUND) {
x += guiLeft;
y += guiTop;
}
builder.drawScrapSlot(this, x - 1, y - 1);
}
protected void drawOutputSlotBar(int x, int y, int count, Layer layer) {
if (layer == Layer.BACKGROUND) {
x += guiLeft;
y += guiTop;
}
builder.drawOutputSlotBar(this, x - 4, y - 4, count);
}
protected void drawArmourSlots(int x, int y, Layer layer) {
if (layer == Layer.BACKGROUND) {
x += guiLeft;

View file

@ -81,7 +81,7 @@ public class GuiBlastFurnace extends GuiBase {
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.drawMultiEnergyBar(this, 9, 19, (int) this.tile.getEnergy(), (int) this.tile.getMaxPower(), mouseX, mouseY, 0, layer);
this.builder.drawBigHeatBar(this, 31, 71, tile.getCachedHeat(), 3230, layer);
if (hasMultiBlock) {
addHologramButton(6, 4, 212, layer);

View file

@ -60,6 +60,6 @@ public class GuiCentrifuge extends GuiBase {
final Layer layer = Layer.FOREGROUND;
this.builder.drawProgressBar(this, this.tile.getProgressScaled(100), 100, 61, 47, 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.drawMultiEnergyBar(this, 9, 19, (int) this.tile.getEnergy(), (int) this.tile.getMaxPower(), mouseX, mouseY, 0, layer);
}
}

View file

@ -57,6 +57,6 @@ public class GuiChemicalReactor extends GuiBase {
this.builder.drawProgressBar(this, this.tile.getProgressScaled(100), 100, 55, 51, mouseX, mouseY, TRBuilder.ProgressDirection.RIGHT, layer);
this.builder.drawProgressBar(this, this.tile.getProgressScaled(100), 100, 105, 51, mouseX, mouseY, TRBuilder.ProgressDirection.LEFT, layer);
this.builder.drawMultiEnergyBar(this, 9, 18, (int) this.tile.getEnergy(), (int) this.tile.getMaxPower(), mouseX, mouseY, 0, layer);
this.builder.drawMultiEnergyBar(this, 9, 19, (int) this.tile.getEnergy(), (int) this.tile.getMaxPower(), mouseX, mouseY, 0, layer);
}
}

View file

@ -55,6 +55,6 @@ public class GuiCompressor extends GuiBase {
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);
this.builder.drawMultiEnergyBar(this, 9, 19, (int) this.tile.getEnergy(), (int) this.tile.getMaxPower(), mouseX, mouseY, 0, layer);
}
}

View file

@ -55,6 +55,6 @@ public class GuiElectricFurnace extends GuiBase {
final Layer layer = Layer.FOREGROUND;
this.builder.drawProgressBar(this, this.tile.gaugeProgressScaled(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);
this.builder.drawMultiEnergyBar(this, 9, 19, (int) this.tile.getEnergy(), (int) this.tile.getMaxPower(), mouseX, mouseY, 0, layer);
}
}

View file

@ -55,6 +55,6 @@ public class GuiExtractor extends GuiBase {
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);
this.builder.drawMultiEnergyBar(this, 9, 19, (int) this.tile.getEnergy(), (int) this.tile.getMaxPower(), mouseX, mouseY, 0, layer);
}
}

View file

@ -54,6 +54,6 @@ public class GuiGenerator extends GuiBase {
final Layer layer = Layer.FOREGROUND;
this.builder.drawBurnBar(this, this.tile.getScaledBurnTime(100), 100, 81, 38, mouseX, mouseY, layer);
this.builder.drawMultiEnergyBar(this, 9, 18, (int) this.tile.getEnergy(), (int) this.tile.getMaxPower(), mouseX, mouseY, 0, layer);
this.builder.drawMultiEnergyBar(this, 9, 19, (int) this.tile.getEnergy(), (int) this.tile.getMaxPower(), mouseX, mouseY, 0, layer);
}
}

View file

@ -55,6 +55,6 @@ public class GuiGrinder extends GuiBase {
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);
this.builder.drawMultiEnergyBar(this, 9, 19, (int) this.tile.getEnergy(), (int) this.tile.getMaxPower(), mouseX, mouseY, 0, layer);
}
}

View file

@ -79,7 +79,7 @@ public class GuiIndustrialGrinder extends GuiBase {
this.builder.drawProgressBar(this, this.tile.getProgressScaled(100), 100, 105, 47, mouseX, mouseY, TRBuilder.ProgressDirection.RIGHT, layer);
this.builder.drawTank(this, 53, 25, mouseX, mouseY, tile.tank.getFluid(), tile.tank.getCapacity(), tile.tank.isEmpty(), layer);
this.builder.drawMultiEnergyBar(this, 9, 18, (int) this.tile.getEnergy(), (int) this.tile.getMaxPower(), mouseX, mouseY, 0, layer);
this.builder.drawMultiEnergyBar(this, 9, 19, (int) this.tile.getEnergy(), (int) this.tile.getMaxPower(), mouseX, mouseY, 0, layer);
if (tile.getMutliBlock()) {
addHologramButton(6, 4, 212, layer);
builder.drawHologramButton(this, 6, 4, mouseX, mouseY, layer);

View file

@ -24,52 +24,39 @@
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.TileMatterFabricator;
public class GuiMatterFabricator extends GuiContainer {
public class GuiMatterFabricator extends GuiBase {
private static final ResourceLocation texture = new ResourceLocation("techreborn",
"textures/gui/matterfabricator.png");
TileMatterFabricator tile;
TileMatterFabricator matterfab;
public GuiMatterFabricator(final EntityPlayer player, final TileMatterFabricator tilematterfab) {
super(tilematterfab.createContainer(player));
this.xSize = 176;
this.ySize = 167;
this.matterfab = tilematterfab;
public GuiMatterFabricator(final EntityPlayer player, final TileMatterFabricator 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(GuiMatterFabricator.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 Layer layer = Layer.BACKGROUND;
drawScrapSlot(30, 20, layer);
drawScrapSlot(50, 20, layer);
drawScrapSlot(70, 20, layer);
drawScrapSlot(90, 20, layer);
drawScrapSlot(110, 20, layer);
drawScrapSlot(130, 20, layer);
drawOutputSlotBar(39, 65, 5, layer);
final int j = this.matterfab.getProgressScaled(24);
if (j > 0) {
this.drawTexturedModalRect(k + 79, l + 34, 176, 14, j + 1, 16);
}
}
@Override
protected void drawGuiContainerForegroundLayer(final int p_146979_1_, final int p_146979_2_) {
final int k = (this.width - this.xSize) / 2;
final int l = (this.height - this.ySize) / 2;
final String name = I18n.translateToLocal("tile.techreborn.matterfabricator.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);
this.fontRendererObj.drawString(this.matterfab.getProgressScaled(100) + "%", 80, 50, 4210752);
}
protected void drawGuiContainerForegroundLayer(final int mouseX, final int mouseY) {
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
final Layer layer = Layer.FOREGROUND;
//this.builder.drawProgressBar(this, this.tile.getProgressScaled(100), 100, 105, 47, mouseX, mouseY, TRBuilder.ProgressDirection.DOWN, layer);
this.builder.drawMultiEnergyBar(this, 9, 19, (int) this.tile.getEnergy(), (int) this.tile.getMaxPower(), mouseX, mouseY, 0, layer);
}
}

View file

@ -53,6 +53,6 @@ public class GuiRecycler extends GuiBase {
final GuiBase.Layer layer = GuiBase.Layer.FOREGROUND;
this.builder.drawProgressBar(this, this.tile.gaugeProgressScaled(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);
this.builder.drawMultiEnergyBar(this, 9, 19, (int) this.tile.getEnergy(), (int) this.tile.getMaxPower(), mouseX, mouseY, 0, layer);
}
}

View file

@ -55,7 +55,7 @@ public class GuiVacuumFreezer extends GuiBase {
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);
this.builder.drawMultiEnergyBar(this, 9, 19, (int) this.tile.getEnergy(), (int) this.tile.getMaxPower(), mouseX, mouseY, 0, layer);
}
}

View file

@ -336,6 +336,30 @@ public class TRBuilder extends GuiBuilder {
gui.drawTexturedModalRect(posX -27, posY + 4, 126, 151, 30, 87);
}
public void drawScrapSlot(GuiScreen gui, int posX, int posY) {
Minecraft.getMinecraft().getTextureManager().bindTexture(GUI_SHEET);
gui.drawTexturedModalRect(posX, posY, 150, 70, 18, 18);
}
public void drawOutputSlotBar(GuiScreen gui, int posX, int posY, int count) {
Minecraft.getMinecraft().getTextureManager().bindTexture(GUI_SHEET);
for (int i = 1; i <= count; i++) {
if (i == 1) {
gui.drawTexturedModalRect(posX, posY, 114, 218, 22, 26);
posX += 22;
if (1 == count) {
gui.drawTexturedModalRect(posX, posY, 136, 218, 4, 26);
}
} else if (i != 1 && i != count) {
gui.drawTexturedModalRect(posX, posY, 116, 218, 20, 26);
posX += 20;
} else if (i == count) {
gui.drawTexturedModalRect(posX, posY, 116, 218, 24, 26);
posX += 24;
}
}
}
public void drawOutputSlot(GuiScreen gui, int posX, int posY) {
Minecraft.getMinecraft().getTextureManager().bindTexture(GUI_SHEET);
gui.drawTexturedModalRect(posX, posY, 150, 18, 26, 26);

View file

@ -27,12 +27,14 @@ package techreborn.tiles;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import reborncore.api.power.EnumPowerTier;
import reborncore.api.tile.IInventoryProvider;
import reborncore.common.IWrenchable;
import reborncore.common.powerSystem.TilePowerAcceptor;
import reborncore.common.util.Inventory;
import reborncore.common.util.ItemUtils;
import techreborn.client.container.IContainerProvider;
import techreborn.client.container.builder.BuiltContainer;
import techreborn.client.container.builder.ContainerBuilder;