Files
CatServer/patches/net/minecraft/block/BlockMycelium.java.patch

54 lines
2.7 KiB
Diff

--- ../src-base/minecraft/net/minecraft/block/BlockMycelium.java
+++ ../src-work/minecraft/net/minecraft/block/BlockMycelium.java
@@ -2,6 +2,10 @@
import java.util.Random;
import javax.annotation.Nullable;
+
+import org.bukkit.event.block.BlockFadeEvent;
+import org.bukkit.event.block.BlockSpreadEvent;
+
import net.minecraft.block.material.MapColor;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
@@ -42,7 +46,18 @@
{
if (worldIn.getLightFromNeighbors(pos.up()) < 4 && worldIn.getBlockState(pos.up()).getLightOpacity(worldIn, pos.up()) > 2)
{
- worldIn.setBlockState(pos, Blocks.DIRT.getDefaultState().withProperty(BlockDirt.VARIANT, BlockDirt.DirtType.DIRT));
+ // CraftBukkit start
+ org.bukkit.World bworld = worldIn.getWorld();
+ org.bukkit.block.BlockState blockState = bworld.getBlockAt(pos.getX(), pos.getY(), pos.getZ()).getState();
+ blockState.setType(org.bukkit.craftbukkit.util.CraftMagicNumbers.getMaterial(Blocks.DIRT));
+
+ BlockFadeEvent event = new BlockFadeEvent(blockState.getBlock(), blockState);
+ worldIn.getServer().getPluginManager().callEvent(event);
+
+ if (!event.isCancelled()) {
+ blockState.update(true);
+ }
+ // CraftBukkit end
}
else
{
@@ -56,7 +71,18 @@
if (iblockstate.getBlock() == Blocks.DIRT && iblockstate.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.DIRT && worldIn.getLightFromNeighbors(blockpos.up()) >= 4 && iblockstate1.getLightOpacity(worldIn, blockpos.up()) <= 2)
{
- worldIn.setBlockState(blockpos, this.getDefaultState());
+ // CraftBukkit start
+ org.bukkit.World bworld = worldIn.getWorld();
+ org.bukkit.block.BlockState blockState = bworld.getBlockAt(blockpos.getX(), blockpos.getY(), blockpos.getZ()).getState();
+ blockState.setType(org.bukkit.craftbukkit.util.CraftMagicNumbers.getMaterial(this));
+
+ BlockSpreadEvent event = new BlockSpreadEvent(blockState.getBlock(), bworld.getBlockAt(pos.getX(), pos.getY(), pos.getZ()), blockState);
+ worldIn.getServer().getPluginManager().callEvent(event);
+
+ if (!event.isCancelled()) {
+ blockState.update(true);
+ }
+ // CraftBukkit end
}
}
}