mirror of
https://github.com/Chaoscaot/schemsearch.git
synced 2025-11-05 05:54:02 +01:00
Improvements
This commit is contained in:
@ -8,14 +8,15 @@ use schemsearch_files::Schematic;
|
||||
use schemsearch_lib::{search, SearchBehavior};
|
||||
|
||||
#[no_mangle]
|
||||
#[allow(unused_variables)]
|
||||
pub extern "system" fn Java_SchemSearch_search<'local>(mut env: JNIEnv<'local>,
|
||||
class: JClass<'local>,
|
||||
schematic_path: JString<'local>,
|
||||
pattern_path: JString<'local>) -> jstring {
|
||||
let schematic_path: String = env.get_string(&schematic_path).expect("Couldn't get java string!").into();
|
||||
let pattern_path: String = env.get_string(&pattern_path).expect("Couldn't get java string!").into();
|
||||
let schematic = Schematic::load(Path::new(&schematic_path));
|
||||
let pattern = Schematic::load(Path::new(&pattern_path));
|
||||
let schematic = Schematic::load(Path::new(&schematic_path)).unwrap();
|
||||
let pattern = Schematic::load(Path::new(&pattern_path)).unwrap();
|
||||
|
||||
let matches = search(&schematic, &pattern, SearchBehavior {
|
||||
ignore_block_data: true,
|
||||
@ -27,8 +28,8 @@ pub extern "system" fn Java_SchemSearch_search<'local>(mut env: JNIEnv<'local>,
|
||||
});
|
||||
|
||||
let mut result = String::new();
|
||||
for (x, y, z) in matches {
|
||||
result.push_str(&format!("{}, {}, {};", x, y, z));
|
||||
for (x, y, z, p) in matches {
|
||||
result.push_str(&format!("{}, {}, {}, {};", x, y, z, p));
|
||||
}
|
||||
result.remove(result.len() - 1);
|
||||
let output = env.new_string(result).expect("Couldn't create java string!");
|
||||
|
||||
Reference in New Issue
Block a user