Jump to content

BotanicNitro

Members
  • Posts

    4
  • Joined

  • Last visited

BotanicNitro's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. I have just two suggestions for this forum itself: Please remove the auto-refresh during account validation (Click the link in your email...) if and when you can. Google's newer captchas tend to take longer than the page refresh. I had to use some hacky JavaScript to clear all intervals and timeouts to get properly registered. Please consider using HTTPS, especially for authentication. I hear Let's Encrypt is a very easy way to get set up with that, and it is both free and automated. I'm not sure if this sort of post would go here, but there is no meta-suggestion forum, so this was my best choice. Thanks for your time.
  2. That's very good to know, thank you. I found that converting my test code to use a similar structure did, in fact, solve the issue with persistence. Additionally, I found an error in my main codebase that, when fixed, also fixed it there. If I encounter further issues with persistence in the future, I will be sure to return. The original post has been updated to include the new files.
  3. I initially started out extending IItemHandler to manage my inventory, but Slot wants an instance of a class that extends IInventory. How would I get a GUI working with IItemHandler? I would prefer not to extend ItemStackHandler, as I wish to store other data that will be related to this inventory, but I'm not too stubborn to consider it if it becomes the only viable option. My own inventory serialization code works extremely similarly to IItemHandler's. However, I use an array instead of a list. I will do further testing to see if following more closely with that structure makes a difference. I will review and revise my test code where necessary to remove this issue, then upload new versions of each afflicted file after further testing.
  4. After banging my head into a wall for a few days, I've come here to ask for some assistance in a project of mine. Up-to-date documentation and best practices are often difficult to find, so please correct me if I've made terrible blunders in my code - especially if I'm terribly over-complicating things. My main goals: 1. Create an item that contains data and an inventory. 2. Create a GUI that allows a user to swap items and see data. 3. Persist instance data while the given ItemStack exists. My approach so far: 1. Create a custom Capability (impl, storage, provider) implementing IInventory. 2. Use initCapabilities to return my custom provider. 3. Trigger player.openGui() on item right click. My issue(s) with this approach: 1. The inventory will wipe itself occasionally during play, and consistently upon reloading the world. 2. Bizarrely, the numeric data persists correctly. Additional questions: - As I understand it, IInventory is deprecated. Is there a better way to meet my goals without it? Notes: - The issue seems potentially related to my storage of slots in an NBTTagList. The first minimum-impl I was going to submit used a raw ItemStack for internal storage and a lone NBTTagCompound for serialization, and did not exhibit the noted issues. My actual implementation is much like the one now present. Linked is a minimum implementation that exhibits these issues. Main Class Capability Capability: Impl Capability: Provider Capability: Storage Example Container Example GuiContainer Example GuiHandler Example Item 2017-07-01 11:45 Capability (2) Capability: Impl (2) Capability: Provider (2) Capability: Storage (2)
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.