MarkusBordihn / BOs-Easy-NPC

Create easily NPC for your world or for your mod.
Other
20 stars 8 forks source link

[Bug] Incompatible with C2ME #251

Closed KiwiFlavoredApollo closed 3 months ago

KiwiFlavoredApollo commented 4 months ago

Minecraft and Mod version 🐞 Minecraft 1.20.1 Fabric 0.15.11

Describe the bug 🐞 Single player world crashes when deleting any type of NPCs

[20:06:51] [Netty Server IO #3/ERROR]: Exception occurred in netty pipeline
java.util.ConcurrentModificationException: Async entity unload
    at net.minecraft.class_3898.handler$zmh000$c2me-fixes-general-threading-issues$preventAsyncEntityUnload(class_3898.java:9985) ~[client-intermediary.jar:?]
    at net.minecraft.class_3898.method_18716(class_3898.java) ~[client-intermediary.jar:?]
    at net.minecraft.class_3215.method_18753(class_3215.java:480) ~[client-intermediary.jar:?]
    at net.minecraft.class_3218$class_5526.method_31437(class_3218.java:1581) ~[client-intermediary.jar:?]
    at net.minecraft.class_3218$class_5526.method_31797(class_3218.java:1536) ~[client-intermediary.jar:?]
    at net.minecraft.class_5579.method_31850(class_5579.java:220) ~[client-intermediary.jar:?]
    at net.minecraft.class_5579$class_5580.method_31750(class_5579.java:115) ~[client-intermediary.jar:?]
    at dev.architectury.hooks.level.entity.fabric.EntityHooksImpl$1.method_31750(EntityHooksImpl.java:48) ~[architectury-9.2.14-fabric.jar:?]
    at net.minecraft.class_1297.method_31745(class_1297.java:3636) ~[client-intermediary.jar:?]
    at net.minecraft.class_1297.method_5650(class_1297.java:402) ~[client-intermediary.jar:?]
    at net.minecraft.class_1309.method_5650(class_1309.java:712) ~[client-intermediary.jar:?]
    at net.minecraft.class_1297.method_31472(class_1297.java:378) ~[client-intermediary.jar:?]
    at de.markusbordihn.easynpc.network.message.server.RemoveNPCMessage.handle(RemoveNPCMessage.java:62) ~[easy_npc-fabric-1.20.1-5.1.1.jar:?]
    at de.markusbordihn.easynpc.network.NetworkHandler.lambda$registerServerNetworkMessageHandler$1(NetworkHandler.java:86) ~[easy_npc-fabric-1.20.1-5.1.1.jar:?]
    at net.fabricmc.fabric.impl.networking.server.ServerPlayNetworkAddon.receive(ServerPlayNetworkAddon.java:85) ~[fabric-networking-api-v1-1.3.11+1802ada577-a65c3ef3908d32fd.jar:?]
    at net.fabricmc.fabric.impl.networking.server.ServerPlayNetworkAddon.receive(ServerPlayNetworkAddon.java:39) ~[fabric-networking-api-v1-1.3.11+1802ada577-a65c3ef3908d32fd.jar:?]
    at net.fabricmc.fabric.impl.networking.AbstractChanneledNetworkAddon.handle(AbstractChanneledNetworkAddon.java:101) ~[fabric-networking-api-v1-1.3.11+1802ada577-a65c3ef3908d32fd.jar:?]
    at net.fabricmc.fabric.impl.networking.server.ServerPlayNetworkAddon.handle(ServerPlayNetworkAddon.java:80) ~[fabric-networking-api-v1-1.3.11+1802ada577-a65c3ef3908d32fd.jar:?]
    at net.minecraft.class_3244.handler$cfm000$fabric-networking-api-v1$handleCustomPayloadReceivedAsync(class_3244.java:2000) ~[client-intermediary.jar:?]
    at net.minecraft.class_3244.method_12075(class_3244.java) ~[client-intermediary.jar:?]
    at net.minecraft.class_2817.method_12199(class_2817.java:38) ~[client-intermediary.jar:?]
    at net.minecraft.class_2817.method_11054(class_2817.java:7) ~[client-intermediary.jar:?]
    at net.minecraft.class_2535.method_10759(class_2535.java:175) ~[client-intermediary.jar:?]
    at net.minecraft.class_2535.method_10770(class_2535.java:160) ~[client-intermediary.jar:?]
    at net.minecraft.class_2535.channelRead0(class_2535.java:52) ~[client-intermediary.jar:?]
    at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:99) ~[netty-transport-4.1.82.Final.jar:?]
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) ~[netty-transport-4.1.82.Final.jar:?]
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) ~[netty-transport-4.1.82.Final.jar:?]
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) ~[netty-transport-4.1.82.Final.jar:?]
    at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410) ~[netty-transport-4.1.82.Final.jar:?]
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) ~[netty-transport-4.1.82.Final.jar:?]
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) ~[netty-transport-4.1.82.Final.jar:?]
    at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919) ~[netty-transport-4.1.82.Final.jar:?]
    at io.netty.channel.local.LocalChannel.readInbound(LocalChannel.java:299) ~[netty-transport-4.1.82.Final.jar:?]
    at io.netty.channel.local.LocalChannel.finishPeerRead0(LocalChannel.java:445) ~[netty-transport-4.1.82.Final.jar:?]
    at io.netty.channel.local.LocalChannel.access$400(LocalChannel.java:50) ~[netty-transport-4.1.82.Final.jar:?]
    at io.netty.channel.local.LocalChannel$5.run(LocalChannel.java:403) ~[netty-transport-4.1.82.Final.jar:?]
    at io.netty.util.concurrent.AbstractEventExecutor.runTask(AbstractEventExecutor.java:174) ~[netty-common-4.1.82.Final.jar:?]
    at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:167) ~[netty-common-4.1.82.Final.jar:?]
    at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:470) ~[netty-common-4.1.82.Final.jar:?]
    at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:569) ~[netty-transport-4.1.82.Final.jar:?]
    at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997) ~[netty-common-4.1.82.Final.jar:?]
    at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) ~[netty-common-4.1.82.Final.jar:?]
    at java.lang.Thread.run(Thread.java:842) ~[?:?]

To Reproduce ⚙️ Spawn any type of NPC and try delete him/her

Expected behavior ✔️ NPC gets deleted and single player world should stay fine

C2ME is notorious for incompatibilities. Users should be warned of the incompatibility just in case.

MarkusBordihn commented 4 months ago

Thanks a lot for the report and the note.

As you assume , in this case this need to be fixed by C2ME itself. The NPC delete function is just using the Vanilla functionality discard(), so nothing fancy or custom.

See: https://github.com/MarkusBordihn/BOs-Easy-NPC/blob/c3d1e85d46844114839960b58f147e1a5738eb22/Common/src/main/java/de/markusbordihn/easynpc/network/message/server/RemoveNPCMessage.java#L62