Loading chunks and can see them
This commit is contained in:
parent
7916ba6dad
commit
5b6e8b8a72
|
@ -59,7 +59,7 @@ class YTDServerProtocol(ServerProtocol):
|
|||
"player_position_and_look",
|
||||
self.buff_type.pack("dddff?",
|
||||
0, # x
|
||||
500, # y Must be >= build height to pass the "Loading Terrain" screen on 1.18.2
|
||||
385, # y Must be >= build height to pass the "Loading Terrain" screen on 1.18.2
|
||||
0, # z
|
||||
0, # yaw
|
||||
0, # pitch
|
||||
|
@ -76,7 +76,11 @@ class YTDServerProtocol(ServerProtocol):
|
|||
# Send full player list
|
||||
self.factory.send_player_list_add(self, self.factory.players)
|
||||
|
||||
self.send_update_view_position(0,0)
|
||||
self.send_chunk(0,0)
|
||||
self.send_chunk(-1,0)
|
||||
self.send_chunk(0,-1)
|
||||
self.send_chunk(-1,-1)
|
||||
|
||||
def send_join_game(self):
|
||||
# Build up fields for "Join Game" packet
|
||||
|
@ -140,6 +144,13 @@ class YTDServerProtocol(ServerProtocol):
|
|||
|
||||
buff.discard()
|
||||
|
||||
def send_update_view_position(self, x, z):
|
||||
self.send_packet(
|
||||
'update_view_position',
|
||||
self.buff_type.pack_varint(x),
|
||||
self.buff_type.pack_varint(z),
|
||||
)
|
||||
|
||||
# def send_chunk(self, x, z, full, heightmap, sections, biomes):
|
||||
def send_chunk(self, x, z):
|
||||
sections, heightmap = self.factory.generate(x,z)
|
||||
|
@ -158,6 +169,13 @@ class YTDServerProtocol(ServerProtocol):
|
|||
self.buff_type.pack_varint(len(sections_data)),
|
||||
sections_data,
|
||||
self.buff_type.pack_varint(0), # Always zero block entities
|
||||
self.buff_type.pack('?', False),
|
||||
self.buff_type.pack_varint(0), # Sky Light Mask
|
||||
self.buff_type.pack_varint(0), # Block Light Mask
|
||||
self.buff_type.pack_varint(0), # Empty Sky Light Mask
|
||||
self.buff_type.pack_varint(0), # Empty Block Light Mask
|
||||
self.buff_type.pack_varint(0), # Sky Light Array Length
|
||||
self.buff_type.pack_varint(0), # Block Light Array Length
|
||||
)
|
||||
|
||||
|
||||
|
@ -247,6 +265,8 @@ class YTDServerFactory(ServerFactory):
|
|||
sections.append((BlockArray.empty(REGISTRY),None,None))
|
||||
for sec in sections:
|
||||
sec[0][0] = {'name': 'minecraft:grass_block', 'snowy': 'false'}
|
||||
for i in range(1,16*16*16):
|
||||
sec[0][i] = {'name': 'minecraft:air'}
|
||||
# height_map = NBT.TagCompound({'MOTION_BLOCKING':NBT.TagLongArray(PackedArray.empty_height())})
|
||||
# height_map = NBT.TagRoot(NBT.TagCompound({'MOTION_BLOCKING':NBT.TagLongArray(PackedArray.empty_height())}))
|
||||
# height_map = NBT.TagRoot({'MOTION_BLOCKING':NBT.TagLongArray(PackedArray.empty_height())})
|
||||
|
|
Loading…
Reference in New Issue