aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--azalea-client/tests/enchantments.rs2
-rw-r--r--azalea-core/src/position.rs14
-rw-r--r--azalea-core/src/registry_holder/entity_effect.rs7
-rw-r--r--azalea/src/swarm/mod.rs10
4 files changed, 23 insertions, 10 deletions
diff --git a/azalea-client/tests/enchantments.rs b/azalea-client/tests/enchantments.rs
index 8e1a695c..4486fba1 100644
--- a/azalea-client/tests/enchantments.rs
+++ b/azalea-client/tests/enchantments.rs
@@ -26,7 +26,7 @@ fn test_enchantments() {
.into_iter()
.collect(),
});
- // actual registry data copied from vanillaw
+ // actual registry data copied from vanilla
s.receive_packet(ClientboundRegistryData {
registry_id: Identifier::new("minecraft:enchantment"),
entries: vec![(
diff --git a/azalea-core/src/position.rs b/azalea-core/src/position.rs
index cdf4b1b9..80b189ce 100644
--- a/azalea-core/src/position.rs
+++ b/azalea-core/src/position.rs
@@ -314,9 +314,17 @@ pub struct Vec3 {
vec3_impl!(Vec3, f64);
impl simdnbt::FromNbtTag for Vec3 {
fn from_nbt_tag(tag: NbtTag) -> Option<Self> {
- let pos = tag.list()?.doubles()?;
- let [x, y, z] = <[f64; 3]>::try_from(pos).ok()?;
- Some(Self { x, y, z })
+ let pos = tag.list()?;
+ if let Some(pos) = pos.doubles() {
+ let [x, y, z] = <[f64; 3]>::try_from(pos).ok()?;
+ Some(Self { x, y, z })
+ } else if let Some(pos) = pos.floats() {
+ // used on hypixel
+ let [x, y, z] = <[f32; 3]>::try_from(pos).ok()?.map(|f| f as f64);
+ Some(Self { x, y, z })
+ } else {
+ None
+ }
}
}
diff --git a/azalea-core/src/registry_holder/entity_effect.rs b/azalea-core/src/registry_holder/entity_effect.rs
index 4cb914e3..00efde21 100644
--- a/azalea-core/src/registry_holder/entity_effect.rs
+++ b/azalea-core/src/registry_holder/entity_effect.rs
@@ -12,6 +12,7 @@ use simdnbt::{
Deserialize, DeserializeError,
borrow::{NbtCompound, NbtTag},
};
+use tracing::error;
use crate::{
position::{Vec3, Vec3i},
@@ -44,7 +45,7 @@ pub enum EntityEffect {
impl Deserialize for EntityEffect {
fn from_compound(nbt: NbtCompound) -> Result<Self, DeserializeError> {
let kind = get_in_compound(&nbt, "type")?;
- match kind {
+ let res = match kind {
EntityEffectKind::AllOf => Deserialize::from_compound(nbt).map(Self::AllOf),
EntityEffectKind::ApplyMobEffect => {
Deserialize::from_compound(nbt).map(Self::ApplyMobEffect)
@@ -78,7 +79,11 @@ impl Deserialize for EntityEffect {
EntityEffectKind::SummonEntity => {
Deserialize::from_compound(nbt).map(Self::SummonEntity)
}
+ };
+ if res.is_err() {
+ error!("Error deserializing EntityEffect {kind}: {nbt:?}");
}
+ res
}
}
diff --git a/azalea/src/swarm/mod.rs b/azalea/src/swarm/mod.rs
index db5dd394..05efa083 100644
--- a/azalea/src/swarm/mod.rs
+++ b/azalea/src/swarm/mod.rs
@@ -218,27 +218,27 @@ impl Swarm {
static WARNED_1_000: AtomicBool = AtomicBool::new(false);
if !WARNED_1_000.swap(true, atomic::Ordering::Relaxed) {
warn!(
- "the client's Event channel has more than 1,000 items! this is probably fine but if you're concerned about it, maybe consider disabling the packet-event feature in azalea to reduce the number of events?"
+ "The client's Event channel has more than 1,000 items! If you don't need it, consider disabling the `packet-event` feature for `azalea`."
)
}
if rx.len() > 10_000 {
static WARNED_10_000: AtomicBool = AtomicBool::new(false);
if !WARNED_10_000.swap(true, atomic::Ordering::Relaxed) {
- warn!("the client's Event channel has more than 10,000 items!!")
+ warn!("The client's Event channel has more than 10,000 items!!")
}
if rx.len() > 100_000 {
static WARNED_100_000: AtomicBool = AtomicBool::new(false);
if !WARNED_100_000.swap(true, atomic::Ordering::Relaxed) {
- warn!("the client's Event channel has more than 100,000 items!!!")
+ warn!("The client's Event channel has more than 100,000 items!!!")
}
if rx.len() > 1_000_000 {
static WARNED_1_000_000: AtomicBool = AtomicBool::new(false);
if !WARNED_1_000_000.swap(true, atomic::Ordering::Relaxed) {
warn!(
- "the client's Event channel has more than 1,000,000 items!!!! your code is almost certainly leaking memory"
+ "The client's Event channel has more than 1,000,000 items!!!! your code is almost certainly leaking memory"
)
}
}
@@ -248,7 +248,7 @@ impl Swarm {
if let Event::Disconnect(_) = event {
debug!(
- "sending SwarmEvent::Disconnect due to receiving an Event::Disconnect from client {}",
+ "Sending SwarmEvent::Disconnect due to receiving an Event::Disconnect from client {}",
bot.entity
);
let account = bot