How Can I add crops?

Started by justfurkanbey on

Topic category: Mod ideas exchange

Last seen on 12:58, 4. Nov 2023
Joined Nov 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How Can I add crops?

I want to make something like a new growing vegetable but I don't know how to do it. How can I do it? Can you help me with this?

Last seen on 14:24, 2. May 2024
Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
You can do this, but not…
Sat, 11/04/2023 - 15:46

You can do this, but not using the default plant options. You'll instead need to make custom blocks for your crops, and use procedures to make them grow to the next level, (the next variant of the block), when they recieve a random tick. 

Essentially, you would want to create a custom block for each growth stage, using the 'cross' block model option, and making the block non-solid to mimic vanilla crops. Then, you would make each variant tick randomly, and make an update procedure for all of them that checks which variant the block is currently on, and advances it to the next variant by replacing the block. That's pretty much it. 

You'll probably also want a procedure to break the block if it's no longer supported, or if its farmland is trampled. And last of course, you'll want to make sure to change the drops of each growth-stage so the earlier ones drop seeds, and the final one drops the finished crop. (Possibly using a loot table to randomize the number of crops.) 

Two-block tall and water based crops are a bit trickier, but use the same principle. Hope this helps!