2022-08-03 21:14:04 +00:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com>
|
|
|
|
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
|
2023-05-12 11:10:08 +00:00
|
|
|
index 921864e748407291b7fa153381e7d9701e1c4608..1c3f54382d66549dc881d4577c7104be6673a274 100644
|
2022-08-03 21:14:04 +00:00
|
|
|
--- a/src/main/java/org/bukkit/block/Block.java
|
|
|
|
+++ b/src/main/java/org/bukkit/block/Block.java
|
2023-02-15 22:10:14 +00:00
|
|
|
@@ -589,6 +589,21 @@ public interface Block extends Metadatable, Translatable, net.kyori.adventure.tr
|
2022-08-03 21:14:04 +00:00
|
|
|
* @return true if the block was destroyed
|
|
|
|
*/
|
2022-12-15 03:37:16 +00:00
|
|
|
boolean breakNaturally(@NotNull ItemStack tool, boolean triggerEffect, boolean dropExperience);
|
2022-08-03 21:14:04 +00:00
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 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
|
2023-05-12 11:10:08 +00:00
|
|
|
index dd4f394860ef8cabbd4174fe3088eec97aec73a5..40ddf8909636ab3cdd78f4e66123358c6a3850f7 100644
|
2022-08-03 21:14:04 +00:00
|
|
|
--- a/src/main/java/org/bukkit/block/data/BlockData.java
|
|
|
|
+++ b/src/main/java/org/bukkit/block/data/BlockData.java
|
2023-04-07 18:39:13 +00:00
|
|
|
@@ -235,4 +235,14 @@ public interface BlockData extends Cloneable {
|
|
|
|
* @param mirror the mirror
|
2022-08-03 21:14:04 +00:00
|
|
|
*/
|
2023-04-07 18:39:13 +00:00
|
|
|
void mirror(@NotNull Mirror mirror);
|
2022-08-03 21:14:04 +00:00
|
|
|
+
|
|
|
|
+ // 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
|
|
|
|
}
|