Always unload chunks before loading and always zero block entities

This commit is contained in:
Kyler 2024-04-16 23:39:34 -06:00
parent 297031c5a1
commit 3cd72ef89b
1 changed files with 11 additions and 3 deletions

View File

@ -12,6 +12,9 @@ from quarry.types.uuid import UUID
from quarry.data.data_packs import data_packs, dimension_types
FOREST_BIOME_DATA_PACK_ID = 7
class YTDServerProtocol(ServerProtocol):
def player_joined(self):
@ -107,7 +110,12 @@ class YTDServerProtocol(ServerProtocol):
buff.discard()
def send_chunk(self, x, z, full, heightmap, sections, biomes):
# sections = self.factory.generate(x,z)
sections_data = self.bt.pack_chunk(sections)
self.send_packet(
'unload_chunk',
self.bt.pack('ii', x, z),
)
self.send_packet(
'chunk_data',
self.bt.pack('ii?', x, z, full),
@ -116,14 +124,14 @@ class YTDServerProtocol(ServerProtocol):
self.bt.pack_array('I', biomes) if full else b'',
self.bt.pack_varint(len(sections_data)),
sections_data,
self.bt.pack_varint(0),
b''.join(self.bt.pack_nbt(entity) for entity in ()))
self.bt.pack_varint(0), # Always zero block entities
)
class YTDServerFactory(ServerFactory):
protocol = YTDServerProtocol
motd = "YTD Custom Server (WIP)"
force_protocol_version = 758
force_protocol_version = 758 # 1.18.2
# Sends an unsigned chat message, using system messages on supporting clients
def broadcast_chat(self, message: str, sender: UUID, sender_name: str):