mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2025-01-26 18:11:49 +01:00
Trial sending rot packet on spawn
This commit is contained in:
parent
dd440ed653
commit
dacaa921b6
@ -16,6 +16,7 @@ import net.citizensnpcs.api.npc.NPC;
|
|||||||
import net.citizensnpcs.nms.v1_19_R3.entity.EntityHumanNPC;
|
import net.citizensnpcs.nms.v1_19_R3.entity.EntityHumanNPC;
|
||||||
import net.citizensnpcs.npc.ai.NPCHolder;
|
import net.citizensnpcs.npc.ai.NPCHolder;
|
||||||
import net.citizensnpcs.util.NMS;
|
import net.citizensnpcs.util.NMS;
|
||||||
|
import net.minecraft.network.protocol.game.ClientboundMoveEntityPacket;
|
||||||
import net.minecraft.server.level.ChunkMap;
|
import net.minecraft.server.level.ChunkMap;
|
||||||
import net.minecraft.server.level.ChunkMap.TrackedEntity;
|
import net.minecraft.server.level.ChunkMap.TrackedEntity;
|
||||||
import net.minecraft.server.level.ServerEntity;
|
import net.minecraft.server.level.ServerEntity;
|
||||||
@ -61,9 +62,18 @@ public class CitizensEntityTracker extends ChunkMap.TrackedEntity {
|
|||||||
final ServerPlayer entityplayer = lastUpdatedPlayer;
|
final ServerPlayer entityplayer = lastUpdatedPlayer;
|
||||||
boolean sendTabRemove = NMS.sendTabListAdd(entityplayer.getBukkitEntity(), (Player) tracker.getBukkitEntity());
|
boolean sendTabRemove = NMS.sendTabListAdd(entityplayer.getBukkitEntity(), (Player) tracker.getBukkitEntity());
|
||||||
if (!sendTabRemove || !Setting.DISABLE_TABLIST.asBoolean()) {
|
if (!sendTabRemove || !Setting.DISABLE_TABLIST.asBoolean()) {
|
||||||
|
Bukkit.getScheduler().scheduleSyncDelayedTask(CitizensAPI.getPlugin(), () -> {
|
||||||
|
NMSImpl.sendPacket(entityplayer.getBukkitEntity(),
|
||||||
|
new ClientboundMoveEntityPacket.Rot(tracker.getId(),
|
||||||
|
(byte) (tracker.getYRot() * 256.0F / 360.0F),
|
||||||
|
(byte) (tracker.getXRot() * 256.0F / 360.0F), tracker.onGround));
|
||||||
|
}, 1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Bukkit.getScheduler().scheduleSyncDelayedTask(CitizensAPI.getPlugin(), () -> {
|
Bukkit.getScheduler().scheduleSyncDelayedTask(CitizensAPI.getPlugin(), () -> {
|
||||||
|
NMSImpl.sendPacket(entityplayer.getBukkitEntity(),
|
||||||
|
new ClientboundMoveEntityPacket.Rot(tracker.getId(), (byte) (tracker.getYRot() * 256.0F / 360.0F),
|
||||||
|
(byte) (tracker.getXRot() * 256.0F / 360.0F), tracker.onGround));
|
||||||
NMS.sendTabListRemove(entityplayer.getBukkitEntity(), (Player) tracker.getBukkitEntity());
|
NMS.sendTabListRemove(entityplayer.getBukkitEntity(), (Player) tracker.getBukkitEntity());
|
||||||
}, Setting.TABLIST_REMOVE_PACKET_DELAY.asTicks());
|
}, Setting.TABLIST_REMOVE_PACKET_DELAY.asTicks());
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user