Jump to content

Venrob

Members
  • Posts

    20
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Venrob's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. I didn't just copy the reference. I am a CS major, I have an idea of what I'm doing. I constructed a new InventoryPlayer, but for some reason that one was still affected when I cleared the original. It seems like a problem with copying a reference, yet I did not copy the reference- thus why I am confused.
  2. Okay, there were several more issues, but I seem to have it working perfectly now! For some reason, despite the InventoryPlayer being passed being just a copy of the original, it was still being cleared when the original was cleared. Don't know why, don't care anymore- I changed it so that the capability simply stores the items in 3 ItemStack[]'s (returning them in an ItemStack[][]). Best part? When dying, then returning to Title Screen before respawning, then rejoining and respawning, THE INVENTORY STILL LOADS SUCCESSFULLY! Thank you so much for your help!
  3. Is there a way to get the reference to the entity the capability is attached to?
  4. Right, okay. (Followed tutorial to a T, didn't realize that was a thing I had specified). Now when I die with the keeping medallion in my inventory, the entire inventory is just deleted. (I'm going to go through and set up some debug logging to see exactly where it is failing)
  5. Okay, that's fixed, but now there's a new crash. This one I know exactly the problem at least, but no clue how to fix it. Provider#serializeNBT returns NBTTagCompound, but the inventory is saved as an NBTTagList. How would I go about converting/changing this?
  6. I don't know what to tell you, I opened the crash report and copy/pasted. Here's a version with fixed spacing/newlines
  7. That's what the game gave me, exactly. Give me a minute, I'll try to make it more readable
  8. Well something is dreadfully wrong now... it crashed the instant I loaded a save. ...So from what I gather, it gets a NullPo when it checks if I am riding something? What is causing THAT? (I haven't updated the repo, but literally the only change made was changing the @SubscribeEvent to being static) Also, the error line is line 21 of the Storage class... that is the first line of a for loop... the only method called is inv.mainInventory.size(), which shouldn't be able to cause THIS.
  9. Oh... I forgot about the static thing AGAIN. Testing that now... The InventoryPlayer that is being passed is already a copy of the original, so it should work fine. (EventHandler.java , InventoryPlayer newInv = new InventoryPlayer(player))
  10. I've now spent an hour looking over capabilities and getting it to work, but I still have an issue. Code: https://github.com/venrob/RobsStuff-mcmod/tree/add-capabilities/main/java/com/venrob/robsstuff The relevant code is at /capabilities, as well as /utils/handlers/CapabilityHandler.java and /utils/handlers/EventHandler.java When the player dies, it should store the inventory in the capability, but the call to CapabilityHandler.getCapabilityInv(Entity entity) returns false. Should the entityPlayer not have the capability from the @SubscribeEvent method attachCapabilityEntity(AttachCapabilitiesEvent<Entity> event) ? What am I missing here?
  11. Okay, so I'm having some trouble here. I want to, under a certain condition, have the player's inventory (either the entire thing, or only certain items, depending on the condition) to be kept after death. Currently, I am just saving an InventoryPlayer variable which I store items in on LivingDeathEvent, and restore on PlayerEvent.Clone. There is an issue I have found, however- if the player disconnects from the server before clicking "Respawn", the inventory is completely lost- not just not kept through death, but does not drop either. What I have figured out is that I need to save the backup of the inventory to the player. Everything I can find online through searching tells me I should be using "IExtendedEntityProperties", though in 1.12 that doesn't appear to exist? How would I go about this in 1.12? (forge version is 14.23.4.2709 btw)
  12. Welp I'm blind. Thanks!
  13. Log: Line of my code: https://github.com/venrob/RobsStuff-mcmod/blob/master/main/java/com/venrob/robsstuff/init/ModEnchantsjava#L16 This was a server crash which happened seemingly out of nowhere, we had had 10+ hours of time on the server without any changes to my mod and without problems. I can't quite figure out what is causing this...
  14. No problem! Like I said, I literally had just coded this exact thing!
  15. Thank you! I'm still confused why the error would point toward my block registry, but that was indeed the actual issue!
×
×
  • Create New...

Important Information

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