Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.