Jump to content

Ender Pack


Ne0NAfr0

Recommended Posts

Hey guys!

 

Recently I had the great idea to add in a "portable" ender chest. An item that acts like an ender chest when you use the item. I got everything to work great, the ender pack is separate from a normal ender chest, so items in an ender chest and items in the players ender bag are separate from each other. As well, each player has a separate ender pack that is their own, each player can store their own items in that pack without interference from other players. My problem is that the Items do not save in the pack after a game restart, they save after reloading the world but not an entire game close and open again. I was under the impression that the code I copied from the enderchest in minecraft saved its inventory through NBTTags, and it does. My problem is that I am unsure of how to save and load the chests to the ArrayList of enderPouchTiles I have. The chest info is being saved and stored, (I think) but everytime you load the game it creates a new array of empty tile data for the chests. I though of storing the info in the TileEntityEnderChest type, as I believe that stores what chest it is, and then loading that tile data rather than creating a new one every time. The problem is that the variables in TileEntityEnderChest do not have proper names, and some are private. I could create my own file with the same info but have the variables public, or have get/set methods but I feel as though there must be an easier way.

 

The spacing is a bit weird on the pastebin but here is my code anyway:

http://pastebin.com/mbXJj2BQ

 

To recap, Every thing works but saving the ListArray of enderPouchTile data. I know how to store basic info in NBTTags, like ints, strings etc... but not something like this. Would that be possible? Any help is appreciated, thanks!

 

Oh, sorry, And I am using Forge 1.8. Thanks.

.|\| E0 |\|.      /\ Fr0

Link to comment
Share on other sites

You need to save the information to the item stacks's nbt

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

You need to save the information to the item stacks's nbt

 

I'd rather pick IExtendedEntityProperties to do this.

 

OP said he wants a per-player inventory accesible by given player (only?). You would want to save inventory of your ender pack inside player's IEEP and make that inventory openable via some item.

 

IEEP tut: http://www.minecraftforum.net/forums/mapping-and-modding/mapping-and-modding-tutorials/1571567-1-7-2-1-6-4-eventhandler-and

 

Else: Do what Drako said, save in itemstack, which is (in my opinion) bad idea (unless you want players to be able to have multiple backpacks).

Also - whole idea of having fields in Item class is VERY BAD.

1.7.10 is no longer supported by forge, you are on your own.

Link to comment
Share on other sites

Ah, yes. That would be better in this case.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

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.