1.8.8 Grow melon, pumpkin, potatoes... faster

Discussion in 'Spigot Plugin Development' started by Sletonn, Jan 12, 2020.

  1. Hello, I’d like to accelerate the growing process of the farms.

    I’m using BlockGrowEvent and I test if the blocks’ material data is an instance of Crops. It’s working for wheat, carrots etc but not for melon and pumpkins. Any idea on how to make melon and pumpkin seeds grow faster?
     
    #1 Sletonn, Jan 12, 2020
    Last edited: Jan 12, 2020
  2. md_5

    Administrator Developer

    Use the correct prefix. This is not a resource.
     
  3. Wrong post tag, this isn't a resource.

    Edit: Sniped
     
  4. Hello, melons and pumpkins are not instanceof BlockCrops, they extends Block. You can check if the material of the block is equal to BlockMelon or BlockPumpkin, and then do your stuff.
     
  5. Hm that might be a bit tricky. I have two ideas for this. But they don't seem very clean.
    1) The first idea is that you cache the BlockStates (unload and load them with chunk loading/unloading) and
    call the method that is called by the random server tick by yourself (might need NMS)
    2) The second idea is caching the BlockData as instance of Sapling and increment the sapling state by yourself on random.

    The second idea might be nice because it lets you control and persist extra parameters like growth speed.
    Also calling a ton of random checks (like if(growthChance > random.nextFloat())) is pretty cheap and can be done
    thousands of times each tick without any performance loss (<0.1ms).

    Don't forget to stop tracking after the sapling is fully grown.
     
  6. md_5

    Administrator Developer

    You have to look at the Material or use the BlockData API that is present in versions which are not several years outdated
     
  7. there is:
    Code (Text):
    growth:
          cactus-modifier: 100
          cane-modifier: 100
          melon-modifier: 100
          mushroom-modifier: 100
          pumpkin-modifier: 100
          sapling-modifier: 100
          wheat-modifier: 100
          netherwart-modifier: 100
          vine-modifier: 100
          cocoa-modifier: 100
    in spigot.yml, unless you are looking to make only specific blocks grow faster instead of all.
     
  8. Does it allow me to control the growth of their seed? Or accelerate the spawn of the melon blocks or pumpkins?


    Do solutions 1 and 2 allow me aswell to control the melon block spawn ?


    I’m not going post 1.9 because the combat update ruined a good game mechanic. Even after the changes made it’s still very different from pre 1.9. Anyway it’s not the case.
    I need to make it by faction claim if some players can activate it...
     
  9. you can make your own combat system in 1.9+ and then enjoy the new features, if you can't reach the same, make something better, be creative! it should be pretty safe performance-wise to go up to 1.12.2 version