1.18 Custom crops plugin

Discussion in 'Spigot Plugin Development' started by miner1235_MC, Jan 20, 2022.

  1. Hi, i'm miner and I'm trying to create plugin with custom crops. I need them to grow in stages and change textures and be plantable. I don't know where to start. I know how I can get drops from it and so, but I can't find anywhere how to make them plantable and how to make them grow. If you have some tutorial or just bit of code it would be great. Thank's.

    PS: Sorry for my bad English I'm Czech _:D
     
  2. From this video I am certain that custom models for blocks isn't possible, but the work around is to use an item frame holding an item with custom model data (). This isn't a great work around because entities are processed on the server and having a crazy large farm with these many entities will lagg things out.

    Now for everything besides texturing, you might be in luck. When you want to plant your custom crop, store its vector3 position in a HashMap along with whatever other data is relevant to the crop (base growth rate or something, and its current growth stage). https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/event/block/BlockPhysicsEvent.html

    When the crop block receives a BlockPhysicsEvent (you can first check to see if the block type IS of a custom crop type before the more expensive hashmap check to see whether that particular crop block is a custom crop).

    You can customize the visual growth stage of the crop as needed and whatever else.

    Hope this helps
     
  3. You may want to look into this plugin. It even has an api. You could create a custom block for each stage of crop. Not too sure how you would make the crops grow though.
     
  4. Zdravím, v případě "vlastních textur u blocků" je zapotřebí:
    1) Mít vlastní resource-pack
    2) Upravovat BlockState blocků - Např. u houbového blocku toto jde skvěle.
     
  5. Tady jde o to, že já mám textury všech stage toho blocku, ale potřeboval bych vytvořit nový "block" který by rostl. Ale i tak, díky
     
  6. Thank you very much.
     
  7. Yes, sure! Thank you.