Added get_height() function

This commit is contained in:
blackfur 2021-02-11 17:33:54 +01:00
parent d149fb63f8
commit 1e169d457e

View file

@ -25,6 +25,7 @@ mod tests {
println!("{:?}",mc.get_block_with_data(position1));
mc.set_block(position1,18,1);
mc.set_blocks(position1,position2,18,1);
println!("{}",mc.get_height(position1));
}
}
@ -81,6 +82,10 @@ impl Minecraft {
pub fn set_blocks(&mut self, pos1:Vec3, pos2:Vec3, blocktype:u8, blockdata:u8) {
self.conn.send(&format!("world.setBlocks({},{},{},{},{},{},{},{})", pos1.x,pos1.y,pos1.z,pos2.x,pos2.y,pos2.z,blocktype,blockdata));
}
pub fn get_height(&mut self, pos:Vec3) -> u8 {
self.conn.send_receive(&format!("world.getHeight({},{})", pos.x,pos.z)).parse::<u8>().unwrap()
}
}
pub fn create(adress:&str) -> Minecraft {