本文整理汇总了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;
}