Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-11-15 12:30:06 +01:00
49 Zeilen
2.1 KiB
Diff
49 Zeilen
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 8fb44799c3273841ffc0996aa8984513e391c70d..e8dd0b9184e164b41cb4b361f23b6925e7670f8f 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
|
|
@@ -708,5 +708,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 5b67d4dd280688093d7e36e59e5b2ec6ebdc796c..0bf863f597f3657a0f158756a2a91bda7eb453f6 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java
|
|
@@ -704,4 +704,11 @@ public class CraftBlockData implements BlockData {
|
|
return speed;
|
|
}
|
|
// Paper end - destroy speed API
|
|
+
|
|
+ // Paper start - Block tick API
|
|
+ @Override
|
|
+ public boolean isRandomlyTicked() {
|
|
+ return this.state.isRandomlyTicking();
|
|
+ }
|
|
+ // Paper end - Block tick API
|
|
}
|