You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I get UnsupportedOperationException when calling MinecraftComponentSerializer.get().serialize(component); on villagers names trade GUI name and some other texts.
Only way to fix that is to convert the adventure Component to Json String and use NMS to convert the Json String to Minecraft MutableComponent, I tried that and works fine.
Seems the issue is somehow caused by the json tree -> MutableComponent implementation.
[15:02:10 ERROR]: [ItemsAdder] Unhandled exception occurred in onPacketSending(PacketEvent) for ItemsAdder
java.lang.UnsupportedOperationException: com.google.gson.JsonSyntaxException: Expected id to be a string, was an array ([140...38])
at net.kyori.adventure.platform.bukkit.MinecraftComponentSerializer.serialize(MinecraftComponentSerializer.java:225) ~[LoneLibs.jar:?]
at ia.m.iI.a(SourceFile:97) ~[ItemsAdder_3.6.3-beta-5.jar:?]
at ia.m.hy.onPacketSending(SourceFile:173) ~[ItemsAdder_3.6.3-beta-5.jar:?]
at com.comphenix.protocol.injector.SortedPacketListenerList.invokeSendingListener(SortedPacketListenerList.java:219) ~[ProtocolLib.jar:?]
at com.comphenix.protocol.injector.SortedPacketListenerList.invokeUnpackedPacketSending(SortedPacketListenerList.java:204) ~[ProtocolLib.jar:?]
at com.comphenix.protocol.injector.SortedPacketListenerList.invokePacketSending(SortedPacketListenerList.java:149) ~[ProtocolLib.jar:?]
at com.comphenix.protocol.injector.SortedPacketListenerList.invokePacketSending(SortedPacketListenerList.java:139) ~[ProtocolLib.jar:?]
at com.comphenix.protocol.injector.PacketFilterManager.postPacketToListeners(PacketFilterManager.java:553) ~[ProtocolLib.jar:?]
at com.comphenix.protocol.injector.PacketFilterManager.invokePacketSending(PacketFilterManager.java:526) ~[ProtocolLib.jar:?]
at com.comphenix.protocol.injector.netty.manager.NetworkManagerInjector.onPacketSending(NetworkManagerInjector.java:100) ~[ProtocolLib.jar:?]
at com.comphenix.protocol.injector.netty.channel.NettyChannelInjector.processOutbound(NettyChannelInjector.java:553) ~[ProtocolLib.jar:?]
at com.comphenix.protocol.injector.netty.channel.NettyChannelInjector$2.doProxyRunnable(NettyChannelInjector.java:456) ~[ProtocolLib.jar:?]
at com.comphenix.protocol.injector.netty.channel.NettyEventLoopProxy.proxyRunnable(NettyEventLoopProxy.java:43) ~[ProtocolLib.jar:?]
at com.comphenix.protocol.injector.netty.channel.NettyEventLoopProxy.execute(NettyEventLoopProxy.java:252) ~[ProtocolLib.jar:?]
at net.minecraft.network.Connection.sendPacket(Connection.java:432) ~[?:?]
at net.minecraft.network.Connection.send(Connection.java:392) ~[?:?]
at net.minecraft.server.network.ServerCommonPacketListenerImpl.send(ServerCommonPacketListenerImpl.java:276) ~[purpur-1.20.2.jar:git-Purpur-2095]
at net.minecraft.server.network.ServerCommonPacketListenerImpl.send(ServerCommonPacketListenerImpl.java:261) ~[purpur-1.20.2.jar:git-Purpur-2095]
at net.minecraft.server.level.ServerPlayer.openMenu(ServerPlayer.java:1640) ~[?:?]
at net.minecraft.world.item.trading.Merchant.openTradingScreen(Merchant.java:41) ~[?:?]
at net.minecraft.world.entity.npc.Villager.startTrading(Villager.java:453) ~[?:?]
at net.minecraft.world.entity.npc.Villager.mobInteract(Villager.java:431) ~[?:?]
at net.minecraft.world.entity.Mob.interact(Mob.java:1374) ~[?:?]
at net.minecraft.world.entity.player.Player.interactOn(Player.java:1174) ~[?:?]
at net.minecraft.server.network.ServerGamePacketListenerImpl$4.performInteraction(ServerGamePacketListenerImpl.java:2816) ~[?:?]
at net.minecraft.server.network.ServerGamePacketListenerImpl$4.a(ServerGamePacketListenerImpl.java:2836) ~[?:?]
at net.minecraft.network.protocol.game.ServerboundInteractPacket$InteractionAction.dispatch(ServerboundInteractPacket.java:131) ~[?:?]
at net.minecraft.network.protocol.game.ServerboundInteractPacket.dispatch(ServerboundInteractPacket.java:80) ~[?:?]
at net.minecraft.server.network.ServerGamePacketListenerImpl.handleInteract(ServerGamePacketListenerImpl.java:2775) ~[?:?]
at net.minecraft.network.protocol.game.ServerboundInteractPacket.handle(ServerboundInteractPacket.java:67) ~[?:?]
at net.minecraft.network.protocol.game.ServerboundInteractPacket.handle(ServerboundInteractPacket.java:12) ~[?:?]
at net.minecraft.network.protocol.PacketUtils.lambda$ensureRunningOnSameThread$0(PacketUtils.java:53) ~[?:?]
at net.minecraft.server.TickTask.run(TickTask.java:18) ~[purpur-1.20.2.jar:git-Purpur-2095]
at net.minecraft.util.thread.BlockableEventLoop.doRunTask(BlockableEventLoop.java:153) ~[?:?]
at net.minecraft.util.thread.ReentrantBlockableEventLoop.doRunTask(ReentrantBlockableEventLoop.java:24) ~[?:?]
at net.minecraft.server.MinecraftServer.doRunTask(MinecraftServer.java:1351) ~[purpur-1.20.2.jar:git-Purpur-2095]
at net.minecraft.server.MinecraftServer.d(MinecraftServer.java:193) ~[purpur-1.20.2.jar:git-Purpur-2095]
at net.minecraft.util.thread.BlockableEventLoop.pollTask(BlockableEventLoop.java:126) ~[?:?]
at net.minecraft.server.MinecraftServer.pollTaskInternal(MinecraftServer.java:1328) ~[purpur-1.20.2.jar:git-Purpur-2095]
at net.minecraft.server.MinecraftServer.pollTask(MinecraftServer.java:1321) ~[purpur-1.20.2.jar:git-Purpur-2095]
at net.minecraft.util.thread.BlockableEventLoop.managedBlock(BlockableEventLoop.java:136) ~[?:?]
at net.minecraft.server.MinecraftServer.waitUntilNextTick(MinecraftServer.java:1299) ~[purpur-1.20.2.jar:git-Purpur-2095]
at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1187) ~[purpur-1.20.2.jar:git-Purpur-2095]
at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:320) ~[purpur-1.20.2.jar:git-Purpur-2095]
at java.lang.Thread.run(Thread.java:833) ~[?:?]
Caused by: com.google.gson.JsonSyntaxException: Expected id to be a string, was an array ([140...38])
at net.minecraft.util.GsonHelper.convertToString(GsonHelper.java:97) ~[?:?]
at net.minecraft.util.GsonHelper.getAsString(GsonHelper.java:103) ~[?:?]
at net.minecraft.network.chat.HoverEvent$EntityTooltipInfo.create(HoverEvent.java:177) ~[?:?]
at net.minecraft.network.chat.HoverEvent$Action.deserialize(HoverEvent.java:136) ~[?:?]
at net.minecraft.network.chat.HoverEvent.deserialize(HoverEvent.java:80) ~[?:?]
at net.minecraft.network.chat.Style$Serializer.getHoverEvent(Style.java:405) ~[?:?]
at net.minecraft.network.chat.Style$Serializer.deserialize(Style.java:377) ~[?:?]
at net.minecraft.network.chat.Style$Serializer.deserialize(Style.java:364) ~[?:?]
at com.google.gson.internal.bind.TreeTypeAdapter.read(TreeTypeAdapter.java:76) ~[gson-2.10.1.jar:?]
at com.google.gson.Gson.fromJson(Gson.java:1227) ~[gson-2.10.1.jar:?]
at com.google.gson.Gson.fromJson(Gson.java:1329) ~[gson-2.10.1.jar:?]
at com.google.gson.Gson.fromJson(Gson.java:1300) ~[gson-2.10.1.jar:?]
at com.google.gson.internal.bind.TreeTypeAdapter$GsonContextImpl.deserialize(TreeTypeAdapter.java:179) ~[gson-2.10.1.jar:?]
at net.minecraft.network.chat.Component$Serializer.deserialize(Component.java:361) ~[?:?]
at net.minecraft.network.chat.Component$Serializer.deserialize(Component.java:222) ~[?:?]
at com.google.gson.internal.bind.TreeTypeAdapter.read(TreeTypeAdapter.java:76) ~[gson-2.10.1.jar:?]
at com.google.gson.Gson.fromJson(Gson.java:1227) ~[gson-2.10.1.jar:?]
at com.google.gson.Gson.fromJson(Gson.java:1329) ~[gson-2.10.1.jar:?]
at com.google.gson.Gson.fromJson(Gson.java:1271) ~[gson-2.10.1.jar:?]
at net.minecraft.network.chat.Component$Serializer.fromJson(Component.java:536) ~[?:?]
at net.kyori.adventure.platform.bukkit.MinecraftComponentSerializer.serialize(MinecraftComponentSerializer.java:221) ~[LoneLibs.jar:?]
... 44 more
[15:02:10 ERROR]: Parameters:
net.minecraft.network.protocol.game.PacketPlayOutOpenWindow@2d1a960d[
a=11
b=net.minecraft.world.inventory.Containers@3a73661d
c=translation{key='entity.minecraft.villager.farmer', args=[]}[style={hoverEvent=HoverEvent{action=<action show_entity>, value='net.minecraft.network.chat.ChatHoverable$b@8abdf856'},insertion=08629de5-8c47-4554-8ad5-1f075a194266}]
]
The text was updated successfully, but these errors were encountered:
Tested on:
I get UnsupportedOperationException when calling
MinecraftComponentSerializer.get().serialize(component);
on villagers names trade GUI name and some other texts.Only way to fix that is to convert the adventure
Component
to Json String and use NMS to convert the Json String to MinecraftMutableComponent
, I tried that and works fine.Seems the issue is somehow caused by the json tree ->
MutableComponent
implementation.The text was updated successfully, but these errors were encountered: