當前位置: 首頁>>代碼示例>>Java>>正文


Java World.createExplosion方法代碼示例

本文整理匯總了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;
}
 
開發者ID:Domochevsky,項目名稱:minecraft-quiverbow,代碼行數:31,代碼來源:PowderKnuckle_Mod.java

示例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;
}
 
開發者ID:Domochevsky,項目名稱:minecraft-quiverbow,代碼行數:17,代碼來源:PowderKnuckle.java


注:本文中的net.minecraft.world.World.createExplosion方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。