mirror of
https://github.com/BG-Software-LLC/WildLoaders.git
synced 2024-11-27 12:46:07 +01:00
Cache player names for holograms of loaders (#88)
This commit is contained in:
parent
2b05c098d5
commit
901f630d89
@ -27,6 +27,7 @@ public final class TileEntityChunkLoader extends TileEntity implements ITickable
|
||||
public final List<EntityHolograms> holograms = new ArrayList<>();
|
||||
private final WChunkLoader chunkLoader;
|
||||
private final Block loaderBlock;
|
||||
private final String cachedPlacerName;
|
||||
|
||||
private short currentTick = 20;
|
||||
private short daysAmount, hoursAmount, minutesAmount, secondsAmount;
|
||||
@ -67,6 +68,8 @@ public final class TileEntityChunkLoader extends TileEntity implements ITickable
|
||||
currentY += 0.23;
|
||||
holograms.add(hologram);
|
||||
}
|
||||
|
||||
this.cachedPlacerName = Optional.ofNullable(this.chunkLoader.getWhoPlaced().getName()).orElse("");
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -117,9 +120,8 @@ public final class TileEntityChunkLoader extends TileEntity implements ITickable
|
||||
}
|
||||
|
||||
private void updateName(EntityHolograms hologram, String line) {
|
||||
String placerName = Optional.ofNullable(chunkLoader.getWhoPlaced().getName()).orElse("");
|
||||
hologram.setHologramName(line
|
||||
.replace("{0}", placerName)
|
||||
.replace("{0}", this.cachedPlacerName)
|
||||
.replace("{1}", daysAmount + "")
|
||||
.replace("{2}", hoursAmount + "")
|
||||
.replace("{3}", minutesAmount + "")
|
||||
|
@ -28,6 +28,7 @@ public final class TileEntityChunkLoader extends TileEntity implements ITickable
|
||||
public final List<EntityHolograms> holograms = new ArrayList<>();
|
||||
private final WChunkLoader chunkLoader;
|
||||
private final Block loaderBlock;
|
||||
private final String cachedPlacerName;
|
||||
|
||||
private short currentTick = 20;
|
||||
private short daysAmount, hoursAmount, minutesAmount, secondsAmount;
|
||||
@ -75,6 +76,8 @@ public final class TileEntityChunkLoader extends TileEntity implements ITickable
|
||||
currentY += 0.23;
|
||||
holograms.add(hologram);
|
||||
}
|
||||
|
||||
this.cachedPlacerName = Optional.ofNullable(this.chunkLoader.getWhoPlaced().getName()).orElse("");
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -131,9 +134,8 @@ public final class TileEntityChunkLoader extends TileEntity implements ITickable
|
||||
}
|
||||
|
||||
private void updateName(EntityHolograms hologram, String line) {
|
||||
String placerName = Optional.ofNullable(chunkLoader.getWhoPlaced().getName()).orElse("");
|
||||
hologram.setHologramName(line
|
||||
.replace("{0}", placerName)
|
||||
.replace("{0}", this.cachedPlacerName)
|
||||
.replace("{1}", daysAmount + "")
|
||||
.replace("{2}", hoursAmount + "")
|
||||
.replace("{3}", minutesAmount + "")
|
||||
|
@ -30,6 +30,7 @@ public final class ChunkLoaderBlockEntity extends BlockEntity implements ITileEn
|
||||
private final ChunkLoaderBlockEntityTicker ticker;
|
||||
private final ServerLevel serverLevel;
|
||||
private final BlockPos blockPos;
|
||||
private final String cachedPlacerName;
|
||||
|
||||
private short currentTick = 20;
|
||||
private short daysAmount, hoursAmount, minutesAmount, secondsAmount;
|
||||
@ -75,6 +76,8 @@ public final class ChunkLoaderBlockEntity extends BlockEntity implements ITileEn
|
||||
currentY += 0.23;
|
||||
holograms.add(hologram);
|
||||
}
|
||||
|
||||
this.cachedPlacerName = Optional.ofNullable(this.chunkLoader.getWhoPlaced().getName()).orElse("");
|
||||
}
|
||||
|
||||
public void tick() {
|
||||
@ -133,9 +136,8 @@ public final class ChunkLoaderBlockEntity extends BlockEntity implements ITileEn
|
||||
}
|
||||
|
||||
private void updateName(EntityHologram hologram, String line) {
|
||||
String placerName = Optional.ofNullable(chunkLoader.getWhoPlaced().getName()).orElse("");
|
||||
hologram.setHologramName(line
|
||||
.replace("{0}", placerName)
|
||||
.replace("{0}", this.cachedPlacerName)
|
||||
.replace("{1}", daysAmount + "")
|
||||
.replace("{2}", hoursAmount + "")
|
||||
.replace("{3}", minutesAmount + "")
|
||||
|
@ -30,6 +30,7 @@ public final class ChunkLoaderBlockEntity extends BlockEntity implements ITileEn
|
||||
private final ChunkLoaderBlockEntityTicker ticker;
|
||||
private final ServerLevel serverLevel;
|
||||
private final BlockPos blockPos;
|
||||
private final String cachedPlacerName;
|
||||
|
||||
private short currentTick = 20;
|
||||
private short daysAmount, hoursAmount, minutesAmount, secondsAmount;
|
||||
@ -75,6 +76,8 @@ public final class ChunkLoaderBlockEntity extends BlockEntity implements ITileEn
|
||||
currentY += 0.23;
|
||||
holograms.add(hologram);
|
||||
}
|
||||
|
||||
this.cachedPlacerName = Optional.ofNullable(this.chunkLoader.getWhoPlaced().getName()).orElse("");
|
||||
}
|
||||
|
||||
public void tick() {
|
||||
@ -133,9 +136,8 @@ public final class ChunkLoaderBlockEntity extends BlockEntity implements ITileEn
|
||||
}
|
||||
|
||||
private void updateName(EntityHologram hologram, String line) {
|
||||
String placerName = Optional.ofNullable(chunkLoader.getWhoPlaced().getName()).orElse("");
|
||||
hologram.setHologramName(line
|
||||
.replace("{0}", placerName)
|
||||
.replace("{0}", this.cachedPlacerName)
|
||||
.replace("{1}", daysAmount + "")
|
||||
.replace("{2}", hoursAmount + "")
|
||||
.replace("{3}", minutesAmount + "")
|
||||
|
@ -30,6 +30,7 @@ public final class ChunkLoaderBlockEntity extends BlockEntity implements ITileEn
|
||||
private final ChunkLoaderBlockEntityTicker ticker;
|
||||
private final ServerLevel serverLevel;
|
||||
private final BlockPos blockPos;
|
||||
private final String cachedPlacerName;
|
||||
|
||||
private short currentTick = 20;
|
||||
private short daysAmount, hoursAmount, minutesAmount, secondsAmount;
|
||||
@ -75,6 +76,8 @@ public final class ChunkLoaderBlockEntity extends BlockEntity implements ITileEn
|
||||
currentY += 0.23;
|
||||
holograms.add(hologram);
|
||||
}
|
||||
|
||||
this.cachedPlacerName = Optional.ofNullable(this.chunkLoader.getWhoPlaced().getName()).orElse("");
|
||||
}
|
||||
|
||||
public void tick() {
|
||||
@ -133,9 +136,8 @@ public final class ChunkLoaderBlockEntity extends BlockEntity implements ITileEn
|
||||
}
|
||||
|
||||
private void updateName(EntityHologram hologram, String line) {
|
||||
String placerName = Optional.ofNullable(chunkLoader.getWhoPlaced().getName()).orElse("");
|
||||
hologram.setHologramName(line
|
||||
.replace("{0}", placerName)
|
||||
.replace("{0}", this.cachedPlacerName)
|
||||
.replace("{1}", daysAmount + "")
|
||||
.replace("{2}", hoursAmount + "")
|
||||
.replace("{3}", minutesAmount + "")
|
||||
|
@ -30,6 +30,7 @@ public final class ChunkLoaderBlockEntity extends BlockEntity implements ITileEn
|
||||
private final ChunkLoaderBlockEntityTicker ticker;
|
||||
private final ServerLevel serverLevel;
|
||||
private final BlockPos blockPos;
|
||||
private final String cachedPlacerName;
|
||||
|
||||
private short currentTick = 20;
|
||||
private short daysAmount, hoursAmount, minutesAmount, secondsAmount;
|
||||
@ -75,6 +76,8 @@ public final class ChunkLoaderBlockEntity extends BlockEntity implements ITileEn
|
||||
currentY += 0.23;
|
||||
holograms.add(hologram);
|
||||
}
|
||||
|
||||
this.cachedPlacerName = Optional.ofNullable(this.chunkLoader.getWhoPlaced().getName()).orElse("");
|
||||
}
|
||||
|
||||
public void tick() {
|
||||
@ -133,9 +136,8 @@ public final class ChunkLoaderBlockEntity extends BlockEntity implements ITileEn
|
||||
}
|
||||
|
||||
private void updateName(EntityHologram hologram, String line) {
|
||||
String placerName = Optional.ofNullable(chunkLoader.getWhoPlaced().getName()).orElse("");
|
||||
hologram.setHologramName(line
|
||||
.replace("{0}", placerName)
|
||||
.replace("{0}", this.cachedPlacerName)
|
||||
.replace("{1}", daysAmount + "")
|
||||
.replace("{2}", hoursAmount + "")
|
||||
.replace("{3}", minutesAmount + "")
|
||||
|
@ -30,6 +30,7 @@ public final class ChunkLoaderBlockEntity extends BlockEntity implements ITileEn
|
||||
private final ChunkLoaderBlockEntityTicker ticker;
|
||||
private final ServerLevel serverLevel;
|
||||
private final BlockPos blockPos;
|
||||
private final String cachedPlacerName;
|
||||
|
||||
private short currentTick = 20;
|
||||
private short daysAmount, hoursAmount, minutesAmount, secondsAmount;
|
||||
@ -75,6 +76,8 @@ public final class ChunkLoaderBlockEntity extends BlockEntity implements ITileEn
|
||||
currentY += 0.23;
|
||||
holograms.add(hologram);
|
||||
}
|
||||
|
||||
this.cachedPlacerName = Optional.ofNullable(this.chunkLoader.getWhoPlaced().getName()).orElse("");
|
||||
}
|
||||
|
||||
public void tick() {
|
||||
@ -133,9 +136,8 @@ public final class ChunkLoaderBlockEntity extends BlockEntity implements ITileEn
|
||||
}
|
||||
|
||||
private void updateName(EntityHologram hologram, String line) {
|
||||
String placerName = Optional.ofNullable(chunkLoader.getWhoPlaced().getName()).orElse("");
|
||||
hologram.setHologramName(line
|
||||
.replace("{0}", placerName)
|
||||
.replace("{0}", this.cachedPlacerName)
|
||||
.replace("{1}", daysAmount + "")
|
||||
.replace("{2}", hoursAmount + "")
|
||||
.replace("{3}", minutesAmount + "")
|
||||
|
@ -30,6 +30,7 @@ public final class ChunkLoaderBlockEntity extends BlockEntity implements ITileEn
|
||||
private final ChunkLoaderBlockEntityTicker ticker;
|
||||
private final ServerLevel serverLevel;
|
||||
private final BlockPos blockPos;
|
||||
private final String cachedPlacerName;
|
||||
|
||||
private short currentTick = 20;
|
||||
private short daysAmount, hoursAmount, minutesAmount, secondsAmount;
|
||||
@ -75,6 +76,8 @@ public final class ChunkLoaderBlockEntity extends BlockEntity implements ITileEn
|
||||
currentY += 0.23;
|
||||
holograms.add(hologram);
|
||||
}
|
||||
|
||||
this.cachedPlacerName = Optional.ofNullable(this.chunkLoader.getWhoPlaced().getName()).orElse("");
|
||||
}
|
||||
|
||||
public void tick() {
|
||||
@ -133,9 +136,8 @@ public final class ChunkLoaderBlockEntity extends BlockEntity implements ITileEn
|
||||
}
|
||||
|
||||
private void updateName(EntityHologram hologram, String line) {
|
||||
String placerName = Optional.ofNullable(chunkLoader.getWhoPlaced().getName()).orElse("");
|
||||
hologram.setHologramName(line
|
||||
.replace("{0}", placerName)
|
||||
.replace("{0}", this.cachedPlacerName)
|
||||
.replace("{1}", daysAmount + "")
|
||||
.replace("{2}", hoursAmount + "")
|
||||
.replace("{3}", minutesAmount + "")
|
||||
|
@ -27,6 +27,7 @@ public final class TileEntityChunkLoader extends TileEntity implements IUpdatePl
|
||||
public final List<EntityHolograms> holograms = new ArrayList<>();
|
||||
private final WChunkLoader chunkLoader;
|
||||
private final Block loaderBlock;
|
||||
private final String cachedPlacerName;
|
||||
|
||||
private short currentTick = 20;
|
||||
private short daysAmount, hoursAmount, minutesAmount, secondsAmount;
|
||||
@ -67,6 +68,8 @@ public final class TileEntityChunkLoader extends TileEntity implements IUpdatePl
|
||||
currentY += 0.23;
|
||||
holograms.add(hologram);
|
||||
}
|
||||
|
||||
this.cachedPlacerName = Optional.ofNullable(this.chunkLoader.getWhoPlaced().getName()).orElse("");
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -117,9 +120,8 @@ public final class TileEntityChunkLoader extends TileEntity implements IUpdatePl
|
||||
}
|
||||
|
||||
private void updateName(EntityHolograms hologram, String line) {
|
||||
String placerName = Optional.ofNullable(chunkLoader.getWhoPlaced().getName()).orElse("");
|
||||
hologram.setHologramName(line
|
||||
.replace("{0}", placerName)
|
||||
.replace("{0}", this.cachedPlacerName)
|
||||
.replace("{1}", daysAmount + "")
|
||||
.replace("{2}", hoursAmount + "")
|
||||
.replace("{3}", minutesAmount + "")
|
||||
|
Loading…
Reference in New Issue
Block a user