Recycler gui
This commit is contained in:
parent
06cb13b910
commit
99be70713b
2 changed files with 22 additions and 46 deletions
|
@ -1,54 +1,34 @@
|
|||
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.TileRecycler;
|
||||
|
||||
public class GuiRecycler extends GuiContainer {
|
||||
public class GuiRecycler extends GuiBase {
|
||||
|
||||
public static final ResourceLocation texture = new ResourceLocation("techreborn", "textures/gui/compressor.png");
|
||||
TileRecycler tile;
|
||||
|
||||
TileRecycler recycler;
|
||||
|
||||
public GuiRecycler(final EntityPlayer player, final TileRecycler recycler) {
|
||||
super(recycler.createContainer(player));
|
||||
this.xSize = 176;
|
||||
this.ySize = 167;
|
||||
this.recycler = recycler;
|
||||
public GuiRecycler(final EntityPlayer player, final TileRecycler 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(GuiRecycler.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.recycler.gaugeProgressScaled(24);
|
||||
if (j > 0) {
|
||||
this.drawTexturedModalRect(k + 78, l + 35, 176, 14, j + 1, 16);
|
||||
}
|
||||
|
||||
j = this.recycler.getEnergyScaled(12);
|
||||
if (j > 0) {
|
||||
this.drawTexturedModalRect(k + 24, l + 36 + 12 - j, 176, 12 - j, 14, j + 2);
|
||||
}
|
||||
this.drawSlot(55, 45, layer);
|
||||
this.drawOutputSlot(101, 45, layer);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(final int p_146979_1_, final int p_146979_2_) {
|
||||
final String name = I18n.translateToLocal("tile.techreborn.recycler.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.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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,14 +4,12 @@ import net.minecraft.block.state.IBlockState;
|
|||
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.blocks.BlockMachineBase;
|
||||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
||||
import reborncore.common.util.Inventory;
|
||||
|
||||
import techreborn.client.container.IContainerProvider;
|
||||
import techreborn.client.container.builder.BuiltContainer;
|
||||
import techreborn.client.container.builder.ContainerBuilder;
|
||||
|
@ -21,13 +19,12 @@ import techreborn.items.ItemParts;
|
|||
public class TileRecycler extends TilePowerAcceptor implements IWrenchable, IInventoryProvider, IContainerProvider {
|
||||
|
||||
private final Inventory inventory = new Inventory(6, "TileRecycler", 64, this);
|
||||
|
||||
private boolean isBurning;
|
||||
private final int capacity = 1000;
|
||||
private final int cost = 2;
|
||||
private int progress;
|
||||
private final int time = 15;
|
||||
private final int chance = 6;
|
||||
private boolean isBurning;
|
||||
private int progress;
|
||||
|
||||
public TileRecycler() {
|
||||
super(1);
|
||||
|
@ -203,9 +200,8 @@ public class TileRecycler extends TilePowerAcceptor implements IWrenchable, IInv
|
|||
|
||||
@Override
|
||||
public BuiltContainer createContainer(final EntityPlayer player) {
|
||||
return new ContainerBuilder("recycler").player(player.inventory).inventory(8, 84).hotbar(8, 142).addInventory()
|
||||
.tile(this).slot(0, 56, 34).slot(1, 116, 34).upgradeSlot(2, 152, 8).upgradeSlot(3, 152, 26)
|
||||
.upgradeSlot(4, 152, 44).upgradeSlot(5, 152, 62).syncEnergyValue()
|
||||
.syncIntegerValue(this::getProgress, this::setProgress).addInventory().create();
|
||||
return new ContainerBuilder("recycler").player(player.inventory).inventory().hotbar().addInventory()
|
||||
.tile(this).slot(0, 55, 45).slot(1, 101, 45).syncEnergyValue()
|
||||
.syncIntegerValue(this::getProgress, this::setProgress).addInventory().create();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue