Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Set air block state when breaking a block #239

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion pumpkin/src/client/player_packet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,6 @@ impl Player {
return;
}
// Block break & block break sound
// TODO: currently this is always dirt replace it
let entity = &self.living_entity.entity;
let world = &entity.world;
world.break_block(location).await;
Expand Down
11 changes: 8 additions & 3 deletions pumpkin/src/world/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ use pumpkin_protocol::{
},
ClientPacket, VarInt,
};
use pumpkin_world::chunk::ChunkData;
use pumpkin_world::coordinates::ChunkRelativeBlockCoordinates;
use pumpkin_world::level::Level;
use pumpkin_world::{block::BlockState, chunk::ChunkData};
use rand::{thread_rng, Rng};
use scoreboard::Scoreboard;
use tokio::sync::{mpsc::Receiver, Mutex};
Expand Down Expand Up @@ -622,8 +622,13 @@ impl World {
pub async fn break_block(&self, position: WorldPosition) {
self.set_block(position, 0).await;

self.broadcast_packet_all(&CWorldEvent::new(2001, &position, 11, false))
.await;
self.broadcast_packet_all(&CWorldEvent::new(
2001,
&position,
i32::from(BlockState::AIR.state_id),
false,
))
.await;
}

pub async fn get_block(&self, position: WorldPosition) -> u16 {
Expand Down