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
|
2022-12-07 22:57:15 +01:00
|
|
|
index 47ee348a7042a8e0705bc7d2c4077c0f270a8239..2b78bdd5773872405690084fea5a92bc40894fe9 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
|
2022-12-07 22:57:15 +01:00
|
|
|
@@ -738,5 +738,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
|
2022-12-07 22:57:15 +01:00
|
|
|
index 14fd37f4bdb9b0b7f28abfccffe682f6fdc6339e..5f0acece20208047e9d17b6e72d77a5f80cb125f 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
|
2022-12-07 22:57:15 +01:00
|
|
|
@@ -617,4 +617,10 @@ public class CraftBlockData implements BlockData {
|
2022-08-03 23:14:04 +02:00
|
|
|
|
|
|
|
return this.state.isFaceSturdy(EmptyBlockGetter.INSTANCE, BlockPos.ZERO, CraftBlock.blockFaceToNotch(face), CraftBlockSupport.toNMS(support));
|
|
|
|
}
|
|
|
|
+ // Paper start - Block tick API
|
|
|
|
+ @Override
|
|
|
|
+ public boolean isRandomlyTicked() {
|
|
|
|
+ return this.state.isRandomlyTicking();
|
|
|
|
+ }
|
|
|
|
+ // Paper end
|
|
|
|
}
|