本文整理匯總了Java中net.minecraft.init.Items.baked_potato方法的典型用法代碼示例。如果您正苦於以下問題:Java Items.baked_potato方法的具體用法?Java Items.baked_potato怎麽用?Java Items.baked_potato使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類net.minecraft.init.Items
的用法示例。
在下文中一共展示了Items.baked_potato方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onImpact
import net.minecraft.init.Items; //導入方法依賴的package包/類
@Override
public void onImpact(MovingObjectPosition target)
{
if (target.entityHit != null)
{
// Damage
target.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.shootingEntity), (float) this.damage);
}
else
{
// Glass breaking
Helper.tryBlockBreak(this.worldObj, this, target, 1);
if (this.shouldDrop && this.canBePickedUp) // If we can be picked up then we're dropping now
{
ItemStack nuggetStack = new ItemStack(Items.baked_potato);
EntityItem entityitem = new EntityItem(this.worldObj, target.blockX, target.blockY + 0.5d, target.blockZ, nuggetStack);
entityitem.delayBeforeCanPickup = 10;
if (captureDrops) { capturedDrops.add(entityitem); }
else { this.worldObj.spawnEntityInWorld(entityitem); }
}
}
// SFX
NetHelper.sendParticleMessageToAllPlayers(this.worldObj, this.getEntityId(), (byte) 3, (byte) 2);
this.worldObj.playSoundAtEntity(this, "random.eat", 0.6F, 0.7F);
this.setDead(); // We've hit something, so begone with the projectile
}