Always unload chunks before loading and always zero block entities
This commit is contained in:
parent
297031c5a1
commit
3cd72ef89b
|
@ -12,6 +12,9 @@ from quarry.types.uuid import UUID
|
||||||
from quarry.data.data_packs import data_packs, dimension_types
|
from quarry.data.data_packs import data_packs, dimension_types
|
||||||
|
|
||||||
|
|
||||||
|
FOREST_BIOME_DATA_PACK_ID = 7
|
||||||
|
|
||||||
|
|
||||||
class YTDServerProtocol(ServerProtocol):
|
class YTDServerProtocol(ServerProtocol):
|
||||||
|
|
||||||
def player_joined(self):
|
def player_joined(self):
|
||||||
|
@ -107,7 +110,12 @@ class YTDServerProtocol(ServerProtocol):
|
||||||
buff.discard()
|
buff.discard()
|
||||||
|
|
||||||
def send_chunk(self, x, z, full, heightmap, sections, biomes):
|
def send_chunk(self, x, z, full, heightmap, sections, biomes):
|
||||||
|
# sections = self.factory.generate(x,z)
|
||||||
sections_data = self.bt.pack_chunk(sections)
|
sections_data = self.bt.pack_chunk(sections)
|
||||||
|
self.send_packet(
|
||||||
|
'unload_chunk',
|
||||||
|
self.bt.pack('ii', x, z),
|
||||||
|
)
|
||||||
self.send_packet(
|
self.send_packet(
|
||||||
'chunk_data',
|
'chunk_data',
|
||||||
self.bt.pack('ii?', x, z, full),
|
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_array('I', biomes) if full else b'',
|
||||||
self.bt.pack_varint(len(sections_data)),
|
self.bt.pack_varint(len(sections_data)),
|
||||||
sections_data,
|
sections_data,
|
||||||
self.bt.pack_varint(0),
|
self.bt.pack_varint(0), # Always zero block entities
|
||||||
b''.join(self.bt.pack_nbt(entity) for entity in ()))
|
)
|
||||||
|
|
||||||
|
|
||||||
class YTDServerFactory(ServerFactory):
|
class YTDServerFactory(ServerFactory):
|
||||||
protocol = YTDServerProtocol
|
protocol = YTDServerProtocol
|
||||||
motd = "YTD Custom Server (WIP)"
|
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
|
# Sends an unsigned chat message, using system messages on supporting clients
|
||||||
def broadcast_chat(self, message: str, sender: UUID, sender_name: str):
|
def broadcast_chat(self, message: str, sender: UUID, sender_name: str):
|
||||||
|
|
Loading…
Reference in New Issue