Fixed too small void ring, make void ring configurable

This commit is contained in:
paulevsGitch 2021-04-29 00:49:22 +03:00
parent 5adf385813
commit 16b02e15bf
2 changed files with 23 additions and 9 deletions

View file

@ -26,6 +26,8 @@ public class GeneratorOptions {
private static BlockPos portal = BlockPos.ZERO; private static BlockPos portal = BlockPos.ZERO;
private static boolean replacePortal; private static boolean replacePortal;
private static boolean replacePillars; private static boolean replacePillars;
private static long islandDistBlock;
private static int islandDistChunk;
public static void init() { public static void init() {
biomeSizeLand = Configs.GENERATOR_CONFIG.getInt("biomeMap", "biomeSizeLand", 256); biomeSizeLand = Configs.GENERATOR_CONFIG.getInt("biomeMap", "biomeSizeLand", 256);
@ -52,6 +54,9 @@ public class GeneratorOptions {
); );
replacePortal = Configs.GENERATOR_CONFIG.getBoolean("portal", "customEndPortal", true); replacePortal = Configs.GENERATOR_CONFIG.getBoolean("portal", "customEndPortal", true);
replacePillars = Configs.GENERATOR_CONFIG.getBoolean("spikes", "customObsidianSpikes", true); replacePillars = Configs.GENERATOR_CONFIG.getBoolean("spikes", "customObsidianSpikes", true);
int circleRadius = Configs.GENERATOR_CONFIG.getInt("customGenerator", "voidRingSize", 1000);
islandDistBlock = (long) circleRadius * (long) circleRadius;
islandDistChunk = (circleRadius >> 3); // Twice bigger than normal
} }
public static int getBiomeSizeLand() { public static int getBiomeSizeLand() {
@ -129,4 +134,12 @@ public class GeneratorOptions {
public static boolean replacePillars() { public static boolean replacePillars() {
return replacePillars; return replacePillars;
} }
public static long getIslandDistBlock() {
return islandDistBlock;
}
public static int getIslandDistChunk() {
return islandDistChunk;
}
} }

View file

@ -5,7 +5,6 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Random; import java.util.Random;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
@ -80,15 +79,17 @@ public class IslandLayer {
} }
} }
if (GeneratorOptions.hasCentralIsland() && ix < 4 && iz < 4 && ix > -4 && iz > -4) { if (GeneratorOptions.hasCentralIsland() && Math.abs(ix) < GeneratorOptions.getIslandDistChunk() && Math.abs(iz) < GeneratorOptions.getIslandDistChunk()) {
List<BlockPos> remove = Lists.newArrayList(); int count = positions.size();
positions.forEach((pos) -> { for (int n = 0; n < count; n++) {
int d = pos.getX() * pos.getX() + pos.getZ() * pos.getZ(); BlockPos pos = positions.get(n);
if (d < 12544) { long d = (long) pos.getX() * (long) pos.getX() + (long) pos.getZ() * (long) pos.getZ();
remove.add(pos); if (d < GeneratorOptions.getIslandDistBlock()) {
positions.remove(n);
count--;
n--;
}
} }
});
positions.removeAll(remove);
if (options.hasCentralIsland) { if (options.hasCentralIsland) {
positions.add(new BlockPos(0, 64, 0)); positions.add(new BlockPos(0, 64, 0));
} }