diff --git a/common/src/main/java/org/valkyrienskies/mod/mixin/mod_compat/vanilla_renderer/MixinLevelRendererVanilla.java b/common/src/main/java/org/valkyrienskies/mod/mixin/mod_compat/vanilla_renderer/MixinLevelRendererVanilla.java index 6c9cf355c..20b33b254 100644 --- a/common/src/main/java/org/valkyrienskies/mod/mixin/mod_compat/vanilla_renderer/MixinLevelRendererVanilla.java +++ b/common/src/main/java/org/valkyrienskies/mod/mixin/mod_compat/vanilla_renderer/MixinLevelRendererVanilla.java @@ -27,6 +27,8 @@ import net.minecraft.core.BlockPos; import net.minecraft.core.Vec3i; import net.minecraft.world.entity.player.Player; +import net.minecraft.world.level.chunk.ChunkAccess; +import net.minecraft.world.level.chunk.LevelChunkSection; import org.jetbrains.annotations.Nullable; import org.joml.Vector3dc; import org.spongepowered.asm.mixin.Final; @@ -122,7 +124,13 @@ private void addShipVisibleChunks( } shipObject.getActiveChunksSet().forEach((x, z) -> { + final ChunkAccess chunk = level.getChunk(x, z); for (int y = level.getMinSection(); y < level.getMaxSection(); y++) { + final LevelChunkSection levelChunkSection = chunk.getSection(y - level.getMinSection()); + if (levelChunkSection.hasOnlyAir()) { + // Skip air sections + continue; + } tempPos.set(x << 4, y << 4, z << 4); final ChunkRenderDispatcher.RenderChunk renderChunk = chunkStorageAccessor.callGetRenderChunkAt(tempPos); diff --git a/common/src/main/java/org/valkyrienskies/mod/mixin/mod_compat/vanilla_renderer/MixinViewAreaVanilla.java b/common/src/main/java/org/valkyrienskies/mod/mixin/mod_compat/vanilla_renderer/MixinViewAreaVanilla.java index 0d18a2c02..104e4db9f 100644 --- a/common/src/main/java/org/valkyrienskies/mod/mixin/mod_compat/vanilla_renderer/MixinViewAreaVanilla.java +++ b/common/src/main/java/org/valkyrienskies/mod/mixin/mod_compat/vanilla_renderer/MixinViewAreaVanilla.java @@ -14,6 +14,7 @@ import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.Unique; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; @@ -35,9 +36,11 @@ public class MixinViewAreaVanilla implements IVSViewAreaMethods { protected int chunkGridSizeY; // Maps chunk position to an array of BuiltChunk, indexed by the y value. + @Unique private final Long2ObjectMap<ChunkRenderDispatcher.RenderChunk[]> vs$shipRenderChunks = new Long2ObjectOpenHashMap<>(); // This creates render chunks + @Unique private ChunkRenderDispatcher vs$chunkBuilder; /**