From ba6618ac26117030a8846a818134c6144222398d Mon Sep 17 00:00:00 2001 From: MysticKoko <132279944+MysticKoko@users.noreply.github.com> Date: Wed, 18 Dec 2024 06:21:53 +0200 Subject: [PATCH] Worldgen stuff Im going to bed bye --- .../configured_feature/anemone_patch.json | 4 +- .../brown_seaweed_patch.json | 4 +- .../configured_feature/giant_clam_patch.json | 4 +- .../green_seaweed_patch.json | 4 +- .../configured_feature/red_seaweed_patch.json | 4 +- .../configured_feature/tube_sponge_patch.json | 4 +- .../placed_feature/anemone_patch.json | 3 - .../worldgen/placed_feature/brine_lake.json | 19 +- .../placed_feature/brown_seaweed_patch.json | 3 - .../placed_feature/deep_ocean_vegetation.json | 7 +- .../placed_feature/giant_clam_patch.json | 3 - .../placed_feature/green_seaweed_patch.json | 3 - .../placed_feature/message_in_a_bottle.json | 3 - .../placed_feature/red_seaweed_patch.json | 3 - .../worldgen/placed_feature/sponge_patch.json | 3 - .../placed_feature/thermal_vent_patch.json | 5 +- .../data/server/ConfiguredFeatureProvider.kt | 13 +- .../data/server/PlacedFeatureProvider.kt | 25 +- .../world/gen/feature/BrineLakeFeature.kt | 228 ++++++++---------- .../world/gen/feature/VentPatchFeature.kt | 2 +- 20 files changed, 138 insertions(+), 206 deletions(-) diff --git a/src/generated/resources/data/hybrid-aquatic/worldgen/configured_feature/anemone_patch.json b/src/generated/resources/data/hybrid-aquatic/worldgen/configured_feature/anemone_patch.json index 52796625d..599998822 100644 --- a/src/generated/resources/data/hybrid-aquatic/worldgen/configured_feature/anemone_patch.json +++ b/src/generated/resources/data/hybrid-aquatic/worldgen/configured_feature/anemone_patch.json @@ -20,8 +20,8 @@ { "type": "minecraft:block_predicate_filter", "predicate": { - "type": "minecraft:matching_fluids", - "fluids": "minecraft:water" + "type": "minecraft:matching_blocks", + "blocks": "minecraft:water" } } ] diff --git a/src/generated/resources/data/hybrid-aquatic/worldgen/configured_feature/brown_seaweed_patch.json b/src/generated/resources/data/hybrid-aquatic/worldgen/configured_feature/brown_seaweed_patch.json index 6a4dbd762..0b18ff273 100644 --- a/src/generated/resources/data/hybrid-aquatic/worldgen/configured_feature/brown_seaweed_patch.json +++ b/src/generated/resources/data/hybrid-aquatic/worldgen/configured_feature/brown_seaweed_patch.json @@ -17,8 +17,8 @@ { "type": "minecraft:block_predicate_filter", "predicate": { - "type": "minecraft:matching_fluids", - "fluids": "minecraft:water" + "type": "minecraft:matching_blocks", + "blocks": "minecraft:water" } } ] diff --git a/src/generated/resources/data/hybrid-aquatic/worldgen/configured_feature/giant_clam_patch.json b/src/generated/resources/data/hybrid-aquatic/worldgen/configured_feature/giant_clam_patch.json index c111e7ef4..b9a2f88b5 100644 --- a/src/generated/resources/data/hybrid-aquatic/worldgen/configured_feature/giant_clam_patch.json +++ b/src/generated/resources/data/hybrid-aquatic/worldgen/configured_feature/giant_clam_patch.json @@ -38,8 +38,8 @@ { "type": "minecraft:block_predicate_filter", "predicate": { - "type": "minecraft:matching_fluids", - "fluids": "minecraft:water" + "type": "minecraft:matching_blocks", + "blocks": "minecraft:water" } } ] diff --git a/src/generated/resources/data/hybrid-aquatic/worldgen/configured_feature/green_seaweed_patch.json b/src/generated/resources/data/hybrid-aquatic/worldgen/configured_feature/green_seaweed_patch.json index 55bdeee3a..ce3bdf74f 100644 --- a/src/generated/resources/data/hybrid-aquatic/worldgen/configured_feature/green_seaweed_patch.json +++ b/src/generated/resources/data/hybrid-aquatic/worldgen/configured_feature/green_seaweed_patch.json @@ -17,8 +17,8 @@ { "type": "minecraft:block_predicate_filter", "predicate": { - "type": "minecraft:matching_fluids", - "fluids": "minecraft:water" + "type": "minecraft:matching_blocks", + "blocks": "minecraft:water" } } ] diff --git a/src/generated/resources/data/hybrid-aquatic/worldgen/configured_feature/red_seaweed_patch.json b/src/generated/resources/data/hybrid-aquatic/worldgen/configured_feature/red_seaweed_patch.json index e18b59e84..840daf531 100644 --- a/src/generated/resources/data/hybrid-aquatic/worldgen/configured_feature/red_seaweed_patch.json +++ b/src/generated/resources/data/hybrid-aquatic/worldgen/configured_feature/red_seaweed_patch.json @@ -17,8 +17,8 @@ { "type": "minecraft:block_predicate_filter", "predicate": { - "type": "minecraft:matching_fluids", - "fluids": "minecraft:water" + "type": "minecraft:matching_blocks", + "blocks": "minecraft:water" } } ] diff --git a/src/generated/resources/data/hybrid-aquatic/worldgen/configured_feature/tube_sponge_patch.json b/src/generated/resources/data/hybrid-aquatic/worldgen/configured_feature/tube_sponge_patch.json index 53f1af034..03cf63270 100644 --- a/src/generated/resources/data/hybrid-aquatic/worldgen/configured_feature/tube_sponge_patch.json +++ b/src/generated/resources/data/hybrid-aquatic/worldgen/configured_feature/tube_sponge_patch.json @@ -20,8 +20,8 @@ { "type": "minecraft:block_predicate_filter", "predicate": { - "type": "minecraft:matching_fluids", - "fluids": "minecraft:water" + "type": "minecraft:matching_blocks", + "blocks": "minecraft:water" } } ] diff --git a/src/generated/resources/data/hybrid-aquatic/worldgen/placed_feature/anemone_patch.json b/src/generated/resources/data/hybrid-aquatic/worldgen/placed_feature/anemone_patch.json index 2d5042784..257531bc6 100644 --- a/src/generated/resources/data/hybrid-aquatic/worldgen/placed_feature/anemone_patch.json +++ b/src/generated/resources/data/hybrid-aquatic/worldgen/placed_feature/anemone_patch.json @@ -11,9 +11,6 @@ { "type": "minecraft:count", "count": 1 - }, - { - "type": "minecraft:biome" } ] } \ No newline at end of file diff --git a/src/generated/resources/data/hybrid-aquatic/worldgen/placed_feature/brine_lake.json b/src/generated/resources/data/hybrid-aquatic/worldgen/placed_feature/brine_lake.json index a5a0c5106..5f5c4ef9e 100644 --- a/src/generated/resources/data/hybrid-aquatic/worldgen/placed_feature/brine_lake.json +++ b/src/generated/resources/data/hybrid-aquatic/worldgen/placed_feature/brine_lake.json @@ -5,15 +5,24 @@ "type": "minecraft:in_square" }, { - "type": "minecraft:heightmap", - "heightmap": "OCEAN_FLOOR" + "type": "minecraft:height_range", + "height": { + "type": "minecraft:uniform", + "max_inclusive": { + "absolute": 256 + }, + "min_inclusive": { + "above_bottom": 0 + } + } }, { - "type": "minecraft:count", - "count": 4 + "type": "minecraft:surface_relative_threshold_filter", + "heightmap": "OCEAN_FLOOR_WG" }, { - "type": "minecraft:biome" + "type": "minecraft:count", + "count": 1 } ] } \ No newline at end of file diff --git a/src/generated/resources/data/hybrid-aquatic/worldgen/placed_feature/brown_seaweed_patch.json b/src/generated/resources/data/hybrid-aquatic/worldgen/placed_feature/brown_seaweed_patch.json index 0d6f4c72d..4e41ac189 100644 --- a/src/generated/resources/data/hybrid-aquatic/worldgen/placed_feature/brown_seaweed_patch.json +++ b/src/generated/resources/data/hybrid-aquatic/worldgen/placed_feature/brown_seaweed_patch.json @@ -11,9 +11,6 @@ { "type": "minecraft:count", "count": 1 - }, - { - "type": "minecraft:biome" } ] } \ No newline at end of file diff --git a/src/generated/resources/data/hybrid-aquatic/worldgen/placed_feature/deep_ocean_vegetation.json b/src/generated/resources/data/hybrid-aquatic/worldgen/placed_feature/deep_ocean_vegetation.json index fd70eb874..d116095ec 100644 --- a/src/generated/resources/data/hybrid-aquatic/worldgen/placed_feature/deep_ocean_vegetation.json +++ b/src/generated/resources/data/hybrid-aquatic/worldgen/placed_feature/deep_ocean_vegetation.json @@ -3,9 +3,9 @@ "placement": [ { "type": "minecraft:noise_based_count", - "noise_factor": 400.0, + "noise_factor": 200.0, "noise_offset": 0.0, - "noise_to_count_ratio": 20 + "noise_to_count_ratio": 40 }, { "type": "minecraft:in_square" @@ -13,9 +13,6 @@ { "type": "minecraft:heightmap", "heightmap": "OCEAN_FLOOR_WG" - }, - { - "type": "minecraft:biome" } ] } \ No newline at end of file diff --git a/src/generated/resources/data/hybrid-aquatic/worldgen/placed_feature/giant_clam_patch.json b/src/generated/resources/data/hybrid-aquatic/worldgen/placed_feature/giant_clam_patch.json index cb6f54861..4cff9af27 100644 --- a/src/generated/resources/data/hybrid-aquatic/worldgen/placed_feature/giant_clam_patch.json +++ b/src/generated/resources/data/hybrid-aquatic/worldgen/placed_feature/giant_clam_patch.json @@ -11,9 +11,6 @@ { "type": "minecraft:count", "count": 1 - }, - { - "type": "minecraft:biome" } ] } \ No newline at end of file diff --git a/src/generated/resources/data/hybrid-aquatic/worldgen/placed_feature/green_seaweed_patch.json b/src/generated/resources/data/hybrid-aquatic/worldgen/placed_feature/green_seaweed_patch.json index 76254ad48..3bf6900f1 100644 --- a/src/generated/resources/data/hybrid-aquatic/worldgen/placed_feature/green_seaweed_patch.json +++ b/src/generated/resources/data/hybrid-aquatic/worldgen/placed_feature/green_seaweed_patch.json @@ -11,9 +11,6 @@ { "type": "minecraft:count", "count": 1 - }, - { - "type": "minecraft:biome" } ] } \ No newline at end of file diff --git a/src/generated/resources/data/hybrid-aquatic/worldgen/placed_feature/message_in_a_bottle.json b/src/generated/resources/data/hybrid-aquatic/worldgen/placed_feature/message_in_a_bottle.json index 9fde7c4a2..41aa1d083 100644 --- a/src/generated/resources/data/hybrid-aquatic/worldgen/placed_feature/message_in_a_bottle.json +++ b/src/generated/resources/data/hybrid-aquatic/worldgen/placed_feature/message_in_a_bottle.json @@ -11,9 +11,6 @@ { "type": "minecraft:rarity_filter", "chance": 150 - }, - { - "type": "minecraft:biome" } ] } \ No newline at end of file diff --git a/src/generated/resources/data/hybrid-aquatic/worldgen/placed_feature/red_seaweed_patch.json b/src/generated/resources/data/hybrid-aquatic/worldgen/placed_feature/red_seaweed_patch.json index 42fb0ff2d..d0845461e 100644 --- a/src/generated/resources/data/hybrid-aquatic/worldgen/placed_feature/red_seaweed_patch.json +++ b/src/generated/resources/data/hybrid-aquatic/worldgen/placed_feature/red_seaweed_patch.json @@ -11,9 +11,6 @@ { "type": "minecraft:count", "count": 1 - }, - { - "type": "minecraft:biome" } ] } \ No newline at end of file diff --git a/src/generated/resources/data/hybrid-aquatic/worldgen/placed_feature/sponge_patch.json b/src/generated/resources/data/hybrid-aquatic/worldgen/placed_feature/sponge_patch.json index ee03ba582..1553c8990 100644 --- a/src/generated/resources/data/hybrid-aquatic/worldgen/placed_feature/sponge_patch.json +++ b/src/generated/resources/data/hybrid-aquatic/worldgen/placed_feature/sponge_patch.json @@ -11,9 +11,6 @@ { "type": "minecraft:count", "count": 1 - }, - { - "type": "minecraft:biome" } ] } \ No newline at end of file diff --git a/src/generated/resources/data/hybrid-aquatic/worldgen/placed_feature/thermal_vent_patch.json b/src/generated/resources/data/hybrid-aquatic/worldgen/placed_feature/thermal_vent_patch.json index e0013e566..ce6c106d9 100644 --- a/src/generated/resources/data/hybrid-aquatic/worldgen/placed_feature/thermal_vent_patch.json +++ b/src/generated/resources/data/hybrid-aquatic/worldgen/placed_feature/thermal_vent_patch.json @@ -3,7 +3,7 @@ "placement": [ { "type": "minecraft:noise_based_count", - "noise_factor": 200.0, + "noise_factor": 100.0, "noise_offset": 0.0, "noise_to_count_ratio": 5 }, @@ -30,9 +30,6 @@ { "type": "minecraft:count", "count": 1 - }, - { - "type": "minecraft:biome" } ] } \ No newline at end of file diff --git a/src/main/kotlin/dev/hybridlabs/aquatic/data/server/ConfiguredFeatureProvider.kt b/src/main/kotlin/dev/hybridlabs/aquatic/data/server/ConfiguredFeatureProvider.kt index 5a090721f..cbbfcc52c 100644 --- a/src/main/kotlin/dev/hybridlabs/aquatic/data/server/ConfiguredFeatureProvider.kt +++ b/src/main/kotlin/dev/hybridlabs/aquatic/data/server/ConfiguredFeatureProvider.kt @@ -10,7 +10,6 @@ import net.fabricmc.fabric.api.datagen.v1.provider.FabricDynamicRegistryProvider import net.minecraft.block.BlockState import net.minecraft.block.Blocks import net.minecraft.block.HorizontalFacingBlock -import net.minecraft.fluid.Fluids import net.minecraft.registry.RegistryWrapper import net.minecraft.registry.entry.RegistryEntryList import net.minecraft.state.property.Properties @@ -38,7 +37,7 @@ class ConfiguredFeatureProvider(output: FabricDataOutput, registriesFuture: Comp SimpleBlockFeatureConfig( BlockStateProvider.of(HybridAquaticBlocks.ANEMONE.defaultState) ), - BlockPredicate.matchingFluids(Fluids.WATER) + BlockPredicate.matchingBlocks(Blocks.WATER) ) ) ) @@ -54,7 +53,7 @@ class ConfiguredFeatureProvider(output: FabricDataOutput, registriesFuture: Comp SimpleBlockFeatureConfig( BlockStateProvider.of(HybridAquaticBlocks.BROWN_SEAWEED.defaultState) ), - BlockPredicate.matchingFluids(Fluids.WATER) + BlockPredicate.matchingBlocks(Blocks.WATER) ) ) ) @@ -70,7 +69,7 @@ class ConfiguredFeatureProvider(output: FabricDataOutput, registriesFuture: Comp SimpleBlockFeatureConfig( BlockStateProvider.of(HybridAquaticBlocks.RED_SEAWEED.defaultState) ), - BlockPredicate.matchingFluids(Fluids.WATER) + BlockPredicate.matchingBlocks(Blocks.WATER) ) ) ) @@ -86,7 +85,7 @@ class ConfiguredFeatureProvider(output: FabricDataOutput, registriesFuture: Comp SimpleBlockFeatureConfig( BlockStateProvider.of(HybridAquaticBlocks.GREEN_SEAWEED.defaultState) ), - BlockPredicate.matchingFluids(Fluids.WATER) + BlockPredicate.matchingBlocks(Blocks.WATER) ) ) ) @@ -104,7 +103,7 @@ class ConfiguredFeatureProvider(output: FabricDataOutput, registriesFuture: Comp SimpleBlockFeatureConfig( BlockStateProvider.of(HybridAquaticBlocks.TUBE_SPONGE.defaultState.with(Properties.WATERLOGGED, true)) ), - BlockPredicate.matchingFluids(Fluids.WATER) + BlockPredicate.matchingBlocks(Blocks.WATER) ) ) ) @@ -126,7 +125,7 @@ class ConfiguredFeatureProvider(output: FabricDataOutput, registriesFuture: Comp .build() ) ), - BlockPredicate.matchingFluids(Fluids.WATER) + BlockPredicate.matchingBlocks(Blocks.WATER) ) ) ) diff --git a/src/main/kotlin/dev/hybridlabs/aquatic/data/server/PlacedFeatureProvider.kt b/src/main/kotlin/dev/hybridlabs/aquatic/data/server/PlacedFeatureProvider.kt index 27cb8fff7..d36391c22 100644 --- a/src/main/kotlin/dev/hybridlabs/aquatic/data/server/PlacedFeatureProvider.kt +++ b/src/main/kotlin/dev/hybridlabs/aquatic/data/server/PlacedFeatureProvider.kt @@ -23,7 +23,6 @@ class PlacedFeatureProvider(output: FabricDataOutput, registriesFuture: Completa SquarePlacementModifier.of(), PlacedFeatures.OCEAN_FLOOR_WG_HEIGHTMAP, CountPlacementModifier.of(1), - BiomePlacementModifier.of() ) ) ) @@ -35,7 +34,6 @@ class PlacedFeatureProvider(output: FabricDataOutput, registriesFuture: Completa SquarePlacementModifier.of(), PlacedFeatures.OCEAN_FLOOR_WG_HEIGHTMAP, CountPlacementModifier.of(1), - BiomePlacementModifier.of() ) ) ) @@ -47,7 +45,6 @@ class PlacedFeatureProvider(output: FabricDataOutput, registriesFuture: Completa SquarePlacementModifier.of(), PlacedFeatures.OCEAN_FLOOR_WG_HEIGHTMAP, CountPlacementModifier.of(1), - BiomePlacementModifier.of() ) ) ) @@ -59,7 +56,6 @@ class PlacedFeatureProvider(output: FabricDataOutput, registriesFuture: Completa SquarePlacementModifier.of(), PlacedFeatures.OCEAN_FLOOR_WG_HEIGHTMAP, CountPlacementModifier.of(1), - BiomePlacementModifier.of() ) ) ) @@ -72,7 +68,6 @@ class PlacedFeatureProvider(output: FabricDataOutput, registriesFuture: Completa SquarePlacementModifier.of(), PlacedFeatures.OCEAN_FLOOR_WG_HEIGHTMAP, CountPlacementModifier.of(1), - BiomePlacementModifier.of() ) ) ) @@ -85,7 +80,6 @@ class PlacedFeatureProvider(output: FabricDataOutput, registriesFuture: Completa SquarePlacementModifier.of(), PlacedFeatures.OCEAN_FLOOR_WG_HEIGHTMAP, CountPlacementModifier.of(1), - BiomePlacementModifier.of() ) ) ) @@ -98,7 +92,6 @@ class PlacedFeatureProvider(output: FabricDataOutput, registriesFuture: Completa SquarePlacementModifier.of(), PlacedFeatures.WORLD_SURFACE_WG_HEIGHTMAP, RarityFilterPlacementModifier.of(150), - BiomePlacementModifier.of() ) ) ) @@ -108,12 +101,11 @@ class PlacedFeatureProvider(output: FabricDataOutput, registriesFuture: Completa HybridAquaticPlacedFeatures.THERMAL_VENT_PATCH, PlacedFeature(entries.ref(HybridAquaticConfiguredFeatures.THERMAL_VENT_PATCH), listOf( - NoiseBasedCountPlacementModifier.of(5, 200.0, 0.0), + NoiseBasedCountPlacementModifier.of(5, 100.0, 0.0), SquarePlacementModifier.of(), PlacedFeatures.BOTTOM_TO_120_RANGE, SurfaceThresholdFilterPlacementModifier.of(Heightmap.Type.OCEAN_FLOOR_WG, Int.MIN_VALUE, -32), CountPlacementModifier.of(1), - BiomePlacementModifier.of() ) ) ) @@ -124,9 +116,9 @@ class PlacedFeatureProvider(output: FabricDataOutput, registriesFuture: Completa PlacedFeature(entries.ref(HybridAquaticConfiguredFeatures.BRINE_LAKE), listOf( SquarePlacementModifier.of(), - PlacedFeatures.OCEAN_FLOOR_HEIGHTMAP, - CountPlacementModifier.of(4), - BiomePlacementModifier.of(), + PlacedFeatures.BOTTOM_TO_120_RANGE, + SurfaceThresholdFilterPlacementModifier.of(Heightmap.Type.OCEAN_FLOOR_WG, Int.MIN_VALUE, Int.MAX_VALUE), + CountPlacementModifier.of(1), ) ) ) @@ -136,7 +128,7 @@ class PlacedFeatureProvider(output: FabricDataOutput, registriesFuture: Completa PlacedFeature(entries.ref(HybridAquaticConfiguredFeatures.DEEP_CORAL_MUSHROOM), listOf( SquarePlacementModifier.of(), - HeightmapPlacementModifier.of(Heightmap.Type.OCEAN_FLOOR_WG), + PlacedFeatures.OCEAN_FLOOR_WG_HEIGHTMAP, ) ) ) @@ -146,7 +138,7 @@ class PlacedFeatureProvider(output: FabricDataOutput, registriesFuture: Completa PlacedFeature(entries.ref(HybridAquaticConfiguredFeatures.DEEP_CORAL_TREE), listOf( SquarePlacementModifier.of(), - HeightmapPlacementModifier.of(Heightmap.Type.OCEAN_FLOOR_WG), + PlacedFeatures.OCEAN_FLOOR_WG_HEIGHTMAP, ) ) ) @@ -156,7 +148,7 @@ class PlacedFeatureProvider(output: FabricDataOutput, registriesFuture: Completa PlacedFeature(entries.ref(HybridAquaticConfiguredFeatures.DEEP_CORAL_CLAW), listOf( SquarePlacementModifier.of(), - HeightmapPlacementModifier.of(Heightmap.Type.OCEAN_FLOOR_WG), + PlacedFeatures.OCEAN_FLOOR_WG_HEIGHTMAP, ) ) ) @@ -166,10 +158,9 @@ class PlacedFeatureProvider(output: FabricDataOutput, registriesFuture: Completa PlacedFeature( entries.ref(HybridAquaticConfiguredFeatures.DEEP_OCEAN_VEGETATION), listOf( - NoiseBasedCountPlacementModifier.of(20, 400.0, 0.0), + NoiseBasedCountPlacementModifier.of(40, 200.0, 0.0), SquarePlacementModifier.of(), PlacedFeatures.OCEAN_FLOOR_WG_HEIGHTMAP, - BiomePlacementModifier.of() ) ) ) diff --git a/src/main/kotlin/dev/hybridlabs/aquatic/world/gen/feature/BrineLakeFeature.kt b/src/main/kotlin/dev/hybridlabs/aquatic/world/gen/feature/BrineLakeFeature.kt index ffad4f0c3..5e339de38 100644 --- a/src/main/kotlin/dev/hybridlabs/aquatic/world/gen/feature/BrineLakeFeature.kt +++ b/src/main/kotlin/dev/hybridlabs/aquatic/world/gen/feature/BrineLakeFeature.kt @@ -10,168 +10,128 @@ import net.minecraft.world.gen.feature.util.FeatureContext @Suppress("DEPRECATION", "NAME_SHADOWING") class BrineLakeFeature(codec: Codec) : Feature(codec) { override fun generate(context: FeatureContext): Boolean { - var blockPos = context.origin - val structureWorldAccess = context.world val random = context.random + val structureWorldAccess = context.world + val blockPos = context.origin val config = context.config - if (blockPos.y <= structureWorldAccess.bottomY + 4) { - return false - } else { - blockPos = blockPos.down(4) - val bls = BooleanArray(2048) - val i = random.nextInt(4) + 4 - - for (j in 0 until i) { - val d = random.nextDouble() * 6.0 + 3.0 - val e = random.nextDouble() * 4.0 + 2.0 - val f = random.nextDouble() * 6.0 + 3.0 - val g = random.nextDouble() * (16.0 - d - 2.0) + 1.0 + d / 2.0 - val h = random.nextDouble() * (8.0 - e - 4.0) + 2.0 + e / 2.0 - val k = random.nextDouble() * (16.0 - f - 2.0) + 1.0 + f / 2.0 - for (l in 1..14) { - for (m in 1..14) { - for (n in 1..6) { - val o = (l.toDouble() - g) / (d / 2.0) - val p = (n.toDouble() - h) / (e / 2.0) - val q = (m.toDouble() - k) / (f / 2.0) - val r = o * o + p * p + q * q - if (r < 1.0) { - bls[(l * 16 + m) * 8 + n] = true - } + val bls = BooleanArray(2048) + val i = random.nextInt(4) + 4 + + for (j in 0 until i) { + val d = random.nextDouble() * 12.0 + 6.0 + val e = random.nextDouble() * 8.0 + 4.0 + val f = random.nextDouble() * 12.0 + 6.0 + val g = random.nextDouble() * (16.0 - d - 2.0) + 1.0 + d / 2.0 + val h = random.nextDouble() * (8.0 - e - 4.0) + 2.0 + e / 2.0 + val k = random.nextDouble() * (16.0 - f - 2.0) + 1.0 + f / 2.0 + + for (l in 1..14) { + for (m in 1..14) { + for (n in 1..6) { + val o = (l.toDouble() - g) / (d / 2.0) + val p = (n.toDouble() - h) / (e / 2.0) + val q = (m.toDouble() - k) / (f / 2.0) + val r = o * o + p * p + q * q + if (r < 1.0) { + bls[(l * 16 + m) * 8 + n] = true } } } } + } - val blockState = config.fluidProvider[random, blockPos] - - var t: Int - var v: Boolean - var u: Int - var s = 0 - while (s < 16) { - t = 0 - while (t < 16) { - u = 0 - while (u < 8) { - v = - !bls[(s * 16 + t) * 8 + u] && ((s < 15 && bls[((s + 1) * 16 + t) * 8 + u] || s > 0 && bls[((s - 1) * 16 + t) * 8 + u] || t < 15 && bls[(s * 16 + t + 1) * 8 + u]) || (t > 0) && bls[(s * 16 + (t - 1)) * 8 + u] || (u < 7) && bls[(s * 16 + t) * 8 + u + 1] || (u > 0) && bls[(s * 16 + t) * 8 + (u - 1)]) - if (v) { - val blockState2 = structureWorldAccess.getBlockState(blockPos.add(s, u, t)) - if (u >= 4 && blockState2.isLiquid) { - return false - } - - if (u < 4 && !blockState2.isSolid && structureWorldAccess.getBlockState( - blockPos.add( - s, - u, - t - ) - ) !== blockState - ) { - return false - } + val blockState = config.fluidProvider[random, blockPos] + + var t: Int + var v: Boolean + var u: Int + var s = 0 + while (s < 16) { + t = 0 + while (t < 16) { + u = 0 + while (u < 8) { + v = + !bls[(s * 16 + t) * 8 + u] && ((s < 15 && bls[((s + 1) * 16 + t) * 8 + u] || s > 0 && bls[((s - 1) * 16 + t) * 8 + u] || t < 15 && bls[(s * 16 + t + 1) * 8 + u]) || (t > 0) && bls[(s * 16 + (t - 1)) * 8 + u] || (u < 7) && bls[(s * 16 + t) * 8 + u + 1] || (u > 0) && bls[(s * 16 + t) * 8 + (u - 1)]) + if (v) { + val blockState2 = structureWorldAccess.getBlockState(blockPos.add(s, u, t)) + if (u >= 4 && blockState2.isLiquid) { + return false } - ++u - } - ++t - } - ++s - } - var bl2: Boolean - s = 0 - while (s < 16) { - t = 0 - while (t < 16) { - u = 0 - while (u < 8) { - if (bls[(s * 16 + t) * 8 + u]) { - val blockPos2 = blockPos.add(s, u, t) - if (this.canReplace(structureWorldAccess.getBlockState(blockPos2))) { - bl2 = u >= 4 - structureWorldAccess.setBlockState( - blockPos2, - if (bl2) WATER else blockState, - 2 + if (u < 4 && !blockState2.isSolid && structureWorldAccess.getBlockState( + blockPos.add( + s, + u, + t ) - if (bl2) { - structureWorldAccess.scheduleBlockTick(blockPos2, WATER.block, 0) - this.markBlocksAboveForPostProcessing(structureWorldAccess, blockPos2) - } - } + ) !== blockState + ) { + return false } - ++u } - ++t + ++u } - ++s + ++t } + ++s + } - val blockState3 = config.barrierProvider[random, blockPos] - if (!blockState3.isAir) { - t = 0 - while (t < 16) { - u = 0 - while (u < 16) { - for (v in 0..7) { - bl2 = - !bls[(t * 16 + u) * 8 + v] && ((t < 15 && bls[((t + 1) * 16 + u) * 8 + v] || t > 0 && bls[((t - 1) * 16 + u) * 8 + v] || u < 15 && bls[(t * 16 + u + 1) * 8 + v] || u > 0 && bls[(t * 16 + (u - 1)) * 8 + v]) || v < 7 && bls[(t * 16 + u) * 8 + v + 1] || v > 0 && bls[(t * 16 + u) * 8 + (v - 1)]) - if (bl2 && (v < 4 || random.nextInt(2) != 0)) { - val blockState4 = structureWorldAccess.getBlockState(blockPos.add(t, v, u)) - if (blockState4.isSolid && !blockState4.isIn(BlockTags.LAVA_POOL_STONE_CANNOT_REPLACE)) { - val blockPos3 = blockPos.add(t, v, u) - structureWorldAccess.setBlockState(blockPos3, blockState3, 2) - this.markBlocksAboveForPostProcessing(structureWorldAccess, blockPos3) - } + var bl2: Boolean + s = 0 + while (s < 16) { + t = 0 + while (t < 16) { + u = 0 + while (u < 8) { + if (bls[(s * 16 + t) * 8 + u]) { + val blockPos2 = blockPos.add(s, u, t) + if (this.canReplace(structureWorldAccess.getBlockState(blockPos2))) { + bl2 = u >= 4 + structureWorldAccess.setBlockState( + blockPos2, + if (bl2) WATER else blockState, + 2 + ) + if (bl2) { + structureWorldAccess.scheduleBlockTick(blockPos2, WATER.block, 0) + this.markBlocksAboveForPostProcessing(structureWorldAccess, blockPos2) } } - ++u } - ++t + ++u } + ++t } + ++s + } - s = 0 - while (s < 16) { - t = 0 - while (t < 16) { - for (u in 7 downTo 0) { - val basePos = blockPos.add(s, u, t) - val currentState = structureWorldAccess.getBlockState(basePos) - - if (currentState.isOf(Blocks.WATER)) { - var y = u + 1 - - while (y < structureWorldAccess.topY) { - val currentPos = blockPos.add(s, y, t) - val currentStateUp = structureWorldAccess.getBlockState(currentPos) - - if (structureWorldAccess.isSkyVisibleAllowingSea(currentPos)) break - - if (currentStateUp.isOf(Blocks.WATER)) { - break - } - - if (this.canReplace(currentStateUp)) { - structureWorldAccess.setBlockState(currentPos, WATER, 2) - } else { - break - } - y++ + val blockState3 = config.barrierProvider[random, blockPos] + if (!blockState3.isAir) { + t = 0 + while (t < 16) { + u = 0 + while (u < 16) { + for (v in 0..7) { + bl2 = + !bls[(t * 16 + u) * 8 + v] && ((t < 15 && bls[((t + 1) * 16 + u) * 8 + v] || t > 0 && bls[((t - 1) * 16 + u) * 8 + v] || u < 15 && bls[(t * 16 + u + 1) * 8 + v] || u > 0 && bls[(t * 16 + (u - 1)) * 8 + v]) || v < 7 && bls[(t * 16 + u) * 8 + v + 1] || v > 0 && bls[(t * 16 + u) * 8 + (v - 1)]) + if (bl2 && (v < 4 || random.nextInt(2) != 0)) { + val blockState4 = structureWorldAccess.getBlockState(blockPos.add(t, v, u)) + if (blockState4.isSolid && !blockState4.isIn(BlockTags.LAVA_POOL_STONE_CANNOT_REPLACE)) { + val blockPos3 = blockPos.add(t, v, u) + structureWorldAccess.setBlockState(blockPos3, blockState3, 2) + this.markBlocksAboveForPostProcessing(structureWorldAccess, blockPos3) } - break } } - ++t + ++u } - ++s + ++t } - - return true } + + return true } private fun canReplace(state: BlockState): Boolean { diff --git a/src/main/kotlin/dev/hybridlabs/aquatic/world/gen/feature/VentPatchFeature.kt b/src/main/kotlin/dev/hybridlabs/aquatic/world/gen/feature/VentPatchFeature.kt index 843a0a502..b7efe8b1d 100644 --- a/src/main/kotlin/dev/hybridlabs/aquatic/world/gen/feature/VentPatchFeature.kt +++ b/src/main/kotlin/dev/hybridlabs/aquatic/world/gen/feature/VentPatchFeature.kt @@ -51,7 +51,7 @@ class VentPatchFeature(codec: Codec) : Feature