Fix lookclose target invalidation

This commit is contained in:
fullwall 2020-04-19 01:28:40 +08:00
parent ecae2dbe8a
commit 9090d1c69b
2 changed files with 2 additions and 3 deletions

View File

@ -82,8 +82,7 @@ public class Skin {
NPC npc = entity.getNPC();
// Use npc cached skin if available.
// If npc requires latest skin, cache is used for faster
// availability until the latest skin can be loaded.
// If npc requires latest skin, cache is used for faster availability until the latest skin can be loaded.
String cachedName = npc.data().get(CACHED_SKIN_UUID_NAME_METADATA);
String texture = npc.data().get(NPC.PLAYER_SKIN_TEXTURE_PROPERTIES_METADATA, "cache");
if (this.skinName.equals(cachedName) && !texture.equals("cache")) {

View File

@ -100,7 +100,7 @@ public class LookClose extends Trait implements Toggleable, CommandConfigurable
if (lookingAt == null)
return true;
if (!lookingAt.isOnline() || lookingAt.getWorld() != npc.getEntity().getWorld()
|| lookingAt.getLocation(PLAYER_LOCATION).distanceSquared(NPC_LOCATION) > range) {
|| lookingAt.getLocation(PLAYER_LOCATION).distanceSquared(NPC_LOCATION) > range * range) {
lookingAt = null;
}
return lookingAt == null;