mirror of
https://github.com/filoghost/HolographicDisplays.git
synced 2024-11-23 02:45:22 +01:00
Use separate view range for item and text lines
This commit is contained in:
parent
370eb9806f
commit
5727de44dc
@ -140,4 +140,9 @@ public class ItemLineTracker extends ClickableLineTracker<Viewer> {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected double getViewRange() {
|
||||
return 16;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -61,8 +61,11 @@ public abstract class LineTracker<T extends Viewer> {
|
||||
sendChangesPackets = true;
|
||||
}
|
||||
|
||||
if (hasViewers() && updatePlaceholders()) {
|
||||
sendChangesPackets = true;
|
||||
if (hasViewers()) {
|
||||
boolean textChanged = updatePlaceholders();
|
||||
if (textChanged) {
|
||||
sendChangesPackets = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Then, send the changes (if any) to already tracked players
|
||||
|
@ -15,8 +15,6 @@ import java.util.Objects;
|
||||
|
||||
abstract class PositionBasedLineTracker<T extends Viewer> extends LineTracker<T> {
|
||||
|
||||
private static final int ENTITY_VIEW_RANGE = 64;
|
||||
|
||||
protected PositionCoordinates position;
|
||||
private boolean positionChanged;
|
||||
|
||||
@ -50,8 +48,8 @@ abstract class PositionBasedLineTracker<T extends Viewer> extends LineTracker<T>
|
||||
double diffX = Math.abs(playerLocation.getX() - position.getX());
|
||||
double diffZ = Math.abs(playerLocation.getZ() - position.getZ());
|
||||
|
||||
return diffX <= (double) ENTITY_VIEW_RANGE
|
||||
&& diffZ <= (double) ENTITY_VIEW_RANGE
|
||||
return diffX <= getViewRange()
|
||||
&& diffZ <= getViewRange()
|
||||
&& getLine().isVisibleTo(player.getBukkitPlayer());
|
||||
}
|
||||
|
||||
@ -65,4 +63,6 @@ abstract class PositionBasedLineTracker<T extends Viewer> extends LineTracker<T>
|
||||
|
||||
protected abstract void sendPositionChangePackets(Viewers<T> viewers);
|
||||
|
||||
protected abstract double getViewRange();
|
||||
|
||||
}
|
||||
|
@ -114,4 +114,9 @@ public class TextLineTracker extends ClickableLineTracker<TextLineViewer> {
|
||||
viewers.sendPackets(textEntity.newTeleportPackets(position));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected double getViewRange() {
|
||||
return 64;
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user