The Twilight Forest

The Twilight Forest

140M Downloads

Tinker's Construct soulbound items disapear on player death when twilight forest is installed

Gemedet03 opened this issue ยท 4 comments

commented

Forge Version

40.1.22

Twilight Forest Version

4.1.1096

Client Log

https://gist.github.com/Gemedet03/0466b8a4e15241901f78e27611460ef3

Crash Report (if applicable)

No response

Steps to Reproduce

  1. enter creative mode. (/gamemode creative)
  2. create a tinker's construct item with the soulbound upgrade (I used a slimelytra)
  3. enter survival mode. (/gamemode survival)
  4. die or use /kill
  5. (note the soulbound item is visible on the toolbar)
  6. click respawn.

What You Expected

Tinker's construct soulbound equipment should still be in the player's inventory upon respawning from death.

What Happened Instead

The soulbound item that was on the toolbar in step 5 has been removed from the inventory after respawning.

Additional Details

This was tested with only Twilight Forest 4.1.1096, Tinker's Construct 3.5.0.17, and Mantle 1.9.20 installed.
(It only occurs when the player is in survival. When in creative mod, soulbound seems to work fine)

Please Read and Confirm The Following

  • I have confirmed this bug can be replicated without the use of Optifine.
  • I have confirmed the details provided in this report are concise as possible and does not contained vague information (ie. Versions are properly recorded, answers to questions are clear).
  • I have confirmed this issue is unique and has not been reported already.
commented

here's a link to the Tinker's Construct version.
SlimeKnights/TinkersConstruct#4906

commented

Relevant code on tinkers side if it helps: https://github.com/SlimeKnights/TinkersConstruct/blob/1.18.2/src/main/java/slimeknights/tconstruct/tools/modifiers/upgrades/general/SoulboundModifier.java

You do seem to be using an entirely different set of events to implement charms here, which could be related. That said, nothing stood out as something that would affect tinker tools when the player lacks the relevant charms. I had quite a bit of success just storing items on the player inventory during living drops then restoring them on player clone, which is basically the same logic used by the keep inventory command IIRC. Keepsake Casket might also be related, not sure how that works.

commented

This looks like it's a goof on my end. It looks like I write the saved inventory to the persistent player data regardless of whether there were actually any saved items or not. This causes the player's inventory to be COMPLETELY overridden on respawn, effectively deleting any items that were added in before respawning. This is actually terrible, so I'm gonna fix this and push it to curse as soon as I can.

commented

alright, this has been fixed in 1519660. I will be pushing a build to curseforge shortly.

I figure I'll document my stupidity here while I'm at it, because this was actually 2 issues. One is completely my fault; the other is partially my fault for using it.

  1. The persistent data is saved regardless of if the charm of keeping actually saved anything or you had tower keys/phantom armor on you. That was stupid.
  2. Using Inventory.load to load the data actually clears all inventory slots. This part isn't my fault per say, I just should have looked into the method better before using it