Jump to content

Check Furnace Inventory


MrGirboto

Recommended Posts

is there a way i can check if a certain item is in the smeltable slot in the furnace. (where iron ore, gold ore, etc goes). I'm trying to make a block change its texture depending on what item is in the smeltable slot. I tried an if statement like:

if (tile.inv[0] == new ItemStack(Item.wheat))

{

    bindTextureByName("/****/****/*********.png");

}

 

where "tile" is the tileEntity, "inv" is the inventory slot, and "[0]" is the smeltable slot.

instead of changing the texture to what i want it just changes it to a glitchy terrain.png.

Link to comment
Share on other sites

For the compare you'll want to compare the IDs of the items or (even better) use isItemEqual, rather than comparing the address of the new item stack against a different one in your tile.

 

if(tile.inv[0].isItemEqual(new ItemStack(Item.wheat)) .....

 

or maybe

 

if(tile.inv[0].itemID == Item.wheat.shiftedIndex)....

 

Check TileEntityFurnace (functions canSmelt and smeltItem) for examples of checking what is where.

 

Not sure about your texture problem.

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

Announcements



×
×
  • Create New...

Important Information

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