def handleBlockData(data): if data == None: data = (block_id<<4)|(meta&0x0F) msg = map_block_msg() msg.x = data.x msg.y = data.y msg.z = data.z # need to change this. find a way to get light, sky, and meta # data from the original block change message (if possible) # otherwise, will have to look at light information from previous # block at specified location msg.blocklight = 0 msg.skylight = 0 msg.blockid = data.blockid rostime = rospy.get_rostime() msg.timestamp = rostime.secs*(10e9)+rostime.nsecs print 'in single block change, %s type in %s %s %s'%(str(msg.blockid),str(msg.x),str(msg.y),str(msg.z)) # in other words, if not air... if msg.blockid != 0: blockpub.publish(msg) """
def sendBlockData(data, column, x, y, z): base_x = data.chunk_x*16 base_z = data.chunk_z*16 #print "base x %d" %(base_x) #print "base z %d" %(base_z) msg = map_block_msg() msg.x = x + base_x msg.y = y msg.z = z + base_z #if (msg.x > -80 and msg.x < -1 # and msg.y > 0 and msg.y < 12 # and msg.z > -96 and msg.z < -19): # print (msg.x, msg.y, msg.z) block_id, block_meta, light, sky = column.get_block(msg.x, msg.y, msg.z) msg.blockid = block_id msg.meta = block_meta msg.blocklight = light msg.skylight = sky # in other words, if not air... if block_id != 0: blockpub.publish(msg)
def sendBlockData(data, column, x, y, z): base_x = data.chunk_x*16 base_z = data.chunk_z*16 msg = map_block_msg() msg.x = x + base_x msg.y = y msg.z = z + base_z block_id, block_meta, light, sky = column.get_block(msg.x, msg.y, msg.z) if (msg.x,msg.y,msg.z) == (-39,13,-45): print "in send block data:it's gold right? %s"%(block_id) if block_id==14: print 'in send block data:it is gold, pos %s %s %s'%(msg.x,msg.y,msg.z) msg.blockid = block_id msg.meta = block_meta msg.blocklight = light msg.skylight = sky rostime = rospy.get_rostime() msg.timestamp = rostime.secs*(10e9)+rostime.nsecs # in other words, if not air... if block_id != 0: blockpub.publish(msg)
def get_block_multi(req): blocks = list() for req_msg in req.coords: msg = map_block_msg() msg.x = req_msg.x msg.y = req_msg.y msg.z = req_msg.z msg.blockid, msg.metadata = world.get_block(msg.x, msg.y, msg.z) #print msg blocks.append(msg) #print type(blocks) return {'blocks': blocks}
def get_block(req): #start = time.time() msg = map_block_msg() msg.x = req.x msg.y = req.y msg.z = req.z msg.blockid, msg.metadata = world.get_block(msg.x, msg.y, msg.z) #print msg #end = time.time() #print"call to getBlock(): %f"%(end-start) return msg
def get_block_multi(req): """ Queries the Minecraft map multiple times (once for each block in the input list) to get the block info for the requested blocks and then returns a dictionary whose 'block' entry contains a list of the requested blocks. """ blocks = list() for req_msg in req.coords: msg = map_block_msg() msg.x = req_msg.x msg.y = req_msg.y msg.z = req_msg.z msg.blockid, msg.metadata = world.get_block(msg.x, msg.y, msg.z) #print msg blocks.append(msg) #print type(blocks) return {'blocks': blocks}
def get_block_multi(req): """ Queries the Minecraft map multiple times (once for each block in the input list) to get the block info for the requested blocks and then returns a dictionary whose 'block' entry contains a list of the requested blocks. """ blocks = list() for req_msg in req.coords: msg = map_block_msg() msg.x = req_msg.x msg.y = req_msg.y msg.z = req_msg.z msg.blockid, msg.metadata = world.get_block(msg.x, msg.y, msg.z) # print msg blocks.append(msg) # print type(blocks) return {'blocks': blocks}
def get_block(req): """ Queries the Minecraft map to get the block info for a single block. The requested block's info is returned to the caller in an instance of a map_block_msg data structure. """ #start = time.time() msg = map_block_msg() msg.x = req.x msg.y = req.y msg.z = req.z msg.blockid, msg.metadata = world.get_block(msg.x, msg.y, msg.z) #print msg #end = time.time() #print"call to getBlock(): %f"%(end-start) return msg
def get_block(req): """ Queries the Minecraft map to get the block info for a single block. The requested block's info is returned to the caller in an instance of a map_block_msg data structure. """ #start = time.time() msg = map_block_msg() msg.x = req.x msg.y = req.y msg.z = req.z msg.blockid, msg.metadata = world.get_block(msg.x, msg.y, msg.z) # print msg #end = time.time() # print"call to getBlock(): %f"%(end-start) return msg
def handleBlockData(data): if data == None: data = (block_id<<4)|(meta&0x0F) msg = map_block_msg() msg.x = x + chunk_x msg.y = y msg.z = z + chunk_z # need to change this. find a way to get light, sky, and meta # data from the original block change message (if possible) # otherwise, will have to look at light information from previous # block at specified location msg.blocklight = 0 msg.skylight = 0 msg.blockid = data.blockid # in other words, if not air... if msg.blockid != 0: blockpub.publish(msg) """