PaperMC/nms-patches/BlockLeaves.patch

27 lines
1.1 KiB
Diff
Raw Normal View History

2015-05-25 20:37:24 +10:00
--- a/net/minecraft/server/BlockLeaves.java
+++ b/net/minecraft/server/BlockLeaves.java
2019-04-23 12:00:00 +10:00
@@ -2,6 +2,8 @@
import java.util.Random;
+import org.bukkit.event.block.LeavesDecayEvent; // CraftBukkit
+
2018-07-15 10:00:00 +10:00
public class BlockLeaves extends Block {
2019-04-23 12:00:00 +10:00
public static final BlockStateInteger DISTANCE = BlockProperties.ah;
2019-12-11 09:00:00 +11:00
@@ -20,6 +22,14 @@
2019-04-23 12:00:00 +10:00
@Override
2019-12-11 09:00:00 +11:00
public void b(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) {
2018-12-06 10:00:00 +11:00
if (!(Boolean) iblockdata.get(BlockLeaves.PERSISTENT) && (Integer) iblockdata.get(BlockLeaves.DISTANCE) == 7) {
2018-07-15 10:00:00 +10:00
+ // CraftBukkit start
2019-12-11 09:00:00 +11:00
+ LeavesDecayEvent event = new LeavesDecayEvent(worldserver.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()));
+ worldserver.getServer().getPluginManager().callEvent(event);
+
2019-12-11 09:00:00 +11:00
+ if (event.isCancelled() || worldserver.getType(blockposition).getBlock() != this) {
2018-07-15 10:00:00 +10:00
+ return;
+ }
+ // CraftBukkit end
2019-12-11 09:00:00 +11:00
c(iblockdata, (World) worldserver, blockposition);
worldserver.a(blockposition, false);
2018-07-15 10:00:00 +10:00
}