net.minecraft.dispenser.IPosition Java Examples

The following examples show how to use net.minecraft.dispenser.IPosition. 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: DispenserBehaviourLingeringPotion.java    From Et-Futurum with The Unlicense 6 votes vote down vote up
@Override
public ItemStack dispense(IBlockSource block, final ItemStack stack) {
	return new BehaviorProjectileDispense() {

		@Override
		protected IProjectile getProjectileEntity(World world, IPosition pos) {
			return new EntityLingeringPotion(world, pos.getX(), pos.getY(), pos.getZ(), stack.copy());
		}

		@Override
		protected float func_82498_a() {
			return super.func_82498_a() * 0.5F;
		}

		@Override
		protected float func_82500_b() {
			return super.func_82500_b() * 1.25F;
		}
	}.dispense(block, stack);
}
 
Example #2
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 #3
Source File: DispenserBehaviourTippedArrow.java    From Et-Futurum with The Unlicense 5 votes vote down vote up
@Override
public ItemStack dispenseStack(IBlockSource block, final ItemStack stack) {
	return new BehaviorProjectileDispense() {

		@Override
		protected IProjectile getProjectileEntity(World world, IPosition pos) {
			EntityTippedArrow entity = new EntityTippedArrow(world, pos.getX(), pos.getY(), pos.getZ());
			entity.canBePickedUp = 1;
			entity.setEffect(TippedArrow.getEffect(stack));
			return entity;
		}
	}.dispense(block, stack);
}
 
Example #4
Source File: BlockTrap.java    From Artifacts with MIT License 5 votes vote down vote up
public static IPosition getIPositionFromBlockSource(IBlockSource par0IBlockSource)
{
    EnumFacing enumfacing = getFacing(par0IBlockSource.getBlockMetadata());
    double d0 = par0IBlockSource.getX() + 0.7D * (double)enumfacing.getFrontOffsetX();
    double d1 = par0IBlockSource.getY() + 0.7D * (double)enumfacing.getFrontOffsetY();
    double d2 = par0IBlockSource.getZ() + 0.7D * (double)enumfacing.getFrontOffsetZ();
    return new PositionImpl(d0, d1, d2);
}
 
Example #5
Source File: BehaviorProjectileDispense.java    From Artifacts with MIT License 5 votes vote down vote up
/**
 * Dispense the specified stack, play the dispense sound and spawn particles.
 */
public ItemStack dispenseStack(IBlockSource par1IBlockSource, ItemStack par2ItemStack)
{
    World world = par1IBlockSource.getWorld();
    IPosition iposition = BlockTrap.getIPositionFromBlockSource(par1IBlockSource);
    EnumFacing enumfacing = BlockTrap.getFacing(par1IBlockSource.getBlockMetadata());
    IProjectile iprojectile = this.getProjectileEntity(world, iposition);
    iprojectile.setThrowableHeading((double)enumfacing.getFrontOffsetX(), (double)((float)enumfacing.getFrontOffsetY() + 0.1F), (double)enumfacing.getFrontOffsetZ(), this.func_82500_b(), this.func_82498_a());
    world.spawnEntityInWorld((Entity)iprojectile);
    //playDispenseSound(par1IBlockSource);
    par2ItemStack.splitStack(1);
    return par2ItemStack;
}
 
Example #6
Source File: BehaviorDefaultDispenseItem.java    From Artifacts with MIT License 5 votes vote down vote up
public static void doDispense(World par0World, ItemStack par1ItemStack, int par2, EnumFacing par3EnumFacing, IPosition par4IPosition)
{
    /*double d0 = par4IPosition.getX();
    double d1 = par4IPosition.getY();
    double d2 = par4IPosition.getZ();
    EntityItem entityitem = new EntityItem(par0World, d0, d1 - 0.3D, d2, par1ItemStack);
    double d3 = par0World.rand.nextDouble() * 0.1D + 0.2D;
    entityitem.motionX = (double)par3EnumFacing.getFrontOffsetX() * d3;
    entityitem.motionY = 0.20000000298023224D;
    entityitem.motionZ = (double)par3EnumFacing.getFrontOffsetZ() * d3;
    entityitem.motionX += par0World.rand.nextGaussian() * 0.007499999832361937D * (double)par2;
    entityitem.motionY += par0World.rand.nextGaussian() * 0.007499999832361937D * (double)par2;
    entityitem.motionZ += par0World.rand.nextGaussian() * 0.007499999832361937D * (double)par2;
    par0World.spawnEntityInWorld(entityitem);*/
}
 
Example #7
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 #8
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 #9
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 #10
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 #11
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());
}
 
Example #12
Source File: BehaviorProjectileDispense.java    From Artifacts with MIT License 2 votes vote down vote up
/**
 * Return the projectile entity spawned by this dispense behavior.
 */
protected abstract IProjectile getProjectileEntity(World world, IPosition iposition);