Jump to content

[1.16] TreeFeature replacing the base block with dirt instead of leaving it alone.


Recommended Posts

Okay, so I registered a treefeature based on the already existing treefeature. I do this so I can specify the block its capable of being placed on. Im using TreeFeature class, but copied to my own class so I can modify the settings. I can get my tree to spawn in my biome just fine, the only problem is every tree that gets placed changes the base block it was formed on back to dirt. I dont want some random dirt blocks in my biome, because I use a different block.Here is the only referrence in TreeFeature to dirt, which ive changed to allow my tree to place on my special dirt.


    private static boolean func_236418_g_(IWorldGenerationBaseReader p_236418_0_, BlockPos p_236418_1_) {
        return p_236418_0_.hasBlockState(p_236418_1_, (p_236409_0_) -> {
            Block block = p_236409_0_.getBlock();
            return isDirt(block) || block == Blocks.FARMLAND || block == CinderbaneRegistry.CINDIRT.get() || block == CinderbaneRegistry.CINDIRT_GRASS_BLOCK.get();


Although, because mappings arent this far done yet I cannot find the function that is replacing the base block with dirt. As seen here treeissue.png.5c8a425f0ff7e7c80e27eb4ecbe6c75a.png


Has anybody had any success with changing this?


Link to comment
Share on other sites

That's probably because that wouldn't be in TreeFeature as literally everything about the tree is customizable. You can even see that within the BaseTreeFeatureConfig. There you'll probably notice something called AbstractTrunkPlacer. From there, you'll find AbstractTrunkPlacer#func_236909_a_, a method that calls TreeFeature#func_236408_b_ with DIRT as a parameter. Looking into that method, you'll see that it sets the block state at the position to DIRT. So, you should probably create your own AbstractTrunkPlacer and implement the changes you want.

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.

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.