add damage type registries

This commit is contained in:
Snowiiii committed 2024-08-03 12:56:21 +02:00
1 parent 661e196987
commit f111c7881c
4 files changed
+44 -4

No files matched your search

+22
View File
@@ -1,3 +1,5 @@
use fastnbt::SerOpts;
use pumpkin_protocol::client::config::RegistryEntry;
use serde::Serialize;
#[derive(Debug, Clone, Serialize)]
@@ -16,6 +18,8 @@ const NAMES: &[&str] = &[
"bad_respawn_point",
"cactus",
"cramming",
"campfire",
"cramming",
"dragon_breath",
"drown",
"dry_out",
@@ -58,3 +62,21 @@ const NAMES: &[&str] = &[
"wither",
"wither_skull",
];
pub(super) fn entires() -> Vec<RegistryEntry> {
let items: Vec<_> = NAMES
.iter()
.map(|name| RegistryEntry {
entry_id: (*name).into(),
data: fastnbt::to_bytes_with_opts(&DamageType {
exhaustion: 0.1,
message_id: "inFire".into(),
scaling: "when_caused_by_living_non_player".into(),
death_message_type: None,
effects: None,
}, SerOpts::network_nbt()).unwrap(),
})
.collect();
items
}
+11 -2
View File
@@ -1,4 +1,5 @@
use biomes::Biome;
use damage_type::DamageType;
use dimensions::Dimension;
use fastnbt::SerOpts;
use paint::Painting;
@@ -33,7 +34,11 @@ impl Registry {
entry_id: "minecraft:snowy_taiga".to_string(),
data: fastnbt::to_bytes_with_opts(&Biome::default(), SerOpts::network_nbt())
.unwrap(),
}],
}, RegistryEntry {
entry_id: "minecraft:plains".to_string(),
data: fastnbt::to_bytes_with_opts(&Biome::default(), SerOpts::network_nbt())
.unwrap(),
}]
};
let wolf_variants = Registry {
registry_id: "minecraft:wolf_variant".to_string(),
@@ -43,6 +48,10 @@ impl Registry {
.unwrap(),
}],
};
let damage_types = Registry {
registry_id: "minecraft:damage_type".to_string(),
registry_entries: damage_type::entires(),
};
let paintings = Registry {
registry_id: "minecraft:painting_variant".to_string(),
registry_entries: vec![RegistryEntry {
@@ -51,6 +60,6 @@ impl Registry {
.unwrap(),
}],
};
vec![dimensions, biomes, wolf_variants, paintings]
vec![dimensions, damage_types, biomes, wolf_variants, paintings]
}
}