mirror of
https://github.com/PaperMC/Paper.git
synced 2025-02-18 19:24:10 +01:00
Block Ticking API
This commit is contained in:
parent
c44d007ade
commit
763c827879
2 changed files with 45 additions and 0 deletions
paper-api/src/main/java/org/bukkit/block
|
@ -593,6 +593,41 @@ public interface Block extends Metadatable, Translatable, net.kyori.adventure.tr
|
|||
* @return true if the block was destroyed
|
||||
*/
|
||||
boolean breakNaturally(@NotNull ItemStack tool, boolean triggerEffect, boolean dropExperience);
|
||||
|
||||
/**
|
||||
* Causes the block to be ticked, this is different from {@link Block#randomTick()},
|
||||
* in that it is usually scheduled to occur, for example
|
||||
* redstone components being activated, sand falling, etc.
|
||||
* <p>
|
||||
* This method may directly fire events relating to block ticking.
|
||||
*
|
||||
* @see #fluidTick()
|
||||
*/
|
||||
void tick();
|
||||
|
||||
/**
|
||||
* Causes the fluid to be ticked, this is different from {@link Block#randomTick()},
|
||||
* in that it is usually scheduled to occur, for example
|
||||
* causing waterlogged blocks to spread.
|
||||
* <p>
|
||||
* This method may directly fire events relating to fluid ticking.
|
||||
*
|
||||
* @see #tick()
|
||||
*/
|
||||
void fluidTick();
|
||||
|
||||
/**
|
||||
* Causes the block to be ticked randomly.
|
||||
* This has a chance to execute naturally if {@link BlockData#isRandomlyTicked()} is true.
|
||||
* <p>
|
||||
* For certain blocks, this behavior may be the same as {@link Block#tick()}.
|
||||
* <p>
|
||||
* This method may directly fire events relating to block random ticking.
|
||||
*
|
||||
* @see #tick()
|
||||
* @see #fluidTick()
|
||||
*/
|
||||
void randomTick();
|
||||
// Paper end
|
||||
|
||||
/**
|
||||
|
|
|
@ -295,4 +295,14 @@ public interface BlockData extends Cloneable {
|
|||
*/
|
||||
float getDestroySpeed(@NotNull ItemStack itemStack, boolean considerEnchants);
|
||||
// Paper end - destroy speed API
|
||||
|
||||
// Paper start - Tick API
|
||||
/**
|
||||
* Gets if this block is ticked randomly in the world.
|
||||
* The blocks current state may change this value.
|
||||
*
|
||||
* @return is ticked randomly
|
||||
*/
|
||||
boolean isRandomlyTicked();
|
||||
// Paper end - Tick API
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue