示例#1
0
 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 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
示例#3
0
 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 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
示例#5
0
 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