diff --git a/src/main/java/biomesoplenty/common/biome/overworld/LavenderFieldBiome.java b/src/main/java/biomesoplenty/common/biome/overworld/LavenderFieldBiome.java index 9a8269228..a70d4efcf 100644 --- a/src/main/java/biomesoplenty/common/biome/overworld/LavenderFieldBiome.java +++ b/src/main/java/biomesoplenty/common/biome/overworld/LavenderFieldBiome.java @@ -9,6 +9,7 @@ package biomesoplenty.common.biome.overworld; import biomesoplenty.api.enums.BOPClimates; import biomesoplenty.common.biome.BiomeTemplate; +import biomesoplenty.common.world.gen.feature.BOPConfiguredFeatures; import biomesoplenty.common.world.gen.feature.BOPFeatures; import com.google.common.collect.ImmutableList; import net.minecraft.entity.EntityClassification; @@ -56,7 +57,7 @@ public class LavenderFieldBiome extends BiomeTemplate //////////////////////////////////////////////////////////// // Vegetation - builder.addFeature(GenerationStage.Decoration.VEGETAL_DECORATION, Feature.RANDOM_SELECTOR.configured(new MultipleRandomFeatureConfig(ImmutableList.of(BOPFeatures.FLOWERING_OAK_TREE.configured(Features.OAK.config().withDecorators(ImmutableList.of(Features.Placements.BEEHIVE_005))).weighted(0.2F), BOPFeatures.BIG_FLOWERING_OAK_TREE.configured(Features.OAK.config()).weighted(0.1F), BOPFeatures.BIG_JACARANDA_TREE.configured(Features.OAK.config()).weighted(0.1F)), BOPFeatures.JACARANDA_TREE.configured(Features.OAK.config().withDecorators(ImmutableList.of(Features.Placements.BEEHIVE_002))))).decorated(Placement.COUNT_EXTRA.configured(new AtSurfaceWithExtraConfig(1, 0.2F, 1)))); + builder.addFeature(GenerationStage.Decoration.VEGETAL_DECORATION, Feature.RANDOM_SELECTOR.configured(new MultipleRandomFeatureConfig(ImmutableList.of(BOPFeatures.FLOWERING_OAK_TREE.configured(Features.OAK.config().withDecorators(ImmutableList.of(Features.Placements.BEEHIVE_005))).weighted(0.2F), BOPConfiguredFeatures.BIG_FLOWERING_OAK_TREE.weighted(0.1F), BOPFeatures.BIG_JACARANDA_TREE.configured(Features.OAK.config()).weighted(0.1F)), BOPFeatures.JACARANDA_TREE.configured(Features.OAK.config().withDecorators(ImmutableList.of(Features.Placements.BEEHIVE_002))))).decorated(Placement.COUNT_EXTRA.configured(new AtSurfaceWithExtraConfig(1, 0.2F, 1)))); builder.addFeature(GenerationStage.Decoration.VEGETAL_DECORATION, BOPFeatures.STANDARD_GRASS.configured(IFeatureConfig.NONE).decorated(Features.Placements.HEIGHTMAP_DOUBLE_SQUARE.count(12))); builder.addFeature(GenerationStage.Decoration.VEGETAL_DECORATION, BOPFeatures.LAVENDER_FLOWERS.configured(IFeatureConfig.NONE).decorated(Features.Placements.HEIGHTMAP_DOUBLE_SQUARE.count(128))); diff --git a/src/main/java/biomesoplenty/common/biome/overworld/LushSwampBiome.java b/src/main/java/biomesoplenty/common/biome/overworld/LushSwampBiome.java index 5a5c21c9b..c1dadde00 100644 --- a/src/main/java/biomesoplenty/common/biome/overworld/LushSwampBiome.java +++ b/src/main/java/biomesoplenty/common/biome/overworld/LushSwampBiome.java @@ -11,6 +11,7 @@ import biomesoplenty.api.block.BOPBlocks; import biomesoplenty.api.enums.BOPClimates; import biomesoplenty.common.biome.BiomeTemplate; import biomesoplenty.common.world.biome.BiomeFeatureHelper; +import biomesoplenty.common.world.gen.feature.BOPConfiguredFeatures; import biomesoplenty.common.world.gen.feature.BOPFeatures; import net.minecraft.block.Blocks; import net.minecraft.entity.EntityClassification; @@ -62,7 +63,7 @@ public class LushSwampBiome extends BiomeTemplate //////////////////////////////////////////////////////////// // Vegetation - builder.addFeature(GenerationStage.Decoration.VEGETAL_DECORATION, BOPFeatures.TALL_SWAMP_TREE.configured(Features.OAK.config()).decorated(Placement.COUNT_EXTRA.configured(new AtSurfaceWithExtraConfig(3, 0.1F, 1)))); + builder.addFeature(GenerationStage.Decoration.VEGETAL_DECORATION, BOPConfiguredFeatures.TALL_SWAMP_TREE.decorated(Placement.COUNT_EXTRA.configured(new AtSurfaceWithExtraConfig(3, 0.1F, 1)))); builder.addFeature(GenerationStage.Decoration.VEGETAL_DECORATION, BOPFeatures.LUSH_SWAMP_FLOWERS.configured(IFeatureConfig.NONE).decorated(Features.Placements.ADD_32).decorated(Features.Placements.HEIGHTMAP_SQUARE.count(5))); builder.addFeature(GenerationStage.Decoration.VEGETAL_DECORATION, BOPFeatures.STANDARD_GRASS.configured(IFeatureConfig.NONE).decorated(Features.Placements.HEIGHTMAP_DOUBLE_SQUARE.count(8))); diff --git a/src/main/java/biomesoplenty/common/biome/overworld/MysticGroveBiome.java b/src/main/java/biomesoplenty/common/biome/overworld/MysticGroveBiome.java index 11394ce6a..f86bb6286 100644 --- a/src/main/java/biomesoplenty/common/biome/overworld/MysticGroveBiome.java +++ b/src/main/java/biomesoplenty/common/biome/overworld/MysticGroveBiome.java @@ -11,6 +11,7 @@ import biomesoplenty.api.block.BOPBlocks; import biomesoplenty.api.enums.BOPClimates; import biomesoplenty.common.biome.BiomeTemplate; import biomesoplenty.common.world.biome.BiomeFeatureHelper; +import biomesoplenty.common.world.gen.feature.BOPConfiguredFeatures; import biomesoplenty.common.world.gen.feature.BOPFeatures; import com.google.common.collect.ImmutableList; import net.minecraft.block.Blocks; @@ -66,7 +67,7 @@ public class MysticGroveBiome extends BiomeTemplate //////////////////////////////////////////////////////////// // Vegetation - builder.addFeature(GenerationStage.Decoration.VEGETAL_DECORATION, Feature.RANDOM_SELECTOR.configured(new MultipleRandomFeatureConfig(ImmutableList.of(BOPFeatures.GIANT_TREE.configured(Features.OAK.config()).weighted(0.01F), BOPFeatures.TALL_SWAMP_TREE.configured(Features.OAK.config()).weighted(0.1F), BOPFeatures.BIG_FLOWERING_OAK_TREE.configured(Features.OAK.config()).weighted(0.2F), BOPFeatures.JACARANDA_TREE.configured(Features.OAK.config().withDecorators(ImmutableList.of(Features.Placements.BEEHIVE_0002))).weighted(0.3F), BOPFeatures.BIG_MAGIC_TREE.configured(Features.OAK.config()).weighted(0.3F)), BOPFeatures.MAGIC_TREE.configured(Features.OAK.config()))).decorated(Placement.COUNT_EXTRA.configured(new AtSurfaceWithExtraConfig(10, 0.5F, 1)))); + builder.addFeature(GenerationStage.Decoration.VEGETAL_DECORATION, BOPConfiguredFeatures.MYSTIC_GROVE_TREES); builder.addFeature(GenerationStage.Decoration.VEGETAL_DECORATION, BOPFeatures.MYSTIC_GROVE_FLOWERS.configured(IFeatureConfig.NONE).decorated(Features.Placements.ADD_32).decorated(Features.Placements.HEIGHTMAP_SQUARE.count(18))); builder.addFeature(GenerationStage.Decoration.VEGETAL_DECORATION, Features.HUGE_RED_MUSHROOM.decorated(Features.Placements.HEIGHTMAP_DOUBLE_SQUARE.count(1))); diff --git a/src/main/java/biomesoplenty/common/biome/overworld/OrchardBiome.java b/src/main/java/biomesoplenty/common/biome/overworld/OrchardBiome.java index 3f2e068cc..fa18a6db1 100644 --- a/src/main/java/biomesoplenty/common/biome/overworld/OrchardBiome.java +++ b/src/main/java/biomesoplenty/common/biome/overworld/OrchardBiome.java @@ -10,6 +10,7 @@ package biomesoplenty.common.biome.overworld; import biomesoplenty.api.block.BOPBlocks; import biomesoplenty.common.biome.BiomeTemplate; import biomesoplenty.common.world.biome.BiomeFeatureHelper; +import biomesoplenty.common.world.gen.feature.BOPConfiguredFeatures; import biomesoplenty.common.world.gen.feature.BOPFeatures; import com.google.common.collect.ImmutableList; import net.minecraft.block.Blocks; @@ -56,7 +57,7 @@ public class OrchardBiome extends BiomeTemplate //////////////////////////////////////////////////////////// // Vegetation - builder.addFeature(GenerationStage.Decoration.VEGETAL_DECORATION, Feature.RANDOM_SELECTOR.configured(new MultipleRandomFeatureConfig(ImmutableList.of(BOPFeatures.BIG_FLOWERING_OAK_TREE.configured(Features.OAK.config()).weighted(0.1F)), BOPFeatures.FLOWERING_OAK_TREE.configured(Features.OAK.config().withDecorators(ImmutableList.of(Features.Placements.BEEHIVE_005))))).decorated(Placement.COUNT_EXTRA.configured(new AtSurfaceWithExtraConfig(2, 0.3F, 1)))); + builder.addFeature(GenerationStage.Decoration.VEGETAL_DECORATION, Feature.RANDOM_SELECTOR.configured(new MultipleRandomFeatureConfig(ImmutableList.of(BOPConfiguredFeatures.BIG_FLOWERING_OAK_TREE.weighted(0.1F)), BOPFeatures.FLOWERING_OAK_TREE.configured(Features.OAK.config().withDecorators(ImmutableList.of(Features.Placements.BEEHIVE_005))))).decorated(Placement.COUNT_EXTRA.configured(new AtSurfaceWithExtraConfig(2, 0.3F, 1)))); builder.addFeature(GenerationStage.Decoration.VEGETAL_DECORATION, BOPFeatures.EXTENDED_FLOWERS.configured(IFeatureConfig.NONE).decorated(Features.Placements.ADD_32).decorated(Features.Placements.HEIGHTMAP_SQUARE.count(15))); builder.addFeature(GenerationStage.Decoration.VEGETAL_DECORATION, BOPFeatures.STANDARD_GRASS.configured(IFeatureConfig.NONE).decorated(Features.Placements.HEIGHTMAP_DOUBLE_SQUARE.count(10))); diff --git a/src/main/java/biomesoplenty/common/biome/overworld/TemperateRainforestBiome.java b/src/main/java/biomesoplenty/common/biome/overworld/TemperateRainforestBiome.java index fa04cbaec..0b6ed738c 100644 --- a/src/main/java/biomesoplenty/common/biome/overworld/TemperateRainforestBiome.java +++ b/src/main/java/biomesoplenty/common/biome/overworld/TemperateRainforestBiome.java @@ -12,6 +12,7 @@ import biomesoplenty.api.block.BOPBlocks; import biomesoplenty.api.enums.BOPClimates; import biomesoplenty.common.biome.BiomeTemplate; import biomesoplenty.common.world.biome.BiomeFeatureHelper; +import biomesoplenty.common.world.gen.feature.BOPConfiguredFeatures; import biomesoplenty.common.world.gen.feature.BOPFeatures; import com.google.common.collect.ImmutableList; import net.minecraft.block.Blocks; @@ -66,7 +67,7 @@ public class TemperateRainforestBiome extends BiomeTemplate //////////////////////////////////////////////////////////// // Vegetation - builder.addFeature(GenerationStage.Decoration.VEGETAL_DECORATION, Feature.RANDOM_SELECTOR.configured(new MultipleRandomFeatureConfig(ImmutableList.of(BOPFeatures.TALL_SWAMP_TREE.configured(Features.OAK.config()).weighted(0.15F), BOPFeatures.BIG_OAK_TREE.configured(Features.OAK.config()).weighted(0.1F), BOPFeatures.SEQUOIA_TREE.configured(Features.OAK.config()).weighted(0.5F)), BOPFeatures.SEQUOIA_TREE_LARGE.configured(Features.OAK.config()))).decorated(Placement.COUNT_EXTRA.configured(new AtSurfaceWithExtraConfig(4, 0.2F, 1)))); + builder.addFeature(GenerationStage.Decoration.VEGETAL_DECORATION, Feature.RANDOM_SELECTOR.configured(new MultipleRandomFeatureConfig(ImmutableList.of(BOPConfiguredFeatures.TALL_SWAMP_TREE.weighted(0.15F), BOPFeatures.BIG_OAK_TREE.configured(Features.OAK.config()).weighted(0.1F), BOPFeatures.SEQUOIA_TREE.configured(Features.OAK.config()).weighted(0.5F)), BOPFeatures.SEQUOIA_TREE_LARGE.configured(Features.OAK.config()))).decorated(Placement.COUNT_EXTRA.configured(new AtSurfaceWithExtraConfig(4, 0.2F, 1)))); builder.addFeature(GenerationStage.Decoration.VEGETAL_DECORATION, BOPFeatures.FERN_GRASS.configured(IFeatureConfig.NONE).decorated(Features.Placements.HEIGHTMAP_DOUBLE_SQUARE.count(10))); builder.addFeature(GenerationStage.Decoration.VEGETAL_DECORATION, Feature.RANDOM_PATCH.configured(BiomeFeatureHelper.createClusterConfigurationDouble(Blocks.LARGE_FERN.defaultBlockState())).decorated(Features.Placements.ADD_32).decorated(Features.Placements.HEIGHTMAP_SQUARE.count(15))); diff --git a/src/main/java/biomesoplenty/common/util/biome/BiomeUtil.java b/src/main/java/biomesoplenty/common/util/biome/BiomeUtil.java index 35c7a9630..b3bd7ad19 100644 --- a/src/main/java/biomesoplenty/common/util/biome/BiomeUtil.java +++ b/src/main/java/biomesoplenty/common/util/biome/BiomeUtil.java @@ -32,21 +32,21 @@ public class BiomeUtil public static Biome getBiome(RegistryKey key) { Biome biome = ForgeRegistries.BIOMES.getValue(key.location()); - if (biome == null) BiomesOPlenty.logger.error("Attempted to get unregistered biome " + key); + if (biome == null) throw new RuntimeException("Attempted to get unregistered biome " + key); return biome; } public static Biome getBiome(int id) { - if (id == -1) BiomesOPlenty.logger.error("Attempted to get biome with id -1"); + if (id == -1) throw new RuntimeException("Attempted to get biome with id -1"); return getBiome(((ForgeRegistry)ForgeRegistries.BIOMES).getKey(id)); } public static int getBiomeId(Biome biome) { - if (biome == null) BiomesOPlenty.logger.error("Attempted to get id of null biome"); + if (biome == null) throw new RuntimeException("Attempted to get id of null biome"); int id = ((ForgeRegistry)ForgeRegistries.BIOMES).getID(biome); - if (id == -1) BiomesOPlenty.logger.error("Biome id is -1 for biome " + biome.delegate.name()); + if (id == -1) throw new RuntimeException("Biome id is -1 for biome " + biome.delegate.name()); return id; } diff --git a/src/main/java/biomesoplenty/common/world/gen/feature/BOPConfiguredFeatures.java b/src/main/java/biomesoplenty/common/world/gen/feature/BOPConfiguredFeatures.java new file mode 100644 index 000000000..bef93f9bf --- /dev/null +++ b/src/main/java/biomesoplenty/common/world/gen/feature/BOPConfiguredFeatures.java @@ -0,0 +1,39 @@ +/******************************************************************************* + * 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.world.gen.feature; + +import biomesoplenty.core.BiomesOPlenty; +import com.google.common.collect.ImmutableList; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.registry.Registry; +import net.minecraft.util.registry.WorldGenRegistries; +import net.minecraft.world.gen.GenerationStage; +import net.minecraft.world.gen.feature.*; +import net.minecraft.world.gen.placement.AtSurfaceWithExtraConfig; +import net.minecraft.world.gen.placement.Placement; + +public class BOPConfiguredFeatures +{ + // Big trees + public static final ConfiguredFeature BIG_FLOWERING_OAK_TREE = register("big_flowering_oak_tree", BOPFeatures.BIG_FLOWERING_OAK_TREE.configured(Features.OAK.config())); + public static final ConfiguredFeature BIG_MAGIC_TREE = register("big_magic_tree", BOPFeatures.BIG_MAGIC_TREE.configured(Features.OAK.config())); + + // Trees + public static final ConfiguredFeature GIANT_TREE = register("giant_tree", BOPFeatures.GIANT_TREE.configured(Features.OAK.config())); + public static final ConfiguredFeature JACARANDA_TREE = register("jacaranda_tree", BOPFeatures.JACARANDA_TREE.configured(Features.OAK.config().withDecorators(ImmutableList.of(Features.Placements.BEEHIVE_0002)))); + public static final ConfiguredFeature MAGIC_TREE = register("magic_tree", BOPFeatures.MAGIC_TREE.configured(Features.OAK.config())); + public static final ConfiguredFeature TALL_SWAMP_TREE = register("tall_swamp_tree", BOPFeatures.TALL_SWAMP_TREE.configured(Features.OAK.config())); + + // Tree assortments + public static final ConfiguredFeature MYSTIC_GROVE_TREES = register("mystic_grove_trees", Feature.RANDOM_SELECTOR.configured(new MultipleRandomFeatureConfig(ImmutableList.of(GIANT_TREE.weighted(0.01F), TALL_SWAMP_TREE.weighted(0.1F), BIG_FLOWERING_OAK_TREE.weighted(0.2F), JACARANDA_TREE.weighted(0.3F), BIG_MAGIC_TREE.weighted(0.3F)), MAGIC_TREE)).decorated(Features.Placements.HEIGHTMAP_SQUARE).decorated(Placement.COUNT_EXTRA.configured(new AtSurfaceWithExtraConfig(10, 0.5F, 1)))); + + private static ConfiguredFeature register(String key, ConfiguredFeature feature) + { + return Registry.register(WorldGenRegistries.CONFIGURED_FEATURE, new ResourceLocation(BiomesOPlenty.MOD_ID, key), feature); + } +}