Traveler's Backpack

Traveler's Backpack

35M Downloads

Modifcation of ItemStack.EMPTY's NBT data

ellie-semele opened this issue ยท 14 comments

commented

Describe the bug
Backpack inventories are being initialized with an empty item stack which nbt's is being modified by this mod which is not very good as it is causing a lot of lag when sending item nbt to the client.

To Reproduce
Steps to reproduce the behavior:
As simple as wearing a backpack as far as I'm aware.

Expected behavior
Not to write data or try to get nbt data from ItemStack.EMPTY.

Screenshots
image
As you can see empty items all have nbt originating from this mod.

Required informations (please complete the following information):

  • Mod version: 1.18.2-7.1.5, seems to affect anything newer.
  • Mod Loader: Fabric

Additional context

this.container = new TravelersBackpackContainer(this.wearable, playerEntity, Reference.WEARABLE_SCREEN_ID);

This seems to be at least one of the causes of the issue as the Inventory is made with an empty ItemStack.

Also this is a stacktrace we get on AOF's servers when I made a mod to log when getOrCreateNbt is called on ItemStack.EMPTY:
log.txt

Edit: this looks bad too...

ItemStack wearable = ItemStack.EMPTY;
wearable.writeNbt(tag);
Nevermind I misread this.

commented

As I can see on screenshot it seems like traveler's backpack is inside imnis backpack is it right?

commented

Well Imnis writes ItemStack.EMPTY stacks to their inventory, and traveler's backpack is writing data to ItemStack.EMPTY so all the air stacks have this nbt data.

commented

is the backpack currently on the back when you are stacktracking this?
Also trinketsIntegartion on/off?

commented

Unsure, this is happening on a server so I can only assume someone is wearing a travellers backpack.
Trinket integration is off.

commented

That's really strange I can't reproduce this issue

commented

If you could give me steps how to reproduce this issue I'd be glad. In my dev environment Empty itemstacks are just empty.. Also code you sent

ItemStack wearable = ItemStack.EMPTY;
wearable.writeNbt(tag);

it does not write tag to ItemStack.EMPTY, but ItemStack.EMPTY is being written to tag. Which later is checked if player hasWearable then it should sync. Ye as I said before reproducing steps would be great

commented

I've been seeing this on my server as well. Running AOF5 1.5.1 which uses travelers-backpack-1.18.2-7.1.5. This issue eventually causes exceptions due to packets being to large. That, in turn, led to players not being able to log in and ae2 failing to show inventories.

commented

This can be reproduced with the help of Inmis.

It seems to happen when the Traveler's Backpack is removed after having been worn.

  1. Start the Minecraft client
  2. Start a new world in creative mode
  3. Cheat in a Frayed Backpack (Inmis)
  4. Open and then close the Frayed Backpack
    • This initializes its NBT data
  5. Note the NBT data on the Frayed Backpack
  6. Cheat in a Traveler's Backpack
  7. Wear the backpack
  8. Remove the backpack
    • This is the point at which the bug presents itself.
  9. Cheat in another Frayed Backpack
  10. Open and then close the Frayed Backpack
  11. Note the NBT data on the Frayed Backpack

(Note: Botania's Bauble Case can be used instead of Inmis' backpacks in detecting this issue.)

commented

Hm I think the issue might be located in syncing. Can you enable TrinketsIntegration and check if it still happens?

commented

What is this mod which shows nbt tags? (on previous screenshot)

commented

Hm I think the issue might be located in syncing. Can you enable TrinketsIntegration and check if it still happens?

I'm not able to reproduce it with "trinketsIntegration": true

commented

Yeah so it seems that's issue with syncing of component

commented

Anyone who might know how to reslove this issue can make a pull request or help.