GTNewHorizons / GT-New-Horizons-Modpack

New Modpack with Gregtech, Thaumcraft and Witchery
https://www.gtnewhorizons.com/
Other
992 stars 301 forks source link

using T to find items in nearby inventories disconnects you from server #17502

Closed NyrZ closed 3 weeks ago

NyrZ commented 3 weeks ago

Your GTNH Discord Username

nyrz

Your Pack Version

nightly 675

Your Server

private server

Java Version

Java 21

Type of Server

Vanilla Forge

Your Expectation

Use T to find in which inventories while hovering an item

The Reality

disconnect me from the server with error "A fatal error has occured, this connection is terminated" when pressing T even on items that are only in my inventory and not in nearby chest (eg: my TCon tool is unique and I still get disconnected)

Exact console log is "NyrZ lost connection: TextComponent{text='A fatal error has occured, this connection is terminated', siblings=[], style=Style{hasParent=false, color=null, bold=null, italic=null, underlined=null, obfuscated=null, clickEvent=null, hoverEvent=null}}"

Your Proposal

Fix disconnection issue when pressing T

Final Checklist

Dream-Master commented 3 weeks ago

@mainrs you add some new stuff to findit any idea?

Dream-Master commented 3 weeks ago

https://github.com/GTNewHorizons/FindIt/pull/19 https://github.com/GTNewHorizons/FindIt/pull/20

slprime commented 3 weeks ago

https://github.com/GTNewHorizons/FindIt/pull/22/ - this PR can fix this. There was a problem calling client code on the server

mainrs commented 3 weeks ago

GTNewHorizons/FindIt#22 - this PR can fix this. There was a problem calling client code on the server

I didn't change any client/server-side related code paths I think. What part of your PR fixes this? Would appreciate an explanation to mitigate the same issues in the future!

Lyfts commented 3 weeks ago

The culprit was this line https://github.com/GTNewHorizons/FindIt/blob/e3cfb6835f6addabeb706be0adaf5d67d57de795/src/main/java/com/gtnh/findit/util/mods/ForestryUtils.java#L26

Anything from the mc client package doesn't exist server-side, such as the Minecraft class in this case.

slprime commented 3 weeks ago

GTNewHorizons/FindIt#22 - this PR can fix this. There was a problem calling client code on the server

I didn't change any client/server-side related code paths I think. What part of your PR fixes this? Would appreciate an explanation to mitigate the same issues in the future!

FindItemRequest.isStackSatisfies - called on the client to highlight items in the inventory and on the server when searching for tileEntites. The error could only be reproduced on a real server.

[21:17:33] [Server thread/ERROR] [FML/]: There was a critical exception handling a packet on channel findit java.lang.NoClassDefFoundError: net/minecraft/client/entity/EntityClientPlayerMP at Launch//com.gtnh.findit.service.itemfinder.FindItemRequest.isStackSatisfies(FindItemRequest.java:69) ~[FindItemRequest.class:?] at Launch//com.gtnh.findit.service.itemfinder.ItemFindService.findItemInTile(ItemFindService.java:94) ~[ItemFindService.class:?] at Launch//com.gtnh.findit.service.itemfinder.ItemFindService.handleRequest(ItemFindService.java:42) ~[ItemFindService.class:?] at Launch//com.gtnh.findit.service.itemfinder.FindItemRequest$Handler.onMessage(FindItemRequest.java:111) ~[FindItemRequest$Handler.class:?] at Launch//com.gtnh.findit.service.itemfinder.FindItemRequest$Handler.onMessage(FindItemRequest.java:106) ~[FindItemRequest$Handler.class:?] at Launch//cpw.mods.fml.common.network.simpleimpl.SimpleChannelHandlerWrapper.channelRead0(SimpleChannelHandlerWrapper.java:37) ~[SimpleChannelHandlerWrapper.class:?] at Launch//cpw.mods.fml.common.network.simpleimpl.SimpleChannelHandlerWrapper.channelRead0(SimpleChannelHandlerWrapper.java:17) ~[SimpleChannelHandlerWrapper.class:?] at Launch//io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:98) ~[minecraft_server.1.7.10.jar:?] at Launch//io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:337) ~[minecraft_server.1.7.10.jar:?] at Launch//io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:323) ~[minecraft_server.1.7.10.jar:?] at Launch//io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103) ~[minecraft_server.1.7.10.jar:?] at Launch//io.netty.handler.codec.MessageToMessageCodec.channelRead(MessageToMessageCodec.java:111) ~[minecraft_server.1.7.10.jar:?] at Launch//io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:337) ~[minecraft_server.1.7.10.jar:?] at Launch//io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:323) ~[minecraft_server.1.7.10.jar:?] at Launch//io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:785) ~[minecraft_server.1.7.10.jar:?] at Launch//io.netty.channel.embedded.EmbeddedChannel.writeInbound(EmbeddedChannel.java:169) ~[minecraft_server.1.7.10.jar:?] at Launch//cpw.mods.fml.common.network.internal.FMLProxyPacket.func_148833_a(FMLProxyPacket.java:77) [FMLProxyPacket.class:?] at Launch//net.minecraft.network.NetworkManager.func_74428_b(NetworkManager.java:212) [ej.class:?] at Launch//net.minecraft.network.NetworkSystem.func_151269_c(NetworkSystem.java:165) [nc.class:?] at Launch//net.minecraft.server.MinecraftServer.func_71190_q(MinecraftServer.java:659) [MinecraftServer.class:?] at Launch//net.minecraft.server.dedicated.DedicatedServer.func_71190_q(DedicatedServer.java:334) [lt.class:?] at Launch//net.minecraft.server.MinecraftServer.func_71217_p(MinecraftServer.java:547) [MinecraftServer.class:?] at Launch//net.minecraft.server.MinecraftServer.run(MinecraftServer.java:427) [MinecraftServer.class:?] at Launch//net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:685) [li.class:?]

mainrs commented 3 weeks ago

The culprit was this line GTNewHorizons/FindIt@e3cfb68/src/main/java/com/gtnh/findit/util/mods/ForestryUtils.java#L26

Anything from the mc client package doesn't exist server-side, such as the Minecraft class in this case.

Ahh, I didn't know that Minecraft was part of the client package. Thanks! I'll make sure to test against real servers next time!

Lyfts commented 3 weeks ago

Fixed in https://github.com/GTNewHorizons/FindIt/pull/22