Jump to content

Forge 1.16, Probrem with the custom feature generation


Olegueyan

Recommended Posts

Hi, I have a new problem about my mod, i have created a custom feature (Tree Generation) and when i try to put this in my biome (with feature); the trees don't generate. I join my biome class and my

class where there is the configured feature.

public enum InitConfiguredFeatures
    {
        DEPTHWOOD((IObject<String, ConfiguredFeature<BaseTreeFeatureConfig,?>>)
                () -> new Tuple<>("depthwood", Feature.TREE.withConfiguration((
                        new BaseTreeFeatureConfig.Builder(
                                new SimpleBlockStateProvider(InitBlocks.DEEP_LOG.getObj().getB().getDefaultState()),
                                new SimpleBlockStateProvider(InitBlocks.DEEP_LEAVES.getObj().getB().getDefaultState()),
                                new BlobFoliagePlacer(FeatureSpread.create(2), FeatureSpread.create(0), 3),
                                new StraightTrunkPlacer(6, 4, 3),
                                new TwoLayerFeature(1, 0, 1))).setIgnoreVines().build())));

        private final Tuple<String, ? extends ConfiguredFeature<?, ?>> obj;

        <T extends ConfiguredFeature<?, ?>> InitConfiguredFeatures(IObject<String, T> object)
        {
            this.obj = object.object();
        }

        public Tuple<String, ? extends  ConfiguredFeature<?, ?>> getObj()
        {
            return obj;
        }

        public static void register(IEventBus eventBus)
        {
            for (InitConfiguredFeatures configuredFeature : values())
            {
                Registry.register(WorldGenRegistries.CONFIGURED_FEATURE, configuredFeature.getObj().getA(),
                        configuredFeature.getObj().getB());
            }
        }
public static void registerElements(IEventBus eventBus)
    {
        InitItems.register(eventBus);
        InitBlocks.register(eventBus);
        InitArmors.register(eventBus);
        InitBiomes.register(eventBus);
        InitTileEntities.register(eventBus);
        InitContainers.register(eventBus);
        InitRecipes.register(eventBus);
        InitConfiguredFeatures.register(eventBus);
    }
public class BioDomeBiome extends BiomeCore
{
    public BioDomeBiome()
    {
        super(() -> ModSurfaceBuilders.BIODOME_SURFACE, 0.110f, 0.01f,
                (surfaceBuilder, depth, scale) ->
        {
            MobSpawnInfo.Builder mobspawninfo$builder = new MobSpawnInfo.Builder();

            BiomeGenerationSettings.Builder biomegenerationsettings$builder =
                    (new BiomeGenerationSettings.Builder()).withSurfaceBuilder(surfaceBuilder);

            biomegenerationsettings$builder.withFeature(GenerationStage.Decoration.LAKES, Features.LAKE_WATER);
            biomegenerationsettings$builder.withFeature(GenerationStage.Decoration.VEGETAL_DECORATION,
                    InitElements.InitConfiguredFeatures.DEPTHWOOD.getObj().getB());

            return (new Biome.Builder())
                    .precipitation(Biome.RainType.NONE)
                    .category(Biome.Category.PLAINS)
                    .depth(depth)
                    .scale(scale)
                    .temperature(1.5F)
                    .downfall(0.9f)
                    .setEffects((new BiomeAmbience.Builder())
                            .setWaterColor(9089394).setWaterFogColor(7915881)
                            .setFogColor(7915881).withSkyColor(1457975)
                            .setAmbientSound
                                    (SoundEvents.AMBIENT_CRIMSON_FOREST_LOOP)
                            .setMoodSound(new MoodSoundAmbience
                                    (SoundEvents.AMBIENT_WARPED_FOREST_MOOD, 6000, 8, 2.0D))
                            .setAdditionsSound(new SoundAdditionsAmbience
                                    (SoundEvents.AMBIENT_NETHER_WASTES_ADDITIONS, 0.0111D))
                            .setMusic(BackgroundMusicTracks.getDefaultBackgroundMusicSelector
                                    (SoundEvents.MUSIC_NETHER_CRIMSON_FOREST))
                            .build()).withMobSpawnSettings(mobspawninfo$builder.build())
                    .withGenerationSettings(biomegenerationsettings$builder.build()).build();
        });
    }
}
public enum InitBiomes
    {
        BIO_DOME((IObject<String, Biome>) () -> new Tuple<>
                ("biodome_biome",  new BioDomeBiome().getBiome())),
        MOSS_RIVER((IObject<String, Biome>) () -> new Tuple<>
                ("mossriver_biome", new MossRiverBiome().getBiome()));

        private final Tuple<String, ? extends Biome> obj;

        <T extends Biome> InitBiomes(IObject<String, T> object)
        {
            this.obj = object.object();
        }

        public Tuple<String, ? extends Biome> getObj()
        {
            return obj;
        }

        public static void register(IEventBus eventBus)
        {
            ObjectRegister<Biome> registerBiomes = new ObjectRegister<>(ForgeRegistries.BIOMES);
            for (InitBiomes biome : values())
            {
                registerBiomes.addElement(biome.getObj().getA(), biome.getObj().getB());
            }
            registerBiomes.register(eventBus);
        }
    }

 

Edited by Olegueyan
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.