aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0839-Block-Ticking-API.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patches/server/0839-Block-Ticking-API.patch')
-rw-r--r--patches/server/0839-Block-Ticking-API.patch48
1 files changed, 48 insertions, 0 deletions
diff --git a/patches/server/0839-Block-Ticking-API.patch b/patches/server/0839-Block-Ticking-API.patch
new file mode 100644
index 0000000000..4511a8454a
--- /dev/null
+++ b/patches/server/0839-Block-Ticking-API.patch
@@ -0,0 +1,48 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Owen1212055 <[email protected]>
+Date: Sun, 26 Dec 2021 13:23:46 -0500
+Subject: [PATCH] Block Ticking API
+
+
+diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
+index 8f588ce8de7304dbb48bca01ed331f65ba25fef8..11cc7e640774c6098c247382da8520d62ba19c32 100644
+--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
++++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
+@@ -708,5 +708,21 @@ public class CraftBlock implements Block {
+ public boolean isValidTool(ItemStack itemStack) {
+ return getDrops(itemStack).size() != 0;
+ }
++
++ @Override
++ public void tick() {
++ net.minecraft.world.level.block.state.BlockState blockData = this.getNMS();
++ net.minecraft.server.level.ServerLevel level = this.world.getMinecraftWorld();
++
++ blockData.getBlock().tick(blockData, level, this.position, level.random);
++ }
++
++ @Override
++ public void randomTick() {
++ net.minecraft.world.level.block.state.BlockState blockData = this.getNMS();
++ net.minecraft.server.level.ServerLevel level = this.world.getMinecraftWorld();
++
++ blockData.getBlock().randomTick(blockData, level, this.position, level.random);
++ }
+ // Paper end
+ }
+diff --git a/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java b/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java
+index 5b67d4dd280688093d7e36e59e5b2ec6ebdc796c..0bf863f597f3657a0f158756a2a91bda7eb453f6 100644
+--- a/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java
++++ b/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java
+@@ -704,4 +704,11 @@ public class CraftBlockData implements BlockData {
+ return speed;
+ }
+ // Paper end - destroy speed API
++
++ // Paper start - Block tick API
++ @Override
++ public boolean isRandomlyTicked() {
++ return this.state.isRandomlyTicking();
++ }
++ // Paper end - Block tick API
+ }