Send entity teleport packet instead of look only for packet sessions, remove from tablist

This commit is contained in:
fullwall 2023-01-29 22:15:32 +08:00
parent e828782be6
commit c258ad1b9a
14 changed files with 190 additions and 49 deletions

View File

@ -101,6 +101,7 @@ public class ProtocolLibListener {
PacketRotationSession session = trait.getPacketSession(event.getPlayer());
if (session == null || !session.isActive())
return;
PacketContainer packet = event.getPacket();
PacketType type = event.getPacketType();
if (type == Server.ENTITY_HEAD_ROTATION) {

View File

@ -228,7 +228,6 @@ import net.minecraft.server.v1_10_R1.NetworkManager;
import net.minecraft.server.v1_10_R1.Packet;
import net.minecraft.server.v1_10_R1.PacketPlayOutAnimation;
import net.minecraft.server.v1_10_R1.PacketPlayOutBed;
import net.minecraft.server.v1_10_R1.PacketPlayOutEntity.PacketPlayOutEntityLook;
import net.minecraft.server.v1_10_R1.PacketPlayOutEntityHeadRotation;
import net.minecraft.server.v1_10_R1.PacketPlayOutEntityTeleport;
import net.minecraft.server.v1_10_R1.PacketPlayOutOpenWindow;
@ -1065,11 +1064,15 @@ public class NMSImpl implements NMSBridge {
@Override
public void sendRotationNearby(org.bukkit.entity.Entity from, float bodyYaw, float headYaw, float pitch) {
Entity handle = getHandle(from);
Packet<?>[] packets = new Packet[] {
new PacketPlayOutEntityLook(handle.getId(), (byte) (bodyYaw * 256.0F / 360.0F),
(byte) (pitch * 256.0F / 360.0F), isOnGround(from)),
float oldBody = handle.yaw;
float oldPitch = handle.pitch;
handle.yaw = bodyYaw;
handle.pitch = pitch;
Packet<?>[] packets = new Packet[] { new PacketPlayOutEntityTeleport(handle),
new PacketPlayOutEntityHeadRotation(handle, (byte) (headYaw * 256.0F / 360.0F)) };
sendPacketsNearby(null, from.getLocation(), packets);
handle.yaw = oldBody;
handle.pitch = oldPitch;
}
@Override

View File

@ -248,7 +248,6 @@ import net.minecraft.server.v1_11_R1.NetworkManager;
import net.minecraft.server.v1_11_R1.Packet;
import net.minecraft.server.v1_11_R1.PacketPlayOutAnimation;
import net.minecraft.server.v1_11_R1.PacketPlayOutBed;
import net.minecraft.server.v1_11_R1.PacketPlayOutEntity.PacketPlayOutEntityLook;
import net.minecraft.server.v1_11_R1.PacketPlayOutEntityHeadRotation;
import net.minecraft.server.v1_11_R1.PacketPlayOutEntityTeleport;
import net.minecraft.server.v1_11_R1.PacketPlayOutOpenWindow;
@ -1124,11 +1123,15 @@ public class NMSImpl implements NMSBridge {
@Override
public void sendRotationNearby(org.bukkit.entity.Entity from, float bodyYaw, float headYaw, float pitch) {
Entity handle = getHandle(from);
Packet<?>[] packets = new Packet[] {
new PacketPlayOutEntityLook(handle.getId(), (byte) (bodyYaw * 256.0F / 360.0F),
(byte) (pitch * 256.0F / 360.0F), isOnGround(from)),
float oldBody = handle.yaw;
float oldPitch = handle.pitch;
handle.yaw = bodyYaw;
handle.pitch = pitch;
Packet<?>[] packets = new Packet[] { new PacketPlayOutEntityTeleport(handle),
new PacketPlayOutEntityHeadRotation(handle, (byte) (headYaw * 256.0F / 360.0F)) };
sendPacketsNearby(null, from.getLocation(), packets);
handle.yaw = oldBody;
handle.pitch = oldPitch;
}
@Override

View File

@ -252,7 +252,6 @@ import net.minecraft.server.v1_12_R1.NetworkManager;
import net.minecraft.server.v1_12_R1.Packet;
import net.minecraft.server.v1_12_R1.PacketPlayOutAnimation;
import net.minecraft.server.v1_12_R1.PacketPlayOutBed;
import net.minecraft.server.v1_12_R1.PacketPlayOutEntity.PacketPlayOutEntityLook;
import net.minecraft.server.v1_12_R1.PacketPlayOutEntityHeadRotation;
import net.minecraft.server.v1_12_R1.PacketPlayOutEntityTeleport;
import net.minecraft.server.v1_12_R1.PacketPlayOutOpenWindow;
@ -1131,11 +1130,15 @@ public class NMSImpl implements NMSBridge {
@Override
public void sendRotationNearby(org.bukkit.entity.Entity from, float bodyYaw, float headYaw, float pitch) {
Entity handle = getHandle(from);
Packet<?>[] packets = new Packet[] {
new PacketPlayOutEntityLook(handle.getId(), (byte) (bodyYaw * 256.0F / 360.0F),
(byte) (pitch * 256.0F / 360.0F), isOnGround(from)),
float oldBody = handle.yaw;
float oldPitch = handle.pitch;
handle.yaw = bodyYaw;
handle.pitch = pitch;
Packet<?>[] packets = new Packet[] { new PacketPlayOutEntityTeleport(handle),
new PacketPlayOutEntityHeadRotation(handle, (byte) (headYaw * 256.0F / 360.0F)) };
sendPacketsNearby(null, from.getLocation(), packets);
handle.yaw = oldBody;
handle.pitch = oldPitch;
}
@Override

View File

@ -286,7 +286,6 @@ import net.minecraft.server.v1_14_R1.MobEffects;
import net.minecraft.server.v1_14_R1.NavigationAbstract;
import net.minecraft.server.v1_14_R1.NetworkManager;
import net.minecraft.server.v1_14_R1.Packet;
import net.minecraft.server.v1_14_R1.PacketPlayOutEntity.PacketPlayOutEntityLook;
import net.minecraft.server.v1_14_R1.PacketPlayOutEntityHeadRotation;
import net.minecraft.server.v1_14_R1.PacketPlayOutEntityTeleport;
import net.minecraft.server.v1_14_R1.PacketPlayOutOpenWindow;
@ -1193,11 +1192,15 @@ public class NMSImpl implements NMSBridge {
@Override
public void sendRotationNearby(org.bukkit.entity.Entity from, float bodyYaw, float headYaw, float pitch) {
Entity handle = getHandle(from);
Packet<?>[] packets = new Packet[] {
new PacketPlayOutEntityLook(handle.getId(), (byte) (bodyYaw * 256.0F / 360.0F),
(byte) (pitch * 256.0F / 360.0F), isOnGround(from)),
float oldBody = handle.yaw;
float oldPitch = handle.pitch;
handle.yaw = bodyYaw;
handle.pitch = pitch;
Packet<?>[] packets = new Packet[] { new PacketPlayOutEntityTeleport(handle),
new PacketPlayOutEntityHeadRotation(handle, (byte) (headYaw * 256.0F / 360.0F)) };
sendPacketsNearby(null, from.getLocation(), packets);
handle.yaw = oldBody;
handle.pitch = oldPitch;
}
@Override

View File

@ -291,7 +291,6 @@ import net.minecraft.server.v1_15_R1.MobEffects;
import net.minecraft.server.v1_15_R1.NavigationAbstract;
import net.minecraft.server.v1_15_R1.NetworkManager;
import net.minecraft.server.v1_15_R1.Packet;
import net.minecraft.server.v1_15_R1.PacketPlayOutEntity.PacketPlayOutEntityLook;
import net.minecraft.server.v1_15_R1.PacketPlayOutEntityHeadRotation;
import net.minecraft.server.v1_15_R1.PacketPlayOutEntityTeleport;
import net.minecraft.server.v1_15_R1.PacketPlayOutOpenWindow;
@ -1211,11 +1210,15 @@ public class NMSImpl implements NMSBridge {
@Override
public void sendRotationNearby(org.bukkit.entity.Entity from, float bodyYaw, float headYaw, float pitch) {
Entity handle = getHandle(from);
Packet<?>[] packets = new Packet[] {
new PacketPlayOutEntityLook(handle.getId(), (byte) (bodyYaw * 256.0F / 360.0F),
(byte) (pitch * 256.0F / 360.0F), isOnGround(from)),
float oldBody = handle.yaw;
float oldPitch = handle.pitch;
handle.yaw = bodyYaw;
handle.pitch = pitch;
Packet<?>[] packets = new Packet[] { new PacketPlayOutEntityTeleport(handle),
new PacketPlayOutEntityHeadRotation(handle, (byte) (headYaw * 256.0F / 360.0F)) };
sendPacketsNearby(null, from.getLocation(), packets);
handle.yaw = oldBody;
handle.pitch = oldPitch;
}
@Override

View File

@ -300,7 +300,6 @@ import net.minecraft.server.v1_16_R3.MobEffects;
import net.minecraft.server.v1_16_R3.NavigationAbstract;
import net.minecraft.server.v1_16_R3.NetworkManager;
import net.minecraft.server.v1_16_R3.Packet;
import net.minecraft.server.v1_16_R3.PacketPlayOutEntity.PacketPlayOutEntityLook;
import net.minecraft.server.v1_16_R3.PacketPlayOutEntityHeadRotation;
import net.minecraft.server.v1_16_R3.PacketPlayOutEntityTeleport;
import net.minecraft.server.v1_16_R3.PacketPlayOutOpenWindow;
@ -1241,11 +1240,15 @@ public class NMSImpl implements NMSBridge {
@Override
public void sendRotationNearby(org.bukkit.entity.Entity from, float bodyYaw, float headYaw, float pitch) {
Entity handle = getHandle(from);
Packet<?>[] packets = new Packet[] {
new PacketPlayOutEntityLook(handle.getId(), (byte) (bodyYaw * 256.0F / 360.0F),
(byte) (pitch * 256.0F / 360.0F), isOnGround(from)),
float oldBody = handle.yaw;
float oldPitch = handle.pitch;
handle.yaw = bodyYaw;
handle.pitch = pitch;
Packet<?>[] packets = new Packet[] { new PacketPlayOutEntityTeleport(handle),
new PacketPlayOutEntityHeadRotation(handle, (byte) (headYaw * 256.0F / 360.0F)) };
sendPacketsNearby(null, from.getLocation(), packets);
handle.yaw = oldBody;
handle.pitch = oldPitch;
}
@Override

View File

@ -245,7 +245,6 @@ import net.minecraft.network.Connection;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.network.protocol.Packet;
import net.minecraft.network.protocol.game.ClientboundMoveEntityPacket;
import net.minecraft.network.protocol.game.ClientboundOpenScreenPacket;
import net.minecraft.network.protocol.game.ClientboundPlayerInfoPacket;
import net.minecraft.network.protocol.game.ClientboundRotateHeadPacket;
@ -1232,11 +1231,16 @@ public class NMSImpl implements NMSBridge {
@Override
public void sendRotationNearby(org.bukkit.entity.Entity from, float bodyYaw, float headYaw, float pitch) {
Entity handle = getHandle(from);
Packet<?>[] packets = new Packet[] {
new ClientboundMoveEntityPacket.Rot(handle.getId(), (byte) (bodyYaw * 256.0F / 360.0F),
(byte) (pitch * 256.0F / 360.0F), handle.isOnGround()),
new ClientboundRotateHeadPacket(handle, (byte) (headYaw * 256.0F / 360.0F)) };
sendPacketsNearby(null, from.getLocation(), packets);
float oldBody = handle.getYRot();
float oldPitch = handle.getXRot();
handle.setYBodyRot(bodyYaw);
handle.setXRot(pitch);
sendPacketsNearby(null, from.getLocation(), new Packet[] { new ClientboundTeleportEntityPacket(handle),
// new ClientboundMoveEntityPacket.Rot(handle.getId(), (byte) (bodyYaw * 256.0F / 360.0F),
// (byte) (pitch * 256.0F / 360.0F), handle.onGround),
new ClientboundRotateHeadPacket(handle, (byte) (headYaw * 256.0F / 360.0F)) });
handle.setYBodyRot(oldBody);
handle.setXRot(oldPitch);
}
@Override

View File

@ -2,10 +2,14 @@ package net.citizensnpcs.nms.v1_17_R1.util;
import java.util.EnumMap;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.metadata.FixedMetadataValue;
import org.bukkit.scheduler.BukkitRunnable;
import com.google.common.collect.Maps;
import net.citizensnpcs.api.CitizensAPI;
import net.citizensnpcs.util.PlayerAnimation;
import net.minecraft.network.protocol.Packet;
import net.minecraft.network.protocol.game.ClientboundAnimatePacket;
@ -35,11 +39,39 @@ public class PlayerAnimationImpl {
break;
case START_USE_MAINHAND_ITEM:
player.startUsingItem(InteractionHand.MAIN_HAND);
new BukkitRunnable() {
@Override
public void run() {
player.startUsingItem(InteractionHand.MAIN_HAND);
sendPacketNearby(
new ClientboundSetEntityDataPacket(player.getId(), player.getEntityData(), true),
player, radius);
if (!player.getBukkitEntity().hasMetadata("citizens-using-item-id")) {
player.getBukkitEntity().setMetadata("citizens-using-item-id",
new FixedMetadataValue(CitizensAPI.getPlugin(), getTaskId()));
}
}
}.runTaskTimer(CitizensAPI.getPlugin(), player.getUseItemRemainingTicks() - 1,
player.getUseItemRemainingTicks() - 1);
sendPacketNearby(new ClientboundSetEntityDataPacket(player.getId(), player.getEntityData(), true),
player, radius);
break;
case START_USE_OFFHAND_ITEM:
player.startUsingItem(InteractionHand.OFF_HAND);
new BukkitRunnable() {
@Override
public void run() {
player.startUsingItem(InteractionHand.OFF_HAND);
sendPacketNearby(
new ClientboundSetEntityDataPacket(player.getId(), player.getEntityData(), true),
player, radius);
if (!player.getBukkitEntity().hasMetadata("citizens-using-item-id")) {
player.getBukkitEntity().setMetadata("citizens-using-item-id",
new FixedMetadataValue(CitizensAPI.getPlugin(), getTaskId()));
}
}
}.runTaskTimer(CitizensAPI.getPlugin(), player.getUseItemRemainingTicks() - 1,
player.getUseItemRemainingTicks() - 1);
sendPacketNearby(new ClientboundSetEntityDataPacket(player.getId(), player.getEntityData(), true),
player, radius);
break;
@ -50,6 +82,11 @@ public class PlayerAnimationImpl {
break;
case STOP_USE_ITEM:
player.stopUsingItem();
if (player.getBukkitEntity().hasMetadata("citizens-using-item-id")) {
Bukkit.getScheduler()
.cancelTask(player.getBukkitEntity().getMetadata("citizens-using-item-id").get(0).asInt());
player.getBukkitEntity().removeMetadata("citizens-using-item-id", CitizensAPI.getPlugin());
}
sendPacketNearby(new ClientboundSetEntityDataPacket(player.getId(), player.getEntityData(), true),
player, radius);
break;

View File

@ -246,7 +246,6 @@ import net.minecraft.network.Connection;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.network.protocol.Packet;
import net.minecraft.network.protocol.game.ClientboundMoveEntityPacket;
import net.minecraft.network.protocol.game.ClientboundOpenScreenPacket;
import net.minecraft.network.protocol.game.ClientboundPlayerInfoPacket;
import net.minecraft.network.protocol.game.ClientboundRotateHeadPacket;
@ -1240,11 +1239,16 @@ public class NMSImpl implements NMSBridge {
@Override
public void sendRotationNearby(org.bukkit.entity.Entity from, float bodyYaw, float headYaw, float pitch) {
Entity handle = getHandle(from);
Packet<?>[] packets = new Packet[] {
new ClientboundMoveEntityPacket.Rot(handle.getId(), (byte) (bodyYaw * 256.0F / 360.0F),
(byte) (pitch * 256.0F / 360.0F), handle.onGround),
new ClientboundRotateHeadPacket(handle, (byte) (headYaw * 256.0F / 360.0F)) };
sendPacketsNearby(null, from.getLocation(), packets);
float oldBody = handle.getYRot();
float oldPitch = handle.getXRot();
handle.setYBodyRot(bodyYaw);
handle.setXRot(pitch);
sendPacketsNearby(null, from.getLocation(), new Packet[] { new ClientboundTeleportEntityPacket(handle),
// new ClientboundMoveEntityPacket.Rot(handle.getId(), (byte) (bodyYaw * 256.0F / 360.0F),
// (byte) (pitch * 256.0F / 360.0F), handle.onGround),
new ClientboundRotateHeadPacket(handle, (byte) (headYaw * 256.0F / 360.0F)) });
handle.setYBodyRot(oldBody);
handle.setXRot(oldPitch);
}
@Override

View File

@ -2,10 +2,14 @@ package net.citizensnpcs.nms.v1_18_R2.util;
import java.util.Map;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.metadata.FixedMetadataValue;
import org.bukkit.scheduler.BukkitRunnable;
import com.google.common.collect.Maps;
import net.citizensnpcs.api.CitizensAPI;
import net.citizensnpcs.util.PlayerAnimation;
import net.minecraft.network.protocol.Packet;
import net.minecraft.network.protocol.game.ClientboundAnimatePacket;
@ -35,11 +39,39 @@ public class PlayerAnimationImpl {
break;
case START_USE_MAINHAND_ITEM:
player.startUsingItem(InteractionHand.MAIN_HAND);
new BukkitRunnable() {
@Override
public void run() {
player.startUsingItem(InteractionHand.MAIN_HAND);
sendPacketNearby(
new ClientboundSetEntityDataPacket(player.getId(), player.getEntityData(), true),
player, radius);
if (!player.getBukkitEntity().hasMetadata("citizens-using-item-id")) {
player.getBukkitEntity().setMetadata("citizens-using-item-id",
new FixedMetadataValue(CitizensAPI.getPlugin(), getTaskId()));
}
}
}.runTaskTimer(CitizensAPI.getPlugin(), player.getUseItemRemainingTicks() - 1,
player.getUseItemRemainingTicks() - 1);
sendPacketNearby(new ClientboundSetEntityDataPacket(player.getId(), player.getEntityData(), true),
player, radius);
break;
case START_USE_OFFHAND_ITEM:
player.startUsingItem(InteractionHand.OFF_HAND);
new BukkitRunnable() {
@Override
public void run() {
player.startUsingItem(InteractionHand.OFF_HAND);
sendPacketNearby(
new ClientboundSetEntityDataPacket(player.getId(), player.getEntityData(), true),
player, radius);
if (!player.getBukkitEntity().hasMetadata("citizens-using-item-id")) {
player.getBukkitEntity().setMetadata("citizens-using-item-id",
new FixedMetadataValue(CitizensAPI.getPlugin(), getTaskId()));
}
}
}.runTaskTimer(CitizensAPI.getPlugin(), player.getUseItemRemainingTicks() - 1,
player.getUseItemRemainingTicks() - 1);
sendPacketNearby(new ClientboundSetEntityDataPacket(player.getId(), player.getEntityData(), true),
player, radius);
break;
@ -50,6 +82,11 @@ public class PlayerAnimationImpl {
break;
case STOP_USE_ITEM:
player.stopUsingItem();
if (player.getBukkitEntity().hasMetadata("citizens-using-item-id")) {
Bukkit.getScheduler()
.cancelTask(player.getBukkitEntity().getMetadata("citizens-using-item-id").get(0).asInt());
player.getBukkitEntity().removeMetadata("citizens-using-item-id", CitizensAPI.getPlugin());
}
sendPacketNearby(new ClientboundSetEntityDataPacket(player.getId(), player.getEntityData(), true),
player, radius);
break;

View File

@ -263,7 +263,6 @@ import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.MutableComponent;
import net.minecraft.network.chat.contents.LiteralContents;
import net.minecraft.network.protocol.Packet;
import net.minecraft.network.protocol.game.ClientboundMoveEntityPacket;
import net.minecraft.network.protocol.game.ClientboundOpenScreenPacket;
import net.minecraft.network.protocol.game.ClientboundPlayerInfoRemovePacket;
import net.minecraft.network.protocol.game.ClientboundPlayerInfoUpdatePacket;
@ -1320,11 +1319,16 @@ public class NMSImpl implements NMSBridge {
@Override
public void sendRotationNearby(org.bukkit.entity.Entity from, float bodyYaw, float headYaw, float pitch) {
Entity handle = getHandle(from);
Packet<?>[] packets = new Packet[] {
new ClientboundMoveEntityPacket.Rot(handle.getId(), (byte) (bodyYaw * 256.0F / 360.0F),
(byte) (pitch * 256.0F / 360.0F), handle.onGround),
new ClientboundRotateHeadPacket(handle, (byte) (headYaw * 256.0F / 360.0F)) };
sendPacketsNearby(null, from.getLocation(), packets);
float oldBody = handle.getYRot();
float oldPitch = handle.getXRot();
handle.setYBodyRot(bodyYaw);
handle.setXRot(pitch);
sendPacketsNearby(null, from.getLocation(), new Packet[] { new ClientboundTeleportEntityPacket(handle),
// new ClientboundMoveEntityPacket.Rot(handle.getId(), (byte) (bodyYaw * 256.0F / 360.0F),
// (byte) (pitch * 256.0F / 360.0F), handle.onGround),
new ClientboundRotateHeadPacket(handle, (byte) (headYaw * 256.0F / 360.0F)) });
handle.setYBodyRot(oldBody);
handle.setXRot(oldPitch);
}
@Override
@ -1354,11 +1358,11 @@ public class NMSImpl implements NMSBridge {
NMSImpl.sendPacket(recipient, packet);
if (VIA_ENABLED == true) {
/* if (VIA_ENABLED == true) {
int version = Via.getAPI().getPlayerVersion(recipient);
return version < 761;
}
return false;
}*/
return true;
}
@Override

View File

@ -2,10 +2,14 @@ package net.citizensnpcs.nms.v1_19_R2.util;
import java.util.Map;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.metadata.FixedMetadataValue;
import org.bukkit.scheduler.BukkitRunnable;
import com.google.common.collect.Maps;
import net.citizensnpcs.api.CitizensAPI;
import net.citizensnpcs.util.PlayerAnimation;
import net.minecraft.network.protocol.Packet;
import net.minecraft.network.protocol.game.ClientboundAnimatePacket;
@ -34,10 +38,34 @@ public class PlayerAnimationImpl {
break;
case START_USE_MAINHAND_ITEM:
player.startUsingItem(InteractionHand.MAIN_HAND);
new BukkitRunnable() {
@Override
public void run() {
player.startUsingItem(InteractionHand.MAIN_HAND);
sendEntityData(radius, player);
if (!player.getBukkitEntity().hasMetadata("citizens-using-item-id")) {
player.getBukkitEntity().setMetadata("citizens-using-item-id",
new FixedMetadataValue(CitizensAPI.getPlugin(), getTaskId()));
}
}
}.runTaskTimer(CitizensAPI.getPlugin(), player.getUseItemRemainingTicks() - 1,
player.getUseItemRemainingTicks() - 1);
sendEntityData(radius, player);
break;
case START_USE_OFFHAND_ITEM:
player.startUsingItem(InteractionHand.OFF_HAND);
new BukkitRunnable() {
@Override
public void run() {
player.startUsingItem(InteractionHand.OFF_HAND);
sendEntityData(radius, player);
if (!player.getBukkitEntity().hasMetadata("citizens-using-item-id")) {
player.getBukkitEntity().setMetadata("citizens-using-item-id",
new FixedMetadataValue(CitizensAPI.getPlugin(), getTaskId()));
}
}
}.runTaskTimer(CitizensAPI.getPlugin(), player.getUseItemRemainingTicks() - 1,
player.getUseItemRemainingTicks() - 1);
sendEntityData(radius, player);
break;
case STOP_SNEAKING:
@ -46,6 +74,11 @@ public class PlayerAnimationImpl {
break;
case STOP_USE_ITEM:
player.stopUsingItem();
if (player.getBukkitEntity().hasMetadata("citizens-using-item-id")) {
Bukkit.getScheduler()
.cancelTask(player.getBukkitEntity().getMetadata("citizens-using-item-id").get(0).asInt());
player.getBukkitEntity().removeMetadata("citizens-using-item-id", CitizensAPI.getPlugin());
}
sendEntityData(radius, player);
break;
default:

View File

@ -205,7 +205,6 @@ import net.minecraft.server.v1_8_R3.NetworkManager;
import net.minecraft.server.v1_8_R3.Packet;
import net.minecraft.server.v1_8_R3.PacketPlayOutAnimation;
import net.minecraft.server.v1_8_R3.PacketPlayOutBed;
import net.minecraft.server.v1_8_R3.PacketPlayOutEntity.PacketPlayOutEntityLook;
import net.minecraft.server.v1_8_R3.PacketPlayOutEntityHeadRotation;
import net.minecraft.server.v1_8_R3.PacketPlayOutEntityTeleport;
import net.minecraft.server.v1_8_R3.PacketPlayOutOpenWindow;
@ -995,11 +994,15 @@ public class NMSImpl implements NMSBridge {
@Override
public void sendRotationNearby(org.bukkit.entity.Entity from, float bodyYaw, float headYaw, float pitch) {
Entity handle = getHandle(from);
Packet<?>[] packets = new Packet[] {
new PacketPlayOutEntityLook(handle.getId(), (byte) (bodyYaw * 256.0F / 360.0F),
(byte) (pitch * 256.0F / 360.0F), isOnGround(from)),
float oldBody = handle.yaw;
float oldPitch = handle.pitch;
handle.yaw = bodyYaw;
handle.pitch = pitch;
Packet<?>[] packets = new Packet[] { new PacketPlayOutEntityTeleport(handle),
new PacketPlayOutEntityHeadRotation(handle, (byte) (headYaw * 256.0F / 360.0F)) };
sendPacketsNearby(null, from.getLocation(), packets);
handle.yaw = oldBody;
handle.pitch = oldPitch;
}
@Override