Jump to content

[1.8] Reading data from a vanilla furnace


Recommended Posts

Hello everyone,

I got a GUI in which I need to read data from a furnace. So I am delivering the ISidedInventory of the furnace via a container.

My Problem right now is that for some reason ISidedInventory.getField(2) is ALWAYS returning 0, even if it should be the cook time of the current item..

Of course I placed coal and iron ore in the furnace to make it burn


public class FurnacesGui extends GuiContainer{

private final ResourceLocation background = new ResourceLocation("advancedfurnaces:textures/gui/allfurnaces.png");

private int furnaceSlots;
private ISidedInventory[] furnaces;

public FurnacesGui(ContainerAllFurnaces container) {
	furnaceSlots = container.getAllFurnaceSlots();


protected void drawGuiContainerBackgroundLayer(float partialTicks,
		int mouseX, int mouseY) {
	GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
	int k = (this.width - this.xSize) /2 ;
	int l = (this.height - this.xSize) /2 ;
	drawTexturedModalRect(k, l, 0, 0, xSize, ySize);

	int pixelToDraw;
	for(int i=0; i<furnaceSlots; i++)

		pixelToDraw= 22*furnaces[i].getField(2)/furnaces[i].getField(3);

		drawTexturedModalRect(k+10+20*i, l+10, 206, 0, 16, 60);
		drawTexturedModalRect(k+11+20*i, l+29, 224, 0, 16, pixelToDraw);



Link to comment
Share on other sites

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.

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

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

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