mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-08 03:39:48 +01:00
49 lines
2.1 KiB
Diff
49 lines
2.1 KiB
Diff
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
|
|
index e4e4a282a10bde462af1e60aa6be992c636b9726..3a201bb68ef34d53aee75ca248248c11c4a77c2c 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
|
|
@@ -758,5 +758,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 9d09b3064fc0474170e6d584dd3ccb9899cfbd42..c061f76ff6ccf64d9eb53045e9bfabe2021e91ec 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java
|
|
@@ -676,4 +676,11 @@ public class CraftBlockData implements BlockData {
|
|
public void mirror(Mirror mirror) {
|
|
this.state = this.state.mirror(net.minecraft.world.level.block.Mirror.valueOf(mirror.name()));
|
|
}
|
|
+
|
|
+ // Paper start - Block tick API
|
|
+ @Override
|
|
+ public boolean isRandomlyTicked() {
|
|
+ return this.state.isRandomlyTicking();
|
|
+ }
|
|
+ // Paper end
|
|
}
|