17
17
"""
18
18
19
19
import array
20
- from math import floor
21
20
22
21
from spockbot .mcp .bbuff import BoundBuffer
23
22
@@ -221,10 +220,9 @@ def get_block(self, pos_or_x, y=None, z=None):
221
220
if None in (y , z ): # pos supplied
222
221
pos_or_x , y , z = pos_or_x
223
222
224
- x , rx = divmod (floor (pos_or_x ), 16 )
225
- y , ry = divmod (floor (y ), 16 )
226
- z , rz = divmod (floor (z ), 16 )
227
-
223
+ x , rx = divmod (int (pos_or_x ), 16 )
224
+ y , ry = divmod (int (y ), 16 )
225
+ z , rz = divmod (int (z ), 16 )
228
226
if (x , z ) not in self .columns or y > 0x0F :
229
227
return 0 , 0
230
228
chunk = self .columns [(x , z )].chunks [y ]
@@ -238,9 +236,9 @@ def set_block(self, pos_or_x, y=None, z=None,
238
236
if None in (y , z ): # pos supplied
239
237
pos_or_x , y , z = pos_or_x
240
238
241
- x , rx = divmod (floor (pos_or_x ), 16 )
242
- y , ry = divmod (floor (y ), 16 )
243
- z , rz = divmod (floor (z ), 16 )
239
+ x , rx = divmod (int (pos_or_x ), 16 )
240
+ y , ry = divmod (int (y ), 16 )
241
+ z , rz = divmod (int (z ), 16 )
244
242
245
243
if y > 0x0F :
246
244
return
@@ -271,7 +269,7 @@ def get_block_entity_data(self, pos_or_x, y=None, z=None):
271
269
"""
272
270
if None not in (y , z ): # x y z supplied
273
271
pos_or_x = pos_or_x , y , z
274
- coord_tuple = tuple (floor (c ) for c in pos_or_x )
272
+ coord_tuple = tuple (int (c ) for c in pos_or_x )
275
273
return self .block_entities .get (coord_tuple , None )
276
274
277
275
def set_block_entity_data (self , pos_or_x , y = None , z = None , data = None ):
@@ -284,7 +282,7 @@ def set_block_entity_data(self, pos_or_x, y=None, z=None, data=None):
284
282
"""
285
283
if None not in (y , z ): # x y z supplied
286
284
pos_or_x = pos_or_x , y , z
287
- coord_tuple = tuple (floor (c ) for c in pos_or_x )
285
+ coord_tuple = tuple (int (c ) for c in pos_or_x )
288
286
old_data = self .block_entities .get (coord_tuple , None )
289
287
self .block_entities [coord_tuple ] = data
290
288
return old_data
@@ -293,9 +291,9 @@ def get_light(self, pos_or_x, y=None, z=None):
293
291
if None in (y , z ): # pos supplied
294
292
pos_or_x , y , z = pos_or_x
295
293
296
- x , rx = divmod (floor (pos_or_x ), 16 )
297
- y , ry = divmod (floor (y ), 16 )
298
- z , rz = divmod (floor (z ), 16 )
294
+ x , rx = divmod (int (pos_or_x ), 16 )
295
+ y , ry = divmod (int (y ), 16 )
296
+ z , rz = divmod (int (z ), 16 )
299
297
300
298
if (x , z ) not in self .columns or y > 0x0F :
301
299
return 0 , 0
@@ -310,9 +308,9 @@ def set_light(self, pos_or_x, y=None, z=None,
310
308
if None in (y , z ): # pos supplied
311
309
pos_or_x , y , z = pos_or_x
312
310
313
- x , rx = divmod (floor (pos_or_x ), 16 )
314
- y , ry = divmod (floor (y ), 16 )
315
- z , rz = divmod (floor (z ), 16 )
311
+ x , rx = divmod (int (pos_or_x ), 16 )
312
+ y , ry = divmod (int (y ), 16 )
313
+ z , rz = divmod (int (z ), 16 )
316
314
317
315
if y > 0x0F :
318
316
return
@@ -332,17 +330,17 @@ def set_light(self, pos_or_x, y=None, z=None,
332
330
chunk .light_sky .set (rx , ry , rz , light_sky & 0xF )
333
331
334
332
def get_biome (self , x , z ):
335
- x , rx = divmod (floor (x ), 16 )
336
- z , rz = divmod (floor (z ), 16 )
333
+ x , rx = divmod (int (x ), 16 )
334
+ z , rz = divmod (int (z ), 16 )
337
335
338
336
if (x , z ) not in self .columns :
339
337
return 0
340
338
341
339
return self .columns [(x , z )].biome .get (rx , rz )
342
340
343
341
def set_biome (self , x , z , data ):
344
- x , rx = divmod (floor (x ), 16 )
345
- z , rz = divmod (floor (z ), 16 )
342
+ x , rx = divmod (int (x ), 16 )
343
+ z , rz = divmod (int (z ), 16 )
346
344
347
345
if (x , z ) in self .columns :
348
346
column = self .columns [(x , z )]
0 commit comments