aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0773-Block-Ticking-API.patch
diff options
context:
space:
mode:
authormaxcom1 <[email protected]>2024-03-23 22:26:17 +0100
committerGitHub <[email protected]>2024-03-23 17:26:17 -0400
commitb6001403e9703cadaa6e8c8558e732b91c3c6d6e (patch)
treea8c57bbc334a8ad48d4ad2b43db335667b142bee /patches/server/0773-Block-Ticking-API.patch
parent9ec7dfcbc41c6e625de0050b6997160a75df9f44 (diff)
downloadPaper-b6001403e9703cadaa6e8c8558e732b91c3c6d6e.tar.gz
Paper-b6001403e9703cadaa6e8c8558e732b91c3c6d6e.zip
Add methods to change entity physics (#10334)
Diffstat (limited to 'patches/server/0773-Block-Ticking-API.patch')
-rw-r--r--patches/server/0773-Block-Ticking-API.patch48
1 files changed, 48 insertions, 0 deletions
diff --git a/patches/server/0773-Block-Ticking-API.patch b/patches/server/0773-Block-Ticking-API.patch
new file mode 100644
index 0000000000..9afbc4d4b1
--- /dev/null
+++ b/patches/server/0773-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 6d10396347b69d9243ab902ecc68ede93fa17b7d..0a96b00a98227714ef99005e0a223765feae8fe9 100644
+--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
++++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
+@@ -709,5 +709,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 a4252f9078c3ab7e458504496ebcdeb6875724d1..37c5d66dafd877d2231c8d191f5a84748bf24551 100644
+--- a/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java
++++ b/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java
+@@ -735,4 +735,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
+ }