本文整理匯總了Java中net.minecraft.world.World.createExplosion方法的典型用法代碼示例。如果您正苦於以下問題:Java World.createExplosion方法的具體用法?Java World.createExplosion怎麽用?Java World.createExplosion使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類net.minecraft.world.World
的用法示例。
在下文中一共展示了World.createExplosion方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onItemUse
import net.minecraft.world.World; //導入方法依賴的package包/類
@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;
}
示例2: onItemUse
import net.minecraft.world.World; //導入方法依賴的package包/類
@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;
}