aboutsummaryrefslogtreecommitdiff
path: root/azalea-entity/src/data.rs
diff options
context:
space:
mode:
Diffstat (limited to 'azalea-entity/src/data.rs')
-rwxr-xr-xazalea-entity/src/data.rs38
1 files changed, 1 insertions, 37 deletions
diff --git a/azalea-entity/src/data.rs b/azalea-entity/src/data.rs
index 533bb49a..050302ca 100755
--- a/azalea-entity/src/data.rs
+++ b/azalea-entity/src/data.rs
@@ -14,13 +14,12 @@ use azalea_inventory::ItemSlot;
use bevy_ecs::component::Component;
use derive_more::Deref;
use enum_as_inner::EnumAsInner;
-use nohash_hasher::IntSet;
use uuid::Uuid;
use crate::particle::Particle;
#[derive(Clone, Debug, Deref)]
-pub struct EntityMetadataItems(Vec<EntityDataItem>);
+pub struct EntityMetadataItems(pub Vec<EntityDataItem>);
#[derive(Clone, Debug)]
pub struct EntityDataItem {
@@ -30,12 +29,6 @@ pub struct EntityDataItem {
pub value: EntityDataValue,
}
-impl EntityMetadataItems {
- pub fn new(data: Vec<EntityDataItem>) -> Self {
- EntityMetadataItems(data)
- }
-}
-
impl McBufReadable for EntityMetadataItems {
fn read_from(buf: &mut Cursor<&[u8]>) -> Result<Self, BufReadError> {
let mut metadata = Vec::new();
@@ -170,35 +163,6 @@ pub struct VillagerData {
pub level: u32,
}
-impl TryFrom<EntityMetadataItems> for Vec<EntityDataValue> {
- type Error = String;
-
- fn try_from(data: EntityMetadataItems) -> Result<Self, Self::Error> {
- let mut data = data.0;
-
- data.sort_by(|a, b| a.index.cmp(&b.index));
-
- let mut prev_indexes = IntSet::default();
- let len = data.len();
- // check to make sure it's valid, in vanilla this is guaranteed to pass
- // but it's possible there's mods that mess with it so we want to make
- // sure it's good
- for item in &data {
- if prev_indexes.contains(&item.index) {
- return Err(format!("Index {} is duplicated", item.index));
- }
- if item.index as usize > len {
- return Err(format!("Index {} is too big", item.index));
- }
- prev_indexes.insert(item.index);
- }
-
- let data = data.into_iter().map(|d| d.value).collect();
-
- Ok(data)
- }
-}
-
#[derive(Debug, Copy, Clone, McBuf, Default)]
pub enum SnifferState {
#[default]