From c55351e980cf89b9a05ca8d7d40dcf0d838aac12 Mon Sep 17 00:00:00 2001 From: JozsefA Date: Sat, 3 Apr 2021 18:33:47 -0700 Subject: [PATCH] Fix nullpointer with starlight --- .../utility/worldWrappers/WrappedChunkProvider.java | 9 +-------- .../utility/worldWrappers/chunk/WrappedChunk.java | 10 +++++----- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/src/main/java/com/simibubi/create/foundation/utility/worldWrappers/WrappedChunkProvider.java b/src/main/java/com/simibubi/create/foundation/utility/worldWrappers/WrappedChunkProvider.java index f6a22d102..f589c16cc 100644 --- a/src/main/java/com/simibubi/create/foundation/utility/worldWrappers/WrappedChunkProvider.java +++ b/src/main/java/com/simibubi/create/foundation/utility/worldWrappers/WrappedChunkProvider.java @@ -56,14 +56,7 @@ public class WrappedChunkProvider extends AbstractChunkProvider { public WrappedChunk getChunk(int x, int z) { long pos = ChunkPos.asLong(x, z); - WrappedChunk chunk = chunks.get(pos); - - if (chunk == null) { - chunk = new WrappedChunk(world, x, z); - chunks.put(pos, chunk); - } - - return chunk; + return chunks.computeIfAbsent(pos, $ -> new WrappedChunk(world, x, z)); } @Override diff --git a/src/main/java/com/simibubi/create/foundation/utility/worldWrappers/chunk/WrappedChunk.java b/src/main/java/com/simibubi/create/foundation/utility/worldWrappers/chunk/WrappedChunk.java index c6904537d..f1c672e6c 100644 --- a/src/main/java/com/simibubi/create/foundation/utility/worldWrappers/chunk/WrappedChunk.java +++ b/src/main/java/com/simibubi/create/foundation/utility/worldWrappers/chunk/WrappedChunk.java @@ -71,6 +71,11 @@ public class WrappedChunk implements IChunk { return sections; } + @Override + public ChunkStatus getStatus() { + return ChunkStatus.LIGHT; + } + @Nullable @Override public BlockState setBlockState(BlockPos p_177436_1_, BlockState p_177436_2_, boolean p_177436_3_) { @@ -148,11 +153,6 @@ public class WrappedChunk implements IChunk { return false; } - @Override - public ChunkStatus getStatus() { - return null; - } - @Override public void removeTileEntity(BlockPos p_177425_1_) {