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(); NPC npc = entity.getNPC();
// Use npc cached skin if available. // Use npc cached skin if available.
// If npc requires latest skin, cache is used for faster // If npc requires latest skin, cache is used for faster availability until the latest skin can be loaded.
// availability until the latest skin can be loaded.
String cachedName = npc.data().get(CACHED_SKIN_UUID_NAME_METADATA); String cachedName = npc.data().get(CACHED_SKIN_UUID_NAME_METADATA);
String texture = npc.data().get(NPC.PLAYER_SKIN_TEXTURE_PROPERTIES_METADATA, "cache"); String texture = npc.data().get(NPC.PLAYER_SKIN_TEXTURE_PROPERTIES_METADATA, "cache");
if (this.skinName.equals(cachedName) && !texture.equals("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) if (lookingAt == null)
return true; return true;
if (!lookingAt.isOnline() || lookingAt.getWorld() != npc.getEntity().getWorld() 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; lookingAt = null;
} }
return lookingAt == null; return lookingAt == null;