Reorder update() method

This commit is contained in:
fullwall 2023-02-06 23:28:00 +08:00
parent 504a38317c
commit 8ba9d2ceb6
1 changed files with 11 additions and 10 deletions

View File

@ -480,8 +480,7 @@ public class CitizensNPC extends AbstractNPC {
}
}
navigator.run();
if (SUPPORT_GLOWING) {
if (SUPPORT_GLOWING && data().has(NPC.Metadata.GLOWING)) {
try {
getEntity().setGlowing(data().get(NPC.Metadata.GLOWING, false));
} catch (NoSuchMethodError e) {
@ -489,6 +488,16 @@ public class CitizensNPC extends AbstractNPC {
}
}
if (SUPPORT_SILENT && data().has(NPC.Metadata.SILENT)) {
try {
getEntity().setSilent(Boolean.parseBoolean(data().get(NPC.Metadata.SILENT).toString()));
} catch (NoSuchMethodError e) {
SUPPORT_SILENT = false;
}
}
navigator.run();
boolean isLiving = getEntity() instanceof LivingEntity;
if (isUpdating(NPCUpdate.PACKET)) {
if (data().get(NPC.Metadata.KEEP_CHUNK_LOADED, Setting.KEEP_CHUNKS_LOADED.asBoolean())) {
@ -527,14 +536,6 @@ public class CitizensNPC extends AbstractNPC {
}
}
if (SUPPORT_SILENT && data().has(NPC.Metadata.SILENT)) {
try {
getEntity().setSilent(Boolean.parseBoolean(data().get(NPC.Metadata.SILENT).toString()));
} catch (NoSuchMethodError e) {
SUPPORT_SILENT = false;
}
}
updateCounter++;
} catch (Exception ex) {
Throwable error = Throwables.getRootCause(ex);