Java Code Examples for net.minecraft.world.World.createExplosion()

The following are Jave code examples for showing how to use createExplosion() of the net.minecraft.world.World class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: minecraft-quiverbow   File: PowderKnuckle_Mod.java   View Source Code Vote up 5 votes
@Override
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float sideX, float sideY, float sideZ)
{
	if (world.isRemote) { return false; }	// Not doing this on client side

	// Right click
	if (this.getDamage(stack) >= this.getMaxDamage()) { return false; }	// Not loaded

	this.consumeAmmo(stack, player, 1);

	// SFX
	NetHelper.sendParticleMessageToAllPlayers(world, player.getEntityId(), (byte) 3, (byte) 4);	// smoke

	// Dmg
	world.createExplosion(player, x, y, z, (float) this.ExplosionSize, true); 	// 4.0F is TNT

	// Mining
	for (int xAxis = -1; xAxis <= 1; xAxis++) // Along the x axis
	{
		for (int yAxis = -1; yAxis <= 1; yAxis++) // Along the y axis
		{
			for (int zAxis = -1; zAxis <= 1; zAxis++) // Along the z axis
			{
				this.doMining(world, (EntityPlayerMP) player, x + xAxis, y + yAxis, z + zAxis);	// That should give me 3 iterations of each axis on every level
			}
		}
	}

	return true;
}
 
Example 2
Project: minecraft-quiverbow   File: PowderKnuckle.java   View Source Code Vote up 4 votes
@Override
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float sideX, float sideY, float sideZ)
{
	if (world.isRemote) { return false; }	// Not doing this on client side

	// Right click
	if (this.getDamage(stack) >= this.getMaxDamage()) { return false; }	// Not loaded

	if (!player.capabilities.isCreativeMode) { this.consumeAmmo(stack, player, 1); }

	world.createExplosion(player, x, y, z, (float) this.ExplosionSize, true);

	NetHelper.sendParticleMessageToAllPlayers(world, player.getEntityId(), (byte) 3, (byte) 4);	// smoke

	return true;
}