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 boolean replacePortal;
private static boolean replacePillars;
private static long islandDistBlock;
private static int islandDistChunk;
public static void init() {
biomeSizeLand = Configs.GENERATOR_CONFIG.getInt("biomeMap", "biomeSizeLand", 256);
@ -52,6 +54,9 @@ public class GeneratorOptions {
);
replacePortal = Configs.GENERATOR_CONFIG.getBoolean("portal", "customEndPortal", 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() {
@ -129,4 +134,12 @@ public class GeneratorOptions {
public static boolean 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.Random;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import net.minecraft.core.BlockPos;
@ -80,15 +79,17 @@ public class IslandLayer {
}
}
if (GeneratorOptions.hasCentralIsland() && ix < 4 && iz < 4 && ix > -4 && iz > -4) {
List<BlockPos> remove = Lists.newArrayList();
positions.forEach((pos) -> {
int d = pos.getX() * pos.getX() + pos.getZ() * pos.getZ();
if (d < 12544) {
remove.add(pos);
if (GeneratorOptions.hasCentralIsland() && Math.abs(ix) < GeneratorOptions.getIslandDistChunk() && Math.abs(iz) < GeneratorOptions.getIslandDistChunk()) {
int count = positions.size();
for (int n = 0; n < count; n++) {
BlockPos pos = positions.get(n);
long d = (long) pos.getX() * (long) pos.getX() + (long) pos.getZ() * (long) pos.getZ();
if (d < GeneratorOptions.getIslandDistBlock()) {
positions.remove(n);
count--;
n--;
}
});
positions.removeAll(remove);
}
if (options.hasCentralIsland) {
positions.add(new BlockPos(0, 64, 0));
}