From 1e169d457efbaeab17bfe74b241ff432ebeb9f8c Mon Sep 17 00:00:00 2001 From: blackfur <64478051+theblackfurguy@users.noreply.github.com> Date: Thu, 11 Feb 2021 17:33:54 +0100 Subject: [PATCH] Added get_height() function --- src/lib.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index 3071e5a..3b017eb 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -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::().unwrap() + } } pub fn create(adress:&str) -> Minecraft {