8
8
import com .github .retrooper .packetevents .protocol .teleport .RelativeFlag ;
9
9
import com .github .retrooper .packetevents .util .Vector3d ;
10
10
import com .github .retrooper .packetevents .wrapper .PacketWrapper ;
11
- import com .github .retrooper .packetevents .wrapper .play .server .WrapperPlayServerDestroyEntities ;
12
- import com .github .retrooper .packetevents .wrapper .play .server .WrapperPlayServerEntityPositionSync ;
13
- import com .github .retrooper .packetevents .wrapper .play .server .WrapperPlayServerEntityTeleport ;
14
- import com .github .retrooper .packetevents .wrapper .play .server .WrapperPlayServerSpawnEntity ;
11
+ import com .github .retrooper .packetevents .wrapper .play .server .*;
15
12
import io .github .retrooper .packetevents .util .SpigotConversionUtil ;
16
13
import lombok .Getter ;
14
+ import lombok .Setter ;
17
15
import org .bukkit .Location ;
18
16
import org .bukkit .entity .Player ;
19
17
import org .jetbrains .annotations .NotNull ;
25
23
import java .util .concurrent .ThreadLocalRandom ;
26
24
27
25
@ Getter
26
+ @ Setter
28
27
public class PacketEntity {
29
28
30
29
// public static final MinecraftVersion V1_20_5 = new MinecraftVersion("1.20.5");
@@ -41,6 +40,9 @@ public PacketEntity(EntityType type, Set<Player> viewers, Location location) {
41
40
private EntityType type ;
42
41
private Set <Player > viewers ;
43
42
private Location location ;
43
+ private float headYaw ;
44
+ private float headPitch ;
45
+
44
46
private boolean removed = false ;
45
47
public @ NotNull Location getLocation () {
46
48
return location ;
@@ -51,6 +53,7 @@ public boolean teleport(@NotNull Location location) {
51
53
this .location = location .clone ();
52
54
if (sent ) {
53
55
sendLocationPacket (viewers );
56
+ // sendHeadRotation(viewers); // TODO
54
57
}
55
58
return true ;
56
59
}
@@ -89,6 +92,11 @@ public void sendLocationPacket(Collection<Player> players) {
89
92
90
93
}
91
94
95
+ public void sendHeadRotation (Collection <Player > players ) {
96
+ WrapperPlayServerEntityRotation packet = new WrapperPlayServerEntityRotation (id , headYaw , headPitch , false );
97
+ players .forEach (player -> PacketEvents .getAPI ().getPlayerManager ().sendPacket (player , packet ));
98
+ }
99
+
92
100
public void sendEntityDestroyPacket (Collection <Player > players ) {
93
101
WrapperPlayServerDestroyEntities packet = new WrapperPlayServerDestroyEntities (id );
94
102
players .forEach (player -> PacketEvents .getAPI ().getPlayerManager ().sendPacket (player , packet ));
0 commit comments