From a345be1b3e8a3e29d928ddcaff9587393819471e Mon Sep 17 00:00:00 2001 From: paulevsGitch Date: Thu, 13 Jan 2022 17:04:22 +0300 Subject: [PATCH] Fix island distance (#381) --- gradle.properties | 2 +- src/main/java/ru/betterend/BetterEnd.java | 2 +- .../world/generator/GeneratorOptions.java | 16 ++++++---------- .../betterend/world/generator/IslandLayer.java | 7 ++----- .../features/EternalPortalStructure.java | 6 +++--- src/main/resources/fabric.mod.json | 2 +- 6 files changed, 14 insertions(+), 21 deletions(-) diff --git a/gradle.properties b/gradle.properties index 5f1354b6..3b513a2d 100644 --- a/gradle.properties +++ b/gradle.properties @@ -19,6 +19,6 @@ archives_base_name=better-end # currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api patchouli_version = 55-FABRIC-SNAPSHOT -bclib_version = 1.2.0 +bclib_version = 1.2.3 rei_version = 7.0.343 canvas_version = 1.0.+ diff --git a/src/main/java/ru/betterend/BetterEnd.java b/src/main/java/ru/betterend/BetterEnd.java index 40e6c306..a83d725d 100644 --- a/src/main/java/ru/betterend/BetterEnd.java +++ b/src/main/java/ru/betterend/BetterEnd.java @@ -66,7 +66,7 @@ public class BetterEnd implements ModInitializer { ru.bclib.world.generator.GeneratorOptions.setFarEndBiomes(GeneratorOptions.getIslandDistBlock()); ru.bclib.world.generator.GeneratorOptions.setEndLandFunction((pos) -> TerrainGenerator.isLand(pos.x, pos.y)); } - + BiomeAPI.registerEndBiomeModification((biomeID, biome) -> { if (!biomeID.equals(Biomes.THE_VOID.location())) { EndStructures.addBiomeStructures(biomeID, biome); diff --git a/src/main/java/ru/betterend/world/generator/GeneratorOptions.java b/src/main/java/ru/betterend/world/generator/GeneratorOptions.java index 79f0850d..35f2a85f 100644 --- a/src/main/java/ru/betterend/world/generator/GeneratorOptions.java +++ b/src/main/java/ru/betterend/world/generator/GeneratorOptions.java @@ -10,7 +10,6 @@ public class GeneratorOptions { private static boolean hasPillars; private static boolean hasDragonFights; private static boolean changeChorusPlant; - private static boolean removeChorusFromVanillaBiomes; private static boolean newGenerator; private static boolean generateCentralIsland; private static boolean generateObsidianPlatform; @@ -25,6 +24,7 @@ public class GeneratorOptions { private static int islandDistChunk; private static boolean directSpikeHeight; private static int circleRadius = 1000; + private static int circleRadiusSqr; public static void init() { biomeSizeCaves = Configs.GENERATOR_CONFIG.getInt("biomeMap", "biomeSizeCaves", 32); @@ -32,11 +32,6 @@ public class GeneratorOptions { hasPillars = Configs.GENERATOR_CONFIG.getBoolean("spikes", "hasSpikes", true); hasDragonFights = Configs.GENERATOR_CONFIG.getBooleanRoot("hasDragonFights", true); changeChorusPlant = Configs.GENERATOR_CONFIG.getBoolean("chorusPlant", "changeChorusPlant", true); - removeChorusFromVanillaBiomes = Configs.GENERATOR_CONFIG.getBoolean( - "chorusPlant", - "removeChorusFromVanillaBiomes", - true - ); newGenerator = Configs.GENERATOR_CONFIG.getBoolean("customGenerator", "useNewGenerator", true); generateCentralIsland = Configs.GENERATOR_CONFIG.getBoolean("customGenerator", "generateCentralIsland", true); endCityFailChance = Configs.GENERATOR_CONFIG.getInt("customGenerator", "endCityFailChance", 5); @@ -77,6 +72,7 @@ public class GeneratorOptions { replacePortal = Configs.GENERATOR_CONFIG.getBoolean("portal", "customEndPortal", true); replacePillars = Configs.GENERATOR_CONFIG.getBoolean("spikes", "customObsidianSpikes", true); circleRadius = Configs.GENERATOR_CONFIG.getInt("customGenerator", "voidRingSize", 1000); + circleRadiusSqr = circleRadius * circleRadius; islandDistChunk = (circleRadius >> 3); // Twice bigger than normal } @@ -100,10 +96,6 @@ public class GeneratorOptions { return changeChorusPlant; } - public static boolean removeChorusFromVanillaBiomes() { - return removeChorusFromVanillaBiomes; - } - public static boolean useNewGenerator() { return newGenerator; } @@ -140,6 +132,10 @@ public class GeneratorOptions { return circleRadius; } + public static int getIslandDistBlockSqr() { + return circleRadiusSqr; + } + 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 76c7a735..94e7fcb1 100644 --- a/src/main/java/ru/betterend/world/generator/IslandLayer.java +++ b/src/main/java/ru/betterend/world/generator/IslandLayer.java @@ -41,10 +41,7 @@ public class IslandLayer { SDF coneBottom = new SDFSmoothUnion().setRadius(0.02F).setSourceA(cone1).setSourceB(cone2); SDF coneTop = new SDFSmoothUnion().setRadius(0.02F).setSourceA(cone3).setSourceB(cone4); - noise = (SDFRadialNoiseMap) new SDFRadialNoiseMap().setSeed(seed) - .setRadius(0.5F) - .setIntensity(0.2F) - .setSource(coneTop); + noise = (SDFRadialNoiseMap) new SDFRadialNoiseMap().setSeed(seed).setRadius(0.5F).setIntensity(0.2F).setSource(coneTop); island = new SDFSmoothUnion().setRadius(0.01F).setSourceA(noise).setSourceB(coneBottom); } @@ -87,7 +84,7 @@ public class IslandLayer { 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()) { + if (d < GeneratorOptions.getIslandDistBlockSqr()) { positions.remove(n); count--; n--; diff --git a/src/main/java/ru/betterend/world/structures/features/EternalPortalStructure.java b/src/main/java/ru/betterend/world/structures/features/EternalPortalStructure.java index dd27ed41..54cf4d2e 100644 --- a/src/main/java/ru/betterend/world/structures/features/EternalPortalStructure.java +++ b/src/main/java/ru/betterend/world/structures/features/EternalPortalStructure.java @@ -25,9 +25,9 @@ public class EternalPortalStructure extends FeatureBaseStructure { public EternalPortalStructure() { super(PieceGeneratorSupplier.simple( - EternalPortalStructure::checkLocation, - EternalPortalStructure::generatePieces - )); + EternalPortalStructure::checkLocation, + EternalPortalStructure::generatePieces) + ); } protected static boolean checkLocation(PieceGeneratorSupplier.Context context) { diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index c674a170..bd1107a6 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -46,7 +46,7 @@ "fabricloader": ">=0.12.9", "fabric": ">=0.44.0", "minecraft": "1.18.x", - "bclib": ">=1.2.0" + "bclib": ">=1.2.3" }, "suggests": { "byg": ">=1.1.3",