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-05-12 13:10:08 +02:00
|
|
|
index a10ca7df7863d76e2b32bf414437cbfc6d35c9b7..b6c4f3d34603929a56073444be5f25fda15ff0c7 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-05-12 13:10:08 +02:00
|
|
|
@@ -755,5 +755,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-05-12 13:10:08 +02:00
|
|
|
index 9d09b3064fc0474170e6d584dd3ccb9899cfbd42..c061f76ff6ccf64d9eb53045e9bfabe2021e91ec 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-05-12 13:10:08 +02:00
|
|
|
@@ -676,4 +676,11 @@ public class CraftBlockData implements BlockData {
|
2023-04-07 20:39:13 +02:00
|
|
|
public void mirror(Mirror mirror) {
|
|
|
|
this.state = this.state.mirror(net.minecraft.world.level.block.Mirror.valueOf(mirror.name()));
|
2022-08-03 23:14:04 +02:00
|
|
|
}
|
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();
|
|
|
|
+ }
|
|
|
|
+ // Paper end
|
|
|
|
}
|