Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-11-15 12:30:06 +01:00
52 Zeilen
2.1 KiB
Diff
52 Zeilen
2.1 KiB
Diff
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
|
|
index e405c279f6135c94c775a856ab88fd3cace6bd5c..9930ebe7a23d306c602840fd43652fbdaba481b3 100644
|
|
--- a/src/main/java/org/bukkit/block/Block.java
|
|
+++ b/src/main/java/org/bukkit/block/Block.java
|
|
@@ -562,6 +562,21 @@ public interface Block extends Metadatable, net.kyori.adventure.translation.Tran
|
|
* @return true if the block was destroyed
|
|
*/
|
|
boolean breakNaturally(@NotNull ItemStack tool, boolean triggerEffect);
|
|
+
|
|
+ /**
|
|
+ * 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 62273e32e87b0dbc568747a67156366d4d4972bd..bd987bd0a29618dfe07de50b194fd6fa694628ec 100644
|
|
--- a/src/main/java/org/bukkit/block/data/BlockData.java
|
|
+++ b/src/main/java/org/bukkit/block/data/BlockData.java
|
|
@@ -151,4 +151,14 @@ public interface BlockData extends Cloneable {
|
|
* @return true if the face is sturdy and can support a block, false otherwise
|
|
*/
|
|
boolean isFaceSturdy(@NotNull BlockFace face, @NotNull BlockSupport support);
|
|
+
|
|
+ // 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
|
|
}
|