improve furnace
This commit is contained in:
parent
cc2c78d995
commit
8f879e9932
13 changed files with 312 additions and 874 deletions
|
@ -1,49 +0,0 @@
|
|||
package client.gui.container;
|
||||
|
||||
import common.block.tech.BlockFurnace;
|
||||
import common.inventory.ContainerFurnace;
|
||||
import common.inventory.IInventory;
|
||||
import common.entity.npc.EntityNPC;
|
||||
import common.tileentity.TileEntityFurnace;
|
||||
|
||||
public class GuiFurnace extends GuiContainer {
|
||||
private final BlockFurnace block;
|
||||
private final IInventory furnace;
|
||||
|
||||
public GuiFurnace(EntityNPC playerInv, IInventory furnaceInv, BlockFurnace block) {
|
||||
super(new ContainerFurnace(playerInv, furnaceInv));
|
||||
this.block = block;
|
||||
this.furnace = furnaceInv;
|
||||
}
|
||||
|
||||
public void draw() {
|
||||
super.draw();
|
||||
this.rect(58, 36, 12, 14, 0x202020);
|
||||
if(TileEntityFurnace.isBurning(this.furnace)) {
|
||||
int burn = this.getBurnLeftScaled(13);
|
||||
burn = Math.min(burn, 13);
|
||||
this.rect(58, 36 + 13 - burn, 12, burn + 1, 0xff7f00);
|
||||
}
|
||||
|
||||
int progress = this.getCookProgressScaled(24);
|
||||
this.rect(79, 39, 24, 8, 0x606060);
|
||||
if(progress > 0)
|
||||
this.rect(79, 39, progress + 1, 8, 0xffaf00);
|
||||
}
|
||||
|
||||
public void addElements() {
|
||||
this.label(this.block.getDisplay(), 8, 16);
|
||||
this.label("Inventar", 8, this.ySize - 96 + 12);
|
||||
}
|
||||
|
||||
private int getCookProgressScaled(int pixels) {
|
||||
int progress = this.furnace.getField(2);
|
||||
int total = this.furnace.getField(3);
|
||||
return total != 0 && progress != 0 ? progress * pixels / total : 0;
|
||||
}
|
||||
|
||||
private int getBurnLeftScaled(int pixels) {
|
||||
int total = this.furnace.getField(1);
|
||||
return this.furnace.getField(0) * pixels / (total == 0 ? 200 : total);
|
||||
}
|
||||
}
|
|
@ -12,7 +12,6 @@ import client.gui.container.GuiChest;
|
|||
import client.gui.container.GuiCrafting;
|
||||
import client.gui.container.GuiDispenser;
|
||||
import client.gui.container.GuiEnchant;
|
||||
import client.gui.container.GuiFurnace;
|
||||
import client.gui.container.GuiHopper;
|
||||
import client.gui.container.GuiEntity;
|
||||
import client.gui.container.GuiDevice;
|
||||
|
@ -28,7 +27,6 @@ import common.block.Block;
|
|||
import common.block.tech.BlockAnvil;
|
||||
import common.block.tech.BlockChest;
|
||||
import common.block.tech.BlockDispenser;
|
||||
import common.block.tech.BlockFurnace;
|
||||
import common.block.tech.BlockWorkbench;
|
||||
import common.dimension.DimType;
|
||||
import common.dimension.Dimension;
|
||||
|
@ -1107,10 +1105,6 @@ public class ClientPlayer implements IClientPlayer
|
|||
{
|
||||
this.gm.show(new GuiHopper(player, new InventoryBasic(slots)));
|
||||
}
|
||||
else if (block instanceof BlockFurnace furnace)
|
||||
{
|
||||
this.gm.show(new GuiFurnace(player, new LocalContainer(slots), furnace));
|
||||
}
|
||||
else if (block == Blocks.brewing_stand)
|
||||
{
|
||||
this.gm.show(new GuiBrewing(player, new LocalContainer(slots)));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue