def fertilize(self): if self.grow_task is not None: G.main_timer.remove_task(self.grow_task) if self.position in self.world: self.world[self.position].growth_stage = self.world[self.position].max_growth_stage G.SERVER.update_tile_entity(self.position, make_nbt_from_dict({'growth_stage': self.world[self.position].growth_stage})) else: # the block ceased to exist return
def grow_callback(self): if self.position in self.world: self.world[self.position].growth_stage = self.world[self.position].growth_stage + 1 G.SERVER.update_tile_entity(self.position, make_nbt_from_dict({'growth_stage': self.world[self.position].growth_stage})) else: # the block ceased to exist return if self.world[self.position].growth_stage < self.world[self.position].max_growth_stage: self.grow_task = G.main_timer.add_task(self.grow_time, self.grow_callback) else: self.grow_task = None
def fertilize(self): if self.growth_stage == self.max_growth_stage: return False G.CLIENT.update_tile_entity(self.entity.position, make_nbt_from_dict({'action'.encode(): 'fertilize'.encode()})) return True