mirror of
https://github.com/barkeser2002/CatServer.git
synced 2026-09-25 03:00:03 +03:00
49 lines
2.3 KiB
Diff
49 lines
2.3 KiB
Diff
--- ../src-base/minecraft/net/minecraft/block/BlockDragonEgg.java
|
|
+++ ../src-work/minecraft/net/minecraft/block/BlockDragonEgg.java
|
|
@@ -16,6 +16,7 @@
|
|
import net.minecraft.world.World;
|
|
import net.minecraftforge.fml.relauncher.Side;
|
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
|
+import org.bukkit.event.block.BlockFromToEvent;
|
|
|
|
public class BlockDragonEgg extends Block
|
|
{
|
|
@@ -48,7 +49,7 @@
|
|
|
|
private void checkFall(World worldIn, BlockPos pos)
|
|
{
|
|
- if (BlockFalling.canFallThrough(worldIn.getBlockState(pos.down())) && pos.getY() >= 0)
|
|
+ if (worldIn.isAirBlock(pos.down()) && BlockFalling.canFallThrough(worldIn.getBlockState(pos.down())) && pos.getY() >= 0)
|
|
{
|
|
int i = 32;
|
|
|
|
@@ -61,7 +62,7 @@
|
|
worldIn.setBlockToAir(pos);
|
|
BlockPos blockpos;
|
|
|
|
- for (blockpos = pos; BlockFalling.canFallThrough(worldIn.getBlockState(blockpos)) && blockpos.getY() > 0; blockpos = blockpos.down())
|
|
+ for (blockpos = pos; worldIn.isAirBlock(blockpos) && BlockFalling.canFallThrough(worldIn.getBlockState(blockpos)) && blockpos.getY() > 0; blockpos = blockpos.down())
|
|
{
|
|
;
|
|
}
|
|
@@ -95,8 +96,18 @@
|
|
{
|
|
BlockPos blockpos = pos.add(worldIn.rand.nextInt(16) - worldIn.rand.nextInt(16), worldIn.rand.nextInt(8) - worldIn.rand.nextInt(8), worldIn.rand.nextInt(16) - worldIn.rand.nextInt(16));
|
|
|
|
- if (worldIn.getBlockState(blockpos).getBlock().blockMaterial == Material.AIR)
|
|
+ if (worldIn.isAirBlock(blockpos))
|
|
{
|
|
+ org.bukkit.block.Block from = worldIn.getWorld().getBlockAt(pos.getX(), pos.getY(), pos.getZ());
|
|
+ org.bukkit.block.Block to = worldIn.getWorld().getBlockAt(blockpos.getX(), blockpos.getY(), blockpos.getZ());
|
|
+ BlockFromToEvent event = new BlockFromToEvent(from, to);
|
|
+ org.bukkit.Bukkit.getPluginManager().callEvent(event);
|
|
+
|
|
+ if (event.isCancelled()) {
|
|
+ return;
|
|
+ }
|
|
+
|
|
+ blockpos = new BlockPos(event.getToBlock().getX(), event.getToBlock().getY(), event.getToBlock().getZ());
|
|
if (worldIn.isRemote)
|
|
{
|
|
for (int j = 0; j < 128; ++j)
|