-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
200 additions
and
117 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,51 @@ | ||
use std::any::Any; | ||
|
||
pub struct BlockEvent { | ||
pos : (i32,i32,i32), | ||
face : i32, | ||
entity_id : i32 | ||
pos: (i32, i32, i32), | ||
face: i32, | ||
entity_id: i32, | ||
} | ||
impl BlockEvent { | ||
pub fn hit(pos : (i32,i32,i32),face : i32,entity_id : i32) -> BlockEvent { | ||
pub fn hit(pos: (i32, i32, i32), face: i32, entity_id: i32) -> BlockEvent { | ||
BlockEvent { | ||
pos, | ||
face, | ||
entity_id | ||
entity_id, | ||
} | ||
} | ||
} | ||
impl ToString for BlockEvent { | ||
fn to_string(&self) -> String { | ||
format!("BlockEvent({:?},{},{},{},{},{}",self.type_id(),self.pos.0,self.pos.1,self.pos.2,self.face,self.entity_id) | ||
format!( | ||
"BlockEvent({:?},{},{},{},{},{}", | ||
self.type_id(), | ||
self.pos.0, | ||
self.pos.1, | ||
self.pos.2, | ||
self.face, | ||
self.entity_id | ||
) | ||
} | ||
} | ||
pub fn decode_xyz(encoded : String) { | ||
let mut ret : (i32,i32,i32) = (0,0,0); | ||
pub fn decode_xyz(encoded: String) { | ||
let mut ret: (i32, i32, i32) = (0, 0, 0); | ||
let mut cnt = 0; | ||
for i in encoded.split("\\,") { | ||
if i.is_empty() || i == " " || i == "\n" { | ||
if i.is_empty() || i == " " || i == "\n" { | ||
continue; | ||
} | ||
match cnt { | ||
0 => {ret.0 = i.parse().expect("Failed to parse");} | ||
1 => {ret.1 = i.parse().expect("Failed to parse");} | ||
2 => {ret.2 = i.parse().expect("Failed to parse");} | ||
_ => break | ||
0 => { | ||
ret.0 = i.parse().expect("Failed to parse"); | ||
} | ||
1 => { | ||
ret.1 = i.parse().expect("Failed to parse"); | ||
} | ||
2 => { | ||
ret.2 = i.parse().expect("Failed to parse"); | ||
} | ||
_ => break, | ||
}; | ||
cnt+=1; | ||
cnt += 1; | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
pub mod connection; | ||
pub mod items; | ||
pub mod events; | ||
pub mod items; | ||
pub mod minecraft; | ||
pub mod prelude; |
Oops, something went wrong.