Skip to content

Commit

Permalink
adapt to new nbtx lib #3
Browse files Browse the repository at this point in the history
  • Loading branch information
theaddonn committed Sep 15, 2024
1 parent cd1eef8 commit 8572121
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion crates/proto/src/packets/add_actor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use bedrockrs_proto_macros::{gamepacket, ProtoCodec};
use bedrockrs_shared::{actor_runtime_id::ActorRuntimeID, actor_unique_id::ActorUniqueID};

use crate::types::{
actor_link::ActorLink, attribute::Attribute, dataitem::DataItem,
actor_link::ActorLink, attribute::Attribute, data_item::DataItem,
property_sync_data::PropertySyncData,
};

Expand Down
3 changes: 1 addition & 2 deletions crates/proto/src/packets/start_game.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use bedrockrs_core::int::{LE, VAR};
use bedrockrs_core::{Vec2, Vec3};
use bedrockrs_nbt as nbt;
use bedrockrs_proto_macros::{gamepacket, ProtoCodec};
use uuid::Uuid;

Expand Down Expand Up @@ -39,7 +38,7 @@ pub struct StartGamePacket {
pub server_version: String,
// TODO: This can now be a concrete type rather than an NBT value.
// How should we do this with the ProtoCodec macro?
pub player_property_data: nbt::Value,
pub player_property_data: nbtx::Value,
pub block_type_registry_checksum: LE<u64>,
pub world_template_id: Uuid,
pub enable_clientside_world_generation: bool,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
use std::collections::HashMap;

use bedrockrs_proto_core::ProtoCodec;
use bedrockrs_core::{
int::{LE, VAR},
Vec3,
};
use bedrockrs_nbt as nbt;
use bedrockrs_proto_macros::ProtoCodec;

#[derive(ProtoCodec, Debug, Clone)]
pub struct DataItem {
pub id: VAR<u32>,
pub value: DataItemValue,
}

#[derive(Debug, Clone)]
pub enum DataItemValue {
ValByte(u8),
ValShort(i16),
ValInt(i32),
ValFloat(f32),
ValString(String),
ValCompoundTag(HashMap<String, nbt::Value>),
ValCompoundTag(HashMap<String, nbtx::Value>),
ValPos(Vec3<VAR<i32>>),
ValInt64(LE<i64>),
ValVec3(Vec3<LE<f32>>),
}
use bedrockrs_proto_core::ProtoCodec;

impl ProtoCodec for DataItemValue {
fn proto_serialize(
&self,
Expand Down
2 changes: 1 addition & 1 deletion crates/proto/src/types/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pub mod connection_request;
pub mod container_id;
pub mod container_type;
pub mod credits_state;
pub mod dataitem;
pub mod data_item;
pub mod disconnect_reason;
pub mod edu_shared_uri_resource;
pub mod event_type;
Expand Down

0 comments on commit 8572121

Please sign in to comment.