Started by
Ovations
on
Topic category: Help with Minecraft modding (Java Edition)
I made a plant that I want to grow like a berry bush or crop. It is supposed to tick so that it can count down and eventually grow. However, the plant doesn't update unless a neighboring block is changed. I turned on the force ticking option as well as making it a growing plant type and nothing worked. Please help.
There are a couple ways I know how to do this:
These are both "Update tick" procedures.
The first method here makes use of NBT tags. In order to have tags work on your plant, you'll need to check the "Has block entity?" box at the top of the "Advanced properties" tab, right above "Force plant ticking?".
If you don't want your plants to be considered tile entities (say for lag reasons if there are too many of them), you could go with the second method here. The only downside to the second one (as far as I'm aware) is that it completely relies on RNG. If a particular plant gets unlucky, it could take a long while to update. Similarly, if it gets lucky, it could grow instantly.
I personally went with this procedure for my own multi-stage berry bush:
If you go with the NBT data method, you can use the "/data get block ~ ~ ~" command to see how far along the plant is; while the "/gamerule randomTickSpeed 3" command will speed up testing for both methods. I recommend setting the number to 30 or 300 - so you can see how quickly your berries grow at 10x or 100x speed. 3 is the default tick speed.
My problem is that the plant doesn't trigger the Update Tick procedure, even when "Force Plant Ticking" is turned on.
The first time I tried it, I used the static plant type, and I didn't actually try the growable plant type until just now. I see what you mean.
Looking at the difference between the two options in the code, the growable plant type has an additional block of code that is presumably canceling out the Update tick procedure...
I'm not very familiar with coding, but I tried combining the two and the result is a plant that breaks as it tries to replace part of itself with a berry variant. I'm not sure how to get a plant to grow on top of a different plant block without breaking itself. I tried telling the Update tick procedure to check for the same type of plant block above and below the one it tries to change, and change all of them at once, but they still break themselves awkwardly.
I was able to create blocks that behave similar to plants (basically the old way of making plants) that can grow on top of each other, but I don't know how to get them to reliably generate in the world like plants.
If you're fine having your plant only be a single block tall, then it's very simple; you just need to use the static plant type. If you do want it to be able to grow taller, then it'll take some tinkering...
Thanks for the help, but I want to use the static plant type, but it won't update tick. By the way, I'm using version 2023.1 and 1.19.2.