Decode forgotten chunk coordinates correctly
This commit is contained in:
1 parent
30e98d7e06
commit
05941f500a
2 files changed
+41
-3
No files matched your search
@@ -726,9 +726,11 @@ class ForgetChunkPacket(Packet):
|
||||
|
||||
def read(self, file_object):
|
||||
packed = Long.read(file_object)
|
||||
self.x = packed >> 32
|
||||
z = packed & 0xFFFFFFFF
|
||||
self.z = z if z < 0x80000000 else z - 0x100000000
|
||||
# ChunkPos stores X in the low 32 bits and Z in the high 32 bits.
|
||||
raw_x = packed & 0xFFFFFFFF
|
||||
raw_z = (packed >> 32) & 0xFFFFFFFF
|
||||
self.x = raw_x if raw_x < 0x80000000 else raw_x - 0x100000000
|
||||
self.z = raw_z if raw_z < 0x80000000 else raw_z - 0x100000000
|
||||
|
||||
|
||||
class PlayGameEventPacket(Packet):
|
||||
@@ -1138,6 +1140,9 @@ class ModernPlayingReactor(PacketReactor):
|
||||
world_state = getattr(self.connection, 'world_state', None)
|
||||
if world_state is not None:
|
||||
world_state.unload_chunk(packet.x, packet.z)
|
||||
if os.getenv('PYCRAFT_TRACE_CHUNKS'):
|
||||
trace('forgot chunk {},{} ({} total)'.format(
|
||||
packet.x, packet.z, len(world_state.chunks)))
|
||||
elif packet.packet_name == "chunk cache center":
|
||||
world_state = getattr(self.connection, 'world_state', None)
|
||||
if world_state is not None:
|
||||
|
||||
Reference in new issue
Block a user