Added surface and subsurface generation
This commit is contained in:
parent
c5eed3b918
commit
3ae79e9485
|
@ -215,13 +215,13 @@ class YTDServerProtocol(ServerProtocol):
|
||||||
# in-game, and does some logging.
|
# in-game, and does some logging.
|
||||||
ServerProtocol.player_joined(self)
|
ServerProtocol.player_joined(self)
|
||||||
self.buff_type = Buffer_1_18_2
|
self.buff_type = Buffer_1_18_2
|
||||||
self.view_distance = 5
|
self.view_distance = 8
|
||||||
|
|
||||||
self.player = Player(
|
self.player = Player(
|
||||||
self,
|
self,
|
||||||
self.display_name, # type: ignore
|
self.display_name, # type: ignore
|
||||||
0,
|
0,
|
||||||
0, #325,
|
128, #325,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
|
@ -245,7 +245,8 @@ class YTDServerProtocol(ServerProtocol):
|
||||||
|
|
||||||
# Start sending "Keep Alive" packets
|
# Start sending "Keep Alive" packets
|
||||||
self.ticker.add_loop(20, self.update_keep_alive)
|
self.ticker.add_loop(20, self.update_keep_alive)
|
||||||
self.ticker.add_loop(.25/self.ticker.interval, self.manage_queue)
|
# self.ticker.add_loop(.25/self.ticker.interval, self.manage_queue)
|
||||||
|
self.ticker.add_loop(1, self.manage_queue)
|
||||||
|
|
||||||
# Announce player join to other players
|
# Announce player join to other players
|
||||||
self.factory.broadcast_player_join(self)
|
self.factory.broadcast_player_join(self)
|
||||||
|
@ -484,20 +485,16 @@ class YTDServerFactory(ServerFactory):
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def func(x, y, z):
|
def func(x, y, z):
|
||||||
# return x + z == y
|
a = 100
|
||||||
return x*x/20 - z*z/20 > y
|
b = 100
|
||||||
# f = lambda x,z,y: x*x/20 - y*y/20 - z
|
if x*x/a - z*z/b > y + 3:
|
||||||
# s = lambda x: math.copysign(1, x)
|
return BLOCK_UNDERGROUND
|
||||||
# v = s(f(x,y,z))
|
elif x*x/a - z*z/b > y + 1:
|
||||||
# return sum((
|
return BLOCK_SUBSURFACE
|
||||||
# v == s(f(x,y,z+1)),
|
elif x*x/a - z*z/b > y:
|
||||||
# v == s(f(x,+1,z)),
|
return BLOCK_SURFACE
|
||||||
# v == s(f(x,y+1,z+1)),
|
else:
|
||||||
# v == s(f(+1,y,z)),
|
return BLOCK_EMPTY
|
||||||
# v == s(f(x+1,y,z+1)),
|
|
||||||
# v == s(f(x+1,y+1,z)),
|
|
||||||
# v == s(f(x+1,y+1,z+1)),
|
|
||||||
# ))
|
|
||||||
|
|
||||||
def fix(self, x, z):
|
def fix(self, x, z):
|
||||||
blocks = []
|
blocks = []
|
||||||
|
@ -516,9 +513,10 @@ class YTDServerFactory(ServerFactory):
|
||||||
for y, sec in enumerate(sections):
|
for y, sec in enumerate(sections):
|
||||||
sec[0] = BLOCK_DEFAULT
|
sec[0] = BLOCK_DEFAULT
|
||||||
for i, xi, yi, zi in chunk_range():
|
for i, xi, yi, zi in chunk_range():
|
||||||
if self.chunk_func(x,y-4,z,xi,yi,zi):
|
sec[i] = self.chunk_func(x,y-12,z,xi,yi,zi)
|
||||||
|
# if self.chunk_func(x,y-4,z,xi,yi,zi):
|
||||||
# print(x * 16 + xi,(y-4) * 16 + yi,z * 16 + zi)
|
# print(x * 16 + xi,(y-4) * 16 + yi,z * 16 + zi)
|
||||||
sec[i] = BLOCK_DEFAULT
|
# sec[i] = BLOCK_DEFAULT
|
||||||
# else:
|
# else:
|
||||||
# sec[i] = BLOCK_EMPTY
|
# sec[i] = BLOCK_EMPTY
|
||||||
height_map = NBT.TagRoot({'':NBT.TagCompound({'MOTION_BLOCKING':NBT.TagLongArray(PackedArray.empty_height())})})
|
height_map = NBT.TagRoot({'':NBT.TagCompound({'MOTION_BLOCKING':NBT.TagLongArray(PackedArray.empty_height())})})
|
||||||
|
|
Loading…
Reference in New Issue