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.

Custom furnace doesn't save items inside after closing MC (or exiting to menu)

Featured Replies

Posted

Good day once again,

I have a problem with Custom furnace.

After I put things inside the machine and then close Minecraft or exit to the menu, it doesn't save the things inside the furnace and also the fuel burn time.

If you'll need any source code, just say so.

FYI: I made one more furnace before and it works fine

  • Author

Here are my NBT functions from TileEntity file:

public void readFromNBT(NBTTagCompound nbttagcompound)
{
ย  ย  ย  ย   super.readFromNBT(nbttagcompound);
ย  ย  ย  ย   NBTTagList nbttaglist = nbttagcompound.getTagList("Items2");
ย  ย  ย  ย   electrolysisItemStacks = new ItemStack[getSizeInventory()];
ย  ย  ย  ย   for (int i = 0; i < nbttaglist.tagCount(); i++)
ย  ย  ย  ย   {
ย  ย  ย  ย  ย  ย  ย  ย   NBTTagCompound nbttagcompound2 = (NBTTagCompound)nbttaglist.tagAt(i);
ย  ย  ย  ย  ย  ย  ย  ย   byte byte0 = nbttagcompound2.getByte("Slot2");
ย  ย  ย  ย  ย  ย  ย  ย   if (byte0 >= 0 && byte0 < electrolysisItemStacks.length)
ย  ย  ย  ย  ย  ย  ย  ย   {
ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  ย   electrolysisItemStacks[byte0] = ItemStack.loadItemStackFromNBT(nbttagcompound2);
ย  ย  ย  ย  ย  ย  ย  ย   }
ย  ย  ย  ย   }
ย  ย  ย  ย   electrolysisBurnTime = nbttagcompound.getShort("BurnTime2");
ย  ย  ย  ย   electrolysisCookTime = nbttagcompound.getShort("CookTime2");
ย  ย  ย  ย   currentItemBurnTime = getItemBurnTime(electrolysisItemStacks[1]);
}

public void writeToNBT(NBTTagCompound nbttagcompound)
{
ย  ย  ย  ย   super.writeToNBT(nbttagcompound);
ย  ย  ย  ย   nbttagcompound.setShort("BurnTime2", (short)electrolysisBurnTime);
ย  ย  ย  ย   nbttagcompound.setShort("CookTime2", (short)electrolysisCookTime);
ย  ย  ย  ย   NBTTagList nbttaglist = new NBTTagList();
ย  ย  ย  ย   for (int i = 0; i < electrolysisItemStacks.length; i++)
ย  ย  ย  ย   {
ย  ย  ย  ย  ย  ย  ย  ย   if (electrolysisItemStacks[i] != null)
ย  ย  ย  ย  ย  ย  ย  ย   {
ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  ย   NBTTagCompound nbttagcompound2 = new NBTTagCompound();
ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  ย   nbttagcompound2.setByte("Slot2", (byte)i);
ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  ย   electrolysisItemStacks[i].writeToNBT(nbttagcompound2);
ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  ย   nbttaglist.appendTag(nbttagcompound2);
ย  ย  ย  ย  ย  ย  ย  ย   }
ย  ย  ย  ย   }
ย  ย  ย  ย   nbttagcompound.setTag("Items2", nbttaglist);
}

ย 

And here are my NBT functions from the previous machine:

public void readFromNBT(NBTTagCompound nbttagcompound)
{
ย  ย  ย  ย   super.readFromNBT(nbttagcompound);
ย  ย  ย  ย   NBTTagList nbttaglist = nbttagcompound.getTagList("Items");
ย  ย  ย  ย   cellingItemStacks = new ItemStack[getSizeInventory()];
ย  ย  ย  ย   for (int i = 0; i < nbttaglist.tagCount(); i++)
ย  ย  ย  ย   {
ย  ย  ย  ย  ย  ย  ย  ย   NBTTagCompound nbttagcompound1 = (NBTTagCompound)nbttaglist.tagAt(i);
ย  ย  ย  ย  ย  ย  ย  ย   byte byte0 = nbttagcompound1.getByte("Slot");
ย  ย  ย  ย  ย  ย  ย  ย   if (byte0 >= 0 && byte0 < cellingItemStacks.length)
ย  ย  ย  ย  ย  ย  ย  ย   {
ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  ย   cellingItemStacks[byte0] = ItemStack.loadItemStackFromNBT(nbttagcompound1);
ย  ย  ย  ย  ย  ย  ย  ย   }
ย  ย  ย  ย   }
ย  ย  ย  ย   cellingBurnTime = nbttagcompound.getShort("BurnTime");
ย  ย  ย  ย   cellingCookTime = nbttagcompound.getShort("CookTime");
ย  ย  ย  ย   currentItemBurnTime = getItemBurnTime(cellingItemStacks[1]);
}

public void writeToNBT(NBTTagCompound nbttagcompound)
{
ย  ย  ย  ย   super.writeToNBT(nbttagcompound);
ย  ย  ย  ย   nbttagcompound.setShort("BurnTime", (short)cellingBurnTime);
ย  ย  ย  ย   nbttagcompound.setShort("CookTime", (short)cellingCookTime);
ย  ย  ย  ย   NBTTagList nbttaglist = new NBTTagList();
ย  ย  ย  ย   for (int i = 0; i < cellingItemStacks.length; i++)
ย  ย  ย  ย   {
ย  ย  ย  ย  ย  ย  ย  ย   if (cellingItemStacks[i] != null)
ย  ย  ย  ย  ย  ย  ย  ย   {
ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  ย   NBTTagCompound nbttagcompound1 = new NBTTagCompound();
ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  ย   nbttagcompound1.setByte("Slot", (byte)i);
ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  ย   cellingItemStacks[i].writeToNBT(nbttagcompound1);
ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  ย   nbttaglist.appendTag(nbttagcompound1);
ย  ย  ย  ย  ย  ย  ย  ย   }
ย  ย  ย  ย   }
ย  ย  ย  ย   nbttagcompound.setTag("Items", nbttaglist);
}

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.