Destructor needs to call the block break event
This commit is contained in:
@@ -26,8 +26,12 @@ import net.minecraft.network.datasync.DataSerializers;
|
|||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.util.math.AxisAlignedBB;
|
import net.minecraft.util.math.AxisAlignedBB;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.world.WorldServer;
|
||||||
import net.minecraft.world.chunk.Chunk;
|
import net.minecraft.world.chunk.Chunk;
|
||||||
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
import net.minecraftforge.common.capabilities.Capability;
|
import net.minecraftforge.common.capabilities.Capability;
|
||||||
|
import net.minecraftforge.common.util.FakePlayerFactory;
|
||||||
|
import net.minecraftforge.event.world.BlockEvent;
|
||||||
import net.minecraftforge.fluids.Fluid;
|
import net.minecraftforge.fluids.Fluid;
|
||||||
import net.minecraftforge.fluids.FluidStack;
|
import net.minecraftforge.fluids.FluidStack;
|
||||||
import net.minecraftforge.fluids.IFluidBlock;
|
import net.minecraftforge.fluids.IFluidBlock;
|
||||||
@@ -140,6 +144,9 @@ public class TileDestructor extends TileMultipartNode implements IComparable, IF
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BlockEvent.BreakEvent e = new BlockEvent.BreakEvent(worldObj, front, frontBlockState, FakePlayerFactory.getMinecraft((WorldServer) worldObj));
|
||||||
|
|
||||||
|
if (!MinecraftForge.EVENT_BUS.post(e)) {
|
||||||
worldObj.playEvent(null, 2001, front, Block.getStateId(frontBlockState));
|
worldObj.playEvent(null, 2001, front, Block.getStateId(frontBlockState));
|
||||||
worldObj.setBlockToAir(front);
|
worldObj.setBlockToAir(front);
|
||||||
|
|
||||||
@@ -154,6 +161,7 @@ public class TileDestructor extends TileMultipartNode implements IComparable, IF
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else if (type == IType.FLUIDS) {
|
} else if (type == IType.FLUIDS) {
|
||||||
Block frontBlock = worldObj.getBlockState(front).getBlock();
|
Block frontBlock = worldObj.getBlockState(front).getBlock();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user