3
0
KCauldronX/patches/net/minecraft/block/BlockLeaves.java.patch

43 lines
1.8 KiB
Diff
Raw Normal View History

2015-03-22 17:38:04 +00:00
--- ../src-base/minecraft/net/minecraft/block/BlockLeaves.java
+++ ../src-work/minecraft/net/minecraft/block/BlockLeaves.java
@@ -18,6 +18,8 @@
import net.minecraft.world.World;
import net.minecraftforge.common.IShearable;
+import org.bukkit.event.block.LeavesDecayEvent; // CraftBukkit
+
public abstract class BlockLeaves extends BlockLeavesBase implements IShearable
{
int[] field_150128_a;
@@ -222,6 +224,16 @@
private void removeLeaves(World p_150126_1_, int p_150126_2_, int p_150126_3_, int p_150126_4_)
{
+ // CraftBukkit start
+ LeavesDecayEvent event = new LeavesDecayEvent(p_150126_1_.getWorld().getBlockAt(p_150126_2_, p_150126_3_, p_150126_4_));
+ p_150126_1_.getServer().getPluginManager().callEvent(event);
+
+ if (event.isCancelled())
+ {
+ return;
+ }
+
+ // CraftBukkit end
this.dropBlockAsItem(p_150126_1_, p_150126_2_, p_150126_3_, p_150126_4_, p_150126_1_.getBlockMetadata(p_150126_2_, p_150126_3_, p_150126_4_), 0);
p_150126_1_.setBlockToAir(p_150126_2_, p_150126_3_, p_150126_4_);
}
2016-02-04 15:55:51 +00:00
@@ -308,6 +320,13 @@
world.setBlockMetadataWithNotify(x, y, z, i2 | 8, 4);
}
world.setBlockMetadataWithNotify(x, y, z, world.getBlockMetadata(x, y, z) | 8, 4);
+ // KCauldron start - fast leaves decay
+ if (net.minecraft.server.MinecraftServer.kcauldronConfig.commonFastLeavesDecayEnable.getValue()) {
+ int min = net.minecraft.server.MinecraftServer.kcauldronConfig.commonFastLeavesDecayMinTickTime.getValue();
+ int max = net.minecraft.server.MinecraftServer.kcauldronConfig.commonFastLeavesDecayMaxTickTime.getValue();
+ world.scheduleBlockUpdate(x, y, z, this, min + world.rand.nextInt(max - min));
+ }
+ // KCauldron end
}
@Override