@@ -8,8 +8,9 @@ use crate::{
8
8
} ;
9
9
use num_traits:: FromPrimitive ;
10
10
use pumpkin_config:: ADVANCED_CONFIG ;
11
+ use pumpkin_core:: math:: position:: WorldPosition ;
11
12
use pumpkin_core:: {
12
- math:: { position :: WorldPosition , vector3:: Vector3 , wrap_degrees} ,
13
+ math:: { vector3:: Vector3 , wrap_degrees} ,
13
14
text:: TextComponent ,
14
15
GameMode ,
15
16
} ;
@@ -18,9 +19,9 @@ use pumpkin_inventory::{InventoryError, WindowType};
18
19
use pumpkin_protocol:: server:: play:: { SCloseContainer , SSetPlayerGround , SUseItem } ;
19
20
use pumpkin_protocol:: {
20
21
client:: play:: {
21
- Animation , CAcknowledgeBlockChange , CBlockUpdate , CEntityAnimation , CEntityVelocity ,
22
- CHeadRot , CHurtAnimation , CPingResponse , CPlayerChatMessage , CUpdateEntityPos ,
23
- CUpdateEntityPosRot , CUpdateEntityRot , FilterType ,
22
+ Animation , CAcknowledgeBlockChange , CEntityAnimation , CEntityVelocity , CHeadRot ,
23
+ CHurtAnimation , CPingResponse , CPlayerChatMessage , CUpdateEntityPos , CUpdateEntityPosRot ,
24
+ CUpdateEntityRot , FilterType ,
24
25
} ,
25
26
server:: play:: {
26
27
Action , ActionType , SChatCommand , SChatMessage , SClientInformationPlay , SConfirmTeleport ,
@@ -29,7 +30,7 @@ use pumpkin_protocol::{
29
30
SUseItemOn , Status ,
30
31
} ,
31
32
} ;
32
- use pumpkin_world:: block:: { BlockFace , BlockState } ;
33
+ use pumpkin_world:: block:: { BlockFace , BlockId , BlockState } ;
33
34
use pumpkin_world:: global_registry;
34
35
35
36
use super :: PlayerConfig ;
@@ -543,17 +544,14 @@ impl Player {
543
544
if let Ok ( block_state_id) = BlockState :: new ( minecraft_id, None ) {
544
545
let entity = & self . living_entity . entity ;
545
546
let world = & entity. world ;
547
+
546
548
world
547
- . broadcast_packet_all ( & CBlockUpdate :: new (
548
- & location,
549
- block_state_id. get_id_mojang_repr ( ) . into ( ) ,
550
- ) )
551
- . await ;
552
- world
553
- . broadcast_packet_all ( & CBlockUpdate :: new (
554
- & WorldPosition ( location. 0 + face. to_offset ( ) ) ,
555
- block_state_id. get_id_mojang_repr ( ) . into ( ) ,
556
- ) )
549
+ . set_block (
550
+ WorldPosition ( location. 0 + face. to_offset ( ) ) ,
551
+ BlockId {
552
+ data : block_state_id. get_id_mojang_repr ( ) as u16 ,
553
+ } ,
554
+ )
557
555
. await ;
558
556
}
559
557
}
0 commit comments