Items
This commit is contained in:
parent
ae911573dd
commit
2945d038c2
162 changed files with 2958 additions and 299 deletions
46
Cargo.lock
generated
46
Cargo.lock
generated
|
@ -103,6 +103,16 @@ dependencies = [
|
||||||
"syn",
|
"syn",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "erased-serde"
|
||||||
|
version = "0.4.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "e004d887f51fcb9fef17317a2f3525c887d8aa3f4f50fed920816a688284a5b7"
|
||||||
|
dependencies = [
|
||||||
|
"serde",
|
||||||
|
"typeid",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "fastnbt"
|
name = "fastnbt"
|
||||||
version = "2.5.0"
|
version = "2.5.0"
|
||||||
|
@ -223,6 +233,7 @@ name = "potato"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bytes",
|
"bytes",
|
||||||
|
"fastnbt",
|
||||||
"potato-data",
|
"potato-data",
|
||||||
"potato-protocol",
|
"potato-protocol",
|
||||||
"serde",
|
"serde",
|
||||||
|
@ -236,9 +247,23 @@ dependencies = [
|
||||||
name = "potato-data"
|
name = "potato-data"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"erased-serde",
|
||||||
|
"fastnbt",
|
||||||
|
"potato-derive",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
|
"uuid",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "potato-derive"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"darling",
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -249,7 +274,7 @@ dependencies = [
|
||||||
"bytes",
|
"bytes",
|
||||||
"fastnbt",
|
"fastnbt",
|
||||||
"potato-data",
|
"potato-data",
|
||||||
"potato-protocol-derive",
|
"potato-derive",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
|
@ -257,16 +282,6 @@ dependencies = [
|
||||||
"uuid",
|
"uuid",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "potato-protocol-derive"
|
|
||||||
version = "0.1.0"
|
|
||||||
dependencies = [
|
|
||||||
"darling",
|
|
||||||
"proc-macro2",
|
|
||||||
"quote",
|
|
||||||
"syn",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "proc-macro2"
|
name = "proc-macro2"
|
||||||
version = "1.0.94"
|
version = "1.0.94"
|
||||||
|
@ -444,6 +459,12 @@ dependencies = [
|
||||||
"syn",
|
"syn",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "typeid"
|
||||||
|
version = "1.0.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "bc7d623258602320d5c55d1bc22793b57daff0ec7efc270ea7d55ce1d5f5471c"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "unicode-ident"
|
name = "unicode-ident"
|
||||||
version = "1.0.18"
|
version = "1.0.18"
|
||||||
|
@ -455,6 +476,9 @@ name = "uuid"
|
||||||
version = "1.15.1"
|
version = "1.15.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e0f540e3240398cce6128b64ba83fdbdd86129c16a3aa1a3a252efd66eb3d587"
|
checksum = "e0f540e3240398cce6128b64ba83fdbdd86129c16a3aa1a3a252efd66eb3d587"
|
||||||
|
dependencies = [
|
||||||
|
"serde",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wasi"
|
name = "wasi"
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[workspace]
|
[workspace]
|
||||||
resolver = "2"
|
resolver = "2"
|
||||||
members = ["potato", "potato-data", "potato-protocol", "potato-protocol-derive"]
|
members = ["potato", "potato-data", "potato-protocol", "potato-derive"]
|
||||||
|
|
||||||
[workspace.package]
|
[workspace.package]
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
|
@ -10,6 +10,11 @@ edition = "2024"
|
||||||
serde = { version = "1.0.218", features = ["derive"] }
|
serde = { version = "1.0.218", features = ["derive"] }
|
||||||
serde_json = "1.0.140"
|
serde_json = "1.0.140"
|
||||||
thiserror = "2.0.11"
|
thiserror = "2.0.11"
|
||||||
uuid = "1.15.1"
|
uuid = { version = "1.15.1", features = ["serde"] }
|
||||||
bytes = "1"
|
bytes = "1"
|
||||||
tokio = { version = "1.43.0", features = ["full"] }
|
tokio = { version = "1.43.0", features = ["full"] }
|
||||||
|
|
||||||
|
# Build from git, since there has not been a release in over a year
|
||||||
|
# Original repo: https://github.com/owengage/fastnbt.git Using a fork
|
||||||
|
# to fix an issue with boolean serialization.
|
||||||
|
fastnbt = { git = "https://github.com/CheAle14/fastnbt.git" }
|
||||||
|
|
12
README.md
12
README.md
|
@ -44,9 +44,9 @@ N/A = Not applicable
|
||||||
| worldgen/world_preset | ❌ | ❌ | ❌ | ❌ |
|
| worldgen/world_preset | ❌ | ❌ | ❌ | ❌ |
|
||||||
| worldgen/flat_level_generator_preset | ❌ | ❌ | ❌ | ❌ |
|
| worldgen/flat_level_generator_preset | ❌ | ❌ | ❌ | ❌ |
|
||||||
| worldgen/multi_noise_biome_source_parameter_list | ❌ | ❌ | ❌ | ❌ |
|
| worldgen/multi_noise_biome_source_parameter_list | ❌ | ❌ | ❌ | ❌ |
|
||||||
<!-- |cat_variant | ❌ | ❌ | ❌ | ❌ | -->
|
| cat_variant | ❌ | ❌ | ❌ | ❌ |
|
||||||
<!-- |cow_variant | ❌ | ❌ | ❌ | ❌ | -->
|
| cow_variant | ❌ | ❌ | ❌ | ❌ |
|
||||||
<!-- |frog_variant | ❌ | ❌ | ❌ | ❌ | -->
|
| frog_variant | ❌ | ❌ | ❌ | ❌ |
|
||||||
<!-- |pig_variant | ❌ | ❌ | ❌ | ❌ | -->
|
| pig_variant | ❌ | ❌ | ❌ | ❌ |
|
||||||
<!-- |test_environment | ❌ | ❌ | ❌ | ❌ | -->
|
| test_environment | ❌ | ❌ | ❌ | ❌ |
|
||||||
<!-- |test_instance | ❌ | ❌ | ❌ | ❌ | -->
|
| test_instance | ❌ | ❌ | ❌ | ❌ |
|
||||||
|
|
|
@ -4,6 +4,11 @@ version.workspace = true
|
||||||
edition.workspace = true
|
edition.workspace = true
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
potato-derive = { path = "../potato-derive" }
|
||||||
|
|
||||||
serde.workspace = true
|
serde.workspace = true
|
||||||
serde_json.workspace = true
|
serde_json.workspace = true
|
||||||
thiserror.workspace = true
|
thiserror.workspace = true
|
||||||
|
fastnbt.workspace = true
|
||||||
|
uuid.workspace = true
|
||||||
|
erased-serde = "0.4.6"
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, Copy, Serialize, Deserialize)]
|
||||||
|
pub struct Color(i32);
|
||||||
|
|
||||||
// TODO: Serialize as array of [red, green, blue] in NBT
|
// TODO: Serialize as array of [red, green, blue] in NBT
|
||||||
#[derive(Debug, Clone, Copy, Serialize, Deserialize)]
|
#[derive(Debug, Clone, Copy, Serialize, Deserialize)]
|
||||||
pub struct RGBf32 {
|
pub struct RGBf32 {
|
||||||
|
|
38
potato-data/src/consume_effect.rs
Normal file
38
potato-data/src/consume_effect.rs
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
use crate::{
|
||||||
|
Either, OneOrMany, identifier::Identifier, registry::worldgen::biome::SoundEvent,
|
||||||
|
status_effect::StatusEffect,
|
||||||
|
};
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
|
#[serde(tag = "type", rename_all = "snake_case")]
|
||||||
|
pub enum ConsumeEffect {
|
||||||
|
#[serde(alias = "minecraft:apply_effects")]
|
||||||
|
ApplyEffects {
|
||||||
|
effects: Vec<StatusEffect>,
|
||||||
|
#[serde(default = "one")]
|
||||||
|
probability: f32,
|
||||||
|
},
|
||||||
|
#[serde(alias = "minecraft:remove_effects")]
|
||||||
|
RemoveEffects { effects: OneOrMany<Identifier> },
|
||||||
|
#[serde(alias = "minecraft:clear_all_effects")]
|
||||||
|
ClearAllEffects,
|
||||||
|
#[serde(alias = "minecraft:teleport_randomly")]
|
||||||
|
TeleportRandomly {
|
||||||
|
#[serde(default = "sixteen")]
|
||||||
|
diameter: f32,
|
||||||
|
},
|
||||||
|
#[serde(alias = "minecraft:play_sound")]
|
||||||
|
PlaySound {
|
||||||
|
sound: Either<Identifier, SoundEvent>,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
fn one() -> f32 {
|
||||||
|
1.0
|
||||||
|
}
|
||||||
|
|
||||||
|
fn sixteen() -> f32 {
|
||||||
|
16.0
|
||||||
|
}
|
|
@ -35,6 +35,8 @@ impl Datapack {
|
||||||
self.load_registry(&mut registries.painting_variants, "painting_variant")?;
|
self.load_registry(&mut registries.painting_variants, "painting_variant")?;
|
||||||
self.load_registry(&mut registries.chat_types, "chat_type")?;
|
self.load_registry(&mut registries.chat_types, "chat_type")?;
|
||||||
|
|
||||||
|
self.load_registry(&mut registries.items, "item")?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,13 +62,12 @@ impl Datapack {
|
||||||
let path = namespace.join(path);
|
let path = namespace.join(path);
|
||||||
let files = std::fs::read_dir(path)?;
|
let files = std::fs::read_dir(path)?;
|
||||||
for file in files {
|
for file in files {
|
||||||
println!("Loading file: {:?}", file);
|
|
||||||
let file = file?.path();
|
let file = file?.path();
|
||||||
let name = file
|
let name = file
|
||||||
.file_stem()
|
.file_stem()
|
||||||
.and_then(OsStr::to_str)
|
.and_then(OsStr::to_str)
|
||||||
.ok_or(DatapackError::Utf8)?;
|
.ok_or(DatapackError::Utf8)?;
|
||||||
let identfiier = Identifier::new_str(namespace_str, name);
|
let identfiier = Identifier::new(namespace_str.to_owned(), name.to_owned());
|
||||||
|
|
||||||
let data: T = serde_json::from_str(&read_to_string(file)?)?;
|
let data: T = serde_json::from_str(&read_to_string(file)?)?;
|
||||||
|
|
||||||
|
@ -75,6 +76,7 @@ impl Datapack {
|
||||||
}
|
}
|
||||||
|
|
||||||
self.load_registry_tags(registry, path)?;
|
self.load_registry_tags(registry, path)?;
|
||||||
|
registry.flatten_tags();
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
use std::fmt;
|
use std::{borrow::Cow, fmt};
|
||||||
|
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use thiserror::Error;
|
use thiserror::Error;
|
||||||
|
@ -7,26 +7,36 @@ use thiserror::Error;
|
||||||
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||||
#[serde(try_from = "&str", into = "String")]
|
#[serde(try_from = "&str", into = "String")]
|
||||||
pub struct Identifier {
|
pub struct Identifier {
|
||||||
pub namespace: String,
|
pub namespace: Cow<'static, str>,
|
||||||
pub path: String,
|
pub path: Cow<'static, str>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Identifier {
|
impl Identifier {
|
||||||
pub fn new(namespace: String, path: String) -> Self {
|
pub const fn new_const(namespace: &'static str, path: &'static str) -> Self {
|
||||||
// TODO: Validate namespace and path
|
// TODO: Validate namespace and path
|
||||||
Self { namespace, path }
|
Self {
|
||||||
|
namespace: Cow::Borrowed(namespace),
|
||||||
|
path: Cow::Borrowed(path),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn minecraft(path: String) -> Self {
|
pub fn new(
|
||||||
Self::new("minecraft".to_string(), path)
|
namespace: impl Into<Cow<'static, str>>,
|
||||||
|
path: impl Into<Cow<'static, str>>,
|
||||||
|
) -> Self {
|
||||||
|
// TODO: Validate namespace and path
|
||||||
|
Self {
|
||||||
|
namespace: namespace.into(),
|
||||||
|
path: path.into(),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn new_str(namespace: &str, path: &str) -> Self {
|
pub const fn minecraft_const(path: &'static str) -> Self {
|
||||||
Self::new(namespace.to_string(), path.to_string())
|
Self::new_const("minecraft", path)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn minecraft_str(path: &str) -> Self {
|
pub fn minecraft(path: impl Into<Cow<'static, str>>) -> Self {
|
||||||
Self::minecraft(path.to_string())
|
Self::new("minecraft", path)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn from_raw_str(raw: &str) -> Result<Self, IdentifierError> {
|
pub fn from_raw_str(raw: &str) -> Result<Self, IdentifierError> {
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use crate::identifier::Identifier;
|
use crate::{identifier::Identifier, registry::item::component_map::ItemComponentMap};
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
pub struct ItemStack {
|
pub struct ItemStack {
|
||||||
id: Identifier,
|
// TODO: Might need a default 1 on this
|
||||||
components: Vec<ItemComponent>,
|
pub count: i32,
|
||||||
|
pub id: Identifier,
|
||||||
|
#[serde(default)]
|
||||||
|
pub components: ItemComponentMap,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, Eq, PartialEq)]
|
|
||||||
pub enum ItemComponent {}
|
|
||||||
|
|
|
@ -4,11 +4,14 @@ use tag::Tag;
|
||||||
|
|
||||||
pub mod block_state;
|
pub mod block_state;
|
||||||
pub mod color;
|
pub mod color;
|
||||||
|
pub mod consume_effect;
|
||||||
pub mod datapack;
|
pub mod datapack;
|
||||||
pub mod identifier;
|
pub mod identifier;
|
||||||
pub mod item_stack;
|
pub mod item_stack;
|
||||||
pub mod particle;
|
pub mod particle;
|
||||||
|
pub mod predicate;
|
||||||
pub mod registry;
|
pub mod registry;
|
||||||
|
pub mod status_effect;
|
||||||
pub mod tag;
|
pub mod tag;
|
||||||
pub mod text_component;
|
pub mod text_component;
|
||||||
|
|
||||||
|
|
8
potato-data/src/predicate.rs
Normal file
8
potato-data/src/predicate.rs
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
|
// TODO: Add the actual predicate data.
|
||||||
|
pub struct Predicate {}
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
|
pub struct ItemPredicate {}
|
100
potato-data/src/registry/advancement.rs
Normal file
100
potato-data/src/registry/advancement.rs
Normal file
|
@ -0,0 +1,100 @@
|
||||||
|
use std::collections::HashMap;
|
||||||
|
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
use crate::{
|
||||||
|
Either, OneOrMany, identifier::Identifier, predicate::Predicate, text_component::TextComponent,
|
||||||
|
};
|
||||||
|
|
||||||
|
use super::item::component_map::ItemComponentMap;
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
|
pub struct Advancement {
|
||||||
|
pub parent: Identifier,
|
||||||
|
pub display: AdvancementDisplay,
|
||||||
|
pub criteria: HashMap<String, AdvancementCriterion>,
|
||||||
|
pub requirements: Vec<Vec<String>>,
|
||||||
|
pub rewards: Option<AdvancementRewards>,
|
||||||
|
#[serde(default = "r#false")]
|
||||||
|
pub sends_telemetry_event: bool,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
|
pub struct AdvancementDisplay {
|
||||||
|
pub icon: AdvancementIcon,
|
||||||
|
pub title: TextComponent,
|
||||||
|
pub description: TextComponent,
|
||||||
|
#[serde(default)]
|
||||||
|
pub frame: AdvancementFrame,
|
||||||
|
// TODO: This is a bit weird. Its basically an identifier followed by .png
|
||||||
|
pub background: Option<String>,
|
||||||
|
#[serde(default = "r#true")]
|
||||||
|
pub show_test: bool,
|
||||||
|
#[serde(default = "r#true")]
|
||||||
|
pub announce_to_chat: bool,
|
||||||
|
#[serde(default = "r#false")]
|
||||||
|
pub hidden: bool,
|
||||||
|
}
|
||||||
|
|
||||||
|
fn r#true() -> bool {
|
||||||
|
true
|
||||||
|
}
|
||||||
|
|
||||||
|
fn r#false() -> bool {
|
||||||
|
false
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
|
pub struct AdvancementIcon {
|
||||||
|
pub id: Identifier,
|
||||||
|
pub count: Option<i32>,
|
||||||
|
pub components: ItemComponentMap,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
|
||||||
|
#[serde(rename_all = "snake_case")]
|
||||||
|
pub enum AdvancementFrame {
|
||||||
|
Challenge,
|
||||||
|
Goal,
|
||||||
|
#[default]
|
||||||
|
Task,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
|
pub struct AdvancementCriterion {
|
||||||
|
conditions: AdvancementConditions,
|
||||||
|
#[serde(flatten)]
|
||||||
|
trigger: AdvancementTrigger,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
|
pub struct AdvancementConditions {
|
||||||
|
pub player: Either<EntityAdvancementCondition, Vec<Predicate>>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
|
pub struct AdvancementRewards {
|
||||||
|
pub experience: Option<i32>,
|
||||||
|
pub recipes: Option<Vec<Identifier>>,
|
||||||
|
pub function: Option<Identifier>,
|
||||||
|
}
|
||||||
|
|
||||||
|
// NOTE: Predicates and advancements in general are way more complex then I expected.
|
||||||
|
// Need to figure out how they actually work before I can really do this.
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
|
#[serde(tag = "trigger", content = "conditions", rename_all = "snake_case")]
|
||||||
|
pub enum AdvancementTrigger {
|
||||||
|
#[serde(rename = "minecraft:allay_drop_item_on_block")]
|
||||||
|
AllayDropItemOnBlock { location: Vec<Predicate> },
|
||||||
|
#[serde(rename = "minecraft:any_block_use")]
|
||||||
|
AnyBlockUse { location: Vec<Predicate> },
|
||||||
|
#[serde(rename = "minecraft:avoid_vibration")]
|
||||||
|
AvoidVibration,
|
||||||
|
// TODO: Finish this
|
||||||
|
// #[serde(rename = "minecraft:bee_nest_destroyed")]
|
||||||
|
// BeeNestDestroyed { block: Identifier, item: },
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: Is this just a predicate?
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
|
pub struct EntityAdvancementCondition {}
|
73
potato-data/src/registry/item/component_map.rs
Normal file
73
potato-data/src/registry/item/component_map.rs
Normal file
|
@ -0,0 +1,73 @@
|
||||||
|
use std::{any::TypeId, collections::HashMap};
|
||||||
|
|
||||||
|
use serde::{
|
||||||
|
de::{Error, MapAccess, Visitor},
|
||||||
|
ser::SerializeMap,
|
||||||
|
};
|
||||||
|
|
||||||
|
use crate::{identifier::Identifier, registry::STATIC_REGISTRIES};
|
||||||
|
|
||||||
|
use super::ItemComponent;
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, Default)]
|
||||||
|
pub struct ItemComponentMap(HashMap<TypeId, Box<dyn ItemComponent>>);
|
||||||
|
|
||||||
|
impl serde::Serialize for ItemComponentMap {
|
||||||
|
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
||||||
|
where
|
||||||
|
S: serde::Serializer,
|
||||||
|
{
|
||||||
|
let inner_map = &self.0;
|
||||||
|
let mut map = serializer.serialize_map(Some(inner_map.len()))?;
|
||||||
|
for v in inner_map.values() {
|
||||||
|
map.serialize_entry(&v.id(), v)?;
|
||||||
|
}
|
||||||
|
map.end()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<'de> serde::Deserialize<'de> for ItemComponentMap {
|
||||||
|
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
|
||||||
|
where
|
||||||
|
D: serde::Deserializer<'de>,
|
||||||
|
{
|
||||||
|
deserializer.deserialize_map(ItemComponentMapVisitor)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
struct ItemComponentMapVisitor;
|
||||||
|
|
||||||
|
impl<'de> Visitor<'de> for ItemComponentMapVisitor {
|
||||||
|
type Value = ItemComponentMap;
|
||||||
|
|
||||||
|
fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||||
|
formatter.write_str("an item component map")
|
||||||
|
}
|
||||||
|
|
||||||
|
fn visit_map<M>(self, mut access: M) -> Result<Self::Value, M::Error>
|
||||||
|
where
|
||||||
|
M: MapAccess<'de>,
|
||||||
|
{
|
||||||
|
if let Some(registries) = STATIC_REGISTRIES.get() {
|
||||||
|
let mut map = HashMap::with_capacity(access.size_hint().unwrap_or(0));
|
||||||
|
|
||||||
|
// While there are entries remaining in the input, add them
|
||||||
|
// into our map.
|
||||||
|
while let Some(key) = access.next_key::<Identifier>()? {
|
||||||
|
if let Some(creator) = registries.item_components.by_key(&key) {
|
||||||
|
let component = access.next_value_seed(creator)?;
|
||||||
|
map.insert(component.type_id(), component);
|
||||||
|
} else {
|
||||||
|
return Err(Error::custom(format!(
|
||||||
|
"Unknown item component '{}'! Is the right plugin loaded?",
|
||||||
|
key
|
||||||
|
)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok(ItemComponentMap(map))
|
||||||
|
} else {
|
||||||
|
Err(Error::custom("Item component registry not present"))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,42 @@
|
||||||
|
use potato_derive::ItemComponent;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
use crate::identifier::Identifier;
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone, ItemComponent)]
|
||||||
|
#[item_component(namespace = "minecraft", id = "attribute_modifiers")]
|
||||||
|
pub struct AttributeModifiers(Vec<AttributeModifier>);
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
|
pub struct AttributeModifier {
|
||||||
|
pub r#type: String,
|
||||||
|
#[serde(default)]
|
||||||
|
pub slot: AttributeModifierSlot,
|
||||||
|
pub id: Identifier,
|
||||||
|
pub amount: f64,
|
||||||
|
pub operation: AttributeModifierOperation,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
|
||||||
|
#[serde(rename_all = "snake_case")]
|
||||||
|
pub enum AttributeModifierSlot {
|
||||||
|
#[default]
|
||||||
|
Any,
|
||||||
|
Hand,
|
||||||
|
Armor,
|
||||||
|
Mainhand,
|
||||||
|
Offhand,
|
||||||
|
Head,
|
||||||
|
Chest,
|
||||||
|
Legs,
|
||||||
|
Feet,
|
||||||
|
Body,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
|
#[serde(rename_all = "snake_case")]
|
||||||
|
pub enum AttributeModifierOperation {
|
||||||
|
AddValue,
|
||||||
|
AddMultipliedBase,
|
||||||
|
AddMultipliedTotal,
|
||||||
|
}
|
|
@ -0,0 +1,8 @@
|
||||||
|
use potato_derive::ItemComponent;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
use crate::identifier::Identifier;
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone, ItemComponent)]
|
||||||
|
#[item_component(namespace = "minecraft", id = "axolotl/variant")]
|
||||||
|
pub struct AxolotlVariant(pub Identifier);
|
14
potato-data/src/registry/item/components/banner_patterns.rs
Normal file
14
potato-data/src/registry/item/components/banner_patterns.rs
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
use potato_derive::ItemComponent;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
use crate::{Either, identifier::Identifier, registry::banner_pattern};
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone, ItemComponent)]
|
||||||
|
#[item_component(namespace = "minecraft", id = "banner_patterns")]
|
||||||
|
pub struct BannerPatterns(Vec<BannerPattern>);
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
|
pub struct BannerPattern {
|
||||||
|
pub color: String,
|
||||||
|
pub pattern: Either<Identifier, banner_pattern::BannerPattern>,
|
||||||
|
}
|
6
potato-data/src/registry/item/components/base_color.rs
Normal file
6
potato-data/src/registry/item/components/base_color.rs
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
use potato_derive::ItemComponent;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone, ItemComponent)]
|
||||||
|
#[item_component(namespace = "minecraft", id = "base_color")]
|
||||||
|
pub struct BaseColor(String);
|
13
potato-data/src/registry/item/components/bees.rs
Normal file
13
potato-data/src/registry/item/components/bees.rs
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
use potato_derive::ItemComponent;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone, ItemComponent)]
|
||||||
|
#[item_component(namespace = "minecraft", id = "bees")]
|
||||||
|
pub struct Bees(Vec<Bee>);
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
|
pub struct Bee {
|
||||||
|
pub entity_data: fastnbt::Value,
|
||||||
|
pub min_ticks_in_hive: i32,
|
||||||
|
pub ticks_in_hive: i32,
|
||||||
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
use potato_derive::ItemComponent;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone, ItemComponent)]
|
||||||
|
#[item_component(namespace = "minecraft", id = "block_entity_data")]
|
||||||
|
pub struct BlockEntityData(fastnbt::Value);
|
8
potato-data/src/registry/item/components/block_state.rs
Normal file
8
potato-data/src/registry/item/components/block_state.rs
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
use potato_derive::ItemComponent;
|
||||||
|
use std::collections::HashMap;
|
||||||
|
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone, ItemComponent)]
|
||||||
|
#[item_component(namespace = "minecraft", id = "block_state")]
|
||||||
|
pub struct BlockState(HashMap<String, String>);
|
50
potato-data/src/registry/item/components/blocks_attacks.rs
Normal file
50
potato-data/src/registry/item/components/blocks_attacks.rs
Normal file
|
@ -0,0 +1,50 @@
|
||||||
|
use potato_derive::ItemComponent;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
use crate::{
|
||||||
|
Either, OneOrMany, TagOrIdentifier, identifier::Identifier,
|
||||||
|
registry::worldgen::biome::SoundEvent, tag::Tag,
|
||||||
|
};
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone, ItemComponent)]
|
||||||
|
#[item_component(namespace = "minecraft", id = "blocks_attacks")]
|
||||||
|
pub struct BlocksAttacks {
|
||||||
|
#[serde(default = "zero")]
|
||||||
|
pub block_delay_seconds: f32,
|
||||||
|
#[serde(default = "one")]
|
||||||
|
pub disable_cooldown_scale: f32,
|
||||||
|
#[serde(default)]
|
||||||
|
pub damage_reductions: Vec<DamageReduction>,
|
||||||
|
pub item_damage: ItemDamage,
|
||||||
|
pub block_sound: Option<Either<Identifier, SoundEvent>>,
|
||||||
|
pub disabled_sound: Option<Either<Identifier, SoundEvent>>,
|
||||||
|
pub bypassed_by: Option<Tag>,
|
||||||
|
}
|
||||||
|
|
||||||
|
fn zero() -> f32 {
|
||||||
|
0.0
|
||||||
|
}
|
||||||
|
|
||||||
|
fn one() -> f32 {
|
||||||
|
1.0
|
||||||
|
}
|
||||||
|
|
||||||
|
fn ninety() -> f32 {
|
||||||
|
90.0
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
|
pub struct DamageReduction {
|
||||||
|
pub r#type: OneOrMany<TagOrIdentifier>,
|
||||||
|
pub base: f32,
|
||||||
|
pub factor: f32,
|
||||||
|
#[serde(default = "ninety")]
|
||||||
|
pub horizontal_blocking_angle: f32,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
|
pub struct ItemDamage {
|
||||||
|
pub threshold: f32,
|
||||||
|
pub base: f32,
|
||||||
|
pub factor: f32,
|
||||||
|
}
|
8
potato-data/src/registry/item/components/break_sound.rs
Normal file
8
potato-data/src/registry/item/components/break_sound.rs
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
use potato_derive::ItemComponent;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
use crate::{Either, identifier::Identifier, registry::worldgen::biome::SoundEvent};
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone, ItemComponent)]
|
||||||
|
#[item_component(namespace = "minecraft", id = "break_sound")]
|
||||||
|
pub struct BreakSound(Either<Identifier, SoundEvent>);
|
|
@ -0,0 +1,7 @@
|
||||||
|
use potato_derive::ItemComponent;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
// TODO: Limit to some tags only https://minecraft.wiki/w/Data_component_format#bucket_entity_data
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone, ItemComponent)]
|
||||||
|
#[item_component(namespace = "minecraft", id = "bucket_entity_data")]
|
||||||
|
pub struct BucketEntityData(fastnbt::Value);
|
|
@ -0,0 +1,8 @@
|
||||||
|
use potato_derive::ItemComponent;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
use crate::item_stack::ItemStack;
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone, ItemComponent)]
|
||||||
|
#[item_component(namespace = "minecraft", id = "bundle_contents")]
|
||||||
|
pub struct BundleContents(Vec<ItemStack>);
|
17
potato-data/src/registry/item/components/can_break.rs
Normal file
17
potato-data/src/registry/item/components/can_break.rs
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
use potato_derive::ItemComponent;
|
||||||
|
use std::collections::HashMap;
|
||||||
|
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
use crate::{OneOrMany, TagOrIdentifier};
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone, ItemComponent)]
|
||||||
|
#[item_component(namespace = "minecraft", id = "can_break")]
|
||||||
|
pub struct CanBreak(pub OneOrMany<CanBreakPredicate>);
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
|
pub struct CanBreakPredicate {
|
||||||
|
pub blocks: OneOrMany<TagOrIdentifier>,
|
||||||
|
pub nbt: fastnbt::Value,
|
||||||
|
pub state: HashMap<String, String>,
|
||||||
|
}
|
17
potato-data/src/registry/item/components/can_place_on.rs
Normal file
17
potato-data/src/registry/item/components/can_place_on.rs
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
use potato_derive::ItemComponent;
|
||||||
|
use std::collections::HashMap;
|
||||||
|
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
use crate::{OneOrMany, TagOrIdentifier};
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone, ItemComponent)]
|
||||||
|
#[item_component(namespace = "minecraft", id = "can_place_on")]
|
||||||
|
pub struct CanPlaceOn(pub OneOrMany<CanPlaceOnPredicate>);
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
|
pub struct CanPlaceOnPredicate {
|
||||||
|
pub blocks: OneOrMany<TagOrIdentifier>,
|
||||||
|
pub nbt: fastnbt::Value,
|
||||||
|
pub state: HashMap<String, String>,
|
||||||
|
}
|
7
potato-data/src/registry/item/components/cat_collar.rs
Normal file
7
potato-data/src/registry/item/components/cat_collar.rs
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
use potato_derive::ItemComponent;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone, ItemComponent)]
|
||||||
|
#[item_component(namespace = "minecraft", id = "cat/collar")]
|
||||||
|
// TODO: dye color enum
|
||||||
|
pub struct CatCollar(pub String);
|
8
potato-data/src/registry/item/components/cat_variant.rs
Normal file
8
potato-data/src/registry/item/components/cat_variant.rs
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
use potato_derive::ItemComponent;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
use crate::identifier::Identifier;
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone, ItemComponent)]
|
||||||
|
#[item_component(namespace = "minecraft", id = "cat/variant")]
|
||||||
|
pub struct CatVariant(pub Identifier);
|
|
@ -0,0 +1,8 @@
|
||||||
|
use potato_derive::ItemComponent;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
use crate::item_stack::ItemStack;
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone, ItemComponent)]
|
||||||
|
#[item_component(namespace = "minecraft", id = "charged_projectiles")]
|
||||||
|
pub struct ChargedProjectiles(Vec<ItemStack>);
|
|
@ -0,0 +1,8 @@
|
||||||
|
use potato_derive::ItemComponent;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
use crate::identifier::Identifier;
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone, ItemComponent)]
|
||||||
|
#[item_component(namespace = "minecraft", id = "chicken/variant")]
|
||||||
|
pub struct ChickenVariant(pub Identifier);
|
52
potato-data/src/registry/item/components/consumable.rs
Normal file
52
potato-data/src/registry/item/components/consumable.rs
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
use potato_derive::ItemComponent;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
use crate::{
|
||||||
|
Either, consume_effect::ConsumeEffect, identifier::Identifier,
|
||||||
|
registry::worldgen::biome::SoundEvent,
|
||||||
|
};
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone, ItemComponent)]
|
||||||
|
#[item_component(namespace = "minecraft", id = "consumable")]
|
||||||
|
pub struct Consumable {
|
||||||
|
#[serde(default = "one_point_six")]
|
||||||
|
pub consume_seconds: f32,
|
||||||
|
#[serde(default)]
|
||||||
|
pub animation: ConsumptionAnimation,
|
||||||
|
#[serde(default = "generic_eat")]
|
||||||
|
pub sound: Either<Identifier, SoundEvent>,
|
||||||
|
#[serde(default)]
|
||||||
|
pub on_consume_effects: Vec<ConsumeEffect>,
|
||||||
|
}
|
||||||
|
|
||||||
|
fn zero() -> u8 {
|
||||||
|
0
|
||||||
|
}
|
||||||
|
|
||||||
|
fn one() -> i32 {
|
||||||
|
1
|
||||||
|
}
|
||||||
|
|
||||||
|
fn one_point_six() -> f32 {
|
||||||
|
1.6
|
||||||
|
}
|
||||||
|
|
||||||
|
fn generic_eat() -> Either<Identifier, SoundEvent> {
|
||||||
|
Either::Left(Identifier::minecraft("entity.generic.eat"))
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Default, Clone)]
|
||||||
|
#[serde(rename_all = "snake_case")]
|
||||||
|
pub enum ConsumptionAnimation {
|
||||||
|
None,
|
||||||
|
#[default]
|
||||||
|
Eat,
|
||||||
|
Drink,
|
||||||
|
Block,
|
||||||
|
Bow,
|
||||||
|
Spear,
|
||||||
|
Crossbow,
|
||||||
|
Spyglass,
|
||||||
|
TootHorn,
|
||||||
|
Brush,
|
||||||
|
}
|
14
potato-data/src/registry/item/components/container.rs
Normal file
14
potato-data/src/registry/item/components/container.rs
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
use potato_derive::ItemComponent;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
use crate::item_stack::ItemStack;
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone, ItemComponent)]
|
||||||
|
#[item_component(namespace = "minecraft", id = "container")]
|
||||||
|
pub struct Container(pub Vec<ContainerSlot>);
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
|
pub struct ContainerSlot {
|
||||||
|
pub item: ItemStack,
|
||||||
|
pub slot: u8,
|
||||||
|
}
|
16
potato-data/src/registry/item/components/container_loot.rs
Normal file
16
potato-data/src/registry/item/components/container_loot.rs
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
use potato_derive::ItemComponent;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
use crate::identifier::Identifier;
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone, ItemComponent)]
|
||||||
|
#[item_component(namespace = "minecraft", id = "container_loot")]
|
||||||
|
pub struct ContainerLoot {
|
||||||
|
pub loot_table: Identifier,
|
||||||
|
#[serde(default = "zero")]
|
||||||
|
pub seed: i64,
|
||||||
|
}
|
||||||
|
|
||||||
|
fn zero() -> i64 {
|
||||||
|
0
|
||||||
|
}
|
8
potato-data/src/registry/item/components/cow_variant.rs
Normal file
8
potato-data/src/registry/item/components/cow_variant.rs
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
use potato_derive::ItemComponent;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
use crate::identifier::Identifier;
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone, ItemComponent)]
|
||||||
|
#[item_component(namespace = "minecraft", id = "cow/variant")]
|
||||||
|
pub struct CowVariant(pub Identifier);
|
7
potato-data/src/registry/item/components/custom_data.rs
Normal file
7
potato-data/src/registry/item/components/custom_data.rs
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
use potato_derive::ItemComponent;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone, ItemComponent)]
|
||||||
|
#[item_component(namespace = "minecraft", id = "custom_data")]
|
||||||
|
// TODO: Enforce as key-value map instead of any nbt value
|
||||||
|
pub struct CustomData(fastnbt::Value);
|
|
@ -0,0 +1,14 @@
|
||||||
|
use potato_derive::ItemComponent;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
use crate::color::Color;
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone, ItemComponent)]
|
||||||
|
#[item_component(namespace = "minecraft", id = "custom_model_data")]
|
||||||
|
pub struct CustomModelData {
|
||||||
|
pub floats: Vec<f32>,
|
||||||
|
pub flags: Vec<bool>,
|
||||||
|
pub strings: Vec<String>,
|
||||||
|
// TODO: Also parse float3 array here
|
||||||
|
pub colors: Vec<Color>,
|
||||||
|
}
|
8
potato-data/src/registry/item/components/custom_name.rs
Normal file
8
potato-data/src/registry/item/components/custom_name.rs
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
use potato_derive::ItemComponent;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
use crate::text_component::TextComponent;
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone, ItemComponent)]
|
||||||
|
#[item_component(namespace = "minecraft", id = "custom_name")]
|
||||||
|
pub struct CustomName(pub TextComponent);
|
6
potato-data/src/registry/item/components/damage.rs
Normal file
6
potato-data/src/registry/item/components/damage.rs
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
use potato_derive::ItemComponent;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone, ItemComponent)]
|
||||||
|
#[item_component(namespace = "minecraft", id = "damage")]
|
||||||
|
pub struct Damage(pub i32);
|
10
potato-data/src/registry/item/components/damage_resistant.rs
Normal file
10
potato-data/src/registry/item/components/damage_resistant.rs
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
use potato_derive::ItemComponent;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
use crate::tag::Tag;
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone, ItemComponent)]
|
||||||
|
#[item_component(namespace = "minecraft", id = "damage_resistant")]
|
||||||
|
pub struct DamageResistant {
|
||||||
|
pub types: Tag,
|
||||||
|
}
|
10
potato-data/src/registry/item/components/death_protection.rs
Normal file
10
potato-data/src/registry/item/components/death_protection.rs
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
use potato_derive::ItemComponent;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
use crate::consume_effect::ConsumeEffect;
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone, ItemComponent)]
|
||||||
|
#[item_component(namespace = "minecraft", id = "death_protection")]
|
||||||
|
pub struct DeathProtection {
|
||||||
|
pub death_effects: Vec<ConsumeEffect>,
|
||||||
|
}
|
|
@ -0,0 +1,10 @@
|
||||||
|
use potato_derive::ItemComponent;
|
||||||
|
use std::collections::HashMap;
|
||||||
|
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
use crate::identifier::Identifier;
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone, ItemComponent)]
|
||||||
|
#[item_component(namespace = "minecraft", id = "debug_stick_state")]
|
||||||
|
pub struct DebugStickState(HashMap<Identifier, String>);
|
9
potato-data/src/registry/item/components/dyed_color.rs
Normal file
9
potato-data/src/registry/item/components/dyed_color.rs
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
use potato_derive::ItemComponent;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
use crate::color::Color;
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone, ItemComponent)]
|
||||||
|
#[item_component(namespace = "minecraft", id = "dyed_color")]
|
||||||
|
// TODO: Parse float3 as well
|
||||||
|
pub struct DyedColor(pub Color);
|
8
potato-data/src/registry/item/components/enchantable.rs
Normal file
8
potato-data/src/registry/item/components/enchantable.rs
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
use potato_derive::ItemComponent;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone, ItemComponent)]
|
||||||
|
#[item_component(namespace = "minecraft", id = "enchantable")]
|
||||||
|
pub struct Enchantable {
|
||||||
|
pub value: i32,
|
||||||
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
use potato_derive::ItemComponent;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone, ItemComponent)]
|
||||||
|
#[item_component(namespace = "minecraft", id = "enchantment_glint_override")]
|
||||||
|
pub struct EnchantmentGlintOverride(pub bool);
|
8
potato-data/src/registry/item/components/enchantments.rs
Normal file
8
potato-data/src/registry/item/components/enchantments.rs
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
use potato_derive::ItemComponent;
|
||||||
|
use std::collections::HashMap;
|
||||||
|
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone, ItemComponent)]
|
||||||
|
#[item_component(namespace = "minecraft", id = "enchantments")]
|
||||||
|
pub struct Enchantments(HashMap<String, i32>);
|
6
potato-data/src/registry/item/components/entity_data.rs
Normal file
6
potato-data/src/registry/item/components/entity_data.rs
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
use potato_derive::ItemComponent;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone, ItemComponent)]
|
||||||
|
#[item_component(namespace = "minecraft", id = "entity_data")]
|
||||||
|
pub struct EntityData(pub fastnbt::Value);
|
45
potato-data/src/registry/item/components/equippable.rs
Normal file
45
potato-data/src/registry/item/components/equippable.rs
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
use potato_derive::ItemComponent;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
use crate::{
|
||||||
|
Either, OneOrMany, TagOrIdentifier, identifier::Identifier,
|
||||||
|
registry::worldgen::biome::SoundEvent,
|
||||||
|
};
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone, ItemComponent)]
|
||||||
|
#[item_component(namespace = "minecraft", id = "equippable")]
|
||||||
|
pub struct Equippable {
|
||||||
|
pub slot: EquipmentSlot,
|
||||||
|
#[serde(default = "armor_equip_generic")]
|
||||||
|
pub equip_sound: Either<Identifier, SoundEvent>,
|
||||||
|
pub asset_id: Option<Identifier>,
|
||||||
|
pub allowed_entities: Option<OneOrMany<TagOrIdentifier>>,
|
||||||
|
#[serde(default = "r#true")]
|
||||||
|
pub dispensable: bool,
|
||||||
|
#[serde(default = "r#true")]
|
||||||
|
pub damage_on_hurt: bool,
|
||||||
|
#[serde(default = "r#true")]
|
||||||
|
pub equip_on_interact: bool,
|
||||||
|
pub camera_overlay: Option<Identifier>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
|
#[serde(rename_all = "snake_case")]
|
||||||
|
pub enum EquipmentSlot {
|
||||||
|
Head,
|
||||||
|
Chest,
|
||||||
|
Legs,
|
||||||
|
Feet,
|
||||||
|
Body,
|
||||||
|
Mainhand,
|
||||||
|
Offhand,
|
||||||
|
Saddle,
|
||||||
|
}
|
||||||
|
|
||||||
|
fn armor_equip_generic() -> Either<Identifier, SoundEvent> {
|
||||||
|
Either::Left(Identifier::minecraft("item.armor.equip_generic"))
|
||||||
|
}
|
||||||
|
|
||||||
|
fn r#true() -> bool {
|
||||||
|
true
|
||||||
|
}
|
|
@ -0,0 +1,24 @@
|
||||||
|
use potato_derive::ItemComponent;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
use crate::color::Color;
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone, ItemComponent)]
|
||||||
|
#[item_component(namespace = "minecraft", id = "firework_explosion")]
|
||||||
|
pub struct FireworkExplosion {
|
||||||
|
pub shape: FireworkShape,
|
||||||
|
pub colors: Vec<Color>,
|
||||||
|
pub fade_colors: Vec<Color>,
|
||||||
|
pub has_trail: bool,
|
||||||
|
pub has_twinkle: bool,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
|
#[serde(rename_all = "snake_case")]
|
||||||
|
pub enum FireworkShape {
|
||||||
|
SmallBall,
|
||||||
|
LargeBall,
|
||||||
|
Star,
|
||||||
|
Creeper,
|
||||||
|
Burst,
|
||||||
|
}
|
17
potato-data/src/registry/item/components/fireworks.rs
Normal file
17
potato-data/src/registry/item/components/fireworks.rs
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
use potato_derive::ItemComponent;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
use super::firework_explosion::FireworkExplosion;
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone, ItemComponent)]
|
||||||
|
#[item_component(namespace = "minecraft", id = "fireworks")]
|
||||||
|
pub struct Fireworks {
|
||||||
|
#[serde(default)]
|
||||||
|
pub explosions: Vec<FireworkExplosion>,
|
||||||
|
#[serde(default = "one")]
|
||||||
|
pub flight_duration: i8,
|
||||||
|
}
|
||||||
|
|
||||||
|
fn one() -> i8 {
|
||||||
|
1
|
||||||
|
}
|
15
potato-data/src/registry/item/components/food.rs
Normal file
15
potato-data/src/registry/item/components/food.rs
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
use potato_derive::ItemComponent;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone, ItemComponent)]
|
||||||
|
#[item_component(namespace = "minecraft", id = "food")]
|
||||||
|
pub struct Food {
|
||||||
|
pub nutrition: i32,
|
||||||
|
pub saturation: f32,
|
||||||
|
#[serde(default = "r#false")]
|
||||||
|
pub can_always_eat: bool,
|
||||||
|
}
|
||||||
|
|
||||||
|
fn r#false() -> bool {
|
||||||
|
false
|
||||||
|
}
|
8
potato-data/src/registry/item/components/fox_variant.rs
Normal file
8
potato-data/src/registry/item/components/fox_variant.rs
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
use potato_derive::ItemComponent;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
use crate::identifier::Identifier;
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone, ItemComponent)]
|
||||||
|
#[item_component(namespace = "minecraft", id = "fox/variant")]
|
||||||
|
pub struct FoxVariant(pub Identifier);
|
8
potato-data/src/registry/item/components/frog_variant.rs
Normal file
8
potato-data/src/registry/item/components/frog_variant.rs
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
use potato_derive::ItemComponent;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
use crate::identifier::Identifier;
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone, ItemComponent)]
|
||||||
|
#[item_component(namespace = "minecraft", id = "frog/variant")]
|
||||||
|
pub struct FrogVariant(pub Identifier);
|
6
potato-data/src/registry/item/components/glider.rs
Normal file
6
potato-data/src/registry/item/components/glider.rs
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
use potato_derive::ItemComponent;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone, ItemComponent)]
|
||||||
|
#[item_component(namespace = "minecraft", id = "glider")]
|
||||||
|
pub struct Glider {}
|
|
@ -0,0 +1,8 @@
|
||||||
|
use potato_derive::ItemComponent;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
use crate::identifier::Identifier;
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone, ItemComponent)]
|
||||||
|
#[item_component(namespace = "minecraft", id = "horse/variant")]
|
||||||
|
pub struct HorseVariant(pub Identifier);
|
21
potato-data/src/registry/item/components/instrument.rs
Normal file
21
potato-data/src/registry/item/components/instrument.rs
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
use potato_derive::ItemComponent;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
use crate::{
|
||||||
|
Either, identifier::Identifier, registry::worldgen::biome::SoundEvent,
|
||||||
|
text_component::TextComponent,
|
||||||
|
};
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone, ItemComponent)]
|
||||||
|
#[item_component(namespace = "minecraft", id = "instrument")]
|
||||||
|
pub struct Instrument(pub Either<Identifier, InstrumentDefinition>);
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
|
pub struct InstrumentDefinition {
|
||||||
|
pub sound_event: Either<Identifier, SoundEvent>,
|
||||||
|
// TODO: Non negative only
|
||||||
|
pub use_duration: f32,
|
||||||
|
// TODO: Non negative only
|
||||||
|
pub range: f32,
|
||||||
|
pub description: TextComponent,
|
||||||
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
use potato_derive::ItemComponent;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone, ItemComponent)]
|
||||||
|
#[item_component(namespace = "minecraft", id = "intangible_projectile")]
|
||||||
|
pub struct IntangibleProjectile;
|
8
potato-data/src/registry/item/components/item_model.rs
Normal file
8
potato-data/src/registry/item/components/item_model.rs
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
use potato_derive::ItemComponent;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
use crate::identifier::Identifier;
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone, ItemComponent)]
|
||||||
|
#[item_component(namespace = "minecraft", id = "item_model")]
|
||||||
|
pub struct ItemModel(pub Identifier);
|
8
potato-data/src/registry/item/components/item_name.rs
Normal file
8
potato-data/src/registry/item/components/item_name.rs
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
use potato_derive::ItemComponent;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
use crate::text_component::TextComponent;
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone, ItemComponent)]
|
||||||
|
#[item_component(namespace = "minecraft", id = "item_name")]
|
||||||
|
pub struct ItemName(pub TextComponent);
|
|
@ -0,0 +1,8 @@
|
||||||
|
use potato_derive::ItemComponent;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
use crate::identifier::Identifier;
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone, ItemComponent)]
|
||||||
|
#[item_component(namespace = "minecraft", id = "jukebox_playable")]
|
||||||
|
pub struct JukeboxPlayable(pub Identifier);
|
|
@ -0,0 +1,8 @@
|
||||||
|
use potato_derive::ItemComponent;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
use crate::identifier::Identifier;
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone, ItemComponent)]
|
||||||
|
#[item_component(namespace = "minecraft", id = "llama/variant")]
|
||||||
|
pub struct LlamaVariant(pub Identifier);
|
8
potato-data/src/registry/item/components/lock.rs
Normal file
8
potato-data/src/registry/item/components/lock.rs
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
use potato_derive::ItemComponent;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
use crate::predicate::ItemPredicate;
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone, ItemComponent)]
|
||||||
|
#[item_component(namespace = "minecraft", id = "lock")]
|
||||||
|
pub struct Lock(pub ItemPredicate);
|
|
@ -0,0 +1,22 @@
|
||||||
|
use potato_derive::ItemComponent;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
use crate::identifier::Identifier;
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone, ItemComponent)]
|
||||||
|
#[item_component(namespace = "minecraft", id = "lodestone_tracker")]
|
||||||
|
pub struct LodestoneTracker {
|
||||||
|
pub target: Option<CompassTarget>,
|
||||||
|
#[serde(default = "r#true")]
|
||||||
|
pub tracked: bool,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
|
pub struct CompassTarget {
|
||||||
|
pub pos: (i32, i32, i32),
|
||||||
|
pub dimension: Identifier,
|
||||||
|
}
|
||||||
|
|
||||||
|
fn r#true() -> bool {
|
||||||
|
true
|
||||||
|
}
|
8
potato-data/src/registry/item/components/lore.rs
Normal file
8
potato-data/src/registry/item/components/lore.rs
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
use potato_derive::ItemComponent;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
use crate::text_component::TextComponent;
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone, ItemComponent)]
|
||||||
|
#[item_component(namespace = "minecraft", id = "lore")]
|
||||||
|
pub struct Lore(pub Vec<TextComponent>);
|
8
potato-data/src/registry/item/components/map_color.rs
Normal file
8
potato-data/src/registry/item/components/map_color.rs
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
use potato_derive::ItemComponent;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
use crate::color::Color;
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone, ItemComponent)]
|
||||||
|
#[item_component(namespace = "minecraft", id = "map_color")]
|
||||||
|
pub struct MapColor(pub Color);
|
55
potato-data/src/registry/item/components/map_decorations.rs
Normal file
55
potato-data/src/registry/item/components/map_decorations.rs
Normal file
|
@ -0,0 +1,55 @@
|
||||||
|
use potato_derive::ItemComponent;
|
||||||
|
use std::collections::HashMap;
|
||||||
|
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone, ItemComponent)]
|
||||||
|
#[item_component(namespace = "minecraft", id = "map_decorations")]
|
||||||
|
pub struct MapDecorations(pub HashMap<String, MapMarker>);
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
|
pub struct MapMarker {
|
||||||
|
pub r#type: MapMarkerType,
|
||||||
|
pub x: f64,
|
||||||
|
pub z: f64,
|
||||||
|
pub rotation: f32,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
|
#[serde(rename_all = "snake_case")]
|
||||||
|
pub enum MapMarkerType {
|
||||||
|
Player,
|
||||||
|
Frame,
|
||||||
|
RedMarker,
|
||||||
|
BlueMarker,
|
||||||
|
TargetX,
|
||||||
|
TargetPoint,
|
||||||
|
PlayerOffMap,
|
||||||
|
PlayerOffLimits,
|
||||||
|
Mansion,
|
||||||
|
Monument,
|
||||||
|
BannerWhite,
|
||||||
|
BannerOrange,
|
||||||
|
BannerMagenta,
|
||||||
|
BannerLightBlue,
|
||||||
|
BannerYellow,
|
||||||
|
BannerLime,
|
||||||
|
BannerPink,
|
||||||
|
BannerGray,
|
||||||
|
BannerLightGray,
|
||||||
|
BannerCyan,
|
||||||
|
BannerPurple,
|
||||||
|
BannerBlue,
|
||||||
|
BannerBrown,
|
||||||
|
BannerGreen,
|
||||||
|
BannerRed,
|
||||||
|
BannerBlack,
|
||||||
|
RedX,
|
||||||
|
VillageDesert,
|
||||||
|
VillagePlains,
|
||||||
|
VillageSavanna,
|
||||||
|
VillageSnowy,
|
||||||
|
VillageTaiga,
|
||||||
|
JungleTemple,
|
||||||
|
SwampHut,
|
||||||
|
}
|
6
potato-data/src/registry/item/components/map_id.rs
Normal file
6
potato-data/src/registry/item/components/map_id.rs
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
use potato_derive::ItemComponent;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone, ItemComponent)]
|
||||||
|
#[item_component(namespace = "minecraft", id = "map_id")]
|
||||||
|
pub struct MapId(pub i32);
|
6
potato-data/src/registry/item/components/max_damage.rs
Normal file
6
potato-data/src/registry/item/components/max_damage.rs
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
use potato_derive::ItemComponent;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone, ItemComponent)]
|
||||||
|
#[item_component(namespace = "minecraft", id = "max_damage")]
|
||||||
|
pub struct MaxDamage(pub i32);
|
|
@ -0,0 +1,7 @@
|
||||||
|
use potato_derive::ItemComponent;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone, ItemComponent)]
|
||||||
|
#[item_component(namespace = "minecraft", id = "max_stack_size")]
|
||||||
|
// TODO: Limit range to 1-99 inclusive (Or maybe allow more if the client doesn't get mad?)
|
||||||
|
pub struct MaxStackSize(pub i32);
|
95
potato-data/src/registry/item/components/mod.rs
Normal file
95
potato-data/src/registry/item/components/mod.rs
Normal file
|
@ -0,0 +1,95 @@
|
||||||
|
pub mod attribute_modifiers;
|
||||||
|
pub mod banner_patterns;
|
||||||
|
pub mod base_color;
|
||||||
|
pub mod bees;
|
||||||
|
pub mod block_entity_data;
|
||||||
|
pub mod block_state;
|
||||||
|
pub mod blocks_attacks;
|
||||||
|
pub mod break_sound;
|
||||||
|
pub mod bucket_entity_data;
|
||||||
|
pub mod bundle_contents;
|
||||||
|
pub mod can_break;
|
||||||
|
pub mod can_place_on;
|
||||||
|
pub mod charged_projectiles;
|
||||||
|
pub mod consumable;
|
||||||
|
pub mod container;
|
||||||
|
pub mod container_loot;
|
||||||
|
pub mod custom_data;
|
||||||
|
pub mod custom_model_data;
|
||||||
|
pub mod custom_name;
|
||||||
|
pub mod damage;
|
||||||
|
pub mod damage_resistant;
|
||||||
|
pub mod death_protection;
|
||||||
|
pub mod debug_stick_state;
|
||||||
|
pub mod dyed_color;
|
||||||
|
pub mod enchantable;
|
||||||
|
pub mod enchantment_glint_override;
|
||||||
|
pub mod enchantments;
|
||||||
|
pub mod entity_data;
|
||||||
|
pub mod equippable;
|
||||||
|
pub mod firework_explosion;
|
||||||
|
pub mod fireworks;
|
||||||
|
pub mod food;
|
||||||
|
pub mod glider;
|
||||||
|
pub mod instrument;
|
||||||
|
pub mod intangible_projectile;
|
||||||
|
pub mod item_model;
|
||||||
|
pub mod item_name;
|
||||||
|
pub mod jukebox_playable;
|
||||||
|
pub mod lock;
|
||||||
|
pub mod lodestone_tracker;
|
||||||
|
pub mod lore;
|
||||||
|
pub mod map_color;
|
||||||
|
pub mod map_decorations;
|
||||||
|
pub mod map_id;
|
||||||
|
pub mod max_damage;
|
||||||
|
pub mod max_stack_size;
|
||||||
|
pub mod note_block_sound;
|
||||||
|
pub mod ominous_bottle_amplifier;
|
||||||
|
pub mod pot_decorations;
|
||||||
|
pub mod potion_contents;
|
||||||
|
pub mod potion_duration_scale;
|
||||||
|
pub mod profile;
|
||||||
|
pub mod provides_banner_patterns;
|
||||||
|
pub mod provides_trim_material;
|
||||||
|
pub mod rarity;
|
||||||
|
pub mod recipes;
|
||||||
|
pub mod repair_cost;
|
||||||
|
pub mod repairable;
|
||||||
|
pub mod stored_enchantments;
|
||||||
|
pub mod suspicious_stew_effects;
|
||||||
|
pub mod tool;
|
||||||
|
pub mod tooltip_display;
|
||||||
|
pub mod tooltip_style;
|
||||||
|
pub mod trim;
|
||||||
|
pub mod unbreakable;
|
||||||
|
pub mod use_cooldown;
|
||||||
|
pub mod use_remainder;
|
||||||
|
pub mod weapon;
|
||||||
|
pub mod writable_book_content;
|
||||||
|
pub mod written_book_content;
|
||||||
|
|
||||||
|
pub mod axolotl_variant;
|
||||||
|
pub mod cat_collar;
|
||||||
|
pub mod cat_variant;
|
||||||
|
pub mod chicken_variant;
|
||||||
|
pub mod cow_variant;
|
||||||
|
pub mod fox_variant;
|
||||||
|
pub mod frog_variant;
|
||||||
|
pub mod horse_variant;
|
||||||
|
pub mod llama_variant;
|
||||||
|
pub mod mooshroom_variant;
|
||||||
|
pub mod painting_variant;
|
||||||
|
pub mod parrot_variant;
|
||||||
|
pub mod pig_variant;
|
||||||
|
pub mod rabbit_variant;
|
||||||
|
pub mod salmon_size;
|
||||||
|
pub mod sheep_color;
|
||||||
|
pub mod shulker_color;
|
||||||
|
pub mod tropical_fish_base_color;
|
||||||
|
pub mod tropical_fish_pattern;
|
||||||
|
pub mod tropical_fish_pattern_color;
|
||||||
|
pub mod villager_variant;
|
||||||
|
pub mod wolf_collar;
|
||||||
|
pub mod wolf_sound_variant;
|
||||||
|
pub mod wolf_variant;
|
|
@ -0,0 +1,8 @@
|
||||||
|
use potato_derive::ItemComponent;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
use crate::identifier::Identifier;
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone, ItemComponent)]
|
||||||
|
#[item_component(namespace = "minecraft", id = "mooshroom/variant")]
|
||||||
|
pub struct MooshroomVariant(pub Identifier);
|
|
@ -0,0 +1,8 @@
|
||||||
|
use potato_derive::ItemComponent;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
use crate::identifier::Identifier;
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone, ItemComponent)]
|
||||||
|
#[item_component(namespace = "minecraft", id = "note_block_sound")]
|
||||||
|
pub struct NoteBlockSound(pub Identifier);
|
|
@ -0,0 +1,7 @@
|
||||||
|
use potato_derive::ItemComponent;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone, ItemComponent)]
|
||||||
|
#[item_component(namespace = "minecraft", id = "ominous_bottle_amplifier")]
|
||||||
|
// TODO: Limit range to 0-4 inclusive
|
||||||
|
pub struct OminousBottleAmplifier(pub i32);
|
|
@ -0,0 +1,8 @@
|
||||||
|
use potato_derive::ItemComponent;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
use crate::{Either, identifier::Identifier, registry::painting_variant};
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone, ItemComponent)]
|
||||||
|
#[item_component(namespace = "minecraft", id = "painting/variant")]
|
||||||
|
pub struct PaintingVariant(pub Either<Identifier, painting_variant::PaintingVariant>);
|
|
@ -0,0 +1,8 @@
|
||||||
|
use potato_derive::ItemComponent;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
use crate::identifier::Identifier;
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone, ItemComponent)]
|
||||||
|
#[item_component(namespace = "minecraft", id = "parrot/variant")]
|
||||||
|
pub struct ParrotVariant(pub Identifier);
|
8
potato-data/src/registry/item/components/pig_variant.rs
Normal file
8
potato-data/src/registry/item/components/pig_variant.rs
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
use potato_derive::ItemComponent;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
use crate::identifier::Identifier;
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone, ItemComponent)]
|
||||||
|
#[item_component(namespace = "minecraft", id = "pig/variant")]
|
||||||
|
pub struct PigVariant(pub Identifier);
|
|
@ -0,0 +1,8 @@
|
||||||
|
use potato_derive::ItemComponent;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
use crate::identifier::Identifier;
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone, ItemComponent)]
|
||||||
|
#[item_component(namespace = "minecraft", id = "pot_decorations")]
|
||||||
|
pub struct PotDecorations(pub Vec<Identifier>);
|
15
potato-data/src/registry/item/components/potion_contents.rs
Normal file
15
potato-data/src/registry/item/components/potion_contents.rs
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
use potato_derive::ItemComponent;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
use crate::{color::Color, identifier::Identifier, status_effect::StatusEffect};
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone, ItemComponent)]
|
||||||
|
#[item_component(namespace = "minecraft", id = "potion_contents")]
|
||||||
|
// TODO: Also parse string as only setting potion key
|
||||||
|
pub struct PotionContents {
|
||||||
|
pub potion: Option<Identifier>,
|
||||||
|
pub custom_color: Option<Color>,
|
||||||
|
pub custom_name: Option<String>,
|
||||||
|
#[serde(default)]
|
||||||
|
pub custom_effects: Vec<StatusEffect>,
|
||||||
|
}
|
|
@ -0,0 +1,10 @@
|
||||||
|
use potato_derive::ItemComponent;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone, ItemComponent)]
|
||||||
|
#[item_component(namespace = "minecraft", id = "potion_duration_scale")]
|
||||||
|
pub struct PotionDurationScale(#[serde(default = "one")] pub f32);
|
||||||
|
|
||||||
|
fn one() -> f32 {
|
||||||
|
1.0
|
||||||
|
}
|
25
potato-data/src/registry/item/components/profile.rs
Normal file
25
potato-data/src/registry/item/components/profile.rs
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
use potato_derive::ItemComponent;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
use uuid::Uuid;
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone, ItemComponent)]
|
||||||
|
#[item_component(namespace = "minecraft", id = "profile")]
|
||||||
|
// TODO: Parse string as if only name is specified
|
||||||
|
pub struct Profile {
|
||||||
|
pub name: Option<String>,
|
||||||
|
pub id: Option<Uuid>,
|
||||||
|
pub properties: Vec<ProfileProperty>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
|
pub struct ProfileProperty {
|
||||||
|
pub name: ProfilePropertyName,
|
||||||
|
pub value: String,
|
||||||
|
pub signature: Option<String>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
|
#[serde(rename_all = "snake_case")]
|
||||||
|
pub enum ProfilePropertyName {
|
||||||
|
Textures,
|
||||||
|
}
|
|
@ -0,0 +1,8 @@
|
||||||
|
use potato_derive::ItemComponent;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
use crate::tag::Tag;
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone, ItemComponent)]
|
||||||
|
#[item_component(namespace = "minecraft", id = "provides_banner_patterns")]
|
||||||
|
pub struct ProvidesBannerPatterns(pub Tag);
|
|
@ -0,0 +1,8 @@
|
||||||
|
use potato_derive::ItemComponent;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
use crate::identifier::Identifier;
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone, ItemComponent)]
|
||||||
|
#[item_component(namespace = "minecraft", id = "provides_trim_material")]
|
||||||
|
pub struct ProvidesTrimMaterial(pub Identifier);
|
|
@ -0,0 +1,8 @@
|
||||||
|
use potato_derive::ItemComponent;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
use crate::identifier::Identifier;
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone, ItemComponent)]
|
||||||
|
#[item_component(namespace = "minecraft", id = "rabbit/variant")]
|
||||||
|
pub struct RabbitVariant(pub Identifier);
|
12
potato-data/src/registry/item/components/rarity.rs
Normal file
12
potato-data/src/registry/item/components/rarity.rs
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
use potato_derive::ItemComponent;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone, ItemComponent)]
|
||||||
|
#[item_component(namespace = "minecraft", id = "rarity")]
|
||||||
|
#[serde(rename_all = "snake_case")]
|
||||||
|
pub enum Rarity {
|
||||||
|
Common,
|
||||||
|
Uncommon,
|
||||||
|
Rare,
|
||||||
|
Epic,
|
||||||
|
}
|
8
potato-data/src/registry/item/components/recipes.rs
Normal file
8
potato-data/src/registry/item/components/recipes.rs
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
use potato_derive::ItemComponent;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
use crate::identifier::Identifier;
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone, ItemComponent)]
|
||||||
|
#[item_component(namespace = "minecraft", id = "recipes")]
|
||||||
|
pub struct Recipes(pub Vec<Identifier>);
|
10
potato-data/src/registry/item/components/repair_cost.rs
Normal file
10
potato-data/src/registry/item/components/repair_cost.rs
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
use potato_derive::ItemComponent;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone, ItemComponent)]
|
||||||
|
#[item_component(namespace = "minecraft", id = "repair_cost")]
|
||||||
|
pub struct RepairCost(#[serde(default = "zero")] pub i32);
|
||||||
|
|
||||||
|
fn zero() -> i32 {
|
||||||
|
0
|
||||||
|
}
|
10
potato-data/src/registry/item/components/repairable.rs
Normal file
10
potato-data/src/registry/item/components/repairable.rs
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
use potato_derive::ItemComponent;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
use crate::{OneOrMany, TagOrIdentifier};
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone, ItemComponent)]
|
||||||
|
#[item_component(namespace = "minecraft", id = "repairable")]
|
||||||
|
pub struct Repairable {
|
||||||
|
pub items: OneOrMany<TagOrIdentifier>,
|
||||||
|
}
|
11
potato-data/src/registry/item/components/salmon_size.rs
Normal file
11
potato-data/src/registry/item/components/salmon_size.rs
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
use potato_derive::ItemComponent;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone, ItemComponent)]
|
||||||
|
#[item_component(namespace = "minecraft", id = "salmon/size")]
|
||||||
|
#[serde(rename_all = "snake_case")]
|
||||||
|
pub enum SalmonSize {
|
||||||
|
Small,
|
||||||
|
Medium,
|
||||||
|
Large,
|
||||||
|
}
|
7
potato-data/src/registry/item/components/sheep_color.rs
Normal file
7
potato-data/src/registry/item/components/sheep_color.rs
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
use potato_derive::ItemComponent;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone, ItemComponent)]
|
||||||
|
#[item_component(namespace = "minecraft", id = "sheep/color")]
|
||||||
|
// TODO: dye color type
|
||||||
|
pub struct SheepColor(pub String);
|
|
@ -0,0 +1,7 @@
|
||||||
|
use potato_derive::ItemComponent;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone, ItemComponent)]
|
||||||
|
#[item_component(namespace = "minecraft", id = "shulker/color")]
|
||||||
|
// TODO: dye color type
|
||||||
|
pub struct ShulkerColor(pub String);
|
|
@ -0,0 +1,10 @@
|
||||||
|
use potato_derive::ItemComponent;
|
||||||
|
use std::collections::HashMap;
|
||||||
|
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
use crate::identifier::Identifier;
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone, ItemComponent)]
|
||||||
|
#[item_component(namespace = "minecraft", id = "stored_enchantments")]
|
||||||
|
pub struct StoredEnchantments(pub HashMap<Identifier, i32>);
|
|
@ -0,0 +1,19 @@
|
||||||
|
use potato_derive::ItemComponent;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
use crate::identifier::Identifier;
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone, ItemComponent)]
|
||||||
|
#[item_component(namespace = "minecraft", id = "suspicious_stew_effects")]
|
||||||
|
pub struct SuspiciousStewEffects(pub Vec<SuspiciousStewEffect>);
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
|
pub struct SuspiciousStewEffect {
|
||||||
|
pub id: Identifier,
|
||||||
|
#[serde(default = "onesixty")]
|
||||||
|
pub duration: i32,
|
||||||
|
}
|
||||||
|
|
||||||
|
fn onesixty() -> i32 {
|
||||||
|
160
|
||||||
|
}
|
40
potato-data/src/registry/item/components/tool.rs
Normal file
40
potato-data/src/registry/item/components/tool.rs
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
use potato_derive::ItemComponent;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
use crate::{OneOrMany, TagOrIdentifier};
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone, ItemComponent)]
|
||||||
|
#[item_component(namespace = "minecraft", id = "tool")]
|
||||||
|
pub struct Tool {
|
||||||
|
#[serde(default = "onef")]
|
||||||
|
pub default_mining_speed: f32,
|
||||||
|
#[serde(default = "one")]
|
||||||
|
pub damage_per_block: i32,
|
||||||
|
#[serde(default = "r#true")]
|
||||||
|
pub can_destroy_blocks_in_creative: bool,
|
||||||
|
pub rules: Vec<ToolRule>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
|
pub struct ToolRule {
|
||||||
|
pub blocks: OneOrMany<TagOrIdentifier>,
|
||||||
|
pub speed: Option<f32>,
|
||||||
|
#[serde(default = "r#false")]
|
||||||
|
pub corect_for_drops: bool,
|
||||||
|
}
|
||||||
|
|
||||||
|
fn onef() -> f32 {
|
||||||
|
1.0
|
||||||
|
}
|
||||||
|
|
||||||
|
fn one() -> i32 {
|
||||||
|
1
|
||||||
|
}
|
||||||
|
|
||||||
|
fn r#true() -> bool {
|
||||||
|
true
|
||||||
|
}
|
||||||
|
|
||||||
|
fn r#false() -> bool {
|
||||||
|
true
|
||||||
|
}
|
12
potato-data/src/registry/item/components/tooltip_display.rs
Normal file
12
potato-data/src/registry/item/components/tooltip_display.rs
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
use potato_derive::ItemComponent;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
use crate::identifier::Identifier;
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone, ItemComponent)]
|
||||||
|
#[item_component(namespace = "minecraft", id = "tooltip_display")]
|
||||||
|
pub struct TooltipDisplay {
|
||||||
|
pub hide_tooltip: Option<bool>,
|
||||||
|
#[serde(default)]
|
||||||
|
pub hidden_components: Vec<Identifier>,
|
||||||
|
}
|
|
@ -0,0 +1,8 @@
|
||||||
|
use potato_derive::ItemComponent;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
use crate::identifier::Identifier;
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone, ItemComponent)]
|
||||||
|
#[item_component(namespace = "minecraft", id = "tooltip_style")]
|
||||||
|
pub struct TooltipStyle(pub Identifier);
|
11
potato-data/src/registry/item/components/trim.rs
Normal file
11
potato-data/src/registry/item/components/trim.rs
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
use potato_derive::ItemComponent;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
use crate::identifier::Identifier;
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone, ItemComponent)]
|
||||||
|
#[item_component(namespace = "minecraft", id = "trim")]
|
||||||
|
pub struct Trim {
|
||||||
|
pub pattern: Identifier,
|
||||||
|
pub material: Identifier,
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
use potato_derive::ItemComponent;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone, ItemComponent)]
|
||||||
|
#[item_component(namespace = "minecraft", id = "tropical_fish/base_color")]
|
||||||
|
// TODO: dye color type
|
||||||
|
pub struct TropicalFishBaseColor(pub String);
|
|
@ -0,0 +1,20 @@
|
||||||
|
use potato_derive::ItemComponent;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone, ItemComponent)]
|
||||||
|
#[item_component(namespace = "minecraft", id = "tropical_fish/pattern")]
|
||||||
|
#[serde(rename_all = "snake_case")]
|
||||||
|
pub enum TropicalFishPattern {
|
||||||
|
Kob,
|
||||||
|
Sunstreak,
|
||||||
|
Snooper,
|
||||||
|
Dasher,
|
||||||
|
Brinely,
|
||||||
|
Spotty,
|
||||||
|
Flopper,
|
||||||
|
Stripey,
|
||||||
|
Glitter,
|
||||||
|
Blockfish,
|
||||||
|
Betty,
|
||||||
|
Clayfish,
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
use potato_derive::ItemComponent;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone, ItemComponent)]
|
||||||
|
#[item_component(namespace = "minecraft", id = "tropical_fish/pattern_color")]
|
||||||
|
// TODO: dye color type
|
||||||
|
pub struct TropicalFishPatternColor(pub String);
|
6
potato-data/src/registry/item/components/unbreakable.rs
Normal file
6
potato-data/src/registry/item/components/unbreakable.rs
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
use potato_derive::ItemComponent;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone, ItemComponent)]
|
||||||
|
#[item_component(namespace = "minecraft", id = "unbreakable")]
|
||||||
|
pub struct Unbreakable {}
|
11
potato-data/src/registry/item/components/use_cooldown.rs
Normal file
11
potato-data/src/registry/item/components/use_cooldown.rs
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
use potato_derive::ItemComponent;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
use crate::identifier::Identifier;
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone, ItemComponent)]
|
||||||
|
#[item_component(namespace = "minecraft", id = "use_cooldown")]
|
||||||
|
pub struct UseCooldown {
|
||||||
|
pub seconds: f32,
|
||||||
|
pub cooldown_group: Option<Identifier>,
|
||||||
|
}
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue