2022-08-03 23:14:04 +02: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
|
2024-01-26 20:17:06 +01:00
|
|
|
index efae68513fe59e95866cdbc6c8c1d9031907bedc..25650e9a31bcaf672acd115547abc1ec41a1de34 100644
|
2022-08-03 23:14:04 +02:00
|
|
|
--- a/src/main/java/org/bukkit/block/Block.java
|
|
|
|
+++ b/src/main/java/org/bukkit/block/Block.java
|
2023-02-15 23:10:14 +01:00
|
|
|
@@ -589,6 +589,21 @@ public interface Block extends Metadatable, Translatable, net.kyori.adventure.tr
|
2022-08-03 23:14:04 +02:00
|
|
|
* @return true if the block was destroyed
|
|
|
|
*/
|
2022-12-15 04:37:16 +01:00
|
|
|
boolean breakNaturally(@NotNull ItemStack tool, boolean triggerEffect, boolean dropExperience);
|
2022-08-03 23:14:04 +02: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
|
2024-01-26 20:17:06 +01:00
|
|
|
index 8a26e7215672f5fd4555fd455c9b1571488f0259..64188a78211195fe792eac427e483e1984f52318 100644
|
2022-08-03 23:14:04 +02:00
|
|
|
--- a/src/main/java/org/bukkit/block/data/BlockData.java
|
|
|
|
+++ b/src/main/java/org/bukkit/block/data/BlockData.java
|
2024-01-26 20:17:06 +01:00
|
|
|
@@ -291,4 +291,14 @@ public interface BlockData extends Cloneable {
|
2023-08-25 19:57:11 +02:00
|
|
|
*/
|
|
|
|
float getDestroySpeed(@NotNull ItemStack itemStack, boolean considerEnchants);
|
|
|
|
// Paper end - destroy speed API
|
2022-08-03 23:14:04 +02: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();
|
2023-08-25 19:57:11 +02:00
|
|
|
+ // Paper end - Tick API
|
2022-08-03 23:14:04 +02:00
|
|
|
}
|