Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package greatblitz.testmod.client.gui;
- import java.io.IOException;
- import greatblitz.testmod.TestMod;
- import greatblitz.testmod.common.container.ContainerTileEntityTestBlock;
- import greatblitz.testmod.tileentity.TileEntityTestBlock;
- import net.minecraft.client.gui.GuiButton;
- import net.minecraft.client.gui.inventory.GuiContainer;
- import net.minecraft.client.renderer.GlStateManager;
- import net.minecraft.entity.player.EntityPlayer;
- import net.minecraft.entity.player.InventoryPlayer;
- import net.minecraft.util.ResourceLocation;
- public class GuiContainerTileEntityTestBlock extends GuiContainer{
- TileEntityTestBlock testBlockTE;
- InventoryPlayer playerInv;
- public GuiContainerTileEntityTestBlock(InventoryPlayer player, TileEntityTestBlock te) {
- super(new ContainerTileEntityTestBlock (player, te));
- playerInv = player;
- testBlockTE = te;
- this.xSize = 176;
- this.ySize = 166;
- }
- @Override
- protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) {
- GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f);
- this.mc.getTextureManager().bindTexture(new ResourceLocation("testmod:textures/gui/container/tile.png"));
- this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, this.xSize, this.ySize);
- }
- @Override
- protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
- String s = "Test Block Tile Entity";
- this.fontRendererObj.drawString(s, 88 - this.fontRendererObj.getStringWidth(s) / 2, 6, 4210752);
- this.fontRendererObj.drawString(this.playerInv.getDisplayName().getUnformattedText(), 8, 72, 4210752);
- }
- @Override
- public void drawScreen(int mouseX, int mouseY, float partialTicks) {
- super.drawScreen(mouseX, mouseY, partialTicks);
- System.out.println("printing from drawscreen");
- System.out.println("te null: " + testBlockTE == null);
- System.out.println("rf: " + testBlockTE.getEnergyStored(null));
- this.fontRendererObj.drawString("RF: " + testBlockTE.getEnergyStored(null) + "/" + testBlockTE.getMaxEnergyStored(null), this.guiLeft + 61, this.guiTop + 14, 4210752);
- if (testBlockTE.gastank.getGas() == null) this.fontRendererObj.drawString("No gas", this.guiLeft + 53, this.guiTop + 60, 4210752);
- else this.fontRendererObj.drawString("Gas: " + testBlockTE.gastank.getGas().getGas().getLocalizedName() + ", " + testBlockTE.gastank.getStored() + "/" + testBlockTE.gastank.getMaxGas(), this.guiLeft + 53, this.guiTop + 60, 4210752);
- }
- @Override
- public void initGui() {
- super.initGui();
- GuiButton btn = new GuiButton(0, this.guiLeft + 50, this.guiTop + 29, "Dump");
- buttonList.add(btn);
- }
- @Override
- protected void actionPerformed(GuiButton button) {
- if (button.id == 0) {
- TestMod.snw.sendToServer(new GuiMessage(0, 0, testBlockTE.getPos().getX(), testBlockTE.getPos().getY(), testBlockTE.getPos().getZ()));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement