MCPcopy Create free account
hub / github.com/BuildCraft/BuildCraft / explodeBlock

Method explodeBlock

common/buildcraft/lib/misc/BlockUtil.java:274–296  ·  view source on GitHub ↗

Create an explosion which only affects a single block.

(World world, BlockPos pos)

Source from the content-addressed store, hash-verified

272
273 /** Create an explosion which only affects a single block. */
274 public static void explodeBlock(World world, BlockPos pos) {
275 if (FMLCommonHandler.instance().getEffectiveSide().isClient()) {
276 return;
277 }
278
279 double x = pos.getX() + 0.5;
280 double y = pos.getY() + 0.5;
281 double z = pos.getZ() + 0.5;
282
283 Explosion explosion = new Explosion(world, null, x, y, z, 3f, false, false);
284 explosion.getAffectedBlockPositions().add(pos);
285 explosion.doExplosionB(true);
286
287 for (EntityPlayer player : world.playerEntities) {
288 if (!(player instanceof EntityPlayerMP)) {
289 continue;
290 }
291
292 if (player.getDistanceSq(pos) < 4096) {
293 ((EntityPlayerMP) player).connection.sendPacket(new SPacketExplosion(x, y, z, 3f, explosion.getAffectedBlockPositions(), null));
294 }
295 }
296 }
297
298 public static long computeBlockBreakPower(World world, BlockPos pos) {
299 IBlockState state = world.getBlockState(pos);

Callers 2

destroyPipeMethod · 0.95
destroyPipeMethod · 0.95

Calls 5

sendPacketMethod · 0.80
getXMethod · 0.65
getYMethod · 0.65
getZMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected