aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/api/0369-Block-Ticking-API.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patches/api/0369-Block-Ticking-API.patch')
-rw-r--r--patches/api/0369-Block-Ticking-API.patch51
1 files changed, 51 insertions, 0 deletions
diff --git a/patches/api/0369-Block-Ticking-API.patch b/patches/api/0369-Block-Ticking-API.patch
new file mode 100644
index 0000000000..aba95a2d13
--- /dev/null
+++ b/patches/api/0369-Block-Ticking-API.patch
@@ -0,0 +1,51 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Owen1212055 <[email protected]>
+Date: Sun, 26 Dec 2021 13:23:52 -0500
+Subject: [PATCH] Block Ticking API
+
+
+diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java
+index cf9600c743e977312c0a15c455d602391797ef34..38cf77e32b76bc7d9db7523f7f21427ebb72f913 100644
+--- a/src/main/java/org/bukkit/block/Block.java
++++ b/src/main/java/org/bukkit/block/Block.java
+@@ -589,6 +589,21 @@ 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.
++ */
++ void tick();
++
++ /**
++ * 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()}.
++ */
++ void randomTick();
+ // Paper end
+
+ /**
+diff --git a/src/main/java/org/bukkit/block/data/BlockData.java b/src/main/java/org/bukkit/block/data/BlockData.java
+index 8a26e7215672f5fd4555fd455c9b1571488f0259..64188a78211195fe792eac427e483e1984f52318 100644
+--- a/src/main/java/org/bukkit/block/data/BlockData.java
++++ b/src/main/java/org/bukkit/block/data/BlockData.java
+@@ -291,4 +291,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
+ }