Entities don't spawn instantly

This commit is contained in:
fullwall 2024-07-09 01:06:08 +08:00
parent ad6b47348c
commit 92cb74b7eb
2 changed files with 7 additions and 3 deletions

View File

@ -750,6 +750,7 @@ public class HologramTrait extends Trait {
public abstract static class SingleEntityHologramRenderer implements HologramRenderer {
protected NPC hologram;
private NPCRegistry registry;
private int spawnWaitTicks;
protected String text;
protected int viewRange = -1;
@ -780,10 +781,13 @@ public class HologramTrait extends Trait {
@Override
public void render(NPC npc, Vector3d offset) {
if (getEntities().isEmpty()) {
if (getEntities().isEmpty() && spawnWaitTicks-- <= 0) {
destroy();
spawnHologram(npc, offset);
spawnWaitTicks = 5;
}
if (!hologram.isSpawned())
return;
render0(npc, offset);
}

View File

@ -41,8 +41,8 @@ public class HomeTrait extends Trait {
@Override
public void run() {
if (!npc.isSpawned() || location == null || npc.getStoredLocation().distance(location) < 0.1
|| npc.getNavigator().isNavigating()) {
if (!npc.isSpawned() || location == null || npc.getNavigator().isNavigating()
|| npc.getStoredLocation().distance(location) < 0.1) {
t = 0;
return;
}