2015-08-29 14:33:25 +02:00
|
|
|
/*
|
2016-05-16 22:52:27 +02:00
|
|
|
* This file ("GuiGiantChest.java") is part of the Actually Additions mod for Minecraft.
|
2015-08-29 14:33:25 +02:00
|
|
|
* It is created and owned by Ellpeck and distributed
|
|
|
|
* under the Actually Additions License to be found at
|
2016-05-16 22:52:27 +02:00
|
|
|
* http://ellpeck.de/actaddlicense
|
2015-08-29 14:33:25 +02:00
|
|
|
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
|
|
*
|
2017-01-01 16:23:26 +01:00
|
|
|
* © 2015-2017 Ellpeck
|
2015-08-29 14:33:25 +02:00
|
|
|
*/
|
|
|
|
|
2016-01-05 04:47:35 +01:00
|
|
|
package de.ellpeck.actuallyadditions.mod.inventory.gui;
|
2015-02-20 22:45:33 +01:00
|
|
|
|
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
|
|
|
|
2017-06-29 18:36:33 +02:00
|
|
|
import java.io.IOException;
|
|
|
|
|
2015-02-20 22:45:33 +01:00
|
|
|
@SideOnly(Side.CLIENT)
|
2017-06-17 00:48:49 +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
|
|
|
|
2016-06-27 20:19:04 +02:00
|
|
|
public GuiGiantChest(InventoryPlayer inventory, TileEntityBase tile, int page){
|
|
|
|
super(new ContainerGiantChest(inventory, tile, page));
|
2015-04-19 01:50:02 +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;
|
2015-03-19 21:27:56 +01:00
|
|
|
this.ySize = 172+86;
|
2015-02-20 22:45:33 +01:00
|
|
|
}
|
|
|
|
|
2016-06-27 20:19:04 +02:00
|
|
|
@Override
|
|
|
|
public void initGui(){
|
|
|
|
super.initGui();
|
|
|
|
|
|
|
|
if(this.page > 0){
|
|
|
|
this.buttonList.add(new GuiButton(this.page-1, this.guiLeft+13, this.guiTop+172, 20, 20, "<"));
|
|
|
|
}
|
|
|
|
|
|
|
|
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, ">"));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected void actionPerformed(GuiButton button) throws IOException{
|
2016-07-08 13:59:28 +02:00
|
|
|
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
|
|
|
|
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
|
|
|
|
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);
|
2015-03-19 21:27:56 +01:00
|
|
|
this.drawTexturedModalRect(this.guiLeft+33, this.guiTop+172, 0, 0, 176, 86);
|
2015-02-20 22:45:33 +01:00
|
|
|
}
|
|
|
|
}
|