Jump to content

Recommended Posts

Posted

Hey everyone, I'm working on a furnace that will have a fuel buffer and it's working like I want it to. It'll burn coal when theres room to store energy and then it'll use that energy to cook items. The only problem is that whenever i save and quit then come back, the buffer is reset to 0. Is there a way to save that number? Thanks a lot!

Posted

 

I tried using nbt data before after looking up the problem, but it wasn't working for me. Heres the code I have, I don't have a clue as to why it's not working. This is just a method in my tile entity class.

 

@Override
        public void readFromNBT(NBTTagCompound tagCompound) {
        	// working code for setting itemstacks, commenting this out breaks the furnace so i know this is being called
                super.readFromNBT(tagCompound);
                NBTTagList tagList = tagCompound.getTagList("Inventory");
                for (int i = 0; i < tagList.tagCount(); i++) {
                        NBTTagCompound tag = (NBTTagCompound) tagList.tagAt(i);
                        byte slot = tag.getByte("Slot");
                        if (slot >= 0 && slot < inv.length) {
                                inv[slot] = ItemStack.loadItemStackFromNBT(tag);
                        }
                } //(ends here)
                
                fuelLevel = tagCompound.getInteger("Fuel"); // reading it isn't working
                //fuelLevel = 50; // me even trying to brute force set it and still not working
        }

  • 3 weeks later...
Posted

you need to use packets so the gui can update.

 

But it isn't the GUI thats going wrong, its the saving, but mabye Packets will help, but how do I use them/what should I do with them?

Posted

you need to use packets so the gui can update.

 

But it isn't the GUI thats going wrong, its the saving, but mabye Packets will help, but how do I use them/what should I do with them?

Posted

The gui is client side, all information must be serverside.

If the client is doing something to change the info inn a tileEntity you must let the server know!

To let the server kniw this you use packets :)

 

Take a look on the tutorials on the forgewiki as well as google for packet tutorials.

If you guys dont get it.. then well ya.. try harder...

Posted

The gui is client side, all information must be serverside.

If the client is doing something to change the info inn a tileEntity you must let the server know!

To let the server kniw this you use packets :)

 

Take a look on the tutorials on the forgewiki as well as google for packet tutorials.

If you guys dont get it.. then well ya.. try harder...

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.