Added get_player_entity_ids() function

This commit is contained in:
blackfur 2021-03-18 12:00:11 +01:00
parent b1b6f9ae0a
commit d0f9743ad3

View file

@ -5,7 +5,7 @@ use std::cmp::{min, max};
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use crate::{create, Vec3}; use crate::{create};
#[test] #[test]
fn it_works() { fn it_works() {
@ -108,6 +108,10 @@ impl Minecraft {
pub fn setting(&mut self, setting:&str, status:bool) { pub fn setting(&mut self, setting:&str, status:bool) {
self.conn.send(&format!("world.setting({},{})",setting,if status == true {1} else {0})); self.conn.send(&format!("world.setting({},{})",setting,if status == true {1} else {0}));
} }
pub fn get_player_entity_ids(&mut self) -> Vec<u16> {
self.conn.send_receive(&format!("world.getPlayerIds()")).split("|").map(|s| s.parse()).collect::<Result<Vec<u16>, _>>().unwrap()
}
} }
pub fn create(adress:&str) -> Minecraft { pub fn create(adress:&str) -> Minecraft {