mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-15 02:15:34 -04:00
network: rewrite legacy block reading (BlockS2CP)
This commit is contained in:
parent
030ea52a6c
commit
5b69fffcae
@ -41,15 +41,14 @@ class BlocksS2CP(buffer: PlayInByteBuffer) : PlayS2CPacket {
|
|||||||
buffer.readInt() // data size, always 4*size
|
buffer.readInt() // data size, always 4*size
|
||||||
update = arrayOfNulls(size)
|
update = arrayOfNulls(size)
|
||||||
for (i in 0 until size) {
|
for (i in 0 until size) {
|
||||||
val raw = buffer.readInt()
|
val combined = buffer.readInt()
|
||||||
val meta = (raw and 0xF)
|
|
||||||
val blockId = (raw and 0xFFF0 ushr 4)
|
|
||||||
val y = (raw and 0xFF0000 ushr 16)
|
|
||||||
val z = (raw and 0x0F000000 ushr 24)
|
|
||||||
val x = (raw and -0x10000000 ushr 28)
|
|
||||||
update[i] = ChunkLocalBlockUpdate.LocalUpdate(
|
update[i] = ChunkLocalBlockUpdate.LocalUpdate(
|
||||||
Vec3i(x, y, z),
|
Vec3i(
|
||||||
buffer.connection.registries.blockState.getOrNull((blockId shl 4) or meta),
|
x = (combined ushr 16 and 0xFF),
|
||||||
|
y = (combined ushr 24 and 0x0F),
|
||||||
|
z = (combined ushr 28 and 0x0F),
|
||||||
|
),
|
||||||
|
buffer.connection.registries.blockState.getOrNull(combined and 0xFFFF),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user