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: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
|
2023-12-06 17:21:56 +01:00
|
|
|
index 6d10396347b69d9243ab902ecc68ede93fa17b7d..0a96b00a98227714ef99005e0a223765feae8fe9 100644
|
2022-08-03 23:14:04 +02:00
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
|
2023-12-06 17:21:56 +01:00
|
|
|
@@ -709,5 +709,21 @@ public class CraftBlock implements Block {
|
2022-08-03 23:14:04 +02:00
|
|
|
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
|
2023-12-06 17:21:56 +01:00
|
|
|
index 79c469d461ce9df0994214ebc8b157a095a4c848..28a798e497c2c12794169068e69b56dd954978f3 100644
|
2022-08-03 23:14:04 +02:00
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java
|
2023-12-06 17:21:56 +01:00
|
|
|
@@ -711,4 +711,11 @@ public class CraftBlockData implements BlockData {
|
2023-08-25 19:57:11 +02:00
|
|
|
return speed;
|
2022-08-03 23:14:04 +02:00
|
|
|
}
|
2023-08-25 19:57:11 +02:00
|
|
|
// Paper end - destroy speed API
|
2023-03-20 09:47:10 +01:00
|
|
|
+
|
2022-08-03 23:14:04 +02:00
|
|
|
+ // Paper start - Block tick API
|
|
|
|
+ @Override
|
|
|
|
+ public boolean isRandomlyTicked() {
|
|
|
|
+ return this.state.isRandomlyTicking();
|
|
|
|
+ }
|
2023-08-25 19:57:11 +02:00
|
|
|
+ // Paper end - Block tick API
|
2022-08-03 23:14:04 +02:00
|
|
|
}
|