From 01573c4ace1bca067f6547f73bc5dbac1969c044 Mon Sep 17 00:00:00 2001 From: Moritz Zwerger Date: Fri, 15 Dec 2023 07:37:24 +0100 Subject: [PATCH] network: only remove explosion blocks when mode is `DESTRUCT` --- .../protocol/packets/s2c/play/world/ExplosionS2CP.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/de/bixilon/minosoft/protocol/packets/s2c/play/world/ExplosionS2CP.kt b/src/main/java/de/bixilon/minosoft/protocol/packets/s2c/play/world/ExplosionS2CP.kt index 75b41b8c2..1a4eced69 100644 --- a/src/main/java/de/bixilon/minosoft/protocol/packets/s2c/play/world/ExplosionS2CP.kt +++ b/src/main/java/de/bixilon/minosoft/protocol/packets/s2c/play/world/ExplosionS2CP.kt @@ -41,7 +41,7 @@ class ExplosionS2CP(buffer: PlayInByteBuffer) : PlayS2CPacket { val power = buffer.readFloat() val explodedBlocks: Array = buffer.readArray((buffer.versionId < V_1_17).decide({ buffer.readInt() }, { buffer.readVarInt() })) { Vec3i(buffer.readByte(), buffer.readByte(), buffer.readByte()) } // ToDo: Find out version val velocity = buffer.readVec3f() - val destruct = if (buffer.versionId >= V_23W45A) buffer.readEnum(DestructionTypes) else null + val destruct = if (buffer.versionId >= V_23W45A) buffer.readEnum(DestructionTypes) else DestructionTypes.DESTROY val particle = if (buffer.versionId >= V_23W45A) buffer.readParticleData() else null val emitter = if (buffer.versionId >= V_23W45A) buffer.readParticleData() else null val sound = if (buffer.versionId >= V_23W45A) buffer.readNamedSound() else null @@ -94,7 +94,9 @@ class ExplosionS2CP(buffer: PlayInByteBuffer) : PlayS2CPacket { } override fun handle(connection: PlayConnection) { - connection.world.clearBlocks(position.floor, this.explodedBlocks) + if (destruct == DestructionTypes.DESTROY) { // TODO: handle DECAY, TRIGGER + connection.world.clearBlocks(position.floor, this.explodedBlocks) + } connection.player.physics.velocity = connection.player.physics.velocity + velocity connection.events.fire(ExplosionEvent(connection, this))