@@ -34,26 +34,13 @@ public function onDeath(PlayerDeathEvent $event) :bool{
34
34
}
35
35
public function Lightning (Player $ player ) :void {
36
36
if (in_array ($ player ->getWorld ()->getFolderName (), $ this ->getOwner ()->getConfig ()->get ("worlds " ))){
37
- $ pos = $ player ->getPosition ();
38
- $ light = new AddActorPacket ();
39
- $ light ->type = "minecraft:lightning_bolt " ;
40
- $ light ->actorRuntimeId = 1 ;
41
- $ light ->metadata = [];
42
- $ light ->motion = null ;
43
- $ light ->yaw = $ player ->getLocation ()->getYaw ();
44
- $ light ->pitch = $ player ->getLocation ()->getPitch ();
45
- $ light ->position = new Vector3 ($ pos ->getX (), $ pos ->getY (), $ pos ->getZ ());
37
+ $ pos = $ player ->getPosition ();
38
+ $ light2 = AddActorPacket::create (Entity::nextRuntimeId (), 1 , "minecraft:lightning_bolt " , $ player ->getPosition ()->asVector3 (), null , $ player ->getLocation ()->getYaw (), $ player ->getLocation ()->getPitch (), 0.0 , [], [], []);
46
39
$ block = $ player ->getWorld ()->getBlock ($ player ->getPosition ()->floor ()->down ());
47
40
$ particle = new BlockBreakParticle ($ block );
48
- $ player ->getWorld ()->addParticle ($ pos ->asVector3 (), $ particle , $ player ->getWorld ()->getPlayers ());
49
- $ sound = new PlaySoundPacket ();
50
- $ sound ->soundName = "ambient.weather.thunder " ;
51
- $ sound ->x = $ pos ->getX ();
52
- $ sound ->y = $ pos ->getY ();
53
- $ sound ->z = $ pos ->getZ ();
54
- $ sound ->volume = 1 ;
55
- $ sound ->pitch = 1 ;
56
- Server::getInstance ()->broadcastPackets ($ player ->getWorld ()->getPlayers (), [$ light , $ sound ]);
41
+ $ player ->getWorld ()->addParticle ($ pos , $ particle , $ player ->getWorld ()->getPlayers ());
42
+ $ sound2 = PlaySoundPacket::create ("ambient.weather.thunder " , $ pos ->getX (), $ pos ->getY (), $ pos ->getZ (), 1 , 1 );
43
+ Server::getInstance ()->broadcastPackets ($ player ->getWorld ()->getPlayers (), [$ light2 , $ sound2 ]);
57
44
}
58
45
}
59
46
0 commit comments