mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-22 18:45:54 +01:00
9c76642f99
The method's implementation uses Block#getDrops which re-computes the drops from the loot table each call leading to isValidTool returning different values with subsequent calls.
72 lines
2.7 KiB
Diff
72 lines
2.7 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 f7d999d702151b50fd6ed956b59645ae2820fd27..0efd8bb70ebdb86372022c9e12ec89f229ab3b52 100644
|
|
--- a/src/main/java/org/bukkit/block/Block.java
|
|
+++ b/src/main/java/org/bukkit/block/Block.java
|
|
@@ -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
|
|
|
|
/**
|
|
diff --git a/src/main/java/org/bukkit/block/data/BlockData.java b/src/main/java/org/bukkit/block/data/BlockData.java
|
|
index 890a511355dd3f2aa9330fdc72c0fb4b3e44e5cb..54664651f34311e95f6c2dcfd93e58477beda8c2 100644
|
|
--- a/src/main/java/org/bukkit/block/data/BlockData.java
|
|
+++ b/src/main/java/org/bukkit/block/data/BlockData.java
|
|
@@ -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
|
|
}
|