Fixed a NPE when placing a chunk loader (#77)

This commit is contained in:
OmerBenGera 2024-03-30 16:41:26 +03:00
parent 901f630d89
commit a07499aa66
9 changed files with 18 additions and 18 deletions

View File

@ -41,6 +41,8 @@ public final class TileEntityChunkLoader extends TileEntity implements ITickable
loaderBlock = world.getType(blockPosition).getBlock();
this.cachedPlacerName = Optional.ofNullable(this.chunkLoader.getWhoPlaced().getName()).orElse("");
if (!this.chunkLoader.isInfinite()) {
long timeLeft = chunkLoader.getTimeLeft();
@ -68,8 +70,6 @@ public final class TileEntityChunkLoader extends TileEntity implements ITickable
currentY += 0.23;
holograms.add(hologram);
}
this.cachedPlacerName = Optional.ofNullable(this.chunkLoader.getWhoPlaced().getName()).orElse("");
}
@Override

View File

@ -49,6 +49,8 @@ public final class TileEntityChunkLoader extends TileEntity implements ITickable
} catch (Throwable ignored) {
}
this.cachedPlacerName = Optional.ofNullable(this.chunkLoader.getWhoPlaced().getName()).orElse("");
if (!this.chunkLoader.isInfinite()) {
long timeLeft = chunkLoader.getTimeLeft();
@ -76,8 +78,6 @@ public final class TileEntityChunkLoader extends TileEntity implements ITickable
currentY += 0.23;
holograms.add(hologram);
}
this.cachedPlacerName = Optional.ofNullable(this.chunkLoader.getWhoPlaced().getName()).orElse("");
}
@Override

View File

@ -48,6 +48,8 @@ public final class ChunkLoaderBlockEntity extends BlockEntity implements ITileEn
loaderBlock = serverLevel.getBlockState(blockPos).getBlock();
this.cachedPlacerName = Optional.ofNullable(this.chunkLoader.getWhoPlaced().getName()).orElse("");
if (!this.chunkLoader.isInfinite()) {
long timeLeft = chunkLoader.getTimeLeft();
@ -76,8 +78,6 @@ 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() {

View File

@ -48,6 +48,8 @@ public final class ChunkLoaderBlockEntity extends BlockEntity implements ITileEn
loaderBlock = serverLevel.getBlockState(blockPos).getBlock();
this.cachedPlacerName = Optional.ofNullable(this.chunkLoader.getWhoPlaced().getName()).orElse("");
if (!this.chunkLoader.isInfinite()) {
long timeLeft = chunkLoader.getTimeLeft();
@ -76,8 +78,6 @@ 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() {

View File

@ -48,6 +48,8 @@ public final class ChunkLoaderBlockEntity extends BlockEntity implements ITileEn
loaderBlock = serverLevel.getBlockState(blockPos).getBlock();
this.cachedPlacerName = Optional.ofNullable(this.chunkLoader.getWhoPlaced().getName()).orElse("");
if (!this.chunkLoader.isInfinite()) {
long timeLeft = chunkLoader.getTimeLeft();
@ -76,8 +78,6 @@ 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() {

View File

@ -48,6 +48,8 @@ public final class ChunkLoaderBlockEntity extends BlockEntity implements ITileEn
loaderBlock = serverLevel.getBlockState(blockPos).getBlock();
this.cachedPlacerName = Optional.ofNullable(this.chunkLoader.getWhoPlaced().getName()).orElse("");
if (!this.chunkLoader.isInfinite()) {
long timeLeft = chunkLoader.getTimeLeft();
@ -76,8 +78,6 @@ 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() {

View File

@ -48,6 +48,8 @@ public final class ChunkLoaderBlockEntity extends BlockEntity implements ITileEn
loaderBlock = serverLevel.getBlockState(blockPos).getBlock();
this.cachedPlacerName = Optional.ofNullable(this.chunkLoader.getWhoPlaced().getName()).orElse("");
if (!this.chunkLoader.isInfinite()) {
long timeLeft = chunkLoader.getTimeLeft();
@ -76,8 +78,6 @@ 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() {

View File

@ -48,6 +48,8 @@ public final class ChunkLoaderBlockEntity extends BlockEntity implements ITileEn
loaderBlock = serverLevel.getBlockState(blockPos).getBlock();
this.cachedPlacerName = Optional.ofNullable(this.chunkLoader.getWhoPlaced().getName()).orElse("");
if (!this.chunkLoader.isInfinite()) {
long timeLeft = chunkLoader.getTimeLeft();
@ -76,8 +78,6 @@ 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() {

View File

@ -41,6 +41,8 @@ public final class TileEntityChunkLoader extends TileEntity implements IUpdatePl
loaderBlock = world.getType(blockPosition).getBlock();
this.cachedPlacerName = Optional.ofNullable(this.chunkLoader.getWhoPlaced().getName()).orElse("");
if (!this.chunkLoader.isInfinite()) {
long timeLeft = chunkLoader.getTimeLeft();
@ -68,8 +70,6 @@ public final class TileEntityChunkLoader extends TileEntity implements IUpdatePl
currentY += 0.23;
holograms.add(hologram);
}
this.cachedPlacerName = Optional.ofNullable(this.chunkLoader.getWhoPlaced().getName()).orElse("");
}
@Override