Chemical reactor GUI & a couple recipe fixes

This commit is contained in:
ProfessorProspector 2017-01-09 16:54:48 -08:00
parent 99be70713b
commit af91263621
8 changed files with 58 additions and 73 deletions

View file

@ -1,62 +1,38 @@
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.TileChemicalReactor;
public class GuiChemicalReactor extends GuiContainer {
public class GuiChemicalReactor extends GuiBase {
public static final ResourceLocation texture = new ResourceLocation("techreborn",
"textures/gui/chemical_reactor.png");
TileChemicalReactor tile;
TileChemicalReactor chemicalReactor;
public GuiChemicalReactor(final EntityPlayer player, final TileChemicalReactor chemicalReactor) {
super(chemicalReactor.createContainer(player));
this.xSize = 176;
this.ySize = 167;
this.chemicalReactor = chemicalReactor;
public GuiChemicalReactor(final EntityPlayer player, final TileChemicalReactor tile) {
super(player, tile, tile.createContainer(player));
this.tile = tile;
}
@Override
public void initGui() {
final int k = (this.width - this.xSize) / 2;
final int l = (this.height - this.ySize) / 2;
super.initGui();
protected void drawGuiContainerBackgroundLayer(final float f, final int mouseX, final int mouseY) {
super.drawGuiContainerBackgroundLayer(f, mouseX, mouseY);
final GuiBase.Layer layer = GuiBase.Layer.BACKGROUND;
this.drawSlot(8, 72, layer);
this.drawSlot(34, 47, layer);
this.drawSlot(126, 47, layer);
this.drawOutputSlot(80, 47, layer);
this.builder.drawJEIButton(this, 150, 4, layer);
}
@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(GuiChemicalReactor.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 drawGuiContainerForegroundLayer(final int mouseX, final int mouseY) {
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
final GuiBase.Layer layer = GuiBase.Layer.FOREGROUND;
int j = 0;
j = this.chemicalReactor.getProgressScaled(11);
if (j > 0) {
this.drawTexturedModalRect(k + 73, l + 39, 177, 15, 30, j);
}
j = this.chemicalReactor.getEnergyScaled(12);
if (j > 0) {
this.drawTexturedModalRect(k + 9, l + 32 + 12 - j, 176, 12 - j, 14, j + 2);
}
}
@Override
protected void drawGuiContainerForegroundLayer(final int p_146979_1_, final int p_146979_2_) {
final String name = I18n.translateToLocal("tile.techreborn.chemicalreactor.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.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);
}
}

View file

@ -84,6 +84,13 @@ public class TRBuilder extends GuiBuilder {
gui.drawTexturedModalRect(x, y, direction.xActive, direction.yActive, j, 10);
}
if (direction.equals(ProgressDirection.LEFT)) {
int j = (int) ((double) progress / (double) maxProgress * 16);
if (j < 0)
j = 0;
gui.drawTexturedModalRect(x + 16 - j, y, direction.xActive + 16 - j, direction.yActive, j, 10);
}
if (isInRect(x, y, direction.width, direction.height, mouseX, mouseY)) {
int percentage = percentage(maxProgress, progress);
List<String> list = new ArrayList<>();
@ -247,7 +254,7 @@ public class TRBuilder extends GuiBuilder {
}
public enum ProgressDirection {
RIGHT(84, 151, 100, 151, 16, 10)/*, DOWN(104, 171, 114, 171, 10, 16), UP(84, 171, 94, 171, 10, 16), LEFT(84, 161, 100, 161, 16, 10)*/;
RIGHT(84, 151, 100, 151, 16, 10), LEFT(100, 161, 84, 161, 16, 10)/*, DOWN(104, 171, 114, 171, 10, 16), UP(84, 171, 94, 171, 10, 16)*/;
public int x;
public int y;
public int xActive;