Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[1.8] Reading data from a vanilla furnace


Mistram
 Share

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) {
	super(container);
	furnaceSlots = container.getAllFurnaceSlots();
	furnaces=container.getFurnaces();


}

@Override
protected void drawGuiContainerBackgroundLayer(float partialTicks,
		int mouseX, int mouseY) {
	GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
	mc.renderEngine.bindTexture(background);
	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);
		System.out.println(furnaces[i].getField(2));
		System.out.println(furnaces[i]);

		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.

Guest
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.

 Share



×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.