Jump to content

Recommended Posts

Posted

hey guys this is my first time posting on these forums so i dont really know how things work so bare with me if there is some bbcode messups

so basically i made a windmill and this windmill works Almost Perfect the only issue is when i go into the game it doesn't save its power's progress bar, it saves the power but not the progress bar here is my tileentity and gui code

the main thing you want to look at is the "getpowerscaled" method in both classes

 

TileEntity

 

  Reveal hidden contents

 

 

GUI

 

  Reveal hidden contents

 

the bar works but when i leave the game and reopen it it doesn't save the state

Its best to only ask questions when you did most of the work yourself.

Posted

That's because you never write to NBT and read from NBT. So override the methods

public void writeToNBT(NBTTagCompound);

and

public void readFromNBT(NBTTagCompound);

. In those method you want to write and read your values from the NBTTagCompound passed in. Be sure to call the super methods!

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Posted
  On 8/16/2014 at 2:20 PM, larsgerrits said:

That's because you never write to NBT and read from NBT. So override the methods

public void writeToNBT(NBTTagCompound);

and

public void readFromNBT(NBTTagCompound);

. In those method you want to write and read your values from the NBTTagCompound passed in. Be sure to call the super methods!

 

I already have the writenbt and readnbt methods in my TileEntity class and it works fine the power saves,the items in the slots save but the bar doesn't save

Its best to only ask questions when you did most of the work yourself.

Posted

I think your problem is with the MAX value. You either need to save it using NBT, or don't initialize it in the constructor but directly when the field is made.

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Posted
  On 8/16/2014 at 3:17 PM, larsgerrits said:

I think your problem is with the MAX value. You either need to save it using NBT, or don't initialize it in the constructor but directly when the field is made.

i removed the max and low floats entirely and changed them with there numbers and it still wont save the bar

here is a image in game when i fill up the turbine with power

 

 

and here is a image of the same exact turbine when i reload the world

 

 

note that in chat the power is printed out as mpw's

Its best to only ask questions when you did most of the work yourself.

Posted
  On 8/16/2014 at 7:55 PM, larsgerrits said:

From where do you call the addPower method? I think your client and server are desynchronized.

i add power from recipes and i call recipes from getstackinslot oh and what may be usefull is my block code

 

 

  Reveal hidden contents

 

Its best to only ask questions when you did most of the work yourself.

Posted

Do you have a GitHub? If so, post the link so we have all the code. Else, post the IGuiHandler class and the Container class.

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Posted
  On 8/16/2014 at 8:13 PM, larsgerrits said:

Do you have a GitHub? If so, post the link so we have all the code. Else, post the IGuiHandler class and the Container class.

 

i do not have github so i will post the container and guihandler

 

container

 

  Reveal hidden contents

 

 

 

handler

 

 

  Reveal hidden contents

 

 

Its best to only ask questions when you did most of the work yourself.

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.