From 3d0c209cf7c45a97edc2c343e5194c33e2658e1b Mon Sep 17 00:00:00 2001 From: libraryaddict Date: Fri, 2 Oct 2020 07:15:32 +1300 Subject: [PATCH] Try handle player skins better --- .../packets/packethandlers/PacketHandlerSpawn.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main/java/me/libraryaddict/disguise/utilities/packets/packethandlers/PacketHandlerSpawn.java b/src/main/java/me/libraryaddict/disguise/utilities/packets/packethandlers/PacketHandlerSpawn.java index f8f07539..ae17e587 100644 --- a/src/main/java/me/libraryaddict/disguise/utilities/packets/packethandlers/PacketHandlerSpawn.java +++ b/src/main/java/me/libraryaddict/disguise/utilities/packets/packethandlers/PacketHandlerSpawn.java @@ -210,10 +210,12 @@ public class PacketHandlerSpawn implements IPacketHandler { spawnPlayer.getIntegers().write(0, entityId); // Id spawnPlayer.getModifier().write(1, spawnProfile.getUUID()); - boolean spawnFarAway = observer == disguisedEntity || - observer.getLocation().distanceSquared(disguisedEntity.getLocation()) > - observer.getLocation().add(observer.getLocation().getDirection()) - .distanceSquared(disguisedEntity.getLocation()); + double dist = observer.getLocation().distanceSquared(disguisedEntity.getLocation()); + + // If self disguise, or further than 64 blocks, or not in front of entity + boolean spawnFarAway = observer == disguisedEntity || dist > (64 * 64) || + (observer.getLocation().add(observer.getLocation().getDirection().normalize()) + .distanceSquared(disguisedEntity.getLocation()) - dist) < 0.3; skin.setSleepPackets(!spawnFarAway);