Hi, I have to change the chunk loading system to reduce a lot of lag when I ride my flying chicken,
the following code work fine and allow me to not lag anymore:
But i have a small problem here :
send packet event-packet to event-player
Cause this can be an old packet and the chunk can be modified while I ride my chicken, I don't know how to send an actual chunk to a player ( Load/unload chunk is server side, and placing a block do not send a new chunk packet)
So if i do :
How to send a chunk to a player ?
the following code work fine and allow me to not lag anymore:
code_language.skript:
on packet event play_server_map_chunk:
{game} is "start"
if vehicle of player is a chicken:
set {_Cx} to (int pnum 0 of event-packet)
set {_Cz} to (int pnum 1 of event-packet)
{CHUNK::%event-player%::%{_Cx}%_%{_Cz}%} is not set
cancel event
while event-player is riding a chicken:
set {_Px} to chunk-x of chunk of event-player
set {_Pz} to chunk-z of chunk of event-player
set {_x} to {_Cx} - {_Px}
set {_z} to {_Cz} - {_Pz}
set {_D} to sqrt ( ({_x}^2) + ({_z}^2) )
if {_D} <= 6:
set {CHUNK::%event-player%::%{_Cx}%_%{_Cz}%} to true
send packet event-packet to event-player
wait a second
delete {CHUNK::%event-player%::%{_Cx}%_%{_Cz}%}
stop
wait a second
But i have a small problem here :
send packet event-packet to event-player
Cause this can be an old packet and the chunk can be modified while I ride my chicken, I don't know how to send an actual chunk to a player ( Load/unload chunk is server side, and placing a block do not send a new chunk packet)
So if i do :
code_language.skript:
command /chunk <integer> <integer>:
trigger:
set {_packet} to new play_server_unload_chunk packet
set int pnum 0 of {_packet} to arg-1
set int pnum 1 of {_packet} to arg-2
send packet {_packet} to player
on packet event play_server_unload_chunk:
{game} is "start"
set {_Cx} to (int pnum 0 of event-packet)
set {_Cz} to (int pnum 1 of event-packet)
broadcast "unload %{_Cx}% %{_Cz}%"
How to send a chunk to a player ?