Trinkets (Fabric)

Trinkets (Fabric)

22M Downloads

Removing a mod that enables a Trinket slot, can cause player(s) to no longer be able to rejoin the server.

MechanosG opened this issue ยท 3 comments

commented

Tfarcenim/DankStorageFabric#9

I posted most of the information over there, before I knew what was causing the issue. But basically, I'm currently testing a new 1.16.4 fabric modpack multiplayer, and we removed the mod Artifacts (on both clients and the server). Soon after I suddenly found myself unable to join the server, with no information on my client other than Internal Server Error. So far, other players have not had this issue however. So I got my character's playerdata from the server, replicated the environment on my own machine, then watched for an error. Something like this would show up server side every time I tried to connect:

[17:39:03] [Server thread/INFO]: [STDOUT]: [trinkets] Found item in slot that doesn't exist! head:hat
[17:39:03] [Server thread/WARN]: Failed to handle packet for /127.0.0.1:5266
net.minecraft.class_148: Loading entity NBT
	at Not Enough Crashes deobfuscated stack trace.(1.16.4+build.7) ~[?:?]
	at net.minecraft.entity.Entity.fromTag(Entity:1663) ~[?:?]
	at net.minecraft.world.WorldSaveHandler.loadPlayerData(WorldSaveHandler:57) ~[?:?]
	at net.minecraft.server.PlayerManager.loadPlayerData(PlayerManager:344) ~[?:?]
	at net.minecraft.server.PlayerManager.onPlayerConnect(PlayerManager:138) ~[?:?]
	at net.minecraft.server.network.ServerLoginNetworkHandler.acceptPlayer(ServerLoginNetworkHandler:113) ~[?:?]
	at net.minecraft.server.network.ServerLoginNetworkHandler.redirect$bpl000$handlePlayerJoin(ServerLoginNetworkHandler:562) ~[?:?]
	at net.minecraft.server.network.ServerLoginNetworkHandler.tick(ServerLoginNetworkHandler:65) ~[?:?]
	at net.minecraft.network.ClientConnection.tick(ClientConnection:228) ~[?:?]
	at net.minecraft.server.ServerNetworkIo.tick(ServerNetworkIo:173) ~[?:?]
	at net.minecraft.server.MinecraftServer.tickWorlds(MinecraftServer:882) ~[intermediary-server.jar:?]
	at net.minecraft.server.dedicated.MinecraftDedicatedServer.tickWorlds(MinecraftDedicatedServer:312) ~[?:?]
	at net.minecraft.server.MinecraftServer.tick(MinecraftServer:811) ~[intermediary-server.jar:?]
	at net.minecraft.server.MinecraftServer.runServer(MinecraftServer:670) ~[intermediary-server.jar:?]
	at net.minecraft.server.MinecraftServer.method_29739(MinecraftServer:257) ~[intermediary-server.jar:?]
	at java.lang.Thread.run(Unknown Source) [?:1.8.0_271]
Caused by: java.lang.NullPointerException
	at Not Enough Crashes deobfuscated stack trace.(1.16.4+build.7) ~[?:?]
	at net.minecraft.item.ItemStack.handler$zmo000$areTagsEqualReturn1(ItemStack:6655) ~[?:?]
	at net.minecraft.item.ItemStack.areTagsEqual(ItemStack:383) ~[?:?]
	at tfar.dankstorage.event.MixinHooks.areItemStacksCompatible(MixinHooks.java:227) ~[dankstorage-1.9a-1.16.3.jar:?]
	at tfar.dankstorage.event.MixinHooks.doesItemStackExist(MixinHooks.java:232) ~[dankstorage-1.9a-1.16.3.jar:?]
	at tfar.dankstorage.event.MixinHooks.voidPickup(MixinHooks.java:150) ~[dankstorage-1.9a-1.16.3.jar:?]
	at tfar.dankstorage.event.MixinHooks.onItemPickup(MixinHooks.java:132) ~[dankstorage-1.9a-1.16.3.jar:?]
	at tfar.dankstorage.event.MixinHooks.interceptItem(MixinHooks.java:47) ~[dankstorage-1.9a-1.16.3.jar:?]
	at net.minecraft.entity.player.PlayerInventory.handler$bdi000$interceptItems(PlayerInventory:2690) ~[?:?]
	at net.minecraft.entity.player.PlayerInventory.insertStack(PlayerInventory) ~[?:?]
	at net.minecraft.entity.player.PlayerEntity.giveItemStack(PlayerEntity:1907) ~[?:?]
	at dev.emi.trinkets.api.PlayerTrinketComponent.fromTag(PlayerTrinketComponent.java:42) ~[trinkets-2.6.7.jar:?]
	at nerdhub.cardinal.components.api.util.container.AbstractComponentContainer.fromTag(AbstractComponentContainer.java:180) ~[2d6540cc-4e4c-4548-904e-94e8517a01a4.jar:?]
	at net.minecraft.entity.Entity.handler$bdp000$fromTag(Entity:8692) ~[?:?]
	at net.minecraft.entity.Entity.fromTag(Entity:1654) ~[?:?]
	... 14 more

Because the log mentioned dankstorage, I thought one of the danks on my character might have been glitching out. But after using an nbt editor to remove the danks from my character, nothing changed. So I started looking at Trinkets, since it's also mentioned. Sure enough, if I remove the trinkets tree out of cardinal_components using the nbt editor, the error goes away and I'm able to join the server again. My character didn't actually have anything in any trinket slots either, and the only thing the nbt said was in those slots, was an air block.

commented

I dont think Trinkets can do much regarding that problem, I think if you had removed the item that was in the removed slot you wouldnt have any problems.

commented

after looking at it I'm not sure if this is exclusively trinkets' fault, I think it's more likely that dank storage had something to do with the comparisons and didn't handle nulls (that trinkets produces, and actually probably shouldn't) I'll make sure to look into this more thoroughly for trinkets 3.0.0, but for now I'm going to keep this on the backburner unless I can figure out what's actually happening and reproduce it.

commented

I dont think Trinkets can do much regarding that problem, I think if you had removed the item that was in the removed slot you wouldnt have any problems.

If you would kindly re-read what I posted, at the end I plainly stated there was nothing in the slots, and the character data said there was air blocks in those slots, presumably placed there by trinkets. (Not to mention that's a pretty bad way to look at it. Even if the problem could be avoided by unequipping items, if this happened to a populated dedicated server, you would have to ask every single player to unequip their trinket slots "before" a modpack update, which is likely impossible if the server accepts random players. Otherwise you'd have to wipe everyone's characters to make sure everyone can join.)

after looking at it I'm not sure if this is exclusively trinkets' fault, I think it's more likely that dank storage had something to do with the comparisons and didn't handle nulls (that trinkets produces, and actually probably shouldn't) I'll make sure to look into this more thoroughly for trinkets 3.0.0, but for now I'm going to keep this on the backburner unless I can figure out what's actually happening and reproduce it.

I can't say for certain, but I'm betting it can be reproduced by having Trinkets and Artifacts installed (and possibly Dank if your theory is correct), create a world, (optionally equip a trinket in one of the slots Artifacts activates then remove it, just in case there's some initialization code I don't know about that puts the air blocks into the slots in the character data), save the game, remove the Artifacts mod (which I assume in turn tries to deactivate the slots it enables), then attempt to join the same game. If it doesn't reproduce it singleplayer, then maybe a dedicated server is required, since the error does report being an internal server error. I also dunno if possibly having another mod that also uses Trinkets, like Age of Exile (which was also active at the time), may be worth including in the test.