File tree 3 files changed +23
-17
lines changed
lib/net/src/packets/outgoing
3 files changed +23
-17
lines changed Original file line number Diff line number Diff line change
1
+ use ferrumc_macros:: event_handler;
2
+ use ferrumc_net:: errors:: NetError ;
3
+ use ferrumc_net:: packets:: outgoing:: entity_animation:: EntityAnimationEvent ;
4
+ use ferrumc_net:: utils:: broadcast:: { broadcast, BroadcastOptions } ;
5
+ use ferrumc_state:: GlobalState ;
6
+
7
+ #[ event_handler]
8
+ async fn entity_animation (
9
+ event : EntityAnimationEvent ,
10
+ state : GlobalState ,
11
+ ) -> Result < EntityAnimationEvent , NetError > {
12
+ //TODO change this global broadcast to a broadcast that affects only players in the view distance
13
+ // of the player doing it, but as long as we still cant see other players, this will be fine.
14
+
15
+ broadcast (
16
+ & event. packet ,
17
+ & state,
18
+ BroadcastOptions :: default ( ) . except ( [ event. eid . val as usize ] ) ,
19
+ )
20
+ . await ?;
21
+ Ok ( event)
22
+ }
Original file line number Diff line number Diff line change
1
+ mod animations;
1
2
mod handshake;
2
3
mod login_process;
3
4
mod tick_handler;
Original file line number Diff line number Diff line change @@ -19,23 +19,6 @@ pub struct EntityAnimationEvent {
19
19
pub packet : EntityAnimationPacket ,
20
20
}
21
21
22
- #[ event_handler]
23
- async fn entity_animation (
24
- event : EntityAnimationEvent ,
25
- state : GlobalState ,
26
- ) -> Result < EntityAnimationEvent , NetError > {
27
- //TODO change this global broadcast to a broadcast that affects only players in the view distance
28
- // of the player doing it, but as long as we still cant see other players, this will be fine.
29
-
30
- broadcast (
31
- & event. packet ,
32
- & state,
33
- BroadcastOptions :: default ( ) . except ( [ event. eid . val as usize ] ) ,
34
- )
35
- . await ?;
36
- Ok ( event)
37
- }
38
-
39
22
impl EntityAnimationPacket {
40
23
pub fn new ( eid : VarInt , animation : u8 ) -> Self {
41
24
Self { eid, animation }
You can’t perform that action at this time.
0 commit comments