🔧 Add invalid_nbt flag.

This commit is contained in:
2024-04-27 21:27:42 +02:00
parent 82108d9e36
commit 0e6f2c3f78
9 changed files with 366 additions and 126 deletions

17
schemsearch-cli/src/types.rs Normal file → Executable file
View File

@@ -26,17 +26,21 @@ use schemsearch_files::SpongeSchematic;
use schemsearch_sql::{load_schemdata, SchematicNode};
pub enum SchematicSupplierType {
PATH(Box<PathSchematicSupplier>),
PATH(PathSchematicSupplier),
#[cfg(feature = "sql")]
SQL(SqlSchematicSupplier),
}
pub trait SchematicSupplier {
fn get_name(&self) -> String;
}
pub struct PathSchematicSupplier {
pub path: PathBuf,
}
impl PathSchematicSupplier {
pub fn get_name(&self) -> String {
impl SchematicSupplier for PathSchematicSupplier {
fn get_name(&self) -> String {
self.path.file_stem().unwrap().to_str().unwrap().to_string()
}
}
@@ -52,8 +56,13 @@ impl SqlSchematicSupplier {
let mut schemdata = block_on(load_schemdata(self.node.id));
SpongeSchematic::load_data(&mut Cursor::new(schemdata.as_mut_slice()))
}
}
pub fn get_name(&self) -> String {
#[cfg(feature = "sql")]
impl SchematicSupplier for SqlSchematicSupplier {
fn get_name(&self) -> String {
format!("{} ({})", self.node.name, self.node.id)
}
}