Compare commits

..

No commits in common. "d69f9cf09e2fefb137e27a7515b20db7ffdc8409" and "4026b410f49dd43e0ef092cba5bfd01ae4d3586e" have entirely different histories.

5 changed files with 14 additions and 55 deletions

View File

@ -520,11 +520,7 @@ class Commands:
pass
if reply:
print('Reply:', reply)
if len(reply) >= 256:
reply = 'reply too long, check console'
print(reply)
if private and not reply.startswith('/'):
self.g.chat.send('/m ' + sender + ' ' + reply)
else:

View File

@ -89,9 +89,6 @@ for item_name, item in ITEMS.items():
def get_id(name):
return ITEMS['minecraft:' + name]['protocol_id']
def get_name(idx):
return ITEM_NAMES[idx]
CHEST_ID = get_id('chest')
GAPPLE_ID = get_id('enchanted_golden_apple')
SAND_ID = get_id('sand')
@ -118,10 +115,8 @@ INIT_WANTED_ITEMS = set()
WANTED_ITEMS = INIT_WANTED_ITEMS
def set_needed(items):
global NEEDED_ITEMS
NEEDED_ITEMS = INIT_NEEDED_ITEMS | items
def set_wanted(items):
global WANTED_ITEMS
WANTED_ITEMS = INIT_WANTED_ITEMS | items

View File

@ -42,12 +42,7 @@ class SleepWithBedStates:
self.beds = []
for bed in result:
if bed in self.bad_beds:
continue
if w.check_bed_occupied(bed):
continue
if bed not in self.bad_beds:
self.beds.append(bed)
print('Found:', self.beds)
@ -89,7 +84,6 @@ class SleepWithBedStates:
def going_to_bed(self):
if utils.pint(self.g.pos) == self.opening:
print('At existing bed')
self.my_bed = False
self.g.look_at = utils.padd(self.area, path.BLOCK_BELOW)
self.state = self.use_bed
@ -134,28 +128,17 @@ class SleepWithBedStates:
def going_to_area(self):
if utils.pint(self.g.pos) == self.opening:
print('At bed area')
self.g.look_at = utils.padd(self.area, path.BLOCK_BELOW)
self.state = self.place_bed
def place_bed(self):
print('Placing bed')
self.g.game.place_block(self.area, BlockFace.TOP)
self.my_bed = True
self.state = self.use_bed
def use_bed(self):
w = self.g.world
if self.g.time < 12550:
return
if w.check_bed_occupied(self.area):
print('Bed occupied, aborting.')
self.state = self.cleanup
return
print('Using bed')
if self.g.time > 12550:
print('Sleeping')
self.g.game.place_block(self.area, BlockFace.TOP)
if not self.silent:
self.g.chat.send('zzz')
@ -165,12 +148,12 @@ class SleepWithBedStates:
w = self.g.world
p = utils.pint(self.g.pos)
threats = w.find_threats(p, 10)
threats = w.find_threats(p, 30)
if threats:
print('Waking up due to threats:')
print(threats)
self.g.game.leave_bed()
self.state = self.cleanup
self.state = self.break_bed
elif self.g.time < 100:
print('Woke up time')
self.state = self.break_bed
@ -182,6 +165,7 @@ class SleepWithBedStates:
else:
self.state = self.cleanup
def collect_bed(self):
if not self.g.breaking:
self.g.path = [utils.padd(self.area, utils.spiral(n)) for n in range(9)]

View File

@ -7,7 +7,6 @@ from minecraft.networking.packets import clientbound, serverbound
from mosfet.protocol import packets
from mosfet import utils
from mosfet.info import blocks
class DataManager:
def __init__(self, directory):
@ -43,7 +42,7 @@ class ChunksManager:
def __init__(self, data_manager):
self.data = data_manager
self.chunks = {}
#self.biomes = {}
self.biomes = {}
self.index = {}
self.loading = False
@ -75,7 +74,7 @@ class ChunksManager:
coords = (dx + l%16, dy + l//256, dz + l%256//16)
self.index[item_id].append(coords)
#self.biomes[(chunk_packet.x, None, chunk_packet.z)] = chunk_packet.biomes # FIXME
self.biomes[(chunk_packet.x, None, chunk_packet.z)] = chunk_packet.biomes # FIXME
if self.loading:
print('.', end='', flush=True)
@ -117,11 +116,6 @@ class ChunksManager:
if not c: return None
c.set_block_at(x%16, y%16, z%16, block)
if block in blocks.INDEXED_IDS:
if block not in self.index:
self.index[block] = []
self.index[block].append((x, y, z))
def check_loaded(self, position, steps=1):
x, y, z = utils.pint(position)
player_chunk = (x//16, 1, z//16)

View File

@ -259,16 +259,6 @@ class World:
result.append(utils.padd(area, direction))
return result
def check_bed_occupied(self, bed):
# returns true if the bed is occupied by a player
print('Checking bed occupancy:', bed)
for player in self.g.players.values():
ppos = utils.pint((player.x, player.y, player.z))
if utils.phyp(bed, ppos) <= 1 and player.y - int(player.y) == 0.6875:
print('Bed is occupied by:', player, self.g.player_names[player.player_uuid])
return True
return False
def find_cache_openings(self, area):
return self.find_bed_openings(area)