Java Code Examples for net.minecraft.dispenser.IPosition#getZ()

The following examples show how to use net.minecraft.dispenser.IPosition#getZ() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DispenserBehaviorFireball.java    From Artifacts with MIT License 6 votes vote down vote up
/**
 * Dispense the specified stack, play the dispense sound and spawn particles.
 */
public ItemStack dispenseStack(IBlockSource par1IBlockSource, ItemStack par2ItemStack)
{
    EnumFacing enumfacing = BlockTrap.getFacing(par1IBlockSource.getBlockMetadata());
    IPosition iposition = BlockTrap.getIPositionFromBlockSource(par1IBlockSource);
    double d0 = iposition.getX() + (double)((float)enumfacing.getFrontOffsetX() * 0.3F);
    double d1 = iposition.getY() + (double)((float)enumfacing.getFrontOffsetX() * 0.3F);
    double d2 = iposition.getZ() + (double)((float)enumfacing.getFrontOffsetZ() * 0.3F);
    World world = par1IBlockSource.getWorld();
    Random random = world.rand;
    double d3 = random.nextGaussian() * 0.05D + (double)enumfacing.getFrontOffsetX();
    double d4 = random.nextGaussian() * 0.05D + (double)enumfacing.getFrontOffsetY();
    double d5 = random.nextGaussian() * 0.05D + (double)enumfacing.getFrontOffsetZ();
    world.spawnEntityInWorld(new EntitySmallFireball(world, d0, d1, d2, d3, d4, d5));
    par2ItemStack.splitStack(1);
    return par2ItemStack;
}
 
Example 2
Source File: DispenserBehaviorArrow.java    From Artifacts with MIT License 5 votes vote down vote up
/**
 * Return the projectile entity spawned by this dispense behavior.
 */
protected IProjectile getProjectileEntity(World par1World, IPosition par2IPosition)
{
    /*EntityArrow entityarrow = new EntityArrow(par1World, par2IPosition.getX(), par2IPosition.getY(), par2IPosition.getZ());
    entityarrow.canBePickedUp = 1;
    entityarrow.setDamage(6);
    return entityarrow;*/
	EntitySpecialArrow entityarrow = new EntitySpecialArrow(par1World, par2IPosition.getX(), par2IPosition.getY(), par2IPosition.getZ(), 2);
	entityarrow.canBePickedUp = 1;
	return entityarrow;
}
 
Example 3
Source File: DispenserBehaviorExperienceBottle.java    From Artifacts with MIT License 4 votes vote down vote up
protected IProjectile getProjectileEntity(World par1World, IPosition par2IPosition)
{
    return new EntityExpBottle(par1World, par2IPosition.getX(), par2IPosition.getY(), par2IPosition.getZ());
}
 
Example 4
Source File: DispenserBehaviorSnowball.java    From Artifacts with MIT License 4 votes vote down vote up
/**
 * Return the projectile entity spawned by this dispense behavior.
 */
protected IProjectile getProjectileEntity(World par1World, IPosition par2IPosition)
{
    return new EntitySnowball(par1World, par2IPosition.getX(), par2IPosition.getY(), par2IPosition.getZ());
}
 
Example 5
Source File: DispenserBehaviorEgg.java    From Artifacts with MIT License 4 votes vote down vote up
/**
 * Return the projectile entity spawned by this dispense behavior.
 */
protected IProjectile getProjectileEntity(World par1World, IPosition par2IPosition)
{
    return new EntityEgg(par1World, par2IPosition.getX(), par2IPosition.getY(), par2IPosition.getZ());
}
 
Example 6
Source File: DispenserBehaviorPotionProjectile.java    From Artifacts with MIT License 4 votes vote down vote up
/**
 * Return the projectile entity spawned by this dispense behavior.
 */
protected IProjectile getProjectileEntity(World par1World, IPosition par2IPosition)
{
    return new EntityPotion(par1World, par2IPosition.getX(), par2IPosition.getY(), par2IPosition.getZ(), this.potionItemStack.copy());
}