diff options
| author | mat <27899617+mat-1@users.noreply.github.com> | 2023-11-19 22:07:38 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-11-19 22:07:38 -0600 |
| commit | 2c610826fc9f8e16897f52313faa8e0602d1dc3d (patch) | |
| tree | 5aad79ecab3b68511a10ebd7eba07af0bd8a5905 /azalea-client/src | |
| parent | 84e036ce3752ecf57904b0f5aff1f33d43e95a32 (diff) | |
| download | azalea-drasl-2c610826fc9f8e16897f52313faa8e0602d1dc3d.tar.xz | |
Replace azalea-nbt with simdnbt (#111)
* delete azalea-nbt and replace with simdnbt
* use simdnbt from crates.io
* remove serde dependency on azalea-registry
Diffstat (limited to 'azalea-client/src')
| -rw-r--r-- | azalea-client/src/chunks.rs | 9 | ||||
| -rw-r--r-- | azalea-client/src/interact.rs | 7 |
2 files changed, 8 insertions, 8 deletions
diff --git a/azalea-client/src/chunks.rs b/azalea-client/src/chunks.rs index 4d2641f5..e91e6b01 100644 --- a/azalea-client/src/chunks.rs +++ b/azalea-client/src/chunks.rs @@ -4,17 +4,18 @@ use std::{ io::Cursor, + ops::Deref, time::{Duration, Instant}, }; use azalea_core::position::ChunkPos; -use azalea_nbt::NbtCompound; use azalea_protocol::packets::game::{ clientbound_level_chunk_with_light_packet::ClientboundLevelChunkWithLightPacket, serverbound_chunk_batch_received_packet::ServerboundChunkBatchReceivedPacket, }; use bevy_app::{App, Plugin, Update}; use bevy_ecs::prelude::*; +use simdnbt::owned::BaseNbt; use tracing::{error, trace}; use crate::{ @@ -99,10 +100,10 @@ fn handle_receive_chunk_events( } } - let heightmaps = event.packet.chunk_data.heightmaps.as_compound(); + let heightmaps_nbt = &event.packet.chunk_data.heightmaps; // necessary to make the unwrap_or work - let empty_nbt_compound = NbtCompound::default(); - let heightmaps = heightmaps.unwrap_or(&empty_nbt_compound); + let empty_nbt = BaseNbt::default(); + let heightmaps = heightmaps_nbt.unwrap_or(&empty_nbt).deref(); if let Err(e) = partial_instance.chunks.replace_with_packet_data( &pos, diff --git a/azalea-client/src/interact.rs b/azalea-client/src/interact.rs index 64cbd7be..bdb17827 100644 --- a/azalea-client/src/interact.rs +++ b/azalea-client/src/interact.rs @@ -11,7 +11,6 @@ use azalea_entity::{ clamp_look_direction, view_vector, Attributes, EyeHeight, LocalEntity, LookDirection, Position, }; use azalea_inventory::{ItemSlot, ItemSlotData}; -use azalea_nbt::NbtList; use azalea_physics::clip::{BlockShapeType, ClipContext, FluidPickType}; use azalea_protocol::packets::game::{ serverbound_interact_packet::InteractionHand, @@ -29,6 +28,7 @@ use bevy_ecs::{ system::{Commands, Query, Res}, }; use derive_more::{Deref, DerefMut}; +use simdnbt::owned::NbtList; use tracing::warn; use crate::{ @@ -272,9 +272,8 @@ pub fn check_block_can_be_broken_by_item_in_adventure_mode( let Some(can_destroy) = item .nbt - .as_compound() - .and_then(|nbt| nbt.get("tag").and_then(|nbt| nbt.as_compound())) - .and_then(|nbt| nbt.get("CanDestroy").and_then(|nbt| nbt.as_list())) + .compound("tag") + .and_then(|nbt| nbt.list("CanDestroy")) else { // no CanDestroy tag return false; |
