2016-01-05 04:47:35 +01:00
|
|
|
package de.ellpeck.actuallyadditions.mod.inventory.gui;
|
2015-02-20 22:45:33 +01:00
|
|
|
|
2019-05-02 09:10:29 +02:00
|
|
|
import java.io.IOException;
|
|
|
|
|
2016-01-05 04:47:35 +01:00
|
|
|
import de.ellpeck.actuallyadditions.mod.inventory.ContainerGiantChest;
|
2016-08-09 20:56:09 +02:00
|
|
|
import de.ellpeck.actuallyadditions.mod.network.PacketHandlerHelper;
|
2016-01-05 04:47:35 +01:00
|
|
|
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
|
|
|
|
import de.ellpeck.actuallyadditions.mod.tile.TileEntityGiantChest;
|
2016-06-27 20:19:04 +02:00
|
|
|
import de.ellpeck.actuallyadditions.mod.tile.TileEntityGiantChestLarge;
|
|
|
|
import de.ellpeck.actuallyadditions.mod.tile.TileEntityGiantChestMedium;
|
2016-01-05 04:47:35 +01:00
|
|
|
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
2016-06-27 20:19:04 +02:00
|
|
|
import net.minecraft.client.gui.GuiButton;
|
2016-01-08 15:21:05 +01:00
|
|
|
import net.minecraft.client.renderer.GlStateManager;
|
2015-02-20 22:45:33 +01:00
|
|
|
import net.minecraft.entity.player.InventoryPlayer;
|
|
|
|
import net.minecraft.util.ResourceLocation;
|
2016-01-07 18:20:59 +01:00
|
|
|
import net.minecraftforge.fml.relauncher.Side;
|
|
|
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
2015-02-20 22:45:33 +01:00
|
|
|
|
|
|
|
@SideOnly(Side.CLIENT)
|
2019-05-02 09:10:29 +02:00
|
|
|
public class GuiGiantChest extends GuiWtfMojang {
|
2015-02-20 22:45:33 +01:00
|
|
|
|
2016-11-19 23:12:22 +01:00
|
|
|
private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_giant_chest");
|
2015-02-20 22:45:33 +01:00
|
|
|
|
2016-06-27 20:19:04 +02:00
|
|
|
private final TileEntityGiantChest chest;
|
|
|
|
private final int page;
|
2015-04-19 01:50:02 +02:00
|
|
|
|
2019-05-02 09:10:29 +02:00
|
|
|
public GuiGiantChest(InventoryPlayer inventory, TileEntityBase tile, int page) {
|
2016-06-27 20:19:04 +02:00
|
|
|
super(new ContainerGiantChest(inventory, tile, page));
|
2019-05-02 09:10:29 +02:00
|
|
|
this.chest = (TileEntityGiantChest) tile;
|
2016-06-27 20:19:04 +02:00
|
|
|
this.page = page;
|
2015-02-20 22:45:33 +01:00
|
|
|
|
|
|
|
this.xSize = 242;
|
2019-05-02 09:10:29 +02:00
|
|
|
this.ySize = 172 + 86;
|
2015-02-20 22:45:33 +01:00
|
|
|
}
|
|
|
|
|
2016-06-27 20:19:04 +02:00
|
|
|
@Override
|
2019-05-02 09:10:29 +02:00
|
|
|
public void initGui() {
|
2016-06-27 20:19:04 +02:00
|
|
|
super.initGui();
|
|
|
|
|
2019-05-02 09:10:29 +02:00
|
|
|
if (this.page > 0) {
|
|
|
|
this.buttonList.add(new GuiButton(this.page - 1, this.guiLeft + 13, this.guiTop + 172, 20, 20, "<"));
|
2016-06-27 20:19:04 +02:00
|
|
|
}
|
|
|
|
|
2019-05-02 09:10:29 +02:00
|
|
|
if (this.page == 0 && this.chest instanceof TileEntityGiantChestMedium || this.page <= 1 && this.chest instanceof TileEntityGiantChestLarge) {
|
|
|
|
this.buttonList.add(new GuiButton(this.page + 1, this.guiLeft + 209, this.guiTop + 172, 20, 20, ">"));
|
2016-06-27 20:19:04 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2019-05-02 09:10:29 +02:00
|
|
|
protected void actionPerformed(GuiButton button) throws IOException {
|
|
|
|
if (button.id >= 0 && button.id < 3) {
|
2016-08-09 20:56:09 +02:00
|
|
|
PacketHandlerHelper.sendButtonPacket(this.chest, button.id);
|
2016-07-08 13:59:28 +02:00
|
|
|
}
|
2016-06-27 20:19:04 +02:00
|
|
|
}
|
|
|
|
|
2015-04-19 01:50:02 +02:00
|
|
|
@Override
|
2019-05-02 09:10:29 +02:00
|
|
|
public void drawGuiContainerForegroundLayer(int x, int y) {
|
2017-06-29 18:30:02 +02:00
|
|
|
AssetUtil.displayNameString(this.fontRenderer, this.xSize, -10, this.chest);
|
2015-04-19 01:50:02 +02:00
|
|
|
}
|
|
|
|
|
2015-02-20 22:45:33 +01:00
|
|
|
@Override
|
2019-05-02 09:10:29 +02:00
|
|
|
public void drawGuiContainerBackgroundLayer(float f, int x, int y) {
|
2016-01-08 15:21:05 +01:00
|
|
|
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
2016-06-17 23:50:38 +02:00
|
|
|
this.mc.getTextureManager().bindTexture(RES_LOC);
|
2015-03-19 21:27:56 +01:00
|
|
|
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, 242, 190);
|
2015-03-29 15:29:05 +02:00
|
|
|
this.mc.getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION);
|
2019-05-02 09:10:29 +02:00
|
|
|
this.drawTexturedModalRect(this.guiLeft + 33, this.guiTop + 172, 0, 0, 176, 86);
|
2015-02-20 22:45:33 +01:00
|
|
|
}
|
|
|
|
}
|