Modifcation of ItemStack.EMPTY's NBT data
ellie-semele opened this issue ยท 14 comments
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
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 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...
As I can see on screenshot it seems like traveler's backpack is inside imnis backpack is it right?
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.
is the backpack currently on the back when you are stacktracking this?
Also trinketsIntegartion on/off?
Unsure, this is happening on a server so I can only assume someone is wearing a travellers backpack.
Trinket integration is off.
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
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.
This can be reproduced with the help of Inmis.
It seems to happen when the Traveler's Backpack is removed after having been worn.
- Start the Minecraft client
- Start a new world in creative mode
- Cheat in a Frayed Backpack (Inmis)
- Open and then close the Frayed Backpack
- This initializes its NBT data
- Note the NBT data on the Frayed Backpack
- Cheat in a Traveler's Backpack
- Wear the backpack
- Remove the backpack
- This is the point at which the bug presents itself.
- Cheat in another Frayed Backpack
- Open and then close the Frayed Backpack
- Note the NBT data on the Frayed Backpack
(Note: Botania's Bauble Case can be used instead of Inmis' backpacks in detecting this issue.)
Hm I think the issue might be located in syncing. Can you enable TrinketsIntegration and check if it still happens?
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
Anyone who might know how to reslove this issue can make a pull request or help.