Posted April 5, 201312 yr so basically what happens whenever I open the blocks GUI all the Slots are shifted to the right and shifted down into wrong places, BUT if I resize minecraft it corrects itself and then if I change it back to its original resolution it still works but then if I exit from the GUI and re open it does the same thing again. If you don't completely understand what I am saying here is a short video of what is happening. http://youtu.be/As06gafplSo Class ContainerBlockFreezer public ContainerBlockFreezer(InventoryPlayer inventoryPlayer, TileEntityFreezer te) { for (int height = 0; height < 6; height++) { for (int length = 0; length < 6; length++) { addSlotToContainer(new Slot(te, inputIndex++, getCoordinate(length, false, false), getCoordinate(height, false, false))); } } // output for (int height = 0; height < 4; height++) { for (int length = 0; length < 4; length++) { addSlotToContainer(new SlotFreezerBlock(inventoryPlayer.player, te, inputIndex, getCoordinate(length, true, false), getCoordinate(height, true, true))); } } //addSlotToContainer(new Slot(te, 36 + 16 + 1, 26, 62)); // fuel //addSlotToContainer(new Slot(te, 36 + 16 + 2, 45, 62)); // fuel 2 for (int height = 0; height < 3; height++) { for (int length = 0; length < 9; length++) { addSlotToContainer(new Slot( inventoryPlayer, length + height * 9 + 9, getCoordinateInventory(length, true), getCoordinateInventory(height, false) ) ); } } for (int length = 0; length < 9; length++) { addSlotToContainer(new Slot(inventoryPlayer, length, getCoordinateInventory(length, true), getCoordinateInventory(3, false))); } } private int getCoordinateInventory(int i, boolean isLength) { if(isLength) { return 43 + (i * 18); } else { return 146 + (i * 18); } } public static int getCoordinate(int i, boolean isOutput, boolean isOutputHeight) { if (!isOutput) { return 5 + (i * 18); } else { if(!isOutputHeight) { return 144 + (i * 18); } else { return 25 + (i * 18); } } } Gui class package common.blocks.freezer; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.client.renderer.RenderEngine; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.util.StatCollector; import org.lwjgl.opengl.GL11; public class GuiBlockFreezer extends GuiContainer { private TileEntityFreezer FreezerInventory; public GuiBlockFreezer(InventoryPlayer inventory, TileEntityFreezer Freezer) { super(new ContainerBlockFreezer(inventory, Freezer)); FreezerInventory = Freezer; } protected void drawGuiContainerForegroundLayer(int par1, int par2) { // fontRenderer.drawString(StatCollector.translateToLocal("container.inventory"), // 8, // (ySize - 96) + 2, 0xffffff); } protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) { GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); mc.renderEngine.bindTexture("/mods/TestMod/textures/gui/GuiBlockFreezer.png"); xSize = 245;//actual gui size ySize = 220;//actual gui size int j = (width - xSize) / 2; int k = (height - ySize) / 2; drawTexturedModalRect(j, k, 0, 0, xSize, ySize); if (FreezerInventory.isBurning()) { //int burn = FreezerInventory.getBurnTimeRemainingScaled(14); //drawTexturedModalRect(j + 73, k + 59, 176, 16, burn, 10); } //int update = FreezerInventory.getCookProgressScaled(16); //drawTexturedModalRect(j + 89, k + 55, 191, 15, -update, -update); } }
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.