Java Code Examples for net.minecraft.entity.IProjectile

The following are top voted examples for showing how to use net.minecraft.entity.IProjectile. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: connor41-etfuturum2   File: DispenserBehaviourLingeringPotion.java   Source Code and License 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
Project: Factorization   File: BlowEntities.java   Source Code and License 6 votes vote down vote up
@Override
public boolean apply(Entity entity) {
    if (entity instanceof EntityItem) {
        return true;
    }
    if (target_speed <= 1) {
        return false;
    }
    if (entity instanceof EntityLiving || entity instanceof IProjectile || entity instanceof EntityTNTPrimed || entity instanceof EntityFallingBlock) {
        return true;
    }
    if (FzConfig.fanturpeller_works_on_players && entity instanceof EntityPlayer) {
        EntityPlayer player = (EntityPlayer) entity;
        found_player = true;
        return !player.capabilities.isCreativeMode && !player.isSneaking();
    }
    return false;
    // Falling sand doesn't work too well with this
    // Minecarts seem to just jump back down (and would be too heavy anyways.)
    // Let's try to keep this method light, hmm?
}
 
Example 3
Project: Et-Futurum   File: DispenserBehaviourLingeringPotion.java   Source Code and License 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 4
Project: AdvancedPotions   File: BehaviorAdvancedProjectileDispense.java   Source Code and 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) {
    World world = par1IBlockSource.getWorld();
    IPosition iposition = BlockDispenser.func_149939_a(par1IBlockSource);
    EnumFacing enumfacing = BlockDispenser.func_149937_b(par1IBlockSource.getBlockMetadata());
    ItemStack stack = par2ItemStack.splitStack(1);
    if (matchesItem(par2ItemStack)) {
        // dispense item as projectile because the item matches
        IProjectile iprojectile = this.getProjectileEntity(world, iposition, par2ItemStack);
        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);
    } else {
        // dispense item as item because it doesn't match
        BehaviorDefaultDispenseItem.doDispense(world, stack, 6, enumfacing, iposition);
    }
    return par2ItemStack;
}
 
Example 5
Project: MineFantasy   File: DispenseBombMF.java   Source Code and License 6 votes vote down vote up
public ItemStack dispenseStack(IBlockSource source, ItemStack stack)
  {
float y = 1.1F;
      World var3 = source.getWorld();
      IPosition var4 = BlockDispenser.getIPositionFromBlockSource(source);
      EnumFacing var5 = BlockDispenser.getFacing(source.getBlockMetadata());
      
      IProjectile var6 = this.getProjectileEntity(var3, var4, stack.getItemDamage());
      if(var6 != null)
      {
      	var6.setThrowableHeading((double)var5.getFrontOffsetX(), 0.10000000149011612D*y, (double)var5.getFrontOffsetY(), this.func_82500_b(), this.func_82498_a());
      	var3.spawnEntityInWorld((Entity)var6);
      	stack.splitStack(1);
      }
      return stack;
  }
 
Example 6
Project: MineFantasy   File: DispenseArrowMF.java   Source Code and License 6 votes vote down vote up
public ItemStack dispenseStack(IBlockSource source, ItemStack stack)
  {
float y = 1.1F;
      World var3 = source.getWorld();
      IPosition var4 = BlockDispenser.getIPositionFromBlockSource(source);
      EnumFacing enumfacing = BlockDispenser.getFacing(source.getBlockMetadata());
      
      IProjectile iprojectile = this.getProjectileEntity(var3, var4, stack.getItemDamage());
      if(iprojectile != null)
      {
      	iprojectile.setThrowableHeading((double)enumfacing.getFrontOffsetX(), (double)((float)enumfacing.getFrontOffsetY() + 0.1F), (double)enumfacing.getFrontOffsetZ(), this.func_82500_b(), this.func_82498_a());
      	var3.spawnEntityInWorld((Entity)iprojectile);
      	stack.splitStack(1);
      }
      return stack;
  }
 
Example 7
Project: MineFantasy   File: DispenseBoltMF.java   Source Code and License 6 votes vote down vote up
public ItemStack dispenseStack(IBlockSource source, ItemStack stack)
  {
float y = 1.1F;
      World var3 = source.getWorld();
      IPosition var4 = BlockDispenser.getIPositionFromBlockSource(source);
      EnumFacing enumfacing = BlockDispenser.getFacing(source.getBlockMetadata());
      
      IProjectile iprojectile = this.getProjectileEntity(var3, var4, stack.getItemDamage());
      if(iprojectile != null)
      {
      	iprojectile.setThrowableHeading((double)enumfacing.getFrontOffsetX(), (double)((float)enumfacing.getFrontOffsetY() + 0.1F), (double)enumfacing.getFrontOffsetZ(), this.func_82500_b(), this.func_82498_a());
      	var3.spawnEntityInWorld((Entity)iprojectile);
      	stack.splitStack(1);
      }
      return stack;
  }
 
Example 8
Project: DecompiledMinecraft   File: BehaviorProjectileDispense.java   Source Code and License 5 votes vote down vote up
/**
 * Dispense the specified stack, play the dispense sound and spawn particles.
 */
public ItemStack dispenseStack(IBlockSource source, ItemStack stack)
{
    World world = source.getWorld();
    IPosition iposition = BlockDispenser.getDispensePosition(source);
    EnumFacing enumfacing = BlockDispenser.getFacing(source.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);
    stack.splitStack(1);
    return stack;
}
 
Example 9
Project: DecompiledMinecraft   File: BehaviorProjectileDispense.java   Source Code and License 5 votes vote down vote up
/**
 * Dispense the specified stack, play the dispense sound and spawn particles.
 */
public ItemStack dispenseStack(IBlockSource source, ItemStack stack)
{
    World world = source.getWorld();
    IPosition iposition = BlockDispenser.getDispensePosition(source);
    EnumFacing enumfacing = BlockDispenser.getFacing(source.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);
    stack.splitStack(1);
    return stack;
}
 
Example 10
Project: BaseClient   File: BehaviorProjectileDispense.java   Source Code and License 5 votes vote down vote up
/**
 * Dispense the specified stack, play the dispense sound and spawn particles.
 */
public ItemStack dispenseStack(IBlockSource source, ItemStack stack)
{
    World world = source.getWorld();
    IPosition iposition = BlockDispenser.getDispensePosition(source);
    EnumFacing enumfacing = BlockDispenser.getFacing(source.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);
    stack.splitStack(1);
    return stack;
}
 
Example 11
Project: BaseClient   File: BehaviorProjectileDispense.java   Source Code and License 5 votes vote down vote up
/**
 * Dispense the specified stack, play the dispense sound and spawn particles.
 */
public ItemStack dispenseStack(IBlockSource source, ItemStack stack)
{
    World world = source.getWorld();
    IPosition iposition = BlockDispenser.getDispensePosition(source);
    EnumFacing enumfacing = BlockDispenser.getFacing(source.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);
    stack.splitStack(1);
    return stack;
}
 
Example 12
Project: connor41-etfuturum2   File: DispenserBehaviourTippedArrow.java   Source Code and License 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 13
Project: Backmemed   File: BehaviorProjectileDispense.java   Source Code and License 5 votes vote down vote up
/**
 * Dispense the specified stack, play the dispense sound and spawn particles.
 */
public ItemStack dispenseStack(IBlockSource source, ItemStack stack)
{
    World world = source.getWorld();
    IPosition iposition = BlockDispenser.getDispensePosition(source);
    EnumFacing enumfacing = (EnumFacing)source.getBlockState().getValue(BlockDispenser.FACING);
    IProjectile iprojectile = this.getProjectileEntity(world, iposition, stack);
    iprojectile.setThrowableHeading((double)enumfacing.getFrontOffsetX(), (double)((float)enumfacing.getFrontOffsetY() + 0.1F), (double)enumfacing.getFrontOffsetZ(), this.getProjectileVelocity(), this.getProjectileInaccuracy());
    world.spawnEntityInWorld((Entity)iprojectile);
    stack.func_190918_g(1);
    return stack;
}
 
Example 14
Project: CustomWorldGen   File: BehaviorProjectileDispense.java   Source Code and License 5 votes vote down vote up
/**
 * Dispense the specified stack, play the dispense sound and spawn particles.
 */
public ItemStack dispenseStack(IBlockSource source, ItemStack stack)
{
    World world = source.getWorld();
    IPosition iposition = BlockDispenser.getDispensePosition(source);
    EnumFacing enumfacing = (EnumFacing)source.getBlockState().getValue(BlockDispenser.FACING);
    IProjectile iprojectile = this.getProjectileEntity(world, iposition, stack);
    iprojectile.setThrowableHeading((double)enumfacing.getFrontOffsetX(), (double)((float)enumfacing.getFrontOffsetY() + 0.1F), (double)enumfacing.getFrontOffsetZ(), this.getProjectileVelocity(), this.getProjectileInaccuracy());
    world.spawnEntityInWorld((Entity)iprojectile);
    stack.splitStack(1);
    return stack;
}
 
Example 15
Project: AdvancedCombat   File: TrackingDispenserBehavior.java   Source Code and License 5 votes vote down vote up
@Override
public ItemStack dispenseStack(IBlockSource source, ItemStack stack) {
       World world = source.getWorld();
       BlockPos pos = source.getBlockPos();
       Vec3d pos2 = new Vec3d(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5);
       Vec3d dir = this.getNearestTargetDirection(world, pos);
       if(dir == null) return null;
       IPosition ipos = new PositionImpl(pos2.x + dir.x * .75, pos2.y + dir.y * .75, pos2.z + dir.z * .75);
       IProjectile iproj = this.getProjectileEntity(standard, world, ipos, stack);
       iproj.shoot(dir.x, dir.y + 0.1F, dir.z, 
       		this.getProjectileVelocity(standard), this.getProjectileInaccuracy(standard));
       world.spawnEntity((Entity)iproj);
       stack.splitStack(1);
       return stack;
}
 
Example 16
Project: AdvancedCombat   File: TrackingDispenserBehavior.java   Source Code and License 5 votes vote down vote up
/** Get the projectile entity via reflection */
private IProjectile getProjectileEntity(BehaviorProjectileDispense standard, World world, IPosition pos, ItemStack stack) {
	Method m = ACUtils.findMethod(BehaviorProjectileDispense.class, standard, new String[]{"getProjectileEntity", "func_82499_a"}, 
			World.class, IPosition.class, ItemStack.class);
	try {
		return (IProjectile)m.invoke(standard, world, pos, stack);
	} catch (Exception e) {
		e.printStackTrace();
		return null;
	}
}
 
Example 17
Project: Overlord   File: Overlord.java   Source Code and License 5 votes vote down vote up
@Mod.EventHandler
public void init(FMLInitializationEvent event) {
	AugmentRegistry.registerAugment(new ItemStack(Items.GOLDEN_APPLE), new AugmentSlowRegen());
	AugmentRegistry.registerAugment(new ItemStack(Items.GOLDEN_APPLE, 1, 1), new AugmentFastRegen());
	AugmentRegistry.registerAugment(new ItemStack(Items.IRON_INGOT), new AugmentIron());
	AugmentRegistry.registerAugment(new ItemStack(Blocks.OBSIDIAN), new AugmentObsidian());
	AugmentRegistry.registerAugment(new ItemStack(Blocks.ANVIL), new AugmentAnvil());
	AugmentRegistry.registerAugment(new ItemStack(Items.SKULL, 1, 1), new AugmentWither());
	AugmentRegistry.registerAugment(new ItemStack(Items.SUGAR), new AugmentJitters());
	AugmentRegistry.registerAugment(new ItemStack(skinsuit_mummy), new AugmentMummy());

	OreDictionary.registerOre("book", squad_editor);

	MilkRegistry.getInstance().registerMilk(new ItemStack(Items.MILK_BUCKET), new ItemStack(Items.BUCKET));
	MilkRegistry.getInstance().registerMilk(new ItemStack(milk_bottle), new ItemStack(Items.GLASS_BOTTLE));

	BlockDispenser.DISPENSE_BEHAVIOR_REGISTRY.putObject(keychain_occupied, new DispenseBehaviorKeychain());
	BlockDispenser.DISPENSE_BEHAVIOR_REGISTRY.putObject(milk_bottle, new BehaviorProjectileDispense() {
		@Override
		@Nonnull
		protected IProjectile getProjectileEntity(@Nonnull World worldIn, @Nonnull IPosition position, @Nonnull ItemStack stackIn) {
			return new EntityMilkBottle(worldIn, position.getX(), position.getY(), position.getZ());
		}
	});

	if (Loader.isModLoaded("ic2")) {
		modCompat = new IC2Compat();
		modCompat.init(event);
	}
}
 
Example 18
Project: Alchemy   File: EntityProjectileTracker.java   Source Code and License 5 votes vote down vote up
public static <T extends Entity & IProjectile> void track(T entity, Entity target) {
	double dx = target.posX - entity.posX;
	double dy = target.getEntityBoundingBox().minY + target.height / 3 - entity.posY;
	double dz = target.posZ - entity.posZ;
	double dr = sqrt(dx * dx + dz * dz);
	entity.setThrowableHeading(dx, dy + dr * 0.2, dz, 1.6F, 2);
}
 
Example 19
Project: Et-Futurum   File: DispenserBehaviourTippedArrow.java   Source Code and License 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 20
Project: ARKCraft-Code   File: EntityARKCreature.java   Source Code and License 5 votes vote down vote up
@Override
public void onDeath(DamageSource cause)
{
	super.onDeath(cause);

	Entity killedBy = cause.getSourceOfDamage();
	Entity indirect = cause.getEntity();

	Entity actualKiller;

	if (indirect != null && killedBy instanceof IProjectile)
	{
		actualKiller = indirect;
	}
	else
	{
		actualKiller = killedBy;
	}

	// TODO grant xp if creature is ridden (possible to kill while ridden)
	// TODO grant xp to owner nearby
	if (actualKiller instanceof EntityARKCreature)
	{
		if (((EntityARKCreature) killedBy)
				.isOwned()) ((EntityARKCreature) killedBy).addXP(creature.getBaseKillXP());
	}
	else if (actualKiller instanceof EntityPlayer)
	{
		ARKPlayer data = ARKPlayer.get((EntityPlayer) actualKiller);
		data.addXP(getKillXP());
	}
}
 
Example 21
Project: ARKCraft-Code   File: DispenseWeaponProjectile.java   Source Code and License 5 votes vote down vote up
@Override
public ItemStack dispenseStack(IBlockSource blocksource, ItemStack itemstack)
{
    World world = blocksource.getWorld();
    IPosition pos = BlockDispenser.getDispensePosition(blocksource);
    EnumFacing face = BlockDispenser.getFacing(blocksource.getBlockMetadata());
    IProjectile projectile = getProjectileEntity(world, pos, itemstack);
    projectile.setThrowableHeading(face.getFrontOffsetX(), face.getFrontOffsetY() + getYVel(), face.getFrontOffsetZ(), getVelocity(), getDeviation());
    world.spawnEntityInWorld((Entity) projectile);
    itemstack.splitStack(1);
    return itemstack;
}
 
Example 22
Project: Resilience-Client-Source   File: BehaviorProjectileDispense.java   Source Code and 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 var3 = par1IBlockSource.getWorld();
    IPosition var4 = BlockDispenser.func_149939_a(par1IBlockSource);
    EnumFacing var5 = BlockDispenser.func_149937_b(par1IBlockSource.getBlockMetadata());
    IProjectile var6 = this.getProjectileEntity(var3, var4);
    var6.setThrowableHeading((double)var5.getFrontOffsetX(), (double)((float)var5.getFrontOffsetY() + 0.1F), (double)var5.getFrontOffsetZ(), this.func_82500_b(), this.func_82498_a());
    var3.spawnEntityInWorld((Entity)var6);
    par2ItemStack.splitStack(1);
    return par2ItemStack;
}
 
Example 23
Project: MineFantasy   File: DispenseArrowMF.java   Source Code and License 5 votes vote down vote up
/**
 * Return the projectile entity spawned by this dispense behavior.
 */
protected IProjectile getProjectileEntity(World world, IPosition pos, int meta)
{
	EntityArrowMF arrow = new EntityArrowMF(world, pos.getX(), pos.getY(), pos.getZ(), meta);
	
	arrow.canBePickedUp = 1;
	return arrow;
}
 
Example 24
Project: MineFantasy   File: DispenseBoltMF.java   Source Code and License 5 votes vote down vote up
/**
 * Return the projectile entity spawned by this dispense behavior.
 */
protected IProjectile getProjectileEntity(World world, IPosition pos, int meta)
{
	EntityBoltMF bolt = new EntityBoltMF(world, pos.getX(), pos.getY(), pos.getZ(), meta);
	bolt.canBePickedUp = 1;
	return bolt;
}
 
Example 25
Project: ExpandedRailsMod   File: BehaviorProjectileDispense.java   Source Code and License 5 votes vote down vote up
/**
 * Dispense the specified stack, play the dispense sound and spawn particles.
 */
public ItemStack dispenseStack(IBlockSource source, ItemStack stack)
{
    World world = source.getWorld();
    IPosition iposition = BlockDispenser.getDispensePosition(source);
    EnumFacing enumfacing = (EnumFacing)source.func_189992_e().getValue(BlockDispenser.FACING);
    IProjectile iprojectile = this.getProjectileEntity(world, iposition, stack);
    iprojectile.setThrowableHeading((double)enumfacing.getFrontOffsetX(), (double)((float)enumfacing.getFrontOffsetY() + 0.1F), (double)enumfacing.getFrontOffsetZ(), this.getProjectileVelocity(), this.getProjectileInaccuracy());
    world.spawnEntityInWorld((Entity)iprojectile);
    stack.splitStack(1);
    return stack;
}
 
Example 26
Project: balkons-weaponmod   File: DispenseWeaponProjectile.java   Source Code and License 5 votes vote down vote up
@Override
public ItemStack dispenseStack(IBlockSource blocksource, ItemStack itemstack)
{
	World world = blocksource.getWorld();
	IPosition pos = BlockDispenser.func_149939_a(blocksource);
	EnumFacing face = BlockDispenser.func_149937_b(blocksource.getBlockMetadata());
	IProjectile projectile = getProjectileEntity(world, pos, itemstack);
	projectile.setThrowableHeading(face.getFrontOffsetX(), face.getFrontOffsetY() + getYVel(), face.getFrontOffsetZ(), getVelocity(), getDeviation());
	world.spawnEntityInWorld((Entity) projectile);
	itemstack.splitStack(1);
	return itemstack;
}
 
Example 27
Project: balkons-weaponmod   File: DispenseBlowgunDart.java   Source Code and License 5 votes vote down vote up
@Override
protected IProjectile getProjectileEntity(World world, IPosition pos, ItemStack itemstack)
{
	EntityBlowgunDart dart = (EntityBlowgunDart) getProjectileEntity(world, pos);
	dart.setDartEffectType(itemstack.getItemDamage());
	return dart;
}
 
Example 28
Project: Cauldron   File: BehaviorProjectileDispense.java   Source Code and License 5 votes vote down vote up
public ItemStack dispenseStack(IBlockSource p_82487_1_, ItemStack p_82487_2_)
{
    World world = p_82487_1_.getWorld();
    IPosition iposition = BlockDispenser.func_149939_a(p_82487_1_);
    EnumFacing enumfacing = BlockDispenser.func_149937_b(p_82487_1_.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);
    p_82487_2_.splitStack(1);
    return p_82487_2_;
}
 
Example 29
Project: ZeldaSwordSkills   File: ItemZeldaShield.java   Source Code and License 5 votes vote down vote up
@Method(modid="battlegear2")
@Override
public boolean catchArrow(ItemStack shield, EntityPlayer player, IProjectile projectile) {
	if (toolMaterial == ToolMaterial.WOOD && projectile instanceof EntityArrow){
		setArrowCount(shield, getArrowCount(shield) + 1);
		player.setArrowCountInEntity(player.getArrowCountInEntity() - 1);
		((EntityArrow) projectile).setDead();
		return true;
	}
	return false;
}
 
Example 30
Project: RuneCraftery   File: BehaviorProjectileDispense.java   Source Code and License 5 votes vote down vote up
public ItemStack func_82487_b(IBlockSource p_82487_1_, ItemStack p_82487_2_) {
   World var3 = p_82487_1_.func_82618_k();
   IPosition var4 = BlockDispenser.func_82525_a(p_82487_1_);
   EnumFacing var5 = BlockDispenser.func_100009_j_(p_82487_1_.func_82620_h());
   IProjectile var6 = this.func_82499_a(var3, var4);
   var6.func_70186_c((double)var5.func_82601_c(), (double)((float)var5.func_96559_d() + 0.1F), (double)var5.func_82599_e(), this.func_82500_b(), this.func_82498_a());
   var3.func_72838_d((Entity)var6);
   p_82487_2_.func_77979_a(1);
   return p_82487_2_;
}
 
Example 31
Project: RuneCraftery   File: BehaviorProjectileDispense.java   Source Code and 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 = BlockDispenser.getIPositionFromBlockSource(par1IBlockSource);
    EnumFacing enumfacing = BlockDispenser.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);
    par2ItemStack.splitStack(1);
    return par2ItemStack;
}
 
Example 32
Project: RuneCraftery   File: DispenserBehaviorArrow.java   Source Code and 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;
    return entityarrow;
}
 
Example 33
Project: MyEssentials-Core   File: EntityUtils.java   Source Code and License 5 votes vote down vote up
private static String getEntityTypeNonCache(Entity e) {
	if (e instanceof EntityGolem) {
        return "Golem";
    } else if (e instanceof IBossDisplayData) {
    	return "Boss";
    } else if (e instanceof IAnimals) {
    	return "Animal";
    } else if (e instanceof IMob) {
    	return "Monster";
    } else if (e instanceof IProjectile) {
    	return "Projectile";
    } else if (e instanceof INpc) {
    	return "NPC";
    } else if (e instanceof EntityItem) {
    	return "Item";
    } else if (e instanceof EntityMob) {
    	return "Monster";
    } else if (e instanceof EntityPlayer) {
    	return "Player";
    } else if (e instanceof EntityFireball) {
    	return "Projectile";
    } else if (e instanceof EntityTNTPrimed) {
    	return "TNT";
    } else {
    	return "Unknown"; // e.getClass().getName();
    }
}
 
Example 34
Project: Battlegear2   File: ItemShield.java   Source Code and License 5 votes vote down vote up
@Override
public boolean catchArrow(ItemStack shield, EntityPlayer player, IProjectile arrow){
    if(arrow instanceof EntityArrow){
        setArrowCount(shield, getArrowCount(shield)+1);
        player.setArrowCountInEntity(player.getArrowCountInEntity() - 1);
        ((EntityArrow)arrow).setDead();
        return true;
    }
    return false;
}
 
Example 35
Project: BetterNutritionMod   File: BehaviorProjectileDispense.java   Source Code and 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 = BlockDispenser.getIPositionFromBlockSource(par1IBlockSource);
    EnumFacing enumfacing = BlockDispenser.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);
    par2ItemStack.splitStack(1);
    return par2ItemStack;
}
 
Example 36
Project: BetterNutritionMod   File: DispenserBehaviorArrow.java   Source Code and 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;
    return entityarrow;
}
 
Example 37
Project: CodeLyokoMod   File: EventHandler.java   Source Code and License 5 votes vote down vote up
@SubscribeEvent
public void onEntityJoinWorld(EntityJoinWorldEvent event)
{
    Entity ent = event.entity;
    if (!(ent instanceof EntityPlayer || ent instanceof EntityLyoko || ent instanceof EntitySpecter || ent instanceof IProjectile || ent instanceof EntityVehicle))
        if (CodeLyoko.entityInLyoko(ent))
            event.setCanceled(true);
}
 
Example 38
Project: Artifacts   File: BehaviorProjectileDispense.java   Source Code and 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 39
Project: Artifacts   File: DispenserBehaviorArrow.java   Source Code and 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 40
Project: Mods   File: EntityAIAirblast.java   Source Code and License 4 votes vote down vote up
@Override
@SuppressWarnings("unchecked")
public void updateTask() {
	// System.out.println("executing
	// "+TF2ActionHandler.playerAction.server.get(host));
	boolean easier = host.world.getDifficulty() == EnumDifficulty.NORMAL;
	delay--;
	if (delay > 0 || this.host.getRNG().nextFloat() > (easier ? 0.22f : 0.28f)) {
		host.getCapability(TF2weapons.WEAPONS_CAP, null).state &= 5;// System.out.println("reset:");
		return;
	}
	Vec3d eyeVec = new Vec3d(host.posX, host.posY + host.getEyeHeight(), host.posZ);
	List<Entity> list = host.world.getEntitiesWithinAABB(Entity.class, new AxisAlignedBB(eyeVec.x - 5,
			eyeVec.y - 5, eyeVec.z - 5, eyeVec.x + 5, eyeVec.y + 5, eyeVec.z + 5));
	boolean airblast = false;
	for (Entity entity : list)
		// System.out.println(entity+"
		// "+ItemFlameThrower.isPushable(host,entity));
		if (ItemFlameThrower.isPushable(host, entity)
				&& (entity instanceof EntityThrowable || entity instanceof IProjectile)) {
			// System.out.println(entity);
			// System.out.println("dystans:
			// "+(entity.getDistanceSq(host.posX, host.posY +
			// (double)host.getEyeHeight(), host.posZ)<25));
			// System.out.println(TF2weapons.getTeam(entity)+"
			// "+TF2weapons.getTeam(host));
			airblast = entity.getDistanceSq(host.posX, host.posY + host.getEyeHeight(),
					host.posZ) < (easier ? 16 : 25)
					&& TF2Util.lookingAt(host, (easier ? 40 : 60), entity.posX, entity.posY + entity.height / 2,
							entity.posZ);
			if (airblast)
				break;
		}

	if (airblast) {
		// System.out.println("airblast:");
		((ItemFlameThrower) this.host.getHeldItemMainhand().getItem()).altUse(this.host.getHeldItemMainhand(), host,
				this.host.world);
		this.delay = easier ? 30 : 18;
	} else
		host.getCapability(TF2weapons.WEAPONS_CAP, null).state &= 5;
}