diff --git a/src/main/java/biomesoplenty/api/biome/BOPBiomes.java b/src/main/java/biomesoplenty/api/biome/BOPBiomes.java index 9fcfca07f..11ad439f2 100644 --- a/src/main/java/biomesoplenty/api/biome/BOPBiomes.java +++ b/src/main/java/biomesoplenty/api/biome/BOPBiomes.java @@ -27,6 +27,7 @@ public class BOPBiomes public static Optional fir_clearing = Optional.empty(); public static Optional floodplain = Optional.empty(); public static Optional flower_meadow = Optional.empty(); + public static Optional ghost_forest = Optional.empty(); public static Optional grassland = Optional.empty(); public static Optional gravel_beach = Optional.empty(); public static Optional grove = Optional.empty(); diff --git a/src/main/java/biomesoplenty/common/biome/overworld/BogBiome.java b/src/main/java/biomesoplenty/common/biome/overworld/BogBiome.java index 8fa4babb6..517e75e34 100644 --- a/src/main/java/biomesoplenty/common/biome/overworld/BogBiome.java +++ b/src/main/java/biomesoplenty/common/biome/overworld/BogBiome.java @@ -52,7 +52,6 @@ public class BogBiome extends BiomeBOP DefaultBiomeFeatures.addDefaultUndergroundVariety(this); DefaultBiomeFeatures.addDefaultOres(this); DefaultBiomeFeatures.addSwampClayDisk(this); - this.addFeature(GenerationStage.Decoration.UNDERGROUND_ORES, Feature.DISK.configured(new SphereReplaceConfig(BOPBlocks.mud.defaultBlockState(), 8, 2, Lists.newArrayList(new BlockState[]{Blocks.DIRT.defaultBlockState(), Blocks.GRASS_BLOCK.defaultBlockState()}))).decorated(Placement.COUNT_TOP_SOLID.configured(new FrequencyConfig(1)))); //////////////////////////////////////////////////////////// diff --git a/src/main/java/biomesoplenty/common/biome/overworld/GhostForestBiome.java b/src/main/java/biomesoplenty/common/biome/overworld/GhostForestBiome.java new file mode 100644 index 000000000..467fdee60 --- /dev/null +++ b/src/main/java/biomesoplenty/common/biome/overworld/GhostForestBiome.java @@ -0,0 +1,106 @@ +/******************************************************************************* + * Copyright 2014-2019, the Biomes O' Plenty Team + * + * This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International Public License. + * + * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/. + ******************************************************************************/ +package biomesoplenty.common.biome.overworld; + +import biomesoplenty.api.biome.BOPBiomes; +import biomesoplenty.api.block.BOPBlocks; +import biomesoplenty.api.enums.BOPClimates; +import biomesoplenty.common.biome.BiomeBOP; +import biomesoplenty.common.world.biome.BiomeFeatureHelper; +import biomesoplenty.common.world.gen.feature.BOPBiomeFeatures; +import biomesoplenty.common.world.gen.feature.StandardGrassFeature; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.Lists; +import net.minecraft.block.BlockState; +import net.minecraft.block.Blocks; +import net.minecraft.entity.EntityClassification; +import net.minecraft.entity.EntityType; +import net.minecraft.world.biome.DefaultBiomeFeatures; +import net.minecraft.world.gen.GenerationStage; +import net.minecraft.world.gen.feature.*; +import net.minecraft.world.gen.feature.structure.MineshaftConfig; +import net.minecraft.world.gen.feature.structure.MineshaftStructure; +import net.minecraft.world.gen.placement.AtSurfaceWithExtraConfig; +import net.minecraft.world.gen.placement.ChanceConfig; +import net.minecraft.world.gen.placement.FrequencyConfig; +import net.minecraft.world.gen.placement.Placement; +import net.minecraft.world.gen.surfacebuilders.ConfiguredSurfaceBuilder; +import net.minecraft.world.gen.surfacebuilders.SurfaceBuilder; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; + +public class GhostForestBiome extends BiomeBOP +{ + public GhostForestBiome() + { + super((new Builder()).surfaceBuilder(new ConfiguredSurfaceBuilder(SurfaceBuilder.DEFAULT, SurfaceBuilder.CONFIG_GRASS)).precipitation(RainType.RAIN).biomeCategory(Category.SWAMP).depth(-0.125F).scale(0.0F).temperature(0.5F).downfall(0.6F).waterColor(0x448FBD).waterFogColor(0x061326).parent((String)null)); + + // Structures + this.addStructureStart(Feature.SWAMP_HUT.configured(IFeatureConfig.NONE)); + this.addStructureStart(Feature.MINESHAFT.configured(new MineshaftConfig(0.004D, MineshaftStructure.Type.NORMAL))); + this.addStructureStart(Feature.STRONGHOLD.configured(IFeatureConfig.NONE)); + + // Underground + DefaultBiomeFeatures.addDefaultCarvers(this); + DefaultBiomeFeatures.addStructureFeaturePlacement(this); + DefaultBiomeFeatures.addDefaultLakes(this); + + this.addFeature(GenerationStage.Decoration.LOCAL_MODIFICATIONS, Feature.LAKE.configured(new BlockStateFeatureConfig(Blocks.CLAY.defaultBlockState())).decorated(Placement.WATER_LAKE.configured(new ChanceConfig(3)))); + + DefaultBiomeFeatures.addDefaultMonsterRoom(this); + DefaultBiomeFeatures.addDefaultUndergroundVariety(this); + DefaultBiomeFeatures.addDefaultOres(this); + + this.addFeature(GenerationStage.Decoration.UNDERGROUND_ORES, Feature.DISK.configured(new SphereReplaceConfig(Blocks.CLAY.defaultBlockState(), 5, 1, Lists.newArrayList(Blocks.DIRT.defaultBlockState(), Blocks.GRASS_BLOCK.defaultBlockState()))).decorated(Placement.COUNT_TOP_SOLID.configured(new FrequencyConfig(2)))); + this.addFeature(GenerationStage.Decoration.UNDERGROUND_ORES, Feature.DISK.configured(new SphereReplaceConfig(Blocks.GRAVEL.defaultBlockState(), 6, 2, Lists.newArrayList(Blocks.DIRT.defaultBlockState(), Blocks.GRASS_BLOCK.defaultBlockState()))).decorated(Placement.COUNT_TOP_SOLID.configured(new FrequencyConfig(2)))); + this.addFeature(GenerationStage.Decoration.UNDERGROUND_ORES, Feature.DISK.configured(new SphereReplaceConfig(BOPBlocks.mud.defaultBlockState(), 4, 2, Lists.newArrayList(new BlockState[]{Blocks.DIRT.defaultBlockState(), Blocks.GRASS_BLOCK.defaultBlockState()}))).decorated(Placement.COUNT_TOP_SOLID.configured(new FrequencyConfig(1)))); + + //////////////////////////////////////////////////////////// + + // Vegetation + this.addFeature(GenerationStage.Decoration.VEGETAL_DECORATION, Feature.RANDOM_SELECTOR.configured(new MultipleRandomFeatureConfig(ImmutableList.of(BOPBiomeFeatures.DARK_OAK_TWIGLET_TREE.configured(DefaultBiomeFeatures.NORMAL_TREE_CONFIG).weighted(0.5F), BOPBiomeFeatures.DEAD_TWIGLET_TREE.configured(DefaultBiomeFeatures.NORMAL_TREE_CONFIG).weighted(0.2F), BOPBiomeFeatures.DEAD_TWIGLET_TREE_TALL.configured(DefaultBiomeFeatures.NORMAL_TREE_CONFIG).weighted(0.1F)), BOPBiomeFeatures.DEAD_TREE.configured(DefaultBiomeFeatures.NORMAL_TREE_CONFIG))).decorated(Placement.COUNT_EXTRA_HEIGHTMAP.configured(new AtSurfaceWithExtraConfig(7, 0.7F, 1)))); + this.addFeature(GenerationStage.Decoration.VEGETAL_DECORATION, new StandardGrassFeature(NoFeatureConfig::deserialize).configured(IFeatureConfig.NONE).decorated(Placement.COUNT_HEIGHTMAP_DOUBLE.configured(new FrequencyConfig(8)))); + this.addFeature(GenerationStage.Decoration.VEGETAL_DECORATION, BOPBiomeFeatures.SCRUB.configured(IFeatureConfig.NONE).decorated(Placement.COUNT_HEIGHTMAP_DOUBLE.configured(new FrequencyConfig(30)))); + this.addFeature(GenerationStage.Decoration.VEGETAL_DECORATION, Feature.RANDOM_PATCH.configured(BiomeFeatureHelper.createClusterConfigurationDoubleWater(BOPBlocks.watergrass.defaultBlockState())).decorated(Placement.COUNT_HEIGHTMAP_DOUBLE.configured(new FrequencyConfig(25)))); + this.addFeature(GenerationStage.Decoration.VEGETAL_DECORATION, Feature.RANDOM_PATCH.configured(BiomeFeatureHelper.createClusterConfigurationDoubleWater(BOPBlocks.reed.defaultBlockState())).decorated(Placement.COUNT_HEIGHTMAP_DOUBLE.configured(new FrequencyConfig(2)))); + + //////////////////////////////////////////////////////////// + + // Other Features + DefaultBiomeFeatures.addDefaultSprings(this); + DefaultBiomeFeatures.addSurfaceFreezing(this); + + // Entities + this.addSpawn(EntityClassification.AMBIENT, new SpawnListEntry(EntityType.BAT, 10, 8, 8)); + this.addSpawn(EntityClassification.MONSTER, new SpawnListEntry(EntityType.SPIDER, 100, 4, 4)); + this.addSpawn(EntityClassification.MONSTER, new SpawnListEntry(EntityType.ZOMBIE, 95, 4, 4)); + this.addSpawn(EntityClassification.MONSTER, new SpawnListEntry(EntityType.ZOMBIE_VILLAGER, 5, 1, 1)); + this.addSpawn(EntityClassification.MONSTER, new SpawnListEntry(EntityType.SKELETON, 100, 4, 4)); + this.addSpawn(EntityClassification.MONSTER, new SpawnListEntry(EntityType.CREEPER, 100, 4, 4)); + this.addSpawn(EntityClassification.MONSTER, new SpawnListEntry(EntityType.SLIME, 100, 4, 4)); + this.addSpawn(EntityClassification.MONSTER, new SpawnListEntry(EntityType.ENDERMAN, 10, 1, 4)); + this.addSpawn(EntityClassification.MONSTER, new SpawnListEntry(EntityType.WITCH, 5, 1, 1)); + + this.addWeight(BOPClimates.WET_TEMPERATE, 2); + this.setBeachBiome(BOPBiomes.gravel_beach); + } + + @OnlyIn(Dist.CLIENT) + @Override + public int getGrassColor(double x, double z) + { + return 0xA1B262; + } + + @OnlyIn(Dist.CLIENT) + @Override + public int getFoliageColor() + { + return 0xA0B563; + } +} diff --git a/src/main/java/biomesoplenty/common/biome/overworld/MangroveBiome.java b/src/main/java/biomesoplenty/common/biome/overworld/MangroveBiome.java index 414f3ad0a..e1c4b7714 100644 --- a/src/main/java/biomesoplenty/common/biome/overworld/MangroveBiome.java +++ b/src/main/java/biomesoplenty/common/biome/overworld/MangroveBiome.java @@ -32,7 +32,7 @@ public class MangroveBiome extends BiomeBOP { public MangroveBiome() { - super((new Biome.Builder()).surfaceBuilder(new ConfiguredSurfaceBuilder(BOPBiomeFeatures.MANGROVE_SURFACE_BUILDER, SurfaceBuilder.CONFIG_GRASS)).precipitation(Biome.RainType.RAIN).biomeCategory(Biome.Category.SWAMP).depth(-0.215F).scale(-0.025F).temperature(0.81F).downfall(0.7F).waterColor(0x448FBD).waterFogColor(0x061326).parent((String)null)); + super((new Biome.Builder()).surfaceBuilder(new ConfiguredSurfaceBuilder(BOPBiomeFeatures.MANGROVE_SURFACE_BUILDER, SurfaceBuilder.CONFIG_GRASS)).precipitation(Biome.RainType.RAIN).biomeCategory(Biome.Category.SWAMP).depth(-0.22F).scale(-0.025F).temperature(0.81F).downfall(0.7F).waterColor(0x448FBD).waterFogColor(0x061326).parent((String)null)); // Structures this.addStructureStart(Feature.MINESHAFT.configured(new MineshaftConfig(0.004D, MineshaftStructure.Type.NORMAL))); diff --git a/src/main/java/biomesoplenty/common/biome/overworld/MireBiome.java b/src/main/java/biomesoplenty/common/biome/overworld/MireBiome.java index 61edbfb7c..c468c27c2 100644 --- a/src/main/java/biomesoplenty/common/biome/overworld/MireBiome.java +++ b/src/main/java/biomesoplenty/common/biome/overworld/MireBiome.java @@ -49,21 +49,25 @@ public class MireBiome extends BiomeBOP DefaultBiomeFeatures.addDefaultCarvers(this); DefaultBiomeFeatures.addStructureFeaturePlacement(this); DefaultBiomeFeatures.addDefaultLakes(this); + + this.addFeature(GenerationStage.Decoration.LOCAL_MODIFICATIONS, Feature.LAKE.configured(new BlockStateFeatureConfig(BOPBlocks.mud.defaultBlockState())).decorated(Placement.WATER_LAKE.configured(new ChanceConfig(3)))); + DefaultBiomeFeatures.addDefaultMonsterRoom(this); DefaultBiomeFeatures.addDefaultUndergroundVariety(this); DefaultBiomeFeatures.addDefaultOres(this); - DefaultBiomeFeatures.addSwampClayDisk(this); - this.addFeature(GenerationStage.Decoration.UNDERGROUND_ORES, Feature.DISK.configured(new SphereReplaceConfig(BOPBlocks.mud.defaultBlockState(), 8, 2, Lists.newArrayList(new BlockState[]{Blocks.DIRT.defaultBlockState(), Blocks.GRASS_BLOCK.defaultBlockState()}))).decorated(Placement.COUNT_TOP_SOLID.configured(new FrequencyConfig(8)))); + + this.addFeature(GenerationStage.Decoration.UNDERGROUND_ORES, Feature.DISK.configured(new SphereReplaceConfig(BOPBlocks.mud.defaultBlockState(), 12, 2, Lists.newArrayList(new BlockState[]{Blocks.DIRT.defaultBlockState(), Blocks.GRASS_BLOCK.defaultBlockState()}))).decorated(Placement.COUNT_TOP_SOLID.configured(new FrequencyConfig(10)))); //////////////////////////////////////////////////////////// // Vegetation - this.addFeature(GenerationStage.Decoration.VEGETAL_DECORATION, Feature.RANDOM_SELECTOR.configured(new MultipleRandomFeatureConfig(ImmutableList.of(BOPBiomeFeatures.DARK_OAK_TWIGLET_TREE.configured(DefaultBiomeFeatures.NORMAL_TREE_CONFIG).weighted(0.8F), BOPBiomeFeatures.TALL_TWIGLET_TREE.configured(DefaultBiomeFeatures.NORMAL_TREE_CONFIG).weighted(0.4F), BOPBiomeFeatures.DEAD_TREE.configured(DefaultBiomeFeatures.NORMAL_TREE_CONFIG).weighted(0.1F)), BOPBiomeFeatures.DYING_TREE.configured(DefaultBiomeFeatures.NORMAL_TREE_CONFIG))).decorated(Placement.COUNT_EXTRA_HEIGHTMAP.configured(new AtSurfaceWithExtraConfig(2, 0.2F, 1)))); + this.addFeature(GenerationStage.Decoration.VEGETAL_DECORATION, BOPBiomeFeatures.DARK_OAK_TWIGLET_TREE.configured(DefaultBiomeFeatures.NORMAL_TREE_CONFIG).decorated(Placement.COUNT_EXTRA_HEIGHTMAP.configured(new AtSurfaceWithExtraConfig(3, 0.1F, 1)))); - this.addFeature(GenerationStage.Decoration.VEGETAL_DECORATION, BOPBiomeFeatures.BIG_BROWN_MUSHROOM.configured(DefaultBiomeFeatures.HUGE_BROWN_MUSHROOM_CONFIG).decorated(Placement.COUNT_HEIGHTMAP_DOUBLE.configured(new FrequencyConfig(17)))); + this.addFeature(GenerationStage.Decoration.VEGETAL_DECORATION, BOPBiomeFeatures.BIG_BROWN_MUSHROOM.configured(DefaultBiomeFeatures.HUGE_BROWN_MUSHROOM_CONFIG).decorated(Placement.COUNT_HEIGHTMAP_DOUBLE.configured(new FrequencyConfig(18)))); this.addFeature(GenerationStage.Decoration.VEGETAL_DECORATION, new StandardGrassFeature(NoFeatureConfig::deserialize).configured(IFeatureConfig.NONE).decorated(Placement.COUNT_HEIGHTMAP_DOUBLE.configured(new FrequencyConfig(4)))); this.addFeature(GenerationStage.Decoration.VEGETAL_DECORATION, Feature.RANDOM_PATCH.configured(BiomeFeatureHelper.createClusterConfiguration(Blocks.BROWN_MUSHROOM.defaultBlockState())).decorated(Placement.CHANCE_HEIGHTMAP_DOUBLE.configured(new ChanceConfig(15)))); this.addFeature(GenerationStage.Decoration.VEGETAL_DECORATION, Feature.RANDOM_PATCH.configured(BiomeFeatureHelper.createClusterConfiguration(Blocks.RED_MUSHROOM.defaultBlockState())).decorated(Placement.CHANCE_HEIGHTMAP_DOUBLE.configured(new ChanceConfig(8)))); + this.addFeature(GenerationStage.Decoration.VEGETAL_DECORATION, BOPBiomeFeatures.SMALL_BROWN_MUSHROOM.configured(IFeatureConfig.NONE).decorated(Placement.COUNT_HEIGHTMAP_DOUBLE.configured(new FrequencyConfig(10)))); //////////////////////////////////////////////////////////// @@ -83,7 +87,7 @@ public class MireBiome extends BiomeBOP this.addSpawn(EntityClassification.MONSTER, new Biome.SpawnListEntry(EntityType.ENDERMAN, 10, 1, 4)); this.addSpawn(EntityClassification.MONSTER, new Biome.SpawnListEntry(EntityType.WITCH, 5, 1, 1)); this.addSpawn(EntityClassification.MONSTER, new Biome.SpawnListEntry(EntityType.SLIME, 1, 1, 1)); - + this.addWeight(BOPClimates.WET_TEMPERATE, 3); this.setBeachBiome((Biome)null); } diff --git a/src/main/java/biomesoplenty/common/biome/overworld/RainforestBiome.java b/src/main/java/biomesoplenty/common/biome/overworld/RainforestBiome.java index def766a26..2013cd308 100644 --- a/src/main/java/biomesoplenty/common/biome/overworld/RainforestBiome.java +++ b/src/main/java/biomesoplenty/common/biome/overworld/RainforestBiome.java @@ -93,7 +93,7 @@ public class RainforestBiome extends BiomeBOP this.addSpawn(EntityClassification.MONSTER, new Biome.SpawnListEntry(EntityType.OCELOT, 2, 1, 1)); this.setBeachBiome(BOPBiomes.mangrove); - this.addWeight(BOPClimates.SUBTROPICAL, 5); + this.addWeight(BOPClimates.TROPICAL, 7); } @OnlyIn(Dist.CLIENT) diff --git a/src/main/java/biomesoplenty/common/biome/overworld/TundraBiome.java b/src/main/java/biomesoplenty/common/biome/overworld/TundraBiome.java index 4558f1ec2..049c4d82c 100644 --- a/src/main/java/biomesoplenty/common/biome/overworld/TundraBiome.java +++ b/src/main/java/biomesoplenty/common/biome/overworld/TundraBiome.java @@ -60,7 +60,7 @@ public class TundraBiome extends BiomeBOP //////////////////////////////////////////////////////////// // Vegetation - this.addFeature(GenerationStage.Decoration.VEGETAL_DECORATION, Feature.RANDOM_SELECTOR.configured(new MultipleRandomFeatureConfig(ImmutableList.of(BOPBiomeFeatures.DEAD_TWIGLET_TREE.configured(DefaultBiomeFeatures.NORMAL_TREE_CONFIG).weighted(0.1F)), BOPBiomeFeatures.MAPLE_TWIGLET_TREE.configured(DefaultBiomeFeatures.NORMAL_TREE_CONFIG))).decorated(Placement.COUNT_EXTRA_HEIGHTMAP.configured(new AtSurfaceWithExtraConfig(1, 0.3F, 1)))); + this.addFeature(GenerationStage.Decoration.VEGETAL_DECORATION, Feature.RANDOM_SELECTOR.configured(new MultipleRandomFeatureConfig(ImmutableList.of(BOPBiomeFeatures.DEAD_TWIGLET_TREE_SMALL.configured(DefaultBiomeFeatures.NORMAL_TREE_CONFIG).weighted(0.1F)), BOPBiomeFeatures.MAPLE_TWIGLET_TREE.configured(DefaultBiomeFeatures.NORMAL_TREE_CONFIG))).decorated(Placement.COUNT_EXTRA_HEIGHTMAP.configured(new AtSurfaceWithExtraConfig(1, 0.3F, 1)))); this.addFeature(GenerationStage.Decoration.LOCAL_MODIFICATIONS, Feature.FOREST_ROCK.configured(new BlockBlobConfig(Blocks.COBBLESTONE.defaultBlockState(), 0)).decorated(Placement.FOREST_ROCK.configured(new FrequencyConfig(1)))); this.addFeature(GenerationStage.Decoration.VEGETAL_DECORATION, BOPBiomeFeatures.SCATTERED_ROCKS.configured(IFeatureConfig.NONE).decorated(Placement.COUNT_HEIGHTMAP_DOUBLE.configured(new FrequencyConfig(5)))); diff --git a/src/main/java/biomesoplenty/common/world/gen/feature/BOPBiomeFeatures.java b/src/main/java/biomesoplenty/common/world/gen/feature/BOPBiomeFeatures.java index 8f980c80d..d750a6fd4 100644 --- a/src/main/java/biomesoplenty/common/world/gen/feature/BOPBiomeFeatures.java +++ b/src/main/java/biomesoplenty/common/world/gen/feature/BOPBiomeFeatures.java @@ -98,8 +98,10 @@ public class BOPBiomeFeatures public static final Feature ACACIA_TWIGLET_SMALL = new TwigletTreeFeature.Builder().placeOn((world, pos) -> world.getBlockState(pos).getBlock() == Blocks.SAND).log(Blocks.ACACIA_LOG.defaultBlockState()).leaves(Blocks.ACACIA_LEAVES.defaultBlockState()).minHeight(1).maxHeight(2).create(); public static final Feature ACACIA_TWIGLET = new TwigletTreeFeature.Builder().log(Blocks.ACACIA_LOG.defaultBlockState()).leaves(Blocks.ACACIA_LEAVES.defaultBlockState()).minHeight(1).maxHeight(2).create(); public static final Feature MAPLE_TWIGLET_TREE = new TwigletTreeFeature.Builder().minHeight(1).maxHeight(2).leaves(BOPBlocks.maple_leaves.defaultBlockState()).create(); - public static final Feature DEAD_TWIGLET_TREE = new TwigletTreeFeature.Builder().minHeight(1).maxHeight(1).leaves(BOPBlocks.dead_leaves.defaultBlockState()).log(BOPBlocks.dead_log.defaultBlockState()).create(); - + public static final Feature DEAD_TWIGLET_TREE_SMALL = new TwigletTreeFeature.Builder().minHeight(1).maxHeight(1).leaves(BOPBlocks.dead_leaves.defaultBlockState()).log(BOPBlocks.dead_log.defaultBlockState()).create(); + public static final Feature DEAD_TWIGLET_TREE = new TwigletTreeFeature.Builder().leafChance(0.1F, 0.5F).leaves(BOPBlocks.dead_leaves.defaultBlockState()).log(BOPBlocks.dead_log.defaultBlockState()).minHeight(4).maxHeight(7).create(); + public static final Feature DEAD_TWIGLET_TREE_TALL = new TwigletTreeFeature.Builder().leafChance(0.05F, 0.25F).leaves(BOPBlocks.dead_leaves.defaultBlockState()).log(BOPBlocks.dead_log.defaultBlockState()).minHeight(8).maxHeight(11).create(); + //Special Trees public static final Feature REDWOOD_TREE = new RedwoodTreeFeature.Builder().create(); public static final Feature REDWOOD_TREE_MEDIUM = new RedwoodTreeFeature.Builder().minHeight(25).maxHeight(40).trunkWidth(2).create(); @@ -117,6 +119,7 @@ public class BOPBiomeFeatures public static final Feature MANGROVE = new MangroveFeature(NoFeatureConfig::deserialize); public static final Feature PUMPKIN_PATCH = new PumpkinPatchFeature(NoFeatureConfig::deserialize); public static final Feature BIG_PUMPKIN = new BigPumpkinFeature(NoFeatureConfig::deserialize); + public static final Feature SMALL_BROWN_MUSHROOM = new SmallBrownMushroomFeature(NoFeatureConfig::deserialize); public static final Feature SHORT_BAMBOO = new ShortBambooFeature(NoFeatureConfig::deserialize); public static final Feature SCRUB = new ScrubFeature(NoFeatureConfig::deserialize); public static final Feature SCATTERED_ROCKS = new ScatteredRocksFeature(NoFeatureConfig::deserialize); diff --git a/src/main/java/biomesoplenty/common/world/gen/feature/SmallBrownMushroomFeature.java b/src/main/java/biomesoplenty/common/world/gen/feature/SmallBrownMushroomFeature.java new file mode 100644 index 000000000..15f110e81 --- /dev/null +++ b/src/main/java/biomesoplenty/common/world/gen/feature/SmallBrownMushroomFeature.java @@ -0,0 +1,100 @@ +package biomesoplenty.common.world.gen.feature; + +import biomesoplenty.common.util.block.IBlockPosQuery; +import com.mojang.datafixers.Dynamic; +import net.minecraft.block.BlockState; +import net.minecraft.block.Blocks; +import net.minecraft.block.LeavesBlock; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.IWorld; +import net.minecraft.world.gen.ChunkGenerator; +import net.minecraft.world.gen.GenerationSettings; +import net.minecraft.world.gen.feature.Feature; +import net.minecraft.world.gen.feature.NoFeatureConfig; + +import java.util.Random; +import java.util.function.Function; + +public class SmallBrownMushroomFeature extends Feature +{ + protected IBlockPosQuery placeOn = (world, pos) -> world.getBlockState(pos).getBlock() == Blocks.GRASS_BLOCK; + protected IBlockPosQuery replace = (world, pos) -> world.getBlockState(pos).canBeReplacedByLeaves(world, pos); + + public SmallBrownMushroomFeature(Function, ? extends NoFeatureConfig> deserializer) + { + super(deserializer); + } + + @Override + public boolean place(IWorld world, ChunkGenerator p_212245_2_, Random p_212245_3_, BlockPos startPos, NoFeatureConfig p_212245_5_) { + while (startPos.getY() > 1 && this.replace.matches(world, startPos)) { + startPos = startPos.below(); + } + + if (!this.placeOn.matches(world, startPos.offset(0, 0, 0))) { + // Abandon if we can't place the tree on this block + return false; + } + + if (!this.checkSpace(world, startPos.above())) { + // Abandon if there isn't enough room + return false; + } + + BlockPos pos = startPos.above(); + + int height = 1 + p_212245_3_.nextInt(2); + + for (int y = 0; y < height; y++) { + this.setBlock(world, pos.above(y), Blocks.MUSHROOM_STEM.defaultBlockState()); + } + + this.setBlock(world, pos.offset(0, height, 0), Blocks.BROWN_MUSHROOM_BLOCK.defaultBlockState()); + this.setBlock(world, pos.offset(-1, height, 0), Blocks.BROWN_MUSHROOM_BLOCK.defaultBlockState()); + this.setBlock(world, pos.offset(1, height, 0), Blocks.BROWN_MUSHROOM_BLOCK.defaultBlockState()); + this.setBlock(world, pos.offset(0, height, -1), Blocks.BROWN_MUSHROOM_BLOCK.defaultBlockState()); + this.setBlock(world, pos.offset(0, height, 1), Blocks.BROWN_MUSHROOM_BLOCK.defaultBlockState()); + + if (p_212245_3_.nextInt(2) == 0) + { + this.setBlock(world, pos.offset(1, height, 1), Blocks.BROWN_MUSHROOM_BLOCK.defaultBlockState()); + this.setBlock(world, pos.offset(-1, height, -1), Blocks.BROWN_MUSHROOM_BLOCK.defaultBlockState()); + } + else + { + this.setBlock(world, pos.offset(-1, height, 1), Blocks.BROWN_MUSHROOM_BLOCK.defaultBlockState()); + this.setBlock(world, pos.offset(1, height, -1), Blocks.BROWN_MUSHROOM_BLOCK.defaultBlockState()); + } + + return true; + } + + public boolean setBlock(IWorld world, BlockPos pos, BlockState state) + { + if (this.replace.matches(world, pos)) + { + super.setBlock(world, pos, state); + return true; + } + return false; + } + + public boolean checkSpace(IWorld world, BlockPos pos) + { + for (int y = 0; y <= 5; y++) + { + for (int x = -3; x <= 4; x++) + { + for (int z = -3; z <= 4; z++) + { + BlockPos pos1 = pos.offset(x, y, z); + if (pos1.getY() >= 255 || !this.replace.matches(world, pos1)) + { + return false; + } + } + } + } + return true; + } +} \ No newline at end of file diff --git a/src/main/java/biomesoplenty/init/ModBiomes.java b/src/main/java/biomesoplenty/init/ModBiomes.java index e7ae6701e..8b5c9ff06 100644 --- a/src/main/java/biomesoplenty/init/ModBiomes.java +++ b/src/main/java/biomesoplenty/init/ModBiomes.java @@ -72,6 +72,7 @@ public class ModBiomes fir_clearing = registerBiome(new FirClearingBiome(), "fir_clearing"); floodplain = registerBiome(new FloodplainBiome(), "floodplain"); flower_meadow = registerBiome(new FlowerMeadowBiome(), "flower_meadow"); + ghost_forest = registerBiome(new GhostForestBiome(), "ghost_forest"); grassland = registerBiome(new GrasslandBiome(), "grassland"); grove = registerBiome(new GroveBiome(), "grove"); orchard = registerBiome(new OrchardBiome(), "orchard"); @@ -172,6 +173,7 @@ public class ModBiomes registerBiomeToDictionary(fir_clearing, Type.CONIFEROUS, Type.FOREST, Type.COLD, Type.SPARSE); registerBiomeToDictionary(floodplain, Type.JUNGLE, Type.WATER, Type.HOT, Type.WET); registerBiomeToDictionary(flower_meadow, Type.PLAINS, Type.LUSH); + registerBiomeToDictionary(ghost_forest, Type.FOREST, Type.SWAMP, Type.DEAD, Type.WET, Type.DENSE); registerBiomeToDictionary(grassland, Type.PLAINS, Type.HILLS, Type.WET); registerBiomeToDictionary(gravel_beach, Type.BEACH); registerBiomeToDictionary(grove, Type.FOREST, Type.PLAINS, Type.LUSH, Type.SPARSE); @@ -247,6 +249,7 @@ public class ModBiomes registerVillagerType(fir_clearing, IVillagerType.TAIGA); registerVillagerType(floodplain, IVillagerType.JUNGLE); registerVillagerType(flower_meadow, IVillagerType.TAIGA); + registerVillagerType(ghost_forest, IVillagerType.SWAMP); registerVillagerType(grassland, IVillagerType.PLAINS); registerVillagerType(gravel_beach, IVillagerType.PLAINS); registerVillagerType(grove, IVillagerType.PLAINS); diff --git a/src/main/resources/assets/biomesoplenty/lang/en_us.json b/src/main/resources/assets/biomesoplenty/lang/en_us.json index 5deecabee..110b5a06c 100644 --- a/src/main/resources/assets/biomesoplenty/lang/en_us.json +++ b/src/main/resources/assets/biomesoplenty/lang/en_us.json @@ -23,6 +23,7 @@ "biome.biomesoplenty.floodplain": "Floodplain", "biome.biomesoplenty.flower_meadow": "Flower Meadow", "biome.biomesoplenty.fungi_forest": "Fungi Forest", + "biome.biomesoplenty.ghost_forest": "Ghost Forest", "biome.biomesoplenty.glowstone_grotto": "Glowstone Grotto", "biome.biomesoplenty.grassland": "Grassland", "biome.biomesoplenty.gravel_beach": "Gravel Beach", diff --git a/src/main/resources/data/biomesoplenty/advancements/biomesoplenty/all_biomes.json b/src/main/resources/data/biomesoplenty/advancements/biomesoplenty/all_biomes.json index a9acf63cc..e505078a6 100644 --- a/src/main/resources/data/biomesoplenty/advancements/biomesoplenty/all_biomes.json +++ b/src/main/resources/data/biomesoplenty/advancements/biomesoplenty/all_biomes.json @@ -98,6 +98,12 @@ "conditions": { "biome": "biomesoplenty:flower_meadow" } + }, + "ghost_forest": { + "trigger": "minecraft:location", + "conditions": { + "biome": "biomesoplenty:ghost_forest" + } }, "grassland": { "trigger": "minecraft:location", diff --git a/src/main/resources/data/biomesoplenty/advancements/biomesoplenty/root.json b/src/main/resources/data/biomesoplenty/advancements/biomesoplenty/root.json index 89f01ad34..fbfaa1087 100644 --- a/src/main/resources/data/biomesoplenty/advancements/biomesoplenty/root.json +++ b/src/main/resources/data/biomesoplenty/advancements/biomesoplenty/root.json @@ -97,6 +97,12 @@ "conditions": { "biome": "biomesoplenty:flower_meadow" } + }, + "ghost_forest": { + "trigger": "minecraft:location", + "conditions": { + "biome": "biomesoplenty:ghost_forest" + } }, "grassland": { "trigger": "minecraft:location", @@ -445,6 +451,7 @@ "fir_clearing", "floodplain", "flower_meadow", + "ghost_forest", "grassland", "gravel_beach", "grove",