<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://forge.gemwire.uk/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=CrynesSs</id>
	<title>Forge Community Wiki - User contributions [en-gb]</title>
	<link rel="self" type="application/atom+xml" href="https://forge.gemwire.uk/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=CrynesSs"/>
	<link rel="alternate" type="text/html" href="https://forge.gemwire.uk/wiki/Special:Contributions/CrynesSs"/>
	<updated>2026-06-02T04:36:29Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.35.0</generator>
	<entry>
		<id>https://forge.gemwire.uk/index.php?title=Saplings&amp;diff=2490</id>
		<title>Saplings</title>
		<link rel="alternate" type="text/html" href="https://forge.gemwire.uk/index.php?title=Saplings&amp;diff=2490"/>
		<updated>2021-03-11T14:48:53Z</updated>

		<summary type="html">&lt;p&gt;CrynesSs: Created page with &amp;quot;&amp;lt;div class=&amp;quot;header&amp;quot;&amp;gt;   &amp;lt;h1&amp;gt;Saplings&amp;lt;/h1&amp;gt;   &amp;lt;p&amp;gt;How to create Saplings in Forge 1.16.4&amp;lt;/p&amp;gt; &amp;lt;/div&amp;gt; Let's start with a basic example by extending SaplingBlock.First create a class...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;header&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;h1&amp;gt;Saplings&amp;lt;/h1&amp;gt;&lt;br /&gt;
  &amp;lt;p&amp;gt;How to create Saplings in Forge 1.16.4&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
Let's start with a basic example by extending SaplingBlock.First create a class that extends SaplingBlock.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;public class ExampleSapling extends SaplingBlock{}&amp;lt;/code&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
After that you can insert the constructor. It must call super with the Parameters : &amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=1&lt;br /&gt;
!Name !! Type !!Description &lt;br /&gt;
|-&lt;br /&gt;
|   &amp;lt;code&amp;gt;treeIn&amp;lt;/code&amp;gt;   ||   &amp;lt;code&amp;gt;net.minecraft.block.trees.Tree&amp;lt;/code&amp;gt;   || &amp;lt;code&amp;gt;The Tree your Sapling is related to&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|   &amp;lt;code&amp;gt;properties&amp;lt;/code&amp;gt;   ||   &amp;lt;code&amp;gt;net.minecraft.block.AbstractBlock.Properties&amp;lt;/code&amp;gt;   ||  &amp;lt;code&amp;gt;The Block Properties of the Sapling&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|}&amp;lt;br&amp;gt;&lt;br /&gt;
That means we need to make a Tree for ourselves, but more on that in a bit.&amp;lt;br&amp;gt;&lt;br /&gt;
If you want to have the Sapling be placeable on your own Mods Block, you need to override &amp;lt;code&amp;gt;isValidGround&amp;lt;/code&amp;gt; and make your own additions to the vanilla provided Blocks. I recommend making a &amp;lt;br&amp;gt;&amp;lt;code&amp;gt;private static final List&amp;lt;Block&amp;gt; validBlocks = ImmutableList.of(Blocks block...)&amp;lt;/code&amp;gt; to add Blocks to the List of possible Blocks.&amp;lt;br&amp;gt;&lt;br /&gt;
If you have that, your function could look like : &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
protected boolean isValidGround(@Nonnull BlockState state,@Nonnull IBlockReader worldIn,@Nonnull BlockPos pos) {&lt;br /&gt;
return validBlocks.stream().anyMatch(state::isIn) || super.isValidGround(state, worldIn, pos);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Now onto making the Tree for your Sapling.&amp;lt;br&amp;gt;&lt;br /&gt;
Start by making a &amp;lt;code&amp;gt;class&amp;lt;/code&amp;gt; that extends &amp;lt;code&amp;gt;Tree&amp;lt;/code&amp;gt; : &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;public class ExampleTree extends Tree &amp;lt;/code&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
This &amp;lt;code&amp;gt;class&amp;lt;/code&amp;gt; will only contain one &amp;lt;code&amp;gt;function&amp;lt;/code&amp;gt; which is : &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;protected ConfiguredFeature&amp;lt;BaseTreeFeatureConfig, ?&amp;gt; getTreeFeature(Random randomIn, boolean largeHive)&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
As you can see, this function requires to return a ConfiguredFeature&amp;lt;BaseTreeFeatureConfig, ?&amp;gt;. This will be the Tree that is Placed in the World. &amp;lt;br&amp;gt;&lt;br /&gt;
The &amp;lt;code&amp;gt;ConfiguredFeature&amp;lt;BaseTreeFeatureConfig, ?&amp;gt;&amp;lt;code&amp;gt; will look sth like this : &amp;lt;br&amp;gt;&lt;br /&gt;
public static final ConfiguredFeature&amp;lt;BaseTreeFeatureConfig, ?&amp;gt; EXAMPLETREEFEATURE = &amp;lt;br&amp;gt;&lt;br /&gt;
 Feature.TREE.withConfiguration(&amp;lt;br&amp;gt;&lt;br /&gt;
            new BaseTreeFeatureConfig.Builder(&amp;lt;br&amp;gt;&lt;br /&gt;
                    new SimpleBlockStateProvider(BlockInit.EXAMPLE_WOOD.get().getDefaultState()),&amp;lt;br&amp;gt;&lt;br /&gt;
                    new SimpleBlockStateProvider(BlockInit.EXAMPLE_LEAVES.get().getDefaultState()),&amp;lt;br&amp;gt;&lt;br /&gt;
                    new BlobFoliagePlacer(FeatureSpread.func_242252_a(2), FeatureSpread.func_242252_a(0), 3),&amp;lt;br&amp;gt;&lt;br /&gt;
                    new StraightTrunkPlacer(4, 2, 0),&amp;lt;br&amp;gt;&lt;br /&gt;
                    new TwoLayerFeature(1, 0, 1)&amp;lt;br&amp;gt;&lt;br /&gt;
            ).setIgnoreVines().build());&amp;lt;br&amp;gt;&lt;br /&gt;
After we have our ExampleTree we need to register it. This is done via 2 functions : &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;public static void registerTrees() {&lt;br /&gt;
        register(&amp;quot;example_tree&amp;quot;, EXAMPLETREE);&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
and also the function &amp;lt;code&amp;gt;register&amp;lt;/code&amp;gt; : &lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
register(String key, ConfiguredFeature&amp;lt;FC, ?&amp;gt; configuredFeature){&lt;br /&gt;
Registry.register(WorldGenRegistries.CONFIGURED_FEATURE, key, configuredFeature);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
If you have everything setup, call registerTrees() in FMLCommonSetupEvent.&amp;lt;br&amp;gt;&lt;br /&gt;
Back to the Sapling. Your constructor can now be completed by putting the Tree we just registered as the first super parameter and the Properties as the second parameter : &lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
public ExampleSapling() {&lt;br /&gt;
        super(new ExampleTree(), AbstractBlock.Properties.create(Material.PLANTS).doesNotBlockMovement().tickRandomly().zeroHardnessAndResistance().sound(SoundType.PLANT));&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Also in your ExampleTree class, instead of null, the function now should return your TreeFeature : &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
protected ConfiguredFeature&amp;lt;BaseTreeFeatureConfig, ?&amp;gt; getTreeFeature(@Nonnull Random randomIn, boolean largeHive) {&lt;br /&gt;
        return EXAMPLETREEFEATURE;&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Now register the Sapling like any other Block and it should be able to be placed and grow with the correct Tree.&lt;/div&gt;</summary>
		<author><name>CrynesSs</name></author>
	</entry>
</feed>