Jump to content

Method to change the "dirt" of a tree using BaseTreeFeatureConfig?


PortsNotAlt

Recommended Posts

I'm using Forge 1.16.5-23.2.34, and I'm attempting to make a tree that would grow from Soul Sand (or any other block I might later choose), and there seems to be no method to change this. I've already made it so that saplings can be placed on it, I just can't get them to form into trees on it.

This is my code for making Saplings peaceable on other blocks:

public class ModSaplingBlock extends SaplingBlock {
    private Supplier<Block> otherDirt;

    public ModSaplingBlock(Tree p_i48337_1_, Properties p_i48337_2_, Supplier<Block> otherDirt) {
        super(p_i48337_1_, p_i48337_2_);
        this.otherDirt = otherDirt;
    }

    @Override
    protected boolean mayPlaceOn(BlockState p_200014_1_, IBlockReader p_200014_2_, BlockPos p_200014_3_) {
        return p_200014_1_.is(otherDirt.get());
    }
}

And this is my code for my trees:

public static final ConfiguredFeature<BaseTreeFeatureConfig, ?> ASH =
            register("ash", Feature.TREE.configured((
                    new BaseTreeFeatureConfig.Builder(
                            new SimpleBlockStateProvider(ModBlocks.ASH_LOG.get().defaultBlockState()),
                            new SimpleBlockStateProvider(Blocks.AIR.defaultBlockState()),
                            new AcaciaFoliagePlacer(FeatureSpread.fixed(2),FeatureSpread.fixed(0)),
                            new ForkyTrunkPlacer(5, 2, 2),
                            new TwoLayerFeature(1, 0, 2))
                            .build())));

Any help or pointers would be greatly appreciated, thanks!

Link to comment
Share on other sites

here's help that works only on 1.19 and above. it does not work on old versions.

use debugger.

saplings don't care about soil other than when the player is placing them. so - it's not that your tree won't grow on given soil, it's that it won't grow at all. use debugger.

Link to comment
Share on other sites

On 6/6/2023 at 3:02 AM, MFMods said:

here's help that works only on 1.19 and above. it does not work on old versions.

use debugger.

saplings don't care about soil other than when the player is placing them. so - it's not that your tree won't grow on given soil, it's that it won't grow at all. use debugger.

Hi! Firstly I'm using 1.16.5

 

Also, I wish it were as simple as the trees dont grow at all, but they do grow only on dirt blocks. The saplings can be placed on Soul Sand but cannot be grown into trees on Soul Sand.

Image of Tree grown on dirt vs grown on Soul Sand

Link to comment
Share on other sites

3 hours ago, Vakror said:

TreeConfiguration.TreeConfigurationBuilder.dirt(BlockStateProvider)

Maybe I'm misunderstanding somewhere, but I'm using BaseTreeFeatureConfig.Builder, not TreeConfiguration.TreeConfigurationBuilder, maybe I'm looking in the wrong spot but that seems to be an outdated function?

Link to comment
Share on other sites

we told you what you need to do but you are not listening.

1) move to newer version if you expect help here.   you won't getting any more.  

2) follow the game logic, either through debugger, or just through IDE without the game. i don't hold minecraft code in my head and nobody else does. we simply can't answer this without looking how exactly a sapling grows. and if you don't care about your mod enough to figure it out, why should anyone else?

 

Link to comment
Share on other sites

On 6/9/2023 at 3:22 AM, MFMods said:

we told you what you need to do but you are not listening.

1) move to newer version if you expect help here.   you won't getting any more.  

2) follow the game logic, either through debugger, or just through IDE without the game. i don't hold minecraft code in my head and nobody else does. we simply can't answer this without looking how exactly a sapling grows. and if you don't care about your mod enough to figure it out, why should anyone else?

 

Hi! Thanks for your advice. I'm developing for a modpack with friends and it has to be on 1.16.5.

 

In the future I'd suggest being kinder to people, it really does go a long way :)

 

I'll look to other forums for help, thanks!

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.



×
×
  • Create New...

Important Information

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