Jump to content

Custom Furnace Block Fuel resetting to max


Irezel

Recommended Posts

Ok, when I start cooking something in my custom furnace block, and I log out while there is still fuel. Next time I log in, the fuel resets to max, So its infinite power, and just to make you you understand. It is not duplicating the fuel item, the fuel bar just keeps going to max. I don't know which classes you would need to look at, so please let me know and I will post them. Thanks

Link to comment
Share on other sites

Are you saving to NBT?

If this is what your talking about, then yes

public void readFromNBT(NBTTagCompound p_145839_1_)
    {
        super.readFromNBT(p_145839_1_);
        NBTTagList nbttaglist = p_145839_1_.getTagList("Items", 10);
        this.frierItemStacks = new ItemStack[this.getSizeInventory()];

        for (int i = 0; i < nbttaglist.tagCount(); ++i)
        {
            NBTTagCompound nbttagcompound1 = nbttaglist.getCompoundTagAt(i);
            byte b0 = nbttagcompound1.getByte("Slot");

            if (b0 >= 0 && b0 < this.frierItemStacks.length)
            {
                this.frierItemStacks[b0] = ItemStack.loadItemStackFromNBT(nbttagcompound1);
            }
        }

        this.frierBurnTime = p_145839_1_.getShort("BurnTime");
        this.frierCookTime = p_145839_1_.getShort("CookTime");
        this.currentItemBurnTime = getItemBurnTime(this.frierItemStacks[1]);

        if (p_145839_1_.hasKey("CustomName", )
        {
            this.field_145958_o = p_145839_1_.getString("CustomName");
        }
    }

    public void writeToNBT(NBTTagCompound p_145841_1_)
    {
        super.writeToNBT(p_145841_1_);
        p_145841_1_.setShort("BurnTime", (short)this.frierBurnTime);
        p_145841_1_.setShort("CookTime", (short)this.frierCookTime);
        NBTTagList nbttaglist = new NBTTagList();

        for (int i = 0; i < this.frierItemStacks.length; ++i)
        {
            if (this.frierItemStacks[i] != null)
            {
                NBTTagCompound nbttagcompound1 = new NBTTagCompound();
                nbttagcompound1.setByte("Slot", (byte)i);
                this.frierItemStacks[i].writeToNBT(nbttagcompound1);
                nbttaglist.appendTag(nbttagcompound1);
            }
        }

        p_145841_1_.setTag("Items", nbttaglist);

        if (this.hasCustomInventoryName())
        {
            p_145841_1_.setString("CustomName", this.field_145958_o);
        }
    }

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.