<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://forge.gemwire.uk/index.php?action=history&amp;feed=atom&amp;title=Saplings%2F1.16</id>
	<title>Saplings/1.16 - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://forge.gemwire.uk/index.php?action=history&amp;feed=atom&amp;title=Saplings%2F1.16"/>
	<link rel="alternate" type="text/html" href="https://forge.gemwire.uk/index.php?title=Saplings/1.16&amp;action=history"/>
	<updated>2026-05-22T21:08:28Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.35.0</generator>
	<entry>
		<id>https://forge.gemwire.uk/index.php?title=Saplings/1.16&amp;diff=2727&amp;oldid=prev</id>
		<title>ShrimpBot: Copy Saplings to MC1.16 archive</title>
		<link rel="alternate" type="text/html" href="https://forge.gemwire.uk/index.php?title=Saplings/1.16&amp;diff=2727&amp;oldid=prev"/>
		<updated>2021-07-27T03:59:06Z</updated>

		<summary type="html">&lt;p&gt;Copy &lt;a href=&quot;/wiki/Saplings&quot; title=&quot;Saplings&quot;&gt;Saplings&lt;/a&gt; to MC1.16 archive&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Let's start with a basic example by extending SaplingBlock.First create a class that extends SaplingBlock.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;public class ExampleSapling extends SaplingBlock{}&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After that you can insert the constructor. It must call super with the Parameters : &lt;br /&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;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
That means we need to make a Tree for ourselves, but more on that in a bit.&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 &lt;br /&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.&lt;br /&gt;
If you have that, your function could look like :&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&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;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now onto making the Tree for your Sapling.&lt;br /&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; : &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;public class ExampleTree extends Tree &amp;lt;/code&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 : &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;&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.&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 :&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
public static final ConfiguredFeature&amp;lt;BaseTreeFeatureConfig, ?&amp;gt; EXAMPLETREEFEATURE = &lt;br /&gt;
 Feature.TREE.withConfiguration(&lt;br /&gt;
            new BaseTreeFeatureConfig.Builder(&lt;br /&gt;
                    new SimpleBlockStateProvider(BlockInit.EXAMPLE_WOOD.get().getDefaultState()),&lt;br /&gt;
                    new SimpleBlockStateProvider(BlockInit.EXAMPLE_LEAVES.get().getDefaultState()),&lt;br /&gt;
                    new BlobFoliagePlacer(FeatureSpread.func_242252_a(2), FeatureSpread.func_242252_a(0), 3),&lt;br /&gt;
                    new StraightTrunkPlacer(4, 2, 0),&lt;br /&gt;
                    new TwoLayerFeature(1, 0, 1)&lt;br /&gt;
            ).setIgnoreVines().build());&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
After we have our ExampleTree we need to register it. This is done via 2 functions :&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
public static void registerTrees() {&lt;br /&gt;
        register(&amp;quot;example_tree&amp;quot;, EXAMPLETREE);&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/syntaxhighlight&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;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
public void 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;/syntaxhighlight &amp;gt;&lt;br /&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;syntaxhighlight lang=&amp;quot;java&amp;quot;&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;/syntaxhighlight &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;syntaxhighlight lang=&amp;quot;java&amp;quot;&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;/syntaxhighlight &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>ShrimpBot</name></author>
	</entry>
</feed>