Solved Dispatch "random tick" to chunk

Discussion in 'Plugin Development' started by MrGlue, Mar 29, 2016.

Thread Status:
Not open for further replies.
  1. Offline

    MrGlue

    Minecraft dispatchs every tick a random tick to 3 random chunks near the player. Every Block receives this tick. Tree and wheat grow. Leaves disappear etc.
    In Vanilla and Bukkit you can change that number to any other by using /gamerule randomTickSpeed int

    Is it possible to pass a "random tick" through a plugin to a loaded chunk?
     
  2. Offline

    Zombie_Striker

    @MrGlue
    Although there is not an event for this, you can use BlockPhysicsEvent which is called whenever the server tried to update a block.
     
  3. Offline

    MrGlue

  4. Offline

    mcdorli

    If you want to stop trees from growing, use a structureGrowEvent.
     
  5. Offline

    JuicyDev

    Edit:

    @mcdorli has a point, spoonfeed is spoonfeed

    If you are trying to simulate a block tick try looking in the nms Block, BlockPlant class for the method, trust me it exists.
     
    Last edited: Mar 30, 2016
  6. Offline

    mcdorli

    Problem solved
     
    Last edited: Mar 30, 2016
  7. Offline

    JuicyDev

    @mcdorli
    You should remove the quote too as it has the code as well.
     
  8. Offline

    MrGlue

    @JuicyDev Thank you very much for your code. I will try it out soon.
    @mcdorli Why is example code such a bad thing? Where is the difference between APIs and example code?
    In both cases you do not use your own code.
     
  9. Offline

    JuicyDev

    @MrGlue
    It won't work as it is, I left out a util class that was serving as a wrapper for the nms BlockPosition class. I'd recommend trying to understand the code and fixing it on your own in order to learn the workings.
     
  10. Offline

    MrGlue

    @JuicyDev
    Thank you for your advise but I don't see any sense in spending hours of time just to dispatch a block tick.
    Of course I could do it with my 3 years of experience but if everyone wouldn't provide any piece of code bukkit wouldn't exist.
    I can't force everyone to share their code but that would make earth a better place.

    #SOLVED
     
Thread Status:
Not open for further replies.

Share This Page