Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package melonslise.runicinscription.client.gui;
- import org.lwjgl.opengl.GL11;
- import melonslise.runicinscription.RunicInscription;
- import melonslise.runicinscription.common.container.ContainerRuneInscription;
- import melonslise.runicinscription.common.network.MessageGrid;
- import net.minecraft.client.Minecraft;
- import net.minecraft.client.gui.inventory.GuiContainer;
- import net.minecraft.entity.player.InventoryPlayer;
- import net.minecraft.inventory.Container;
- import net.minecraft.util.ResourceLocation;
- import net.minecraft.world.World;
- public class GUIRuneInscription extends GuiContainer
- {
- private ResourceLocation texture = new ResourceLocation(RunicInscription.ID + ":" + "textures/gui/RuneInscription.png");
- private boolean[][] grid = new boolean[5][7];
- public GUIRuneInscription(InventoryPlayer inventoryPlayer, World world, int x, int y, int z)
- {
- super(new ContainerRuneInscription(inventoryPlayer, world, x, y, z));
- this.xSize = 176;
- this.ySize = 206;
- }
- public void renderCarvingGrid()
- {
- GL11.glColor4f(1F, 1F, 1F, 1F);
- mc.getTextureManager().bindTexture(texture);
- for(int x = 0; x < 5; ++x)
- {
- for(int y = 0; y < 7; ++y)
- {
- if (grid[x][y] == false)
- {
- drawTexturedModalRect(guiLeft + 43 + x * 16, guiTop + 6 + y * 16, 0, 206, 16, 16);
- }
- else if (grid[x][y] == true)
- {
- drawTexturedModalRect(guiLeft + 43 + x * 16, guiTop + 6 + y * 16, 16, 206, 16, 16);
- }
- }
- }
- }
- public void mouseClicked(int mouseX, int mouseY, int mouseButton)
- {
- super.mouseClicked(mouseX, mouseY, mouseButton);
- if (mouseButton == 0)
- {
- for (int x = 0; x < 5; ++x)
- {
- for (int y = 0; y < 7; ++y)
- {
- if ((((mouseX - guiLeft) >= 43 + x * 16) && ((mouseX - guiLeft) < 43 + (x + 1) * 16)) && (((mouseY - guiTop) >= 6 + y * 16) && ((mouseY - guiTop) < 6 + (y + 1) * 16)))
- {
- grid[x][y] = true;
- RunicInscription.network.sendToServer(new MessageGrid(grid[x][y], x, y));
- }
- }
- }
- }
- }
- public void onGuiClosed()
- {
- super.onGuiClosed();
- }
- protected void drawGuiContainerForegroundLayer(int i, int j)
- {
- //Draw text
- }
- @Override
- protected void drawGuiContainerBackgroundLayer(float f1, int i1, int i2)
- {
- GL11.glColor4f(1F, 1F, 1F, 1F);
- Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
- drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
- renderCarvingGrid();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement