Tomb Many Graves

Tomb Many Graves

3M Downloads

Does not appear to restore equipped Iron Backpacks backpack when inventory is full

Xuerian opened this issue ยท 21 comments

commented

If a player has an equipped backpack from Iron Backpacks, it is restored to the first open slot. If there is none (Including armor and offhand), it evaporates.

Judging by the saved inventories file, this will need to be handled specifically, but I would suggest that any item that can't find a real slot be dropped on the ground and the player get a notification.

Unless, like my other ticket, this already happens and something else is going on.

Here's a snap of a player's data file and the ForgeCaps section, after picking up graves and not getting backpacks, if it helps: http://i.imgur.com/R3aYuIV.png

As there was some discussion in an early issue there about how to handle grave mods, I've also reported it there: gr8pefish/IronBackpacks#118

commented

@M4thG33k I think this on your end. I can try PR'ing a fix, would you accept that?

Edit: Looks like you have inbuilt integration with other backpack mods and are just missing Iron Backpacks. Maybe it would be best for you to include the integration, and I will be here if you have any questions.

commented

@gr8pefish I know it's an issue on my end, I just haven't gotten around to implementing the fix. :-)

If you could give me a link to where in code you can get/set the backpack slot I can look into adding compatibility tomorrow.

commented

Sure thing, thanks!

I don't actually have a slot containing the backpack, it is just saved as NBT data for a player via capabilities. I'll go grab the link(s) to that and edit them in here.

Related: I also have a custom soulbound-style modifier (an 'eternity upgrade'), you may need to check for that as well (I haven't tested). I'll provide a link to that code as well.

commented

Awesome. Thanks! That will expedite the process. :-)

commented

Alright, here is the event handler that deals with dying. The helper method(s) it delegates to are here. From that you should be able to figure out most everything needed (for both normal handling and the soulbound/eternity upgrade (internal legacy name is keepOnDeathUpgrade btw) ), but please don't hesitate to message me if you run into trouble!

commented

Will do. Thanks again!

commented

@Xuerian Despite the backpack not going into its appropriate slot (which I'm currently working on), I haven't been able to reproduce the issue where the backpack evaporates (unless I'm in creative, of course).

commented

@Xuerian Alright. I think I figured out what's happening (and am not sure how to work around it). If every slot in the player's inventory is filled when the player dies, Iron Backpacks is set to immediately drop the equipped backpack into the world (meaning it cannot get saved to the grave so it actually drops and will eventually despawn).

I'm not sure how to work around this, @gr8pefish, since you're using a higher priority on the death event than I am (and I don't want to use highest because that could cause issues with other death events such as Botania's Laurel Crown). I also don't think I can save/restore the backpack slot in the grave because it will always be empty by the time the grave logic starts.

commented

I think I have a fix ready to go! Would you be able to publish a new version of Iron Backpacks with the new priority?

commented

Sweet, nice work and thank you! I have 1 more bug to fix before I'm going to release, but that should happen today or tomorrow (i.e. soon), and that will have the priority change.

commented

Cool. Let me know when that goes live so I can publish mine too; I don't want it live before the compatible version of IB. :-)

commented

Will do! When this issue closes that means I will have merged my bugfixes branch into main and built a new version and published it to curseforge. So when you get the email/notification that this issue is closed then you will know my release is live :)

commented

Oops, sorry. I meant to say when the issue on my bugtracker closes (#118) then you're good to go. I'll just post a message here when that happens.

commented

I just subbed to that issue so I'll still get an email.

commented

Jolly cooperation!

commented

Sweet, looks like it's all good for everyone! Glad that was relatively painless ๐Ÿ’ฏ

commented

What event priority should I use to fix it? The reason it is how it is now is that in 1.7.10 I had to change it to be a very high priority so it worked with Open Blocks' graves (which don't exist in 1.10+). I can alter this to be in line with your graves though. Does it need to be the same priority as you, or one below that?

Edit: If you didn't figure it out already, one possible way to get around the eternity upgrade, you can just ignore the backpack if it has that, and let my code figure it out. Sorry my API is a mess and doesn't let you easily do so, I plan on refactoring it a lot soon!
Edit2: Hehe perfect, you were one step ahead of me.

commented

If it doesn't affect any other mod interaction, one below would be better. I could then check if any backpacks have the Eternity upgrade and, if so, just ignore them when compiling the grave.

commented

Alright, I'll get you a custom jar with the priority changed so you can test it.

Edit: Let me just fix another bugfix that I'm almost done with, then I'll get right on that.

commented

Perfect

commented

Alright, here is a link to the file with the event priority on NORMAL (1 below HIGH, i.e. you). Let me know if I can do anything else to help!