Topic category: User side tutorials
I finally figured out how to get saplings to work- just in time for the event system to change in MCreator. If you know how to represent events in the new sequence form, or if you're using old versions of MCreator, then this will work for you.
These steps will only make a sapling grow when you click on it with bonemeal (although technically, any dye will work, so you can grow trees with ink sacs or lapis lazuli if you really wanted) I am not sure how to make them grow naturally after a time span of more than 10 ticks. I tried it before and the sapling grew as soon as it was placed on dirt.
1- Make a tree schematic with MCedit.
2- Make a plant or block for the sapling and go to events.
3- under events, choose "when right clicked on block"
4- add a stack event with the condition "item in player's hand = dye"
5- under your stack event, add two more events:
5.1-consume item from inventory -->" item to consume=dye" with the condition (in all cases)
5.2- stack event with two event:
5.2.1-place schematic with the condition Random possibility= [9.15]%
5.2.2- add block at i, j, k = [whatever block your tree's trunk is made of]
6- Now go into the test environment and try growing the sapling. It will take a few times like a normal sapling, but when it grows, it will place the tree somewhere in the +x +z direction away from the sapling. Count how many blocks in X and Z the base of the trunk is from the sapling, with the block the sapling is on counting as 1.
7- Edit (with locking) the code of the sapling and scroll to the bottom. You should see a lot of lines of code like this:
world.setBlockState(new BlockPos(i + 3, j + 0, k + 1), Block.getBlockById(97).getStateFromMeta(8), 3);
8- If your schematic is supposed to use modded blocks, you need to edit every section of "getBlockById(#)" . Kane has a good tutorial on how to do this HERE.
9- Edit every section of "new BlockPos(i+#, j+#, k+#)" to align the tree with the sapling. For example, if my tree schematic generated 3 blocks away in X and 2 in Z, the example code above would change to
orld.setBlockState(new BlockPos(i + 0, j + 0, k - 1), Block.getBlockById(97).getStateFromMeta(8), 3);
NOTE: All of my schematics so far have generated +X +Z away from the sapling, but I don't know if it does this 100% of the time, so double check the direction when you measure your schematic in step 6.
10- Hit "Save and build" to save the code and test the sapling in minecraft.