diff options
| -rw-r--r-- | azalea-client/src/client.rs | 1 | ||||
| -rw-r--r-- | azalea-core/src/position.rs | 1 | ||||
| -rw-r--r-- | azalea-physics/src/lib.rs | 11 | ||||
| -rw-r--r-- | bot/src/main.rs | 20 |
4 files changed, 19 insertions, 14 deletions
diff --git a/azalea-client/src/client.rs b/azalea-client/src/client.rs index c495bc5c..eae0a1b6 100644 --- a/azalea-client/src/client.rs +++ b/azalea-client/src/client.rs @@ -716,6 +716,7 @@ impl Client { if let Err(e) = client.send_position().await { println!("Error sending position: {:?}", e); } + client.ai_step(); // TODO: minecraft does ambient sounds here diff --git a/azalea-core/src/position.rs b/azalea-core/src/position.rs index f54510b5..6a0de350 100644 --- a/azalea-core/src/position.rs +++ b/azalea-core/src/position.rs @@ -303,6 +303,7 @@ const X_OFFSET: u64 = PACKED_Y_LENGTH + PACKED_Z_LENGTH; impl McBufReadable for BlockPos { fn read_from(buf: &mut impl Read) -> Result<Self, BufReadError> { let val = u64::read_from(buf)?; + println!("reading blockpos from {}", val); let x = (val << 64 - X_OFFSET - PACKED_X_LENGTH >> 64 - PACKED_X_LENGTH) as i32; let y = (val << 64 - PACKED_Y_LENGTH >> 64 - PACKED_Y_LENGTH) as i32; let z = (val << 64 - Z_OFFSET - PACKED_Z_LENGTH >> 64 - PACKED_Z_LENGTH) as i32; diff --git a/azalea-physics/src/lib.rs b/azalea-physics/src/lib.rs index 8842727b..642fa89e 100644 --- a/azalea-physics/src/lib.rs +++ b/azalea-physics/src/lib.rs @@ -34,7 +34,10 @@ impl HasPhysics for EntityMut<'_> { let block_below: Box<dyn Block> = block_state_below.into(); block_below.behavior().friction } else { - unreachable!("Block below should be a real block.") + unreachable!( + "Block below at {:?} should be a real block.", + block_pos_below + ) }; let inertia = if self.on_ground { @@ -86,10 +89,10 @@ impl HasPhysics for EntityMut<'_> { fn get_block_pos_below_that_affects_movement(entity: &EntityData) -> BlockPos { BlockPos::new( - entity.pos().x as i32, + entity.pos().x.floor() as i32, // TODO: this uses bounding_box.min_y instead of position.y - (entity.pos().y - 0.5f64) as i32, - entity.pos().z as i32, + (entity.pos().y - 0.5f64).floor() as i32, + entity.pos().z.floor() as i32, ) } diff --git a/bot/src/main.rs b/bot/src/main.rs index c8f6bea7..bad00b57 100644 --- a/bot/src/main.rs +++ b/bot/src/main.rs @@ -55,16 +55,16 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> { // client.move_entity() // println!("{}", m.to_ansi(None)); - if let Err(e) = client - .move_entity(&Vec3 { - x: 0., - y: -0.5, - z: 0., - }) - .await - { - eprintln!("{:?}", e); - } + // if let Err(e) = client + // .move_entity(&Vec3 { + // x: 0., + // y: -0.5, + // z: 0., + // }) + // .await + // { + // eprintln!("{:?}", e); + // } } _ => {} } |
