From 16b02e15bf03ab9fd7551ca55d749d268f4c23ce Mon Sep 17 00:00:00 2001 From: paulevsGitch Date: Thu, 29 Apr 2021 00:49:22 +0300 Subject: [PATCH] Fixed too small void ring, make void ring configurable --- .../world/generator/GeneratorOptions.java | 13 +++++++++++++ .../world/generator/IslandLayer.java | 19 ++++++++++--------- 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/src/main/java/ru/betterend/world/generator/GeneratorOptions.java b/src/main/java/ru/betterend/world/generator/GeneratorOptions.java index b9b34d4c..5c7f6c2d 100644 --- a/src/main/java/ru/betterend/world/generator/GeneratorOptions.java +++ b/src/main/java/ru/betterend/world/generator/GeneratorOptions.java @@ -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; + } } diff --git a/src/main/java/ru/betterend/world/generator/IslandLayer.java b/src/main/java/ru/betterend/world/generator/IslandLayer.java index fc98a264..d50f2797 100644 --- a/src/main/java/ru/betterend/world/generator/IslandLayer.java +++ b/src/main/java/ru/betterend/world/generator/IslandLayer.java @@ -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 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)); }