@@ -3,13 +3,12 @@ use azalea::{
33 entity:: Position ,
44 interact:: HitResultComponent ,
55 pathfinder:: {
6- ExecutingPath , GotoEvent , Pathfinder , PathfinderClientExt ,
6+ ExecutingPath , Pathfinder , PathfinderClientExt ,
77 goals:: { BlockPosGoal , Goal , InverseGoal , RadiusGoal , ReachBlockPosGoal , XZGoal , YGoal } ,
88 } ,
99 protocol:: packets:: game:: { ServerboundPlayerCommand , s_player_command:: Action } ,
1010 world:: MinecraftEntityId ,
1111} ;
12- use log:: error;
1312use mlua:: { FromLua , Lua , Result , Table , UserDataRef , Value } ;
1413
1514use super :: { Client , Direction , Vec3 } ;
@@ -121,11 +120,7 @@ pub async fn start_go_to(
121120 } else {
122121 client. start_goto ( goal) ;
123122 }
124- while client. get_tick_broadcaster ( ) . recv ( ) . await . is_ok ( ) {
125- if client. ecs . lock ( ) . get :: < GotoEvent > ( client. entity ) . is_none ( ) {
126- break ;
127- }
128- }
123+ let _ = client. get_tick_broadcaster ( ) . recv ( ) . await ;
129124
130125 Ok ( ( ) )
131126}
@@ -215,17 +210,15 @@ pub fn set_position(_lua: &Lua, client: &Client, new_position: Vec3) -> Result<(
215210}
216211
217212pub fn set_sneaking ( _lua : & Lua , client : & Client , sneaking : bool ) -> Result < ( ) > {
218- if let Err ( error ) = client. write_packet ( ServerboundPlayerCommand {
213+ client. write_packet ( ServerboundPlayerCommand {
219214 id : client. component :: < MinecraftEntityId > ( ) ,
220215 action : if sneaking {
221216 Action :: PressShiftKey
222217 } else {
223218 Action :: ReleaseShiftKey
224219 } ,
225220 data : 0 ,
226- } ) {
227- error ! ( "failed to send PlayerCommand packet: {error:?}" ) ;
228- }
221+ } ) ;
229222 Ok ( ( ) )
230223}
231224
@@ -244,13 +237,11 @@ pub fn stop_pathfinding(_lua: &Lua, client: &Client, (): ()) -> Result<()> {
244237}
245238
246239pub fn stop_sleeping ( _lua : & Lua , client : & Client , ( ) : ( ) ) -> Result < ( ) > {
247- if let Err ( error ) = client. write_packet ( ServerboundPlayerCommand {
240+ client. write_packet ( ServerboundPlayerCommand {
248241 id : client. component :: < MinecraftEntityId > ( ) ,
249242 action : Action :: StopSleeping ,
250243 data : 0 ,
251- } ) {
252- error ! ( "failed to send PlayerCommand packet: {error:?}" ) ;
253- }
244+ } ) ;
254245 Ok ( ( ) )
255246}
256247
0 commit comments