Solved Farm items

Discussion in 'Spigot Plugin Development' started by ParaStyle, Nov 11, 2015.

  1. Is it possible to farm items? So you plant an diamond seed and if it is grown you recieve a diamond? If so could could you give a tip on how to do it?
    Thanks in advance.
  2. Inkzzz

    Resource Staff

    Check the item on item break - check if the block broke is a farm item, if so, give the player a seed.
    • Like Like x 1
  3. I want to plant a diamond seed and if it is grown it will show a diamond block and give that diamond block when breaking it.
  4. Right-Click Event to plant seed - Create scheduler which is probably has some random ints thrown in to make the growing seem fairly random - When all grow stages are done, set the block to diamond block.
  5. A scheduler.. for crops growing?.. It's much better to store the location and check if it's a diamond seed on StructureGrowEvent
  6. Oh. He meant use real seeds? I thought he meant use a diamond, right click ground and start growing. My bad.
  7. Isn't the StructureGrowEvent only for trees?
  8. You can't use StructureGrowEvent.
    Hum i think use nbttag,sheduler, and interact event

  9. It's for anything that can grow I guess.
  10. and items can't grow ^^
  11. Just use normal seeds and track which item should be growing. Then when the block is broken, drop the appropriate stack.
  12. I was thinking of something like that. So check what the name of the seed is and then drop the itemstack I want when the seed is grown. But I have no idea on how to check this..
  13. You could set some metadata on the block as soon as you plant it (Block implements Metadatable after all), and check this meta when it gets destroyed / set to another type (in combination with checking the growth state).

    Note that you need to implement your own persistence, as metadata will be cleared on restart.
    • Informative Informative x 1
  14. Alright, thank you for the tip, I will check this out if I have time.
  15. It worked thanks!