Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.mysticsbiomes.common.world;
- import com.google.common.collect.ImmutableList;
- import com.mysticsbiomes.core.init.MysticBiomes;
- import com.google.common.collect.ImmutableList.Builder;
- import net.minecraft.world.level.biome.Biomes;
- import net.minecraft.world.level.block.Block;
- import net.minecraft.world.level.block.Blocks;
- import net.minecraft.world.level.levelgen.Noises;
- import net.minecraft.world.level.levelgen.SurfaceRules;
- import net.minecraft.world.level.levelgen.SurfaceRules.*;
- import net.minecraft.world.level.levelgen.VerticalAnchor;
- public class MysticSurfaceRules {
- private static final SurfaceRules.RuleSource AIR = makeStateRule(Blocks.AIR);
- private static final SurfaceRules.RuleSource BEDROCK = makeStateRule(Blocks.BEDROCK);
- private static final SurfaceRules.RuleSource WHITE_TERRACOTTA = makeStateRule(Blocks.WHITE_TERRACOTTA);
- private static final SurfaceRules.RuleSource ORANGE_TERRACOTTA = makeStateRule(Blocks.ORANGE_TERRACOTTA);
- private static final SurfaceRules.RuleSource TERRACOTTA = makeStateRule(Blocks.TERRACOTTA);
- private static final SurfaceRules.RuleSource RED_SAND = makeStateRule(Blocks.RED_SAND);
- private static final SurfaceRules.RuleSource RED_SANDSTONE = makeStateRule(Blocks.RED_SANDSTONE);
- private static final SurfaceRules.RuleSource STONE = makeStateRule(Blocks.STONE);
- private static final SurfaceRules.RuleSource DEEPSLATE = makeStateRule(Blocks.DEEPSLATE);
- private static final SurfaceRules.RuleSource DIRT = makeStateRule(Blocks.DIRT);
- private static final SurfaceRules.RuleSource PODZOL = makeStateRule(Blocks.PODZOL);
- private static final SurfaceRules.RuleSource COARSE_DIRT = makeStateRule(Blocks.COARSE_DIRT);
- private static final SurfaceRules.RuleSource MYCELIUM = makeStateRule(Blocks.MYCELIUM);
- private static final SurfaceRules.RuleSource GRASS_BLOCK = makeStateRule(Blocks.GRASS_BLOCK);
- private static final SurfaceRules.RuleSource CALCITE = makeStateRule(Blocks.CALCITE);
- private static final SurfaceRules.RuleSource GRAVEL = makeStateRule(Blocks.GRAVEL);
- private static final SurfaceRules.RuleSource SAND = makeStateRule(Blocks.SAND);
- private static final SurfaceRules.RuleSource SANDSTONE = makeStateRule(Blocks.SANDSTONE);
- private static final SurfaceRules.RuleSource PACKED_ICE = makeStateRule(Blocks.PACKED_ICE);
- private static final SurfaceRules.RuleSource SNOW_BLOCK = makeStateRule(Blocks.SNOW_BLOCK);
- private static final SurfaceRules.RuleSource POWDER_SNOW = makeStateRule(Blocks.POWDER_SNOW);
- private static final SurfaceRules.RuleSource ICE = makeStateRule(Blocks.ICE);
- private static final SurfaceRules.RuleSource WATER = makeStateRule(Blocks.WATER);
- private static RuleSource makeStateRule(Block block) {
- return SurfaceRules.state(block.defaultBlockState());
- }
- public static RuleSource overworld() {
- return overworldLike(true, false, true);
- }
- public static RuleSource overworldLike(boolean p_198381_, boolean nether, boolean overworld) {
- ConditionSource conditionSource = SurfaceRules.yBlockCheck(VerticalAnchor.absolute(97), 2);
- ConditionSource conditionSource1 = SurfaceRules.yBlockCheck(VerticalAnchor.absolute(256), 0);
- ConditionSource conditionSource2 = SurfaceRules.yStartCheck(VerticalAnchor.absolute(63), -1);
- ConditionSource conditionSource3 = SurfaceRules.yStartCheck(VerticalAnchor.absolute(74), 1);
- ConditionSource conditionSource4 = SurfaceRules.yBlockCheck(VerticalAnchor.absolute(62), 0);
- ConditionSource conditionSource5 = SurfaceRules.yBlockCheck(VerticalAnchor.absolute(63), 0);
- ConditionSource conditionSource6 = SurfaceRules.waterBlockCheck(-1, 0);
- ConditionSource conditionSource7 = SurfaceRules.waterBlockCheck(0, 0);
- ConditionSource conditionSource8 = SurfaceRules.waterStartCheck(-6, -1);
- ConditionSource conditionSource9 = SurfaceRules.hole();
- ConditionSource conditionSource10 = SurfaceRules.isBiome(Biomes.FROZEN_OCEAN, Biomes.DEEP_FROZEN_OCEAN);
- ConditionSource conditionSource11 = SurfaceRules.steep();
- RuleSource ruleSource = SurfaceRules.sequence(SurfaceRules.ifTrue(conditionSource7, GRASS_BLOCK), DIRT);
- RuleSource ruleSource1 = SurfaceRules.sequence(SurfaceRules.ifTrue(SurfaceRules.ON_CEILING, SANDSTONE), SAND);
- RuleSource ruleSource2 = SurfaceRules.sequence(SurfaceRules.ifTrue(SurfaceRules.ON_CEILING, STONE), GRAVEL);
- ConditionSource conditionSource12 = SurfaceRules.isBiome(Biomes.WARM_OCEAN, Biomes.BEACH, Biomes.SNOWY_BEACH);
- ConditionSource conditionSource13 = SurfaceRules.isBiome(Biomes.DESERT);
- RuleSource ruleSource3 = SurfaceRules.sequence(SurfaceRules.ifTrue(SurfaceRules.isBiome(Biomes.STONY_PEAKS), SurfaceRules.sequence(SurfaceRules.ifTrue(SurfaceRules.noiseCondition(Noises.CALCITE, -0.0125D, 0.0125D), CALCITE), STONE)), SurfaceRules.ifTrue(SurfaceRules.isBiome(Biomes.STONY_SHORE), SurfaceRules.sequence(SurfaceRules.ifTrue(SurfaceRules.noiseCondition(Noises.GRAVEL, -0.05D, 0.05D), ruleSource2), STONE)), SurfaceRules.ifTrue(SurfaceRules.isBiome(Biomes.WINDSWEPT_HILLS), SurfaceRules.ifTrue(surfaceNoiseAbove(1.0D), STONE)), SurfaceRules.ifTrue(conditionSource12, ruleSource1), SurfaceRules.ifTrue(conditionSource13, ruleSource1), SurfaceRules.ifTrue(SurfaceRules.isBiome(Biomes.DRIPSTONE_CAVES), STONE));
- RuleSource ruleSource4 = SurfaceRules.ifTrue(SurfaceRules.noiseCondition(Noises.POWDER_SNOW, 0.45D, 0.58D), SurfaceRules.ifTrue(conditionSource7, POWDER_SNOW));
- RuleSource ruleSource5 = SurfaceRules.ifTrue(SurfaceRules.noiseCondition(Noises.POWDER_SNOW, 0.35D, 0.6D), SurfaceRules.ifTrue(conditionSource7, POWDER_SNOW));
- RuleSource ruleSource6 = SurfaceRules.sequence(SurfaceRules.ifTrue(SurfaceRules.isBiome(Biomes.FROZEN_PEAKS), SurfaceRules.sequence(SurfaceRules.ifTrue(conditionSource11, PACKED_ICE), SurfaceRules.ifTrue(SurfaceRules.noiseCondition(Noises.PACKED_ICE, -0.5D, 0.2D), PACKED_ICE), SurfaceRules.ifTrue(SurfaceRules.noiseCondition(Noises.ICE, -0.0625D, 0.025D), ICE), SurfaceRules.ifTrue(conditionSource7, SNOW_BLOCK))), SurfaceRules.ifTrue(SurfaceRules.isBiome(Biomes.SNOWY_SLOPES), SurfaceRules.sequence(SurfaceRules.ifTrue(conditionSource11, STONE), ruleSource4, SurfaceRules.ifTrue(conditionSource7, SNOW_BLOCK))), SurfaceRules.ifTrue(SurfaceRules.isBiome(Biomes.JAGGED_PEAKS), STONE), SurfaceRules.ifTrue(SurfaceRules.isBiome(Biomes.GROVE), SurfaceRules.sequence(ruleSource4, DIRT)), ruleSource3, SurfaceRules.ifTrue(SurfaceRules.isBiome(Biomes.WINDSWEPT_SAVANNA), SurfaceRules.ifTrue(surfaceNoiseAbove(1.75D), STONE)), SurfaceRules.ifTrue(SurfaceRules.isBiome(Biomes.WINDSWEPT_GRAVELLY_HILLS), SurfaceRules.sequence(SurfaceRules.ifTrue(surfaceNoiseAbove(2.0D), ruleSource2), SurfaceRules.ifTrue(surfaceNoiseAbove(1.0D), STONE), SurfaceRules.ifTrue(surfaceNoiseAbove(-1.0D), DIRT), ruleSource2)), DIRT);
- RuleSource ruleSource7 = SurfaceRules.sequence(SurfaceRules.ifTrue(SurfaceRules.isBiome(Biomes.FROZEN_PEAKS), SurfaceRules.sequence(SurfaceRules.ifTrue(conditionSource11, PACKED_ICE), SurfaceRules.ifTrue(SurfaceRules.noiseCondition(Noises.PACKED_ICE, 0.0D, 0.2D), PACKED_ICE), SurfaceRules.ifTrue(SurfaceRules.noiseCondition(Noises.ICE, 0.0D, 0.025D), ICE), SurfaceRules.ifTrue(conditionSource7, SNOW_BLOCK))), SurfaceRules.ifTrue(SurfaceRules.isBiome(Biomes.SNOWY_SLOPES), SurfaceRules.sequence(SurfaceRules.ifTrue(conditionSource11, STONE), ruleSource5, SurfaceRules.ifTrue(conditionSource7, SNOW_BLOCK))), SurfaceRules.ifTrue(SurfaceRules.isBiome(Biomes.JAGGED_PEAKS), SurfaceRules.sequence(SurfaceRules.ifTrue(conditionSource11, STONE), SurfaceRules.ifTrue(conditionSource7, SNOW_BLOCK))), SurfaceRules.ifTrue(SurfaceRules.isBiome(Biomes.GROVE), SurfaceRules.sequence(ruleSource5, SurfaceRules.ifTrue(conditionSource7, SNOW_BLOCK))), ruleSource3, SurfaceRules.ifTrue(SurfaceRules.isBiome(Biomes.WINDSWEPT_SAVANNA), SurfaceRules.sequence(SurfaceRules.ifTrue(surfaceNoiseAbove(1.75D), STONE), SurfaceRules.ifTrue(surfaceNoiseAbove(-0.5D), COARSE_DIRT))), SurfaceRules.ifTrue(SurfaceRules.isBiome(Biomes.WINDSWEPT_GRAVELLY_HILLS), SurfaceRules.sequence(SurfaceRules.ifTrue(surfaceNoiseAbove(2.0D), ruleSource2), SurfaceRules.ifTrue(surfaceNoiseAbove(1.0D), STONE), SurfaceRules.ifTrue(surfaceNoiseAbove(-1.0D), ruleSource), ruleSource2)), SurfaceRules.ifTrue(SurfaceRules.isBiome(Biomes.OLD_GROWTH_PINE_TAIGA, Biomes.OLD_GROWTH_SPRUCE_TAIGA), SurfaceRules.sequence(SurfaceRules.ifTrue(surfaceNoiseAbove(1.75D), COARSE_DIRT), SurfaceRules.ifTrue(surfaceNoiseAbove(-0.95D), PODZOL))), SurfaceRules.ifTrue(SurfaceRules.isBiome(Biomes.ICE_SPIKES), SurfaceRules.ifTrue(conditionSource7, SNOW_BLOCK)), SurfaceRules.ifTrue(SurfaceRules.isBiome(Biomes.MUSHROOM_FIELDS), MYCELIUM), ruleSource);
- ConditionSource conditionSource14 = SurfaceRules.noiseCondition(Noises.SURFACE, -0.909D, -0.5454D);
- ConditionSource conditionSource15 = SurfaceRules.noiseCondition(Noises.SURFACE, -0.1818D, 0.1818D);
- ConditionSource conditionSource16 = SurfaceRules.noiseCondition(Noises.SURFACE, 0.5454D, 0.909D);
- RuleSource ruleSource8 = SurfaceRules.sequence(mysticRule(), SurfaceRules.ifTrue(SurfaceRules.ON_FLOOR, SurfaceRules.sequence(SurfaceRules.ifTrue(SurfaceRules.isBiome(Biomes.WOODED_BADLANDS), SurfaceRules.ifTrue(conditionSource, SurfaceRules.sequence(SurfaceRules.ifTrue(conditionSource14, COARSE_DIRT), SurfaceRules.ifTrue(conditionSource15, COARSE_DIRT), SurfaceRules.ifTrue(conditionSource16, COARSE_DIRT), ruleSource))), SurfaceRules.ifTrue(SurfaceRules.isBiome(Biomes.SWAMP), SurfaceRules.ifTrue(conditionSource4, SurfaceRules.ifTrue(SurfaceRules.not(conditionSource5), SurfaceRules.ifTrue(SurfaceRules.noiseCondition(Noises.SWAMP, 0.0D), WATER)))))), SurfaceRules.ifTrue(SurfaceRules.isBiome(Biomes.BADLANDS, Biomes.ERODED_BADLANDS, Biomes.WOODED_BADLANDS), SurfaceRules.sequence(SurfaceRules.ifTrue(SurfaceRules.ON_FLOOR, SurfaceRules.sequence(SurfaceRules.ifTrue(conditionSource1, ORANGE_TERRACOTTA), SurfaceRules.ifTrue(conditionSource3, SurfaceRules.sequence(SurfaceRules.ifTrue(conditionSource14, TERRACOTTA), SurfaceRules.ifTrue(conditionSource15, TERRACOTTA), SurfaceRules.ifTrue(conditionSource16, TERRACOTTA), SurfaceRules.bandlands())), SurfaceRules.ifTrue(conditionSource6, SurfaceRules.sequence(SurfaceRules.ifTrue(SurfaceRules.ON_CEILING, RED_SANDSTONE), RED_SAND)), SurfaceRules.ifTrue(SurfaceRules.not(conditionSource9), ORANGE_TERRACOTTA), SurfaceRules.ifTrue(conditionSource8, WHITE_TERRACOTTA), ruleSource2)), SurfaceRules.ifTrue(conditionSource2, SurfaceRules.sequence(SurfaceRules.ifTrue(conditionSource5, SurfaceRules.ifTrue(SurfaceRules.not(conditionSource3), ORANGE_TERRACOTTA)), SurfaceRules.bandlands())), SurfaceRules.ifTrue(SurfaceRules.UNDER_FLOOR, SurfaceRules.ifTrue(conditionSource8, WHITE_TERRACOTTA)))), SurfaceRules.ifTrue(SurfaceRules.ON_FLOOR, SurfaceRules.ifTrue(conditionSource6, SurfaceRules.sequence(SurfaceRules.ifTrue(conditionSource10, SurfaceRules.ifTrue(conditionSource9, SurfaceRules.sequence(SurfaceRules.ifTrue(conditionSource7, AIR), SurfaceRules.ifTrue(SurfaceRules.temperature(), ICE), WATER))), ruleSource7))), SurfaceRules.ifTrue(conditionSource8, SurfaceRules.sequence(SurfaceRules.ifTrue(SurfaceRules.ON_FLOOR, SurfaceRules.ifTrue(conditionSource10, SurfaceRules.ifTrue(conditionSource9, WATER))), SurfaceRules.ifTrue(SurfaceRules.UNDER_FLOOR, ruleSource6), SurfaceRules.ifTrue(conditionSource12, SurfaceRules.ifTrue(SurfaceRules.DEEP_UNDER_FLOOR, SANDSTONE)), SurfaceRules.ifTrue(conditionSource13, SurfaceRules.ifTrue(SurfaceRules.VERY_DEEP_UNDER_FLOOR, SANDSTONE)))), SurfaceRules.ifTrue(SurfaceRules.ON_FLOOR, SurfaceRules.sequence(SurfaceRules.ifTrue(SurfaceRules.isBiome(Biomes.FROZEN_PEAKS, Biomes.JAGGED_PEAKS), STONE), SurfaceRules.ifTrue(SurfaceRules.isBiome(Biomes.WARM_OCEAN, Biomes.LUKEWARM_OCEAN, Biomes.DEEP_LUKEWARM_OCEAN), ruleSource1), ruleSource2)));
- RuleSource ruleSource9 = SurfaceRules.ifTrue(SurfaceRules.abovePreliminarySurface(), ruleSource8);
- Builder<RuleSource> builder = ImmutableList.builder();
- if (nether) {
- builder.add(SurfaceRules.ifTrue(SurfaceRules.not(SurfaceRules.verticalGradient("bedrock_roof", VerticalAnchor.belowTop(5), VerticalAnchor.top())), BEDROCK));
- }
- if (overworld) {
- builder.add(SurfaceRules.ifTrue(SurfaceRules.verticalGradient("bedrock_floor", VerticalAnchor.bottom(), VerticalAnchor.aboveBottom(5)), BEDROCK));
- }
- builder.add(p_198381_ ? ruleSource9 : ruleSource8);
- builder.add(SurfaceRules.ifTrue(SurfaceRules.verticalGradient("deepslate", VerticalAnchor.absolute(0), VerticalAnchor.absolute(8)), DEEPSLATE));
- return SurfaceRules.sequence(builder.build().toArray(RuleSource[]::new));
- }
- private static SurfaceRules.RuleSource mysticRule() {
- SurfaceRules.RuleSource bambooBlossomSurface = SurfaceRules.sequence(SurfaceRules.ifTrue(surfaceNoiseAbove(1.75D), PODZOL), SurfaceRules.ifTrue(surfaceNoiseAbove(-0.95D), GRASS_BLOCK));
- return SurfaceRules.sequence(SurfaceRules.ifTrue(SurfaceRules.isBiome(MysticBiomes.BAMBOO_BLOSSOM_FOREST.getKey()), bambooBlossomSurface));
- }
- private static SurfaceRules.ConditionSource surfaceNoiseAbove(double value) {
- return SurfaceRules.noiseCondition(Noises.SURFACE, value / 8.25D, Double.MAX_VALUE);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement