TogAr2 / MinestomPvP

Combat library for Minestom
Apache License 2.0
83 stars 33 forks source link

Network Protocol Error with End Crystal #45

Open Asintotoo opened 2 months ago

Asintotoo commented 2 months ago

With the ExplosiveFeature enabled, if you try to place an End Crystal on a block of Obsidian or Bedrock, you get kicked for "Network Protocol Error" and can't join the server back unless you restart it. I also tried this on a simple Minestom server with minimal to none configuration and it happens too.

I momentarily found a work around to be able to still use tnt and respawn anchor features: I rewrote the VanillaExplosiveFeature class and remove the PlayerUseItemOnBlockEvent listener and everything seems to work fine (a part from crystals obviously).

TogAr2 commented 2 months ago

As a temporary workaround it would also be possible to cancel CrystalPlaceEvent instead of rewriting the feature.

Will look at a fix soon.

Sparky983 commented 1 month ago

The issue is due to the CrystalEntity extending LivingEntity when it should only extend Entity.

Client crash report:

java.lang.IllegalStateException: Server tried to update attributes of a non-living entity (actually: EndCrystal['End Crystal'/3, l='ClientLevel', x=27.50, y=158.00, z=-71.50])
    at Genesis//net.minecraft.client.multiplayer.ClientPacketListener.handleUpdateAttributes(SourceFile:2097)
    at Genesis//net.minecraft.network.protocol.game.ClientboundUpdateAttributesPacket.handle(SourceFile:51)
    at Genesis//net.minecraft.network.protocol.game.ClientboundUpdateAttributesPacket.handle(SourceFile:20)
    at Genesis//net.minecraft.network.protocol.PacketUtils.lambda$ensureRunningOnSameThread$0(SourceFile:27)
    at Genesis//net.minecraft.util.thread.BlockableEventLoop.doRunTask(SourceFile:162)
    at Genesis//net.minecraft.util.thread.ReentrantBlockableEventLoop.doRunTask(SourceFile:23)
    at Genesis//net.minecraft.util.thread.BlockableEventLoop.pollTask(SourceFile:136)
    at Genesis//net.minecraft.util.thread.BlockableEventLoop.runAllTasks(SourceFile:121)
    at Genesis//net.minecraft.client.Minecraft.runTick(SourceFile:1240)
    at Genesis//net.minecraft.client.Minecraft.run(SourceFile:882)
    at Genesis//net.minecraft.client.main.Main.main(SourceFile:256)
    at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(Unknown Source)
    at java.base/java.lang.reflect.Method.invoke(Unknown Source)
    at com.moonsworth.lunar.genesis.ClientGameBootstrap.apply(Unknown Source)
    at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(Unknown Source)
    at java.base/java.lang.reflect.Method.invoke(Unknown Source)
    at com.moonsworth.lunar.genesis.COHORCHOCHOOOCHRHIHIRIICHIHIHO.RROCOCCHRORIORIHOROCORCIHHHICC(Unknown Source)
    at com.moonsworth.lunar.genesis.Genesis.run(Unknown Source)
    at com.moonsworth.lunar.genesis.Genesis.main(Unknown Source)