-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
-Optimize world generation by checking if a column's sections are emp…
…ty, if so, skip.
- Loading branch information
Showing
4 changed files
with
82 additions
and
5 deletions.
There are no files selected for viewing
3 changes: 2 additions & 1 deletion
3
src/main/java/io/github/opencubicchunks/cubicchunks/chunk/ICubeGenerator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
package io.github.opencubicchunks.cubicchunks.chunk; | ||
|
||
import io.github.opencubicchunks.cubicchunks.chunk.cube.CubePrimer; | ||
import io.github.opencubicchunks.cubicchunks.world.CubeWorldGenRegion; | ||
import net.minecraft.world.level.StructureFeatureManager; | ||
|
||
public interface ICubeGenerator { | ||
default void decorate(CubeWorldGenRegion region, StructureFeatureManager structureManager) { | ||
default void decorate(CubeWorldGenRegion region, StructureFeatureManager structureManager, CubePrimer chunkAccess) { | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
src/main/java/io/github/opencubicchunks/cubicchunks/chunk/util/CCWorldGenUtils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package io.github.opencubicchunks.cubicchunks.chunk.util; | ||
|
||
import io.github.opencubicchunks.cubicchunks.chunk.IBigCube; | ||
import io.github.opencubicchunks.cubicchunks.utils.Coords; | ||
import net.minecraft.world.level.ChunkPos; | ||
import net.minecraft.world.level.chunk.LevelChunkSection; | ||
|
||
public class CCWorldGenUtils { | ||
|
||
public static boolean areSectionsEmpty(int cubeY, ChunkPos pos, IBigCube cube) { | ||
int emptySections = 0; | ||
for (int yScan = 0; yScan < IBigCube.DIAMETER_IN_SECTIONS; yScan++) { | ||
int sectionY = Coords.cubeToSection(cubeY, yScan); | ||
int sectionIndex = Coords.sectionToIndex(pos.x, sectionY, pos.z); | ||
LevelChunkSection cubeSection = cube.getCubeSections()[sectionIndex]; | ||
if (LevelChunkSection.isEmpty(cubeSection)) { | ||
emptySections++; | ||
} | ||
if (emptySections == IBigCube.DIAMETER_IN_SECTIONS) { | ||
return true; | ||
} | ||
} | ||
return false; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters