Topic category: Help with MCreator software
No vegetation in my biome.
If needed, here's the code.
package net.mcreator.amethyst.world.biome;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.common.BiomeManager;
import net.minecraftforge.common.BiomeDictionary;
import net.minecraft.world.gen.trunkplacer.MegaJungleTrunkPlacer;
import net.minecraft.world.gen.treedecorator.TrunkVineTreeDecorator;
import net.minecraft.world.gen.treedecorator.LeaveVineTreeDecorator;
import net.minecraft.world.gen.surfacebuilders.SurfaceBuilderConfig;
import net.minecraft.world.gen.surfacebuilders.SurfaceBuilder;
import net.minecraft.world.gen.placement.Placement;
import net.minecraft.world.gen.placement.NoiseDependant;
import net.minecraft.world.gen.placement.AtSurfaceWithExtraConfig;
import net.minecraft.world.gen.foliageplacer.JungleFoliagePlacer;
import net.minecraft.world.gen.feature.structure.StructureFeatures;
import net.minecraft.world.gen.feature.TwoLayerFeature;
import net.minecraft.world.gen.feature.ProbabilityConfig;
import net.minecraft.world.gen.feature.Features;
import net.minecraft.world.gen.feature.FeatureSpread;
import net.minecraft.world.gen.feature.Feature;
import net.minecraft.world.gen.feature.BlockClusterFeatureConfig;
import net.minecraft.world.gen.feature.BigMushroomFeatureConfig;
import net.minecraft.world.gen.feature.BaseTreeFeatureConfig;
import net.minecraft.world.gen.blockstateprovider.SimpleBlockStateProvider;
import net.minecraft.world.gen.blockplacer.SimpleBlockPlacer;
import net.minecraft.world.gen.GenerationStage;
import net.minecraft.world.biome.MobSpawnInfo;
import net.minecraft.world.biome.DefaultBiomeFeatures;
import net.minecraft.world.biome.BiomeGenerationSettings;
import net.minecraft.world.biome.BiomeAmbience;
import net.minecraft.world.biome.Biome;
import net.minecraft.util.registry.WorldGenRegistries;
import net.minecraft.util.registry.Registry;
import net.minecraft.util.RegistryKey;
import net.minecraft.block.HugeMushroomBlock;
import net.minecraft.block.Blocks;
import net.mcreator.amethyst.block.AmethystGrassBlock;
import net.mcreator.amethyst.AmethystModElements;
import com.google.common.collect.ImmutableList;
@AmethystModElements.ModElement.Tag
public class AmethystStreetBiome extends AmethystModElements.ModElement {
public static Biome biome;
public AmethystStreetBiome(AmethystModElements instance) {
super(instance, 23);
FMLJavaModLoadingContext.get().getModEventBus().register(new BiomeRegisterHandler());
}
private static class BiomeRegisterHandler {
@SubscribeEvent
public void registerBiomes(RegistryEvent.Register<Biome> event) {
if (biome == null) {
BiomeAmbience effects = new BiomeAmbience.Builder().setFogColor(12638463).setWaterColor(-10092391).setWaterFogColor(329011)
.withSkyColor(7972607).withFoliageColor(-10092442).withGrassColor(-10092442).build();
BiomeGenerationSettings.Builder biomeGenerationSettings = new BiomeGenerationSettings.Builder()
.withSurfaceBuilder(SurfaceBuilder.DEFAULT.func_242929_a(new SurfaceBuilderConfig(AmethystGrassBlock.block.getDefaultState(),
Blocks.DIRT.getDefaultState(), Blocks.DIRT.getDefaultState())));
biomeGenerationSettings.withStructure(StructureFeatures.MINESHAFT);
biomeGenerationSettings.withFeature(GenerationStage.Decoration.VEGETAL_DECORATION, Feature.TREE
.withConfiguration((new BaseTreeFeatureConfig.Builder(new SimpleBlockStateProvider(Blocks.JUNGLE_LOG.getDefaultState()),
new SimpleBlockStateProvider(Blocks.JUNGLE_LEAVES.getDefaultState()),
new JungleFoliagePlacer(FeatureSpread.func_242252_a(2), FeatureSpread.func_242252_a(0), 2),
new MegaJungleTrunkPlacer(10, 2, 19), new TwoLayerFeature(1, 1, 2)))
.setDecorators(
ImmutableList.of(TrunkVineTreeDecorator.field_236879_b_, LeaveVineTreeDecorator.field_236871_b_))
.build())
.withPlacement(Features.Placements.HEIGHTMAP_PLACEMENT)
.withPlacement(Placement.COUNT_EXTRA.configure(new AtSurfaceWithExtraConfig(1, 0.1F, 1))));
biomeGenerationSettings.withFeature(GenerationStage.Decoration.VEGETAL_DECORATION,
Feature.RANDOM_PATCH.withConfiguration(Features.Configs.GRASS_PATCH_CONFIG).withPlacement(Features.Placements.PATCH_PLACEMENT)
.withPlacement(Placement.COUNT_NOISE.configure(new NoiseDependant(-0.8D, 5, 4))));
biomeGenerationSettings.withFeature(GenerationStage.Decoration.VEGETAL_DECORATION, Feature.SEAGRASS
.withConfiguration(new ProbabilityConfig(0.3F)).func_242731_b(1).withPlacement(Features.Placements.SEAGRASS_DISK_PLACEMENT));
biomeGenerationSettings.withFeature(GenerationStage.Decoration.VEGETAL_DECORATION,
Feature.FLOWER.withConfiguration(Features.Configs.NORMAL_FLOWER_CONFIG)
.withPlacement(Features.Placements.VEGETATION_PLACEMENT).withPlacement(Features.Placements.HEIGHTMAP_PLACEMENT)
.func_242731_b(2));
biomeGenerationSettings.withFeature(GenerationStage.Decoration.VEGETAL_DECORATION,
Feature.RANDOM_PATCH.withConfiguration(
(new BlockClusterFeatureConfig.Builder(new SimpleBlockStateProvider(Blocks.BROWN_MUSHROOM.getDefaultState()),
SimpleBlockPlacer.PLACER)).tries(2).func_227317_b_().build()));
biomeGenerationSettings.withFeature(GenerationStage.Decoration.VEGETAL_DECORATION,
Feature.RANDOM_PATCH.withConfiguration(
(new BlockClusterFeatureConfig.Builder(new SimpleBlockStateProvider(Blocks.RED_MUSHROOM.getDefaultState()),
SimpleBlockPlacer.PLACER)).tries(2).func_227317_b_().build()));
biomeGenerationSettings.withFeature(GenerationStage.Decoration.VEGETAL_DECORATION,
Feature.HUGE_BROWN_MUSHROOM.withConfiguration(new BigMushroomFeatureConfig(
new SimpleBlockStateProvider(Blocks.BROWN_MUSHROOM_BLOCK.getDefaultState().with(HugeMushroomBlock.UP, Boolean.TRUE)
.with(HugeMushroomBlock.DOWN, Boolean.FALSE)),
new SimpleBlockStateProvider(Blocks.MUSHROOM_STEM.getDefaultState().with(HugeMushroomBlock.UP, Boolean.FALSE)
.with(HugeMushroomBlock.DOWN, Boolean.FALSE)),
4)));
biomeGenerationSettings.withFeature(GenerationStage.Decoration.VEGETAL_DECORATION,
Feature.HUGE_RED_MUSHROOM.withConfiguration(new BigMushroomFeatureConfig(
new SimpleBlockStateProvider(Blocks.RED_MUSHROOM_BLOCK.getDefaultState().with(HugeMushroomBlock.DOWN, Boolean.FALSE)),
new SimpleBlockStateProvider(Blocks.MUSHROOM_STEM.getDefaultState().with(HugeMushroomBlock.UP, Boolean.FALSE)
.with(HugeMushroomBlock.DOWN, Boolean.FALSE)),
4)));
DefaultBiomeFeatures.withCavesAndCanyons(biomeGenerationSettings);
DefaultBiomeFeatures.withOverworldOres(biomeGenerationSettings);
DefaultBiomeFeatures.withFrozenTopLayer(biomeGenerationSettings);
MobSpawnInfo.Builder mobSpawnInfo = new MobSpawnInfo.Builder().isValidSpawnBiomeForPlayer();
biome = new Biome.Builder().precipitation(Biome.RainType.RAIN).category(Biome.Category.FOREST).depth(0.5f).scale(0.2f)
.temperature(1.2f).downfall(0.2f).setEffects(effects).withMobSpawnSettings(mobSpawnInfo.copy())
.withGenerationSettings(biomeGenerationSettings.build()).build();
event.getRegistry().register(biome.setRegistryName("amethyst:amethyst_street"));
}
}
}
@Override
public void init(FMLCommonSetupEvent event) {
BiomeDictionary.addTypes(RegistryKey.getOrCreateKey(Registry.BIOME_KEY, WorldGenRegistries.BIOME.getKey(biome)), BiomeDictionary.Type.FOREST);
BiomeManager.addBiome(BiomeManager.BiomeType.WARM,
new BiomeManager.BiomeEntry(RegistryKey.getOrCreateKey(Registry.BIOME_KEY, WorldGenRegistries.BIOME.getKey(biome)), 15));
}
}
the grass block need the "forge:dirt" tag to work with vegetation
Sorry for the question, but I haven't worked with tags before. Could you give me a prompting?
You need to create a new tag named Dirt. Set its namespace to "forge". Set its type to "blocks." Then add your biome dirt to the list of elements under the tag.
Thank.
Thank you