mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-18 20:05:02 -04:00
network: only remove explosion blocks when mode is DESTRUCT
This commit is contained in:
parent
be30d5a3b4
commit
01573c4ace
@ -41,7 +41,7 @@ class ExplosionS2CP(buffer: PlayInByteBuffer) : PlayS2CPacket {
|
|||||||
val power = buffer.readFloat()
|
val power = buffer.readFloat()
|
||||||
val explodedBlocks: Array<Vec3i> = buffer.readArray((buffer.versionId < V_1_17).decide({ buffer.readInt() }, { buffer.readVarInt() })) { Vec3i(buffer.readByte(), buffer.readByte(), buffer.readByte()) } // ToDo: Find out version
|
val explodedBlocks: Array<Vec3i> = 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 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 particle = if (buffer.versionId >= V_23W45A) buffer.readParticleData() else null
|
||||||
val emitter = 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
|
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) {
|
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.player.physics.velocity = connection.player.physics.velocity + velocity
|
||||||
|
|
||||||
connection.events.fire(ExplosionEvent(connection, this))
|
connection.events.fire(ExplosionEvent(connection, this))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user