Java Code Examples for net.minecraft.init.Items.baked_potato()

The following are Jave code examples for showing how to use baked_potato() of the net.minecraft.init.Items 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: PotatoShot.java   View Source Code Vote up 5 votes
@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
}