Added get_height() function
This commit is contained in:
parent
d149fb63f8
commit
1e169d457e
|
@ -25,6 +25,7 @@ mod tests {
|
||||||
println!("{:?}",mc.get_block_with_data(position1));
|
println!("{:?}",mc.get_block_with_data(position1));
|
||||||
mc.set_block(position1,18,1);
|
mc.set_block(position1,18,1);
|
||||||
mc.set_blocks(position1,position2,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) {
|
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));
|
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 {
|
pub fn create(adress:&str) -> Minecraft {
|
||||||
|
|
Loading…
Reference in a new issue