mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-22 10:36:10 +01:00
Return to using arm swings to update entity yaw
This commit is contained in:
parent
0b076b1a21
commit
bdd995197a
@ -22,7 +22,7 @@ import net.citizensnpcs.util.NMS;
|
||||
import net.minecraft.server.v1_13_R2.Entity;
|
||||
import net.minecraft.server.v1_13_R2.EntityPlayer;
|
||||
import net.minecraft.server.v1_13_R2.EntityTrackerEntry;
|
||||
import net.minecraft.server.v1_13_R2.PacketPlayOutEntity.PacketPlayOutEntityLook;
|
||||
import net.minecraft.server.v1_13_R2.PacketPlayOutAnimation;
|
||||
|
||||
public class PlayerlistTrackerEntry extends EntityTrackerEntry {
|
||||
private final Entity tracker;
|
||||
@ -86,9 +86,7 @@ public class PlayerlistTrackerEntry extends EntityTrackerEntry {
|
||||
NMS.sendTabListAdd(entityplayer.getBukkitEntity(), (Player) tracker.getBukkitEntity());
|
||||
lastUpdatedPlayer = null;
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(CitizensAPI.getPlugin(), () -> {
|
||||
NMSImpl.sendPacket(entityplayer.getBukkitEntity(),
|
||||
new PacketPlayOutEntityLook(tracker.getId(), (byte) (tracker.yaw * 256.0F / 360.0F),
|
||||
(byte) (tracker.pitch * 256.0F / 360.0F), tracker.onGround));
|
||||
NMSImpl.sendPacket(entityplayer.getBukkitEntity(), new PacketPlayOutAnimation(tracker, 0));
|
||||
}, 1);
|
||||
if (!Setting.DISABLE_TABLIST.asBoolean())
|
||||
return;
|
||||
|
@ -21,7 +21,7 @@ import net.citizensnpcs.util.NMS;
|
||||
import net.minecraft.server.v1_14_R1.Entity;
|
||||
import net.minecraft.server.v1_14_R1.EntityPlayer;
|
||||
import net.minecraft.server.v1_14_R1.EntityTrackerEntry;
|
||||
import net.minecraft.server.v1_14_R1.PacketPlayOutEntity.PacketPlayOutEntityLook;
|
||||
import net.minecraft.server.v1_14_R1.PacketPlayOutAnimation;
|
||||
import net.minecraft.server.v1_14_R1.PlayerChunkMap;
|
||||
import net.minecraft.server.v1_14_R1.PlayerChunkMap.EntityTracker;
|
||||
|
||||
@ -86,9 +86,7 @@ public class PlayerlistTracker extends PlayerChunkMap.EntityTracker {
|
||||
final EntityPlayer entityplayer = lastUpdatedPlayer;
|
||||
NMS.sendTabListAdd(entityplayer.getBukkitEntity(), (Player) tracker.getBukkitEntity());
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(CitizensAPI.getPlugin(), () -> {
|
||||
NMSImpl.sendPacket(entityplayer.getBukkitEntity(),
|
||||
new PacketPlayOutEntityLook(tracker.getId(), (byte) (tracker.yaw * 256.0F / 360.0F),
|
||||
(byte) (tracker.pitch * 256.0F / 360.0F), tracker.onGround));
|
||||
NMSImpl.sendPacket(entityplayer.getBukkitEntity(), new PacketPlayOutAnimation(tracker, 0));
|
||||
}, 1);
|
||||
if (!Setting.DISABLE_TABLIST.asBoolean())
|
||||
return;
|
||||
|
@ -21,7 +21,7 @@ import net.citizensnpcs.util.NMS;
|
||||
import net.minecraft.server.v1_15_R1.Entity;
|
||||
import net.minecraft.server.v1_15_R1.EntityPlayer;
|
||||
import net.minecraft.server.v1_15_R1.EntityTrackerEntry;
|
||||
import net.minecraft.server.v1_15_R1.PacketPlayOutEntity.PacketPlayOutEntityLook;
|
||||
import net.minecraft.server.v1_15_R1.PacketPlayOutAnimation;
|
||||
import net.minecraft.server.v1_15_R1.PlayerChunkMap;
|
||||
import net.minecraft.server.v1_15_R1.PlayerChunkMap.EntityTracker;
|
||||
|
||||
@ -86,9 +86,7 @@ public class PlayerlistTracker extends PlayerChunkMap.EntityTracker {
|
||||
final EntityPlayer entityplayer = lastUpdatedPlayer;
|
||||
NMS.sendTabListAdd(entityplayer.getBukkitEntity(), (Player) tracker.getBukkitEntity());
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(CitizensAPI.getPlugin(), () -> {
|
||||
NMSImpl.sendPacket(entityplayer.getBukkitEntity(),
|
||||
new PacketPlayOutEntityLook(tracker.getId(), (byte) (tracker.yaw * 256.0F / 360.0F),
|
||||
(byte) (tracker.pitch * 256.0F / 360.0F), tracker.onGround));
|
||||
NMSImpl.sendPacket(entityplayer.getBukkitEntity(), new PacketPlayOutAnimation(tracker, 0));
|
||||
}, 1);
|
||||
if (!Setting.DISABLE_TABLIST.asBoolean())
|
||||
return;
|
||||
|
@ -21,7 +21,7 @@ import net.citizensnpcs.util.NMS;
|
||||
import net.minecraft.server.v1_16_R3.Entity;
|
||||
import net.minecraft.server.v1_16_R3.EntityPlayer;
|
||||
import net.minecraft.server.v1_16_R3.EntityTrackerEntry;
|
||||
import net.minecraft.server.v1_16_R3.PacketPlayOutEntity.PacketPlayOutEntityLook;
|
||||
import net.minecraft.server.v1_16_R3.PacketPlayOutAnimation;
|
||||
import net.minecraft.server.v1_16_R3.PlayerChunkMap;
|
||||
import net.minecraft.server.v1_16_R3.PlayerChunkMap.EntityTracker;
|
||||
|
||||
@ -86,9 +86,7 @@ public class PlayerlistTracker extends PlayerChunkMap.EntityTracker {
|
||||
final EntityPlayer entityplayer = lastUpdatedPlayer;
|
||||
NMS.sendTabListAdd(entityplayer.getBukkitEntity(), (Player) tracker.getBukkitEntity());
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(CitizensAPI.getPlugin(), () -> {
|
||||
NMSImpl.sendPacket(entityplayer.getBukkitEntity(),
|
||||
new PacketPlayOutEntityLook(tracker.getId(), (byte) (tracker.yaw * 256.0F / 360.0F),
|
||||
(byte) (tracker.pitch * 256.0F / 360.0F), tracker.isOnGround()));
|
||||
NMSImpl.sendPacket(entityplayer.getBukkitEntity(), new PacketPlayOutAnimation(tracker, 0));
|
||||
}, 1);
|
||||
if (!Setting.DISABLE_TABLIST.asBoolean())
|
||||
return;
|
||||
|
@ -13,7 +13,7 @@ import net.citizensnpcs.api.npc.NPC;
|
||||
import net.citizensnpcs.nms.v1_17_R1.entity.EntityHumanNPC;
|
||||
import net.citizensnpcs.npc.ai.NPCHolder;
|
||||
import net.citizensnpcs.util.NMS;
|
||||
import net.minecraft.network.protocol.game.ClientboundMoveEntityPacket;
|
||||
import net.minecraft.network.protocol.game.ClientboundAnimatePacket;
|
||||
import net.minecraft.server.level.ChunkMap;
|
||||
import net.minecraft.server.level.ChunkMap.TrackedEntity;
|
||||
import net.minecraft.server.level.ServerEntity;
|
||||
@ -40,9 +40,7 @@ public class PlayerlistTracker extends ChunkMap.TrackedEntity {
|
||||
final ServerPlayer entityplayer = lastUpdatedPlayer;
|
||||
NMS.sendTabListAdd(entityplayer.getBukkitEntity(), (Player) tracker.getBukkitEntity());
|
||||
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.isOnGround()));
|
||||
NMSImpl.sendPacket(entityplayer.getBukkitEntity(), new ClientboundAnimatePacket(tracker, 0));
|
||||
}, 1);
|
||||
if (!Setting.DISABLE_TABLIST.asBoolean())
|
||||
return;
|
||||
|
@ -13,7 +13,7 @@ import net.citizensnpcs.api.npc.NPC;
|
||||
import net.citizensnpcs.nms.v1_18_R2.entity.EntityHumanNPC;
|
||||
import net.citizensnpcs.npc.ai.NPCHolder;
|
||||
import net.citizensnpcs.util.NMS;
|
||||
import net.minecraft.network.protocol.game.ClientboundMoveEntityPacket;
|
||||
import net.minecraft.network.protocol.game.ClientboundAnimatePacket;
|
||||
import net.minecraft.server.level.ChunkMap;
|
||||
import net.minecraft.server.level.ChunkMap.TrackedEntity;
|
||||
import net.minecraft.server.level.ServerEntity;
|
||||
@ -40,9 +40,7 @@ public class PlayerlistTracker extends ChunkMap.TrackedEntity {
|
||||
final ServerPlayer entityplayer = lastUpdatedPlayer;
|
||||
NMS.sendTabListAdd(entityplayer.getBukkitEntity(), (Player) tracker.getBukkitEntity());
|
||||
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));
|
||||
NMSImpl.sendPacket(entityplayer.getBukkitEntity(), new ClientboundAnimatePacket(tracker, 0));
|
||||
}, 1);
|
||||
if (!Setting.DISABLE_TABLIST.asBoolean())
|
||||
return;
|
||||
|
@ -16,7 +16,7 @@ import net.citizensnpcs.api.npc.NPC;
|
||||
import net.citizensnpcs.nms.v1_19_R3.entity.EntityHumanNPC;
|
||||
import net.citizensnpcs.npc.ai.NPCHolder;
|
||||
import net.citizensnpcs.util.NMS;
|
||||
import net.minecraft.network.protocol.game.ClientboundMoveEntityPacket;
|
||||
import net.minecraft.network.protocol.game.ClientboundAnimatePacket;
|
||||
import net.minecraft.server.level.ChunkMap;
|
||||
import net.minecraft.server.level.ChunkMap.TrackedEntity;
|
||||
import net.minecraft.server.level.ServerEntity;
|
||||
@ -63,17 +63,12 @@ public class CitizensEntityTracker extends ChunkMap.TrackedEntity {
|
||||
boolean sendTabRemove = NMS.sendTabListAdd(entityplayer.getBukkitEntity(), (Player) tracker.getBukkitEntity());
|
||||
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));
|
||||
NMSImpl.sendPacket(entityplayer.getBukkitEntity(), new ClientboundAnimatePacket(tracker, 0));
|
||||
}, 1);
|
||||
return;
|
||||
}
|
||||
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));
|
||||
NMSImpl.sendPacket(entityplayer.getBukkitEntity(), new ClientboundAnimatePacket(tracker, 0));
|
||||
NMS.sendTabListRemove(entityplayer.getBukkitEntity(), (Player) tracker.getBukkitEntity());
|
||||
}, Setting.TABLIST_REMOVE_PACKET_DELAY.asTicks());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user