mirror of
https://github.com/barkeser2002/CatServer.git
synced 2026-09-25 09:26:08 +03:00
65 lines
3.3 KiB
Diff
65 lines
3.3 KiB
Diff
--- ../src-base/minecraft/net/minecraft/block/BlockGrass.java
|
|
+++ ../src-work/minecraft/net/minecraft/block/BlockGrass.java
|
|
@@ -2,6 +2,11 @@
|
|
|
|
import java.util.Random;
|
|
import javax.annotation.Nullable;
|
|
+
|
|
+import org.bukkit.craftbukkit.event.CraftEventFactory;
|
|
+import org.bukkit.event.block.BlockFadeEvent;
|
|
+import org.bukkit.event.block.BlockSpreadEvent;
|
|
+
|
|
import net.minecraft.block.material.Material;
|
|
import net.minecraft.block.properties.IProperty;
|
|
import net.minecraft.block.properties.PropertyBool;
|
|
@@ -41,7 +46,18 @@
|
|
{
|
|
if (worldIn.getLightFromNeighbors(pos.up()) < 4 && worldIn.getBlockState(pos.up()).getLightOpacity(worldIn, pos.up()) > 2)
|
|
{
|
|
- worldIn.setBlockState(pos, Blocks.DIRT.getDefaultState());
|
|
+ // 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
|
|
{
|
|
@@ -61,7 +77,19 @@
|
|
|
|
if (iblockstate1.getBlock() == Blocks.DIRT && iblockstate1.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.DIRT && worldIn.getLightFromNeighbors(blockpos.up()) >= 4 && iblockstate.getLightOpacity(worldIn, pos.up()) <= 2)
|
|
{
|
|
- worldIn.setBlockState(blockpos, Blocks.GRASS.getDefaultState());
|
|
+ // CraftBukkit start
|
|
+ // world.setTypeUpdate(blockposition1, Blocks.GRASS.getBlockData());
|
|
+ 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(Blocks.GRASS));
|
|
+
|
|
+ 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
|
|
}
|
|
}
|
|
}
|
|
@@ -110,7 +138,7 @@
|
|
|
|
if (Blocks.TALLGRASS.canBlockStay(worldIn, blockpos1, iblockstate1))
|
|
{
|
|
- worldIn.setBlockState(blockpos1, iblockstate1, 3);
|
|
+ CraftEventFactory.handleBlockGrowEvent(worldIn, blockpos1.getX(), blockpos1.getY(), blockpos1.getZ(), iblockstate1.getBlock(), iblockstate1.getBlock().getMetaFromState(iblockstate1)); // CraftBukkit
|
|
}
|
|
}
|
|
}
|