mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-29 15:49:00 +01:00
edd270486c
* Updated Upstream (Bukkit/CraftBukkit) Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: 150a2861 PR-827: Add BlockData#getPlacementMaterial 58c9c8ce SPIGOT-7301: Prevent creating non-openable inventories 3741079b PR-824: Expand upon PotionEffect API to better accommodate infinite durations CraftBukkit Changes: e5a7921f0 PR-1149: Add BlockData#getPlacementMaterial 58504fa61 SPIGOT-7302: Fix more issues with EntityDamageByEntity - Fix Projectile damage by dispenser - Fix cases where only exists a direct entity damager 48394703d Increase outdated build delay * Improve docs for BlockData#getPlacementMaterial
48 lines
2.1 KiB
Diff
48 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
|
|
@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java
|
|
@@ -0,0 +0,0 @@ public class CraftBlockData implements BlockData {
|
|
public Material getPlacementMaterial() {
|
|
return CraftMagicNumbers.getMaterial(this.state.getBlock().asItem());
|
|
}
|
|
+
|
|
+ // Paper start - Block tick API
|
|
+ @Override
|
|
+ public boolean isRandomlyTicked() {
|
|
+ return this.state.isRandomlyTicking();
|
|
+ }
|
|
+ // Paper end
|
|
}
|