public void refreshSingleLines() { if (world.isChunkLoaded(chunkX, chunkZ)) { double currentY = this.y; boolean first = true; for (CraftHologramLine line : lines) { currentY -= line.getHeight(); if (first) { first = false; } else { currentY -= Configuration.spaceBetweenLines; } if (line.isSpawned()) { line.teleport(x, currentY, z); } else { line.spawn(world, x, currentY, z); if (allowPlaceholders && line instanceof CraftTextLine) { PlaceholdersManager.trackIfNecessary((CraftTextLine) line); } } } } }
@Override public void setAllowPlaceholders(boolean allowPlaceholders) { if (this.allowPlaceholders != allowPlaceholders) { if (allowPlaceholders) { // Now allowed, previously weren't for (CraftHologramLine line : lines) { if (line instanceof CraftTextLine) { PlaceholdersManager.trackIfNecessary((CraftTextLine) line); } } } else { // Now not allowed for (CraftHologramLine line : lines) { if (line instanceof CraftTextLine) { PlaceholdersManager.untrack((CraftTextLine) line); } } } this.allowPlaceholders = allowPlaceholders; } }
/** Forces the entities to spawn, without checking if the chunk is loaded. */ public void spawnEntities() { Validator.isTrue(!deleted, "hologram already deleted"); despawnEntities(); double currentY = this.y; boolean first = true; for (CraftHologramLine line : lines) { currentY -= line.getHeight(); if (first) { first = false; } else { currentY -= Configuration.spaceBetweenLines; } line.spawn(world, x, currentY, z); if (allowPlaceholders && line instanceof CraftTextLine) { PlaceholdersManager.trackIfNecessary((CraftTextLine) line); } } }