Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.limplungs.invcalc.gui;
- import com.limplungs.invcalc.containers.ContainerCalculatorBasic;
- import com.limplungs.invcalc.help.Reference;
- import net.minecraft.client.Minecraft;
- import net.minecraft.client.gui.GuiButton;
- import net.minecraft.client.gui.inventory.GuiContainer;
- import net.minecraft.entity.player.InventoryPlayer;
- import net.minecraft.util.ResourceLocation;
- public class GUICalculatorBasic extends GuiContainer
- {
- public GUICalculatorBasic(InventoryPlayer inventory)
- {
- super(new ContainerCalculatorBasic(inventory));
- this.xSize = 194;
- this.ySize = 108;
- }
- ResourceLocation texture = new ResourceLocation(Reference.MODID, "textures/gui/calculators/calcbasic.png");
- @Override
- protected void drawGuiContainerBackgroundLayer(float f, int x, int y)
- {
- this.xSize = 194;
- this.ySize = 108;
- Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
- drawTexturedModalRect((this.width / 2) - 97, (this.height - this.ySize), 0, 0, this.xSize, this.ySize);
- }
- @Override
- protected void drawGuiContainerForegroundLayer(int x, int y)
- {
- this.xSize = 194;
- this.ySize = 108;
- //this.fontRendererObj.drawString("Basic Calculator", (this.width / 2) + 8, (this.height - this.ySize) + 77, 4210752);
- }
- @Override
- @SuppressWarnings("unchecked")
- public void initGui()
- {
- this.xSize = 194;
- this.ySize = 108;
- if (Minecraft.getMinecraft().theWorld.isRemote)
- {
- this.buttonList.add(new GuiButton(10, (this.width / 2) - 97 + 95, (this.height - this.ySize) + 3, 20, 20, "0"));
- this.buttonList.add(new GuiButton(17, (this.width / 2) - 97 + 6, (this.height - this.ySize) + 3, 20, 20, "7"));
- this.buttonList.add(new GuiButton(18, (this.width / 2) - 97 + 37, (this.height - this.ySize) + 3, 20, 20, "8"));
- this.buttonList.add(new GuiButton(19, (this.width / 2) - 97 + 68, (this.height - this.ySize) + 3, 20, 20, "9"));
- this.buttonList.add(new GuiButton(14, (this.width / 2) - 97 + 6, (this.height - this.ySize) + 33, 20, 20, "4"));
- this.buttonList.add(new GuiButton(15, (this.width / 2) - 97 + 37, (this.height - this.ySize) + 33, 20, 20, "5"));
- this.buttonList.add(new GuiButton(16, (this.width / 2) - 97 + 68, (this.height - this.ySize) + 33, 20, 20, "6"));
- this.buttonList.add(new GuiButton(11, (this.width / 2) - 97 + 6, (this.height - this.ySize) + 63, 20, 20, "1"));
- this.buttonList.add(new GuiButton(12, (this.width / 2) - 97 + 37, (this.height - this.ySize) + 63, 20, 20, "2"));
- this.buttonList.add(new GuiButton(13, (this.width / 2) - 97 + 68, (this.height - this.ySize) + 63, 20, 20, "3"));
- }
- }
- @Override
- public void actionPerformed(GuiButton button)
- {
- if (Minecraft.getMinecraft().theWorld.isRemote)
- {
- if (button.id == 11)
- Minecraft.getMinecraft().thePlayer.sendChatMessage("1");
- if (button.id == 12)
- Minecraft.getMinecraft().thePlayer.sendChatMessage("2");
- if (button.id == 13)
- Minecraft.getMinecraft().thePlayer.sendChatMessage("3");
- if (button.id == 14)
- Minecraft.getMinecraft().thePlayer.sendChatMessage("4");
- if (button.id == 15)
- Minecraft.getMinecraft().thePlayer.sendChatMessage("5");
- if (button.id == 16)
- Minecraft.getMinecraft().thePlayer.sendChatMessage("6");
- if (button.id == 17)
- Minecraft.getMinecraft().thePlayer.sendChatMessage("7");
- if (button.id == 18)
- Minecraft.getMinecraft().thePlayer.sendChatMessage("8");
- if (button.id == 19)
- Minecraft.getMinecraft().thePlayer.sendChatMessage("9");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement