1.18 Increase tick at a specific location

Discussion in 'Spigot Plugin Development' started by ValkyrieHD, Jan 8, 2022.

  1. Hello,
    I wanted to know if there is a way to increase tick of a specific region in a minecraft map using spigot.
    I know it is possible to change the tick, but locally sems impossible to me, I wanted to be sure.

    Or to increase the speed of specific plants or seed.
  2. Option 1: Listening to BlockGrowEvent and either canceling it to delay growth rate or adding 1 to the age of the block affected to increase the growth rate.
    Option 2: Making use of the BukkitScheduler.
    • Like Like x 1
  3. Thank-you I think option 1 might be a good solution, I'll try this way :)
  4. I have another problem, I also want to increase cactus and sugar cane tick but unfortunately there not count as aged block.
    I would have to check manually if the block is type of cactus, count how many block high is the cactus and set the block above, but it would be easier if the cactus
  5. Looking at the JavaDocs, their BlockData seems to have Ageable implemented, so I'm not sure what you mean.

    Using @Gadse's suggestion, I would recommend Option 1 as well. You can get the block, check if it is in a BoundingBox (please don't initialize it in the event) that represents your region, and add your age using setAge(getAge() + 1) or something.
  6. I'm pretty sure the age of cactus and sugar cane is always their maximum age. I believe he needs to traverse the y axis and see. If you have the root you can do the following
    Code (Java):
    public int findCactusHeight(Location groundLoc) {
        Block block = groundLoc.getBlock();
        if(block.getType() != Material.CACTUS) {
            return 0;
        return 1 + findCactusHeight(groundLoc.add(0, 1, 0));
    Maybe not the most efficient solution but I remember working fine when I used it some time ago.
    #6 wand555, Jan 28, 2022
    Last edited: Jan 28, 2022
    • Agree Agree x 3
    • Useful Useful x 1
  7. Thanks I think this is the only solution for my problem, I'll have to set the block above the maxHeight