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-06-06 11:09:19 +02:00
|
|
|
index e4e4a282a10bde462af1e60aa6be992c636b9726..3a201bb68ef34d53aee75ca248248c11c4a77c2c 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-06-06 11:09:19 +02:00
|
|
|
@@ -758,5 +758,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
|
|
|
|
}
|