2021-03-15 23:00:00 +01:00
|
|
|
--- a/net/minecraft/world/level/block/BlockLeaves.java
|
|
|
|
+++ b/net/minecraft/world/level/block/BlockLeaves.java
|
2022-02-28 16:00:00 +01:00
|
|
|
@@ -19,6 +19,8 @@
|
2021-03-15 23:00:00 +01:00
|
|
|
import net.minecraft.world.phys.shapes.VoxelShape;
|
|
|
|
import net.minecraft.world.phys.shapes.VoxelShapes;
|
2014-11-25 22:32:16 +01:00
|
|
|
|
|
|
|
+import org.bukkit.event.block.LeavesDecayEvent; // CraftBukkit
|
|
|
|
+
|
2018-07-15 02:00:00 +02:00
|
|
|
public class BlockLeaves extends Block {
|
2014-11-25 22:32:16 +01:00
|
|
|
|
2021-06-11 07:00:00 +02:00
|
|
|
public static final int DECAY_DISTANCE = 7;
|
2022-02-28 16:00:00 +01:00
|
|
|
@@ -44,6 +46,14 @@
|
2019-04-23 04:00:00 +02:00
|
|
|
@Override
|
2021-11-21 23:00:00 +01:00
|
|
|
public void randomTick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) {
|
|
|
|
if (!(Boolean) iblockdata.getValue(BlockLeaves.PERSISTENT) && (Integer) iblockdata.getValue(BlockLeaves.DISTANCE) == 7) {
|
2018-07-15 02:00:00 +02:00
|
|
|
+ // CraftBukkit start
|
2019-12-10 23:00:00 +01:00
|
|
|
+ LeavesDecayEvent event = new LeavesDecayEvent(worldserver.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()));
|
2021-06-11 13:33:49 +02:00
|
|
|
+ worldserver.getCraftServer().getPluginManager().callEvent(event);
|
2014-11-25 22:32:16 +01:00
|
|
|
+
|
2021-11-21 23:00:00 +01:00
|
|
|
+ if (event.isCancelled() || worldserver.getBlockState(blockposition).getBlock() != this) {
|
2018-07-15 02:00:00 +02:00
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ // CraftBukkit end
|
2021-11-21 23:00:00 +01:00
|
|
|
dropResources(iblockdata, worldserver, blockposition);
|
|
|
|
worldserver.removeBlock(blockposition, false);
|
2018-07-15 02:00:00 +02:00
|
|
|
}
|