Update to setting type

This commit is contained in:
fullwall 2024-08-16 10:25:35 +08:00
parent c66ff1eeee
commit b00e99fedb
3 changed files with 8 additions and 8 deletions

View File

@ -240,7 +240,7 @@ public class Settings {
NPC_SKIN_ROTATION_UPDATE_DEGREES("npc.skins.rotation-update-degrees", 90f),
NPC_SKIN_USE_LATEST("Whether to fetch new skins from Minecraft every so often",
"npc.skins.use-latest-by-default", false),
NPC_SKIN_VIEW_DISTANCE("View distance in blocks", "npc.skins.view-distance", 100D),
NPC_SKIN_VIEW_DISTANCE("View distance in blocks", "npc.skins.view-distance", 100),
NPC_WATER_SPEED_MODIFIER("Movement speed percentage increase while in water",
"npc.movement.water-speed-modifier", 1.15F),
PACKET_HOLOGRAMS("Use packet NPCs for name holograms (experimental)", "npc.use-packet-holograms", false),

View File

@ -129,7 +129,7 @@ public class SkinPacketTracker {
return;
updateNearbyViewers(entity.getNPC().data().get(NPC.Metadata.TRACKING_RANGE,
Setting.NPC_SKIN_VIEW_DISTANCE.asDouble()));
Setting.NPC_SKIN_VIEW_DISTANCE.asInt()));
}
}.runTaskLater(CitizensAPI.getPlugin(), 15);
}

View File

@ -64,7 +64,7 @@ public class SkinUpdateTracker {
Location skinLoc = entity.getLocation();
if (playerLoc.distance(skinLoc) > skinnable.getNPC().data().get(NPC.Metadata.TRACKING_RANGE,
Setting.NPC_SKIN_VIEW_DISTANCE.asDouble()))
Setting.NPC_SKIN_VIEW_DISTANCE.asInt()))
return false;
// see if the NPC is within the players field of view
@ -262,17 +262,17 @@ public class SkinUpdateTracker {
return;
double viewDistance = skinnable.getNPC().data().get(NPC.Metadata.TRACKING_RANGE,
Setting.NPC_SKIN_VIEW_DISTANCE.asDouble());
Setting.NPC_SKIN_VIEW_DISTANCE.asInt());
Location location = entity.getLocation();
List<Player> players = entity.getWorld().getPlayers();
for (Player player : players) {
if (player.hasMetadata("NPC")) {
if (player.hasMetadata("NPC"))
continue;
}
Location ploc = player.getLocation();
if (ploc.getWorld() != location.getWorld() || ploc.distance(location) > viewDistance) {
if (ploc.getWorld() != location.getWorld() || ploc.distance(location) > viewDistance)
continue;
}
PlayerTracker tracker = playerTrackers.get(player.getUniqueId());
if (tracker != null) {
tracker.hardReset(player);