This commit is contained in:
modmuss50 2019-08-20 15:06:09 +01:00
parent 17665e7400
commit 6174506d6c
2 changed files with 21 additions and 32 deletions

View file

@ -270,7 +270,7 @@ public class IronAlloyFurnaceBlockEntity extends MachineBaseBlockEntity
@Override @Override
public BuiltContainer createContainer(int syncID, final PlayerEntity player) { public BuiltContainer createContainer(int syncID, final PlayerEntity player) {
return new ContainerBuilder("alloyfurnace").player(player.inventory).inventory(8, 84).hotbar(8, 142) return new ContainerBuilder("alloyfurnace").player(player.inventory).inventory().hotbar()
.addInventory().blockEntity(this) .addInventory().blockEntity(this)
.slot(0, 47, 17) .slot(0, 47, 17)
.slot(1, 65, 17) .slot(1, 65, 17)

View file

@ -24,53 +24,42 @@
package techreborn.client.gui; package techreborn.client.gui;
import com.mojang.blaze3d.platform.GlStateManager;
import net.minecraft.client.gui.screen.ingame.AbstractContainerScreen;
import net.minecraft.client.resource.language.I18n;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.text.LiteralText;
import net.minecraft.util.Identifier;
import reborncore.client.containerBuilder.builder.BuiltContainer; import reborncore.client.containerBuilder.builder.BuiltContainer;
import reborncore.client.gui.builder.GuiBase;
import reborncore.client.gui.guibuilder.GuiBuilder;
import techreborn.blockentity.machine.iron.IronAlloyFurnaceBlockEntity; import techreborn.blockentity.machine.iron.IronAlloyFurnaceBlockEntity;
public class GuiAlloyFurnace extends AbstractContainerScreen<BuiltContainer> { public class GuiAlloyFurnace extends GuiBase<BuiltContainer> {
private static final Identifier texture = new Identifier("techreborn",
"textures/gui/alloy_furnace.png");
IronAlloyFurnaceBlockEntity alloyfurnace; IronAlloyFurnaceBlockEntity alloyfurnace;
public GuiAlloyFurnace(int syncID, final PlayerEntity player, final IronAlloyFurnaceBlockEntity alloyFurnace) { public GuiAlloyFurnace(int syncID, final PlayerEntity player, final IronAlloyFurnaceBlockEntity alloyFurnace) {
super(alloyFurnace.createContainer(syncID, player), player.inventory, new LiteralText("techreborn.alloy_furnace")); super(player, alloyFurnace, alloyFurnace.createContainer(syncID, player));
this.containerWidth = 176;
this.containerHeight = 167;
this.alloyfurnace = alloyFurnace; this.alloyfurnace = alloyFurnace;
} }
@Override @Override
protected void drawBackground(final float p_146976_1_, final int p_146976_2_, final int p_146976_3_) { protected void drawBackground(final float f, final int mouseX, final int mouseY) {
this.renderBackground(); super.drawBackground(f, mouseX, mouseY);
GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F);
this.minecraft.getTextureManager().bindTexture(GuiAlloyFurnace.texture);
final int k = (this.width - this.containerWidth) / 2;
final int l = (this.height - this.containerHeight) / 2;
this.blit(k, l, 0, 0, this.containerWidth, this.containerHeight);
if (this.alloyfurnace.isBurning()) { final GuiBase.Layer layer = GuiBase.Layer.BACKGROUND;
int i1 = this.alloyfurnace.getBurnTimeRemainingScaled(13);
this.blit(k + 56, l + 36 + 12 - i1, 176, 12 - i1, 14, i1 + 1); drawSlot(47, 17, layer);
i1 = this.alloyfurnace.getCookProgressScaled(24); drawSlot(65, 17, layer);
this.blit(k + 79, l + 34, 176, 14, i1 + 1, 16);
} drawSlot(56, 53, layer);
drawOutputSlot(116, 35, layer);
} }
@Override @Override
protected void drawForeground(final int p_146979_1_, final int p_146979_2_) { protected void drawForeground(final int mouseX, final int mouseY) {
final String name = I18n.translate("block.techreborn.iron_alloy_furnace"); super.drawForeground(mouseX, mouseY);
this.font.draw(name, this.containerWidth / 2 - this.font.getStringWidth(name) / 2, 6, final GuiBase.Layer layer = GuiBase.Layer.FOREGROUND;
4210752);
this.font.draw(I18n.translate("container.inventory", new Object[0]), 8, builder.drawProgressBar(this, alloyfurnace.getCookProgressScaled(100), 100, 85, 36, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer);
this.containerHeight - 96 + 2, 4210752); builder.drawBurnBar(this, alloyfurnace.getBurnTimeRemainingScaled(100), 100, 56, 36, mouseX, mouseY, layer);
} }
@Override @Override