Fix sand gather job bugs
This commit is contained in:
		@@ -15,9 +15,13 @@ for name, data in JSON_BLOCKS.items():
 | 
				
			|||||||
    for state in data['states']:
 | 
					    for state in data['states']:
 | 
				
			||||||
        BLOCKS[state['id']] = name.replace('minecraft:', '')
 | 
					        BLOCKS[state['id']] = name.replace('minecraft:', '')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					AIR = 0
 | 
				
			||||||
 | 
					SAND = 66
 | 
				
			||||||
SINGLE_SNOW = 3921
 | 
					SINGLE_SNOW = 3921
 | 
				
			||||||
SOUL_TORCH = 4008
 | 
					SOUL_TORCH = 4008
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
AVOID = [
 | 
					AVOID = [
 | 
				
			||||||
    'lava',
 | 
					    'lava',
 | 
				
			||||||
    'water',
 | 
					    'water',
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										8
									
								
								game.py
									
									
									
									
									
								
							
							
						
						
									
										8
									
								
								game.py
									
									
									
									
									
								
							@@ -268,6 +268,9 @@ class Game:
 | 
				
			|||||||
            if data == 'wood':
 | 
					            if data == 'wood':
 | 
				
			||||||
                self.g.job.state = self.g.job.lumberjack
 | 
					                self.g.job.state = self.g.job.lumberjack
 | 
				
			||||||
                reply = 'ok'
 | 
					                reply = 'ok'
 | 
				
			||||||
 | 
					            elif data == 'sand':
 | 
				
			||||||
 | 
					                self.g.job.state = self.g.job.gather_sand
 | 
				
			||||||
 | 
					                reply = 'ok'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if reply:
 | 
					            if reply:
 | 
				
			||||||
                for i in self.g.inv.values():
 | 
					                for i in self.g.inv.values():
 | 
				
			||||||
@@ -277,6 +280,11 @@ class Game:
 | 
				
			|||||||
                else:
 | 
					                else:
 | 
				
			||||||
                    reply += ', I need a bed'
 | 
					                    reply += ', I need a bed'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if command == 'stop':
 | 
				
			||||||
 | 
					            self.g.job.state = self.g.job.stop
 | 
				
			||||||
 | 
					            reply = 'ok'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if command == 'inv':
 | 
					        if command == 'inv':
 | 
				
			||||||
            for i in self.g.inv.values():
 | 
					            for i in self.g.inv.values():
 | 
				
			||||||
                if i.present:
 | 
					                if i.present:
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										4
									
								
								jobs.py
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								jobs.py
									
									
									
									
									
								
							@@ -193,9 +193,9 @@ class GatherSandStates:
 | 
				
			|||||||
        w = self.g.world
 | 
					        w = self.g.world
 | 
				
			||||||
        p = utils.pint(self.g.pos)
 | 
					        p = utils.pint(self.g.pos)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        w.chunks.set_block_at(*self.sand, 0)
 | 
					        self.g.chunks.set_block_at(*self.sand, blocks.AIR)
 | 
				
			||||||
        navpath = w.path_to_place(p, self.sand)
 | 
					        navpath = w.path_to_place(p, self.sand)
 | 
				
			||||||
        w.chunks.set_block_at(*self.sand, 66)
 | 
					        self.g.chunks.set_block_at(*self.sand, blocks.SAND)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if navpath:
 | 
					        if navpath:
 | 
				
			||||||
            self.g.path = navpath[:-1]
 | 
					            self.g.path = navpath[:-1]
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user