Java Code Examples for net.minecraft.entity.projectile.EntityThrowable

The following are top voted examples for showing how to use net.minecraft.entity.projectile.EntityThrowable. 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: ZeldaSwordSkills   File: RenderEntitySwordBeam.java   Source Code and License 6 votes vote down vote up
@Override
public void doRender(EntityThrowable entity, double x, double y, double z, float yaw, float partialTick) {
	GlStateManager.pushMatrix();
	GlStateManager.translate(x, y, z);
	GlStateManager.pushAttrib();
	GlStateManager.enableBlend();
	GlStateManager.enableLighting();
	GlStateManager.enableTexture2D();
	GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
	GlStateManager.scale(1.5F, 0.5F, 1.5F);
	this.bindTexture(this.getEntityTexture(entity));
	Tessellator tessellator = Tessellator.getInstance();
	WorldRenderer renderer = tessellator.getWorldRenderer();
	GlStateManager.rotate(180.0F - renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
	GlStateManager.rotate(-renderManager.playerViewX, 1.0F, 0.0F, 0.0F);
	float rgb = this.getRgb(entity);
	GlStateManager.color(rgb, rgb, rgb);
	renderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_NORMAL);
	renderer.pos(-0.5D, -0.25D, 0.0D).tex(0, 1).normal(0.0F, 1.0F, 0.0F).endVertex();
	renderer.pos(0.5D, -0.25D, 0.0D).tex(1, 1).normal(0.0F, 1.0F, 0.0F).endVertex();
	renderer.pos(0.5D, 0.75D, 0.0D).tex(1, 0).normal(0.0F, 1.0F, 0.0F).endVertex();
	renderer.pos(-0.5D, 0.75D, 0.0D).tex(0, 0).normal(0.0F, 1.0F, 0.0F).endVertex();
	tessellator.draw();
	GlStateManager.popAttrib();
	GlStateManager.popMatrix();
}
 
Example 2
Project: IceAndShadow2   File: EntityNyxNecromancer.java   Source Code and License 6 votes vote down vote up
@Override
public void attackEntityWithRangedAttack(EntityLivingBase sucker, float par2) {
	if (worldObj.isRemote)
		return;
	final EntityCosmeticShadowRiser ecsr = new EntityCosmeticShadowRiser(worldObj);
	ecsr.setPosition(posX, posY + getEyeHeight(), posZ);
	worldObj.spawnEntityInWorld(ecsr);
	final boolean harm_undead = sucker.getCreatureAttribute() == EnumCreatureAttribute.UNDEAD;
	final AxisAlignedBB bb = AxisAlignedBB.getBoundingBox(sucker.posX - 8.0, sucker.posY - 16.0, sucker.posZ - 8.0,
			sucker.posX + 8.0, sucker.posY + 16.0, sucker.posZ + 8.0);
	if (!harm_undead) {
		final List li = worldObj.getEntitiesWithinAABBExcludingEntity(this, bb);
		for (final Object obj : li)
			if (obj instanceof EntityNyxSkeleton) {
				final EntityThrowable entityball = new EntityShadowBall(worldObj, this, false, true);
				final Entity target = (Entity) obj;
				entityball.setPosition(target.posX, target.posY + 32 + worldObj.rand.nextFloat() * 32, target.posZ);
				entityball.setThrowableHeading(0, -1, 0, 0.40F, 0F);
				worldObj.spawnEntityInWorld(entityball);
			}
	}
	final EntityThrowable entitysmite = new EntityShadowBall(worldObj, this, harm_undead, true);
	entitysmite.setPosition(sucker.posX, sucker.posY + 32 + worldObj.rand.nextFloat() * 32, sucker.posZ);
	entitysmite.setThrowableHeading(0, -1, 0, 0.40F, 0F);
	worldObj.spawnEntityInWorld(entitysmite);
}
 
Example 3
Project: IceAndShadow2   File: EntityNyxSkeleton.java   Source Code and License 6 votes vote down vote up
public void doShadowAttack(EntityLivingBase par1EntityLiving, float par2) {
	final boolean harm_undead = par1EntityLiving.getCreatureAttribute() == EnumCreatureAttribute.UNDEAD;
	final EntityThrowable entityball = new EntityShadowBall(worldObj, this, harm_undead,
			IaSWorldHelper.getRegionLevel(par1EntityLiving) >= 6);

	final double d0 = par1EntityLiving.posX + par1EntityLiving.motionX - posX;
	final double d1 = par1EntityLiving.posY + par1EntityLiving.getEyeHeight() - getEyeHeight() - posY;
	final double d2 = par1EntityLiving.posZ + par1EntityLiving.motionZ - posZ;
	final float f1 = MathHelper.sqrt_double(d0 * d0 + d2 * d2);

	if (f1 <= 2.0) {
		entityball.setThrowableHeading(d0, d1, d2, 0.40F, 8.0F);
	} else {
		entityball.rotationPitch += 20.0F;
	}
	entityball.setThrowableHeading(d0, d1 + f1 * 0.2F, d2, 0.80F, 8.0F);
	worldObj.spawnEntityInWorld(entityball);
}
 
Example 4
Project: CountryGamer_PlantsVsZombies   File: EntityPlantShooterBase.java   Source Code and License 6 votes vote down vote up
public void attackEntityWithRangedAttack(EntityLivingBase entitylivingbase,
		float f) {
	EntityThrowable ent = entitySelect(this.worldObj);
	double toX = entitylivingbase.posX - this.posX;
	float percentToMouth = 0.5F;
	double toY = entitylivingbase.posY + this.height * percentToMouth
			- 1.0D - ent.posY;
	double toZ = entitylivingbase.posZ - this.posZ;
	float f1 = MathHelper.sqrt_double(toX * toX + toZ * toZ) * 0.2F;
	ent.setThrowableHeading(toX, toY + f1, toZ, 1.6F, 12.0F);
	playSound("random.bow", 1.0F,
			1.0F / (getRNG().nextFloat() * 0.4F + 0.8F));
	this.worldObj.spawnEntityInWorld(ent);
	if (entitylivingbase instanceof EntityCreature) {
		((EntityCreature) entitylivingbase).setAttackTarget(this);
	}
}
 
Example 5
Project: CountryGamer_PlantsVsZombies   File: EntityFumeShroom.java   Source Code and License 6 votes vote down vote up
public void attackEntityWithRangedAttack(EntityLivingBase entitylivingbase, float f)
{
  if (entitySelect(this.worldObj) != null)
  {
    int numbPods = this.min + (int)(Math.random() * (this.max - this.min + 1));
    for (int i = 0; i < numbPods; i++) {
      EntityThrowable ent = entitySelect(this.worldObj);
      double toX = entitylivingbase.posX - this.posX;
      float percentToMouth = 0.5F;
      double toY = entitylivingbase.posY + this.height * percentToMouth - 1.0D - ent.posY;
      double toZ = entitylivingbase.posZ - this.posZ;
      float f1 = MathHelper.sqrt_double(toX * toX + toZ * toZ) * 0.2F;
      ent.setThrowableHeading(toX, toY + f1, toZ, 1.6F, 12.0F);
      playSound("random.bow", 1.0F, 1.0F / (getRNG().nextFloat() * 0.4F + 0.8F));
      this.worldObj.spawnEntityInWorld(ent);
    }
  }
}
 
Example 6
Project: Uranium   File: ActivationRange.java   Source Code and License 5 votes vote down vote up
/**
 * These entities are excluded from Activation range checks.
 *
 * @param entity
 * @param world
 * @return boolean If it should always tick.
 */
public static boolean initializeEntityActivationState(Entity entity, SpigotWorldConfig config)
{
    // Cauldron start - another fix for Proxy Worlds
    if (config == null && DimensionManager.getWorld(0) != null)
    {
        config = DimensionManager.getWorld(0).spigotConfig;
    }
    else
    {
        return true;
    }
    // Cauldron end

    if ( ( entity.activationType == 3 && config.miscActivationRange == 0 )
            || ( entity.activationType == 2 && config.animalActivationRange == 0 )
            || ( entity.activationType == 1 && config.monsterActivationRange == 0 )
            || (entity instanceof EntityPlayer && !(entity instanceof FakePlayer)) // Cauldron
            || entity instanceof EntityThrowable
            || entity instanceof EntityDragon
            || entity instanceof EntityDragonPart
            || entity instanceof EntityWither
            || entity instanceof EntityFireball
            || entity instanceof EntityWeatherEffect
            || entity instanceof EntityTNTPrimed
            || entity instanceof EntityEnderCrystal
            || entity instanceof EntityFireworkRocket
            || entity instanceof EntityVillager
            // Cauldron start - force ticks for entities with superclass of Entity and not a creature/monster
            || (entity.getClass().getSuperclass() == Entity.class && !entity.isCreatureType(EnumCreatureType.creature, false)
            && !entity.isCreatureType(EnumCreatureType.ambient, false) && !entity.isCreatureType(EnumCreatureType.monster, false)
            && !entity.isCreatureType(EnumCreatureType.waterCreature, false)))
    {
        return true;
    }

    return false;
}
 
Example 7
Project: Rival-Rebels-Mod   File: EntityRhodes.java   Source Code and License 5 votes vote down vote up
private Entity findTarget()
{
	Iterator iter = worldObj.loadedEntityList.iterator();
	Entity target = null;
	double priority = 0;
	while(iter.hasNext())
	{
		Entity e = (Entity) iter.next();
		if (e != this && !e.isDead && (!(e instanceof EntityLivingBase) || ((EntityLivingBase)e).getHealth()>0) && (!(e instanceof EntityRhodes) || (RivalRebels.rhodesFF && (RivalRebels.rhodesCC || ((EntityRhodes)e).colorType != colorType))) &&
			!( e instanceof EntityThrowable
			|| e instanceof EntityInanimate
			|| e instanceof EntityItem
			|| e instanceof EntityAnimal
			|| e instanceof EntityVillager
			|| e instanceof EntityBat
			|| e instanceof EntitySquid
			|| e instanceof EntityBoat
			|| e instanceof EntityMinecart))
		{
			double prio = getPriority(e)-getDistanceToEntity(e);
			if (prio > priority)
			{
				target = e;
				priority = prio;
			}
		}
	}
	return target;
}
 
Example 8
Project: Aether-Legacy   File: AbilityRepulsion.java   Source Code and License 5 votes vote down vote up
private Entity getShooter(Entity ent) 
{
	return ent instanceof EntityArrow ? ((EntityArrow)ent).shootingEntity :
		ent instanceof EntityThrowable ? ((EntityThrowable)ent).getThrower() :
			ent instanceof EntityDartBase ? ((EntityDartBase)ent).shootingEntity :
				ent instanceof EntityFireball ? ((EntityFireball)ent).shootingEntity :
						null;
}
 
Example 9
Project: ThermosRebased   File: ActivationRange.java   Source Code and License 5 votes vote down vote up
/**
 * These entities are excluded from Activation range checks.
 *
 * @param entity
 * @param world
 * @return boolean If it should always tick.
 */
public static boolean initializeEntityActivationState(Entity entity, SpigotWorldConfig config)
{
    // Cauldron start - another fix for Proxy Worlds
    if (config == null && DimensionManager.getWorld(0) != null)
    {
        config = DimensionManager.getWorld(0).spigotConfig;
    }
    else
    {
        return true;
    }
    // Cauldron end

    if ( ( entity.activationType == 3 && config.miscActivationRange == 0 )
            || ( entity.activationType == 2 && config.animalActivationRange == 0 )
            || ( entity.activationType == 1 && config.monsterActivationRange == 0 )
            || (entity instanceof EntityPlayer && !(entity instanceof FakePlayer)) // Cauldron
            || entity instanceof EntityThrowable
            || entity instanceof EntityDragon
            || entity instanceof EntityDragonPart
            || entity instanceof EntityWither
            || entity instanceof EntityFireball
            || entity instanceof EntityWeatherEffect
            || entity instanceof EntityTNTPrimed
            || entity instanceof EntityEnderCrystal
            || entity instanceof EntityFireworkRocket
            || entity instanceof EntityVillager
            // Cauldron start - force ticks for entities with superclass of Entity and not a creature/monster
            || (entity.getClass().getSuperclass() == Entity.class && !entity.isCreatureType(EnumCreatureType.creature, false)
            && !entity.isCreatureType(EnumCreatureType.ambient, false) && !entity.isCreatureType(EnumCreatureType.monster, false)
            && !entity.isCreatureType(EnumCreatureType.waterCreature, false)))
    {
        return true;
    }

    return false;
}
 
Example 10
Project: ForageCraft   File: RockItem.java   Source Code and License 5 votes vote down vote up
@Override
public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand handIn)
   {
	ItemStack itemstack = playerIn.getHeldItem(handIn);

       if (!playerIn.capabilities.isCreativeMode)
       {
           itemstack.shrink(1);
       }

       //It seems like it's playing a sound to null player.
	//But it seems to work regardless? This might be a bug within multiplayer. We'll have to check.
       worldIn.playSound((EntityPlayer)null, playerIn.posX, playerIn.posY, playerIn.posZ, SoundEvents.ENTITY_SNOWBALL_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));

       if (!worldIn.isRemote)
       {
       	EntityThrowable rock = new EntityRockNormal(worldIn, playerIn);
       	switch(type)
           {
           	
           	case NORMAL: rock = new EntityRockNormal(worldIn, playerIn);
           		break;
			case FLAT: rock = new EntityRockFlat(worldIn, playerIn);
				break;
			default:
				break;
           }

		rock.shoot(playerIn, playerIn.rotationPitch, playerIn.rotationYaw, 0.0F, 1.5F, 1.0F); //rock.setHeadingFromThrower(playerIn, playerIn.rotationPitch, playerIn.rotationYaw, 0.0F, 1.5F, 1.0F);
           //wtf is "shoot"? //Forge changed their shit
           worldIn.spawnEntity(rock);
       }
       
       return new ActionResult<>(EnumActionResult.SUCCESS, itemstack);
   }
 
Example 11
Project: Thermos   File: ActivationRange.java   Source Code and License 5 votes vote down vote up
/**
 * These entities are excluded from Activation range checks.
 *
 * @param entity
 * @param world
 * @return boolean If it should always tick.
 */
public static boolean initializeEntityActivationState(Entity entity, SpigotWorldConfig config)
{
    // Cauldron start - another fix for Proxy Worlds
    if (config == null && DimensionManager.getWorld(0) != null)
    {
        config = DimensionManager.getWorld(0).spigotConfig;
    }
    else
    {
        return true;
    }
    // Cauldron end

    if ( ( entity.activationType == 3 && config.miscActivationRange == 0 )
            || ( entity.activationType == 2 && config.animalActivationRange == 0 )
            || ( entity.activationType == 1 && config.monsterActivationRange == 0 )
            || (entity instanceof EntityPlayer && !(entity instanceof FakePlayer)) // Cauldron
            || entity instanceof EntityThrowable
            || entity instanceof EntityDragon
            || entity instanceof EntityDragonPart
            || entity instanceof EntityWither
            || entity instanceof EntityFireball
            || entity instanceof EntityWeatherEffect
            || entity instanceof EntityTNTPrimed
            || entity instanceof EntityFallingBlock // PaperSpigot - Always tick falling blocks
            || entity instanceof EntityEnderCrystal
            || entity instanceof EntityFireworkRocket
            || entity instanceof EntityVillager
            // Cauldron start - force ticks for entities with superclass of Entity and not a creature/monster
            || (entity.getClass().getSuperclass() == Entity.class && !entity.isCreatureType(EnumCreatureType.creature, false)
            && !entity.isCreatureType(EnumCreatureType.ambient, false) && !entity.isCreatureType(EnumCreatureType.monster, false)
            && !entity.isCreatureType(EnumCreatureType.waterCreature, false)))
    {
        return true;
    }

    return false;
}
 
Example 12
Project: KCauldron   File: ActivationRange.java   Source Code and License 5 votes vote down vote up
/**
 * These entities are excluded from Activation range checks.
 *
 * @param entity
 * @param world
 * @return boolean If it should always tick.
 */
public static boolean initializeEntityActivationState(Entity entity, SpigotWorldConfig config)
{
    // Cauldron start - another fix for Proxy Worlds
    if (config == null && DimensionManager.getWorld(0) != null)
    {
        config = DimensionManager.getWorld(0).spigotConfig;
    }
    else
    {
        return true;
    }
    // Cauldron end

    if ( ( entity.activationType == 3 && config.miscActivationRange == 0 )
            || ( entity.activationType == 2 && config.animalActivationRange == 0 )
            || ( entity.activationType == 1 && config.monsterActivationRange == 0 )
            || (entity instanceof EntityPlayer && !(entity instanceof FakePlayer)) // Cauldron
            || entity instanceof EntityThrowable
            || entity instanceof EntityDragon
            || entity instanceof EntityDragonPart
            || entity instanceof EntityWither
            || entity instanceof EntityFireball
            || entity instanceof EntityWeatherEffect
            || entity instanceof EntityTNTPrimed
            || entity instanceof EntityEnderCrystal
            || entity instanceof EntityFireworkRocket
            || entity instanceof EntityVillager
            // Cauldron start - force ticks for entities with superclass of Entity and not a creature/monster
            || (entity.getClass().getSuperclass() == Entity.class && !entity.isCreatureType(EnumCreatureType.creature, false)
            && !entity.isCreatureType(EnumCreatureType.ambient, false) && !entity.isCreatureType(EnumCreatureType.monster, false)
            && !entity.isCreatureType(EnumCreatureType.waterCreature, false)))
    {
        return true;
    }

    return false;
}
 
Example 13
Project: CauldronGit   File: ActivationRange.java   Source Code and License 5 votes vote down vote up
/**
 * These entities are excluded from Activation range checks.
 *
 * @param entity
 * @param world
 * @return boolean If it should always tick.
 */
public static boolean initializeEntityActivationState(Entity entity, SpigotWorldConfig config)
{
    // Cauldron start - another fix for Proxy Worlds
    if (config == null && DimensionManager.getWorld(0) != null)
    {
        config = DimensionManager.getWorld(0).spigotConfig;
    }
    else
    {
        return true;
    }
    // Cauldron end

    if ( ( entity.activationType == 3 && config.miscActivationRange == 0 )
            || ( entity.activationType == 2 && config.animalActivationRange == 0 )
            || ( entity.activationType == 1 && config.monsterActivationRange == 0 )
            || (entity instanceof EntityPlayer && !(entity instanceof FakePlayer)) // Cauldron
            || entity instanceof EntityThrowable
            || entity instanceof EntityDragon
            || entity instanceof EntityDragonPart
            || entity instanceof EntityWither
            || entity instanceof EntityFireball
            || entity instanceof EntityWeatherEffect
            || entity instanceof EntityTNTPrimed
            || entity instanceof EntityEnderCrystal
            || entity instanceof EntityFireworkRocket
            || entity instanceof EntityVillager
            // Cauldron start - force ticks for entities with superclass of Entity and not a creature/monster
            || (entity.getClass().getSuperclass() == Entity.class && !entity.isCreatureType(EnumCreatureType.creature, false)
            && !entity.isCreatureType(EnumCreatureType.ambient, false) && !entity.isCreatureType(EnumCreatureType.monster, false)
            && !entity.isCreatureType(EnumCreatureType.waterCreature, false)))
    {
        return true;
    }

    return false;
}
 
Example 14
Project: Cauldron-Old   File: ActivationRange.java   Source Code and License 5 votes vote down vote up
/**
 * These entities are excluded from Activation range checks.
 *
 * @param entity
 * @param world
 * @return boolean If it should always tick.
 */
public static boolean initializeEntityActivationState(Entity entity, SpigotWorldConfig config)
{
    // Cauldron start - another fix for Proxy Worlds
    if (config == null && DimensionManager.getWorld(0) != null)
    {
        config = DimensionManager.getWorld(0).spigotConfig;
    }
    else
    {
        return true;
    }
    // Cauldron end

    if ( ( entity.activationType == 3 && config.miscActivationRange == 0 )
            || ( entity.activationType == 2 && config.animalActivationRange == 0 )
            || ( entity.activationType == 1 && config.monsterActivationRange == 0 )
            || (entity instanceof EntityPlayer && !(entity instanceof FakePlayer)) // Cauldron
            || entity instanceof EntityThrowable
            || entity instanceof EntityDragon
            || entity instanceof EntityDragonPart
            || entity instanceof EntityWither
            || entity instanceof EntityFireball
            || entity instanceof EntityWeatherEffect
            || entity instanceof EntityTNTPrimed
            || entity instanceof EntityEnderCrystal
            || entity instanceof EntityFireworkRocket
            || entity instanceof EntityVillager
            // Cauldron start - force ticks for entities with superclass of Entity and not a creature/monster
            || (entity.getClass().getSuperclass() == Entity.class && !entity.isCreatureType(EnumCreatureType.creature, false)
            && !entity.isCreatureType(EnumCreatureType.ambient, false) && !entity.isCreatureType(EnumCreatureType.monster, false)
            && !entity.isCreatureType(EnumCreatureType.waterCreature, false)))
    {
        return true;
    }

    return false;
}
 
Example 15
Project: Cauldron-Reloaded   File: ActivationRange.java   Source Code and License 5 votes vote down vote up
/**
 * These entities are excluded from Activation range checks.
 *
 * @param entity
 * @param world
 * @return boolean If it should always tick.
 */
public static boolean initializeEntityActivationState(Entity entity, SpigotWorldConfig config)
{
    // Cauldron start - another fix for Proxy Worlds
    if (config == null && DimensionManager.getWorld(0) != null)
    {
        config = DimensionManager.getWorld(0).spigotConfig;
    }
    else
    {
        return true;
    }
    // Cauldron end

    if ( ( entity.activationType == 3 && config.miscActivationRange == 0 )
            || ( entity.activationType == 2 && config.animalActivationRange == 0 )
            || ( entity.activationType == 1 && config.monsterActivationRange == 0 )
            || (entity instanceof EntityPlayer && !(entity instanceof FakePlayer)) // Cauldron
            || entity instanceof EntityThrowable
            || entity instanceof EntityDragon
            || entity instanceof EntityDragonPart
            || entity instanceof EntityWither
            || entity instanceof EntityFireball
            || entity instanceof EntityWeatherEffect
            || entity instanceof EntityTNTPrimed
            || entity instanceof EntityEnderCrystal
            || entity instanceof EntityFireworkRocket
            || entity instanceof EntityVillager
            // Cauldron start - force ticks for entities with superclass of Entity and not a creature/monster
            || (entity.getClass().getSuperclass() == Entity.class && !entity.isCreatureType(EnumCreatureType.creature, false)
            && !entity.isCreatureType(EnumCreatureType.ambient, false) && !entity.isCreatureType(EnumCreatureType.monster, false)
            && !entity.isCreatureType(EnumCreatureType.waterCreature, false)))
    {
        return true;
    }

    return false;
}
 
Example 16
Project: Cyclic   File: BaseItemRapidScepter.java   Source Code and License 5 votes vote down vote up
private void shootTwins(World world, EntityPlayer player, float velocityFactor, float damage) {
  Vec3d vecCrossRight = player.getLookVec().normalize().crossProduct(new Vec3d(0, 2, 0));
  Vec3d vecCrossLeft = player.getLookVec().normalize().crossProduct(new Vec3d(0, -2, 0));
  EntityThrowable projRight = createBullet(world, player, damage);
  projRight.posX += vecCrossRight.x;
  projRight.posZ += vecCrossRight.z;
  this.launchProjectile(world, player, projRight, velocityFactor);
  EntityThrowable projLeft = createBullet(world, player, damage);
  projLeft.posX += vecCrossLeft.x;
  projLeft.posZ += vecCrossLeft.z;
  this.launchProjectile(world, player, projLeft, velocityFactor);
}
 
Example 17
Project: Cyclic   File: BaseItemRapidScepter.java   Source Code and License 5 votes vote down vote up
protected void launchProjectile(World world, EntityPlayer player, EntityThrowable thing, float velocity) {
  if (!world.isRemote) {
    //zero pitch offset, meaning match the players existing. 1.0 at end ins inn
    thing.setHeadingFromThrower(player, player.rotationPitch, player.rotationYaw, PITCHOFFSET, velocity, INACCURACY_DEFAULT);
    world.spawnEntity(thing);
  }
  BlockPos pos = player.getPosition();
  UtilSound.playSound(player, pos, getSound(), SoundCategory.PLAYERS);
}
 
Example 18
Project: Cyclic   File: BaseItemChargeScepter.java   Source Code and License 5 votes vote down vote up
private void shootTwins(World world, EntityPlayer player, float velocityFactor, float damage) {
  Vec3d vecCrossRight = player.getLookVec().normalize().crossProduct(new Vec3d(0, 2, 0));
  Vec3d vecCrossLeft = player.getLookVec().normalize().crossProduct(new Vec3d(0, -2, 0));
  EntityThrowable projRight = createBullet(world, player, damage);
  projRight.posX += vecCrossRight.x;
  projRight.posZ += vecCrossRight.z;
  this.launchProjectile(world, player, projRight, velocityFactor * VELOCITY_MAX);
  EntityThrowable projLeft = createBullet(world, player, damage);
  projLeft.posX += vecCrossLeft.x;
  projLeft.posZ += vecCrossLeft.z;
  this.launchProjectile(world, player, projLeft, velocityFactor * VELOCITY_MAX);
}
 
Example 19
Project: Cyclic   File: BaseItemChargeScepter.java   Source Code and License 5 votes vote down vote up
protected void launchProjectile(World world, EntityPlayer player, EntityThrowable thing, float velocity) {
  if (!world.isRemote) {
    //zero pitch offset, meaning match the players existing. 1.0 at end ins inn
    thing.setHeadingFromThrower(player, player.rotationPitch, player.rotationYaw, PITCHOFFSET, velocity, INACCURACY_DEFAULT);
    world.spawnEntity(thing);
  }
  BlockPos pos = player.getPosition();
  UtilSound.playSound(player, pos, getSound(), SoundCategory.PLAYERS);
}
 
Example 20
Project: Cyclic   File: BaseItemProjectile.java   Source Code and License 5 votes vote down vote up
public void doThrow(World world, EntityPlayer player, EnumHand hand, EntityThrowable thing, float velocity) {
  if (!world.isRemote) {
    // func_184538_a
    //zero pitch offset, meaning match the players existing. 1.0 at end ins inn
    thing.setHeadingFromThrower(player, player.rotationPitch, player.rotationYaw, PITCHOFFSET, velocity, INACCURACY_DEFAULT);
    world.spawnEntity(thing);
  }
  player.swingArm(hand);
  BlockPos pos = player.getPosition();
  UtilSound.playSound(player, pos, getSound(), SoundCategory.PLAYERS, 0.5F);
}
 
Example 21
Project: FFoKC   File: ActivationRange.java   Source Code and License 5 votes vote down vote up
/**
 * These entities are excluded from Activation range checks.
 *
 * @param entity
 * @param world
 * @return boolean If it should always tick.
 */
public static boolean initializeEntityActivationState(Entity entity, SpigotWorldConfig config)
{
    // Cauldron start - another fix for Proxy Worlds
    if (config == null && DimensionManager.getWorld(0) != null)
    {
        config = DimensionManager.getWorld(0).spigotConfig;
    }
    else
    {
        return true;
    }
    // Cauldron end

    if ( ( entity.activationType == 3 && config.miscActivationRange == 0 )
            || ( entity.activationType == 2 && config.animalActivationRange == 0 )
            || ( entity.activationType == 1 && config.monsterActivationRange == 0 )
            || (entity.getClass().equals(EntityPlayer.class) && !(entity.getClass().equals(FakePlayer.class))) // Cauldron
            || entity.getClass().equals(EntityThrowable.class)
            || entity.getClass().equals(EntityDragon.class)
            || entity.getClass().equals(EntityDragonPart.class)
            || entity.getClass().equals(EntityWither.class)
            || entity.getClass().equals(EntityFireball.class)
            || entity.getClass().equals(EntityWeatherEffect.class)
            || entity.getClass().equals(EntityTNTPrimed.class)
            || entity.getClass().equals(EntityFallingBlock.class)
            || entity.getClass().equals(EntityEnderCrystal.class)
            || entity.getClass().equals(EntityFireworkRocket.class)
            || entity.getClass().equals(EntityVillager.class)
            // Cauldron start - force ticks for entities with superclass of Entity and not a creature/monster
            || (entity.getClass().getSuperclass() == Entity.class && !entity.isCreatureType(EnumCreatureType.creature, false)
            && !entity.isCreatureType(EnumCreatureType.ambient, false) && !entity.isCreatureType(EnumCreatureType.monster, false)
            && !entity.isCreatureType(EnumCreatureType.waterCreature, false)))
    {
        return true;
    }

    return false;
}
 
Example 22
Project: Quantum-Anomalies   File: ItemRiftArmor.java   Source Code and License 5 votes vote down vote up
@SuppressWarnings("unchecked")
public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack) {
    double posX = player.posX;
    double posY = player.posY;
    double posZ = player.posZ;

    if (itemStack.getItem() == QAItems.RIFT_HELM.getItem())
        player.setAir(300);

    if (itemStack.getItem() == QAItems.RIFT_CHEST.getItem()) {
        double s = 2.5;
        List<Entity> projectiles = world.getEntitiesWithinAABB(Entity.class, AxisAlignedBB.getBoundingBox(posX - s, posY - s, posZ - s, posX + s, posY + s, posZ + s));

        for (Entity ent : projectiles) {
            boolean canThrowable = ent instanceof EntityThrowable && ((EntityThrowable) ent).getThrower() != player;
            boolean canArrow = ent instanceof EntityArrow && ((EntityArrow) ent).shootingEntity != player;
            if (canArrow || canThrowable) {
                if (world.isRemote) {
                    int loop = RandomUtils.nextInt(15, 25);
                    for (int i = 0; i < loop; i++) {
                        double mx = ent.motionX / 10 + RandomUtils.nextDouble(0, 0.025);
                        double my = ent.motionY / 10 + RandomUtils.nextDouble(0, 0.025);
                        double mz = ent.motionZ / 10 + RandomUtils.nextDouble(0, 0.025);

                        world.spawnParticle("portal", ent.posX + (mx*i), ent.posY - 1.3 + (my*i), ent.posZ + (mz*i), mx, my, mz);
                    }
                }
                    //NetworkHandler.wrapper.sendToAllAround(new MessageVanillaParticle("flame", ent.posX, ent.posY, ent.posZ, 0D, 0D, 0D, 2), new NetworkRegistry.TargetPoint(world.provider.dimensionId, posX, posY, posZ, 32));
                ent.setDead();
            }
        }
    }
}
 
Example 23
Project: Cauldron   File: ActivationRange.java   Source Code and License 5 votes vote down vote up
/**
 * These entities are excluded from Activation range checks.
 *
 * @param entity
 * @param world
 * @return boolean If it should always tick.
 */
public static boolean initializeEntityActivationState(Entity entity, SpigotWorldConfig config)
{
    // Cauldron start - another fix for Proxy Worlds
    if (config == null && DimensionManager.getWorld(0) != null)
    {
        config = DimensionManager.getWorld(0).spigotConfig;
    }
    else
    {
        return true;
    }
    // Cauldron end

    if ( ( entity.activationType == 3 && config.miscActivationRange == 0 )
            || ( entity.activationType == 2 && config.animalActivationRange == 0 )
            || ( entity.activationType == 1 && config.monsterActivationRange == 0 )
            || (entity instanceof EntityPlayer && !(entity instanceof FakePlayer)) // Cauldron
            || entity instanceof EntityThrowable
            || entity instanceof EntityDragon
            || entity instanceof EntityDragonPart
            || entity instanceof EntityWither
            || entity instanceof EntityFireball
            || entity instanceof EntityWeatherEffect
            || entity instanceof EntityTNTPrimed
            || entity instanceof EntityEnderCrystal
            || entity instanceof EntityFireworkRocket
            || entity instanceof EntityVillager
            // Cauldron start - force ticks for entities with superclass of Entity and not a creature/monster
            || (entity.getClass().getSuperclass() == Entity.class && !entity.isCreatureType(EnumCreatureType.creature, false)
            && !entity.isCreatureType(EnumCreatureType.ambient, false) && !entity.isCreatureType(EnumCreatureType.monster, false)
            && !entity.isCreatureType(EnumCreatureType.waterCreature, false)))
    {
        return true;
    }

    return false;
}
 
Example 24
Project: Blockbender   File: ProjectileLauncher.java   Source Code and License 5 votes vote down vote up
public static void launchProjectile(Entity entity, EntityThrowable proj, double targetX, double targetY, double targetZ) {
	double dx = targetX - entity.posX;
	double dy = targetY - entity.posY;
	double dz = targetZ - entity.posZ;
	proj.setThrowableHeading(dx, dy, dz, 1.6F, 0F);
	entity.worldObj.spawnEntityInWorld(proj);
}
 
Example 25
Project: ZeldaSwordSkills   File: EntitySwordBeam.java   Source Code and License 5 votes vote down vote up
@Override
public void readSpawnData(ByteBuf buffer) {
	String throwerName = ByteBufUtils.readUTF8String(buffer);
	if (getThrower() == null && throwerName != null && throwerName.length() > 0) {
		// EntityThrowable#thrower is private with no setter -.-
		ReflectionHelper.setPrivateValue(EntityThrowable.class, this, worldObj.getPlayerEntityByName(throwerName), "field_70192_c", "thrower");
	}
}
 
Example 26
Project: ZeldaSwordSkills   File: CustomExplosion.java   Source Code and License 5 votes vote down vote up
/**
 * Returns an explosion damage source with the thrower of the explosive, if
 * available, set as the indirect entity.
 */
public static DamageSource getExplosionSource(CustomExplosion explosion) {
	if (explosion.exploder instanceof EntityThrowable) {
		return new EntityDamageSourceIndirect("explosion", explosion.exploder, ((EntityThrowable) explosion.exploder).getThrower()).setExplosion().setDifficultyScaled();
	}
	return DamageSource.setExplosionSource(explosion);
}
 
Example 27
Project: ZeldaSwordSkills   File: RenderEntitySwordBeam.java   Source Code and License 5 votes vote down vote up
private float getRgb(EntityThrowable entity) {
	EntityLivingBase thrower = entity.getThrower();
	if (thrower != null && thrower.getCurrentArmor(ArmorIndex.WORN_HELM) != null && thrower.getCurrentArmor(ArmorIndex.WORN_HELM).getItem() == ZSSItems.maskFierce) {
		return 0.0F; //  nice and dark for the Fierce Diety
	}
	return 1.0F;
}
 
Example 28
Project: MyEssentials-Core   File: ProjectileImpactEvent.java   Source Code and License 5 votes vote down vote up
/**
 * Creates a new event for an impacting EntityThrowable
 */
public ProjectileImpactEvent(EntityThrowable throwable, MovingObjectPosition mop)
{
    super(throwable);
    this.firingEntity = throwable.getThrower();
    this.movingObjectPosition = mop;
}
 
Example 29
Project: CountryGamer_PlantsVsZombies   File: EntityShroomShooterBase.java   Source Code and License 5 votes vote down vote up
public void attackEntityWithRangedAttack(EntityLivingBase entitylivingbase, float f)
{
  if (entitySelect(this.worldObj) != null) {
    EntityThrowable ent = entitySelect(this.worldObj);
    double toX = entitylivingbase.posX - this.posX;
    float percentToMouth = 0.5F;
    double toY = entitylivingbase.posY + this.height * percentToMouth - 1.0D - ent.posY;
    double toZ = entitylivingbase.posZ - this.posZ;
    float f1 = MathHelper.sqrt_double(toX * toX + toZ * toZ) * 0.2F;
    ent.setThrowableHeading(toX, toY + f1, toZ, 1.6F, 12.0F);
    playSound("random.bow", 1.0F, 1.0F / (getRNG().nextFloat() * 0.4F + 0.8F));
    this.worldObj.spawnEntityInWorld(ent);
  }
}
 
Example 30
Project: CountryGamer_PlantsVsZombies   File: EntityShroomShooterBase.java   Source Code and License 5 votes vote down vote up
public EntityThrowable entitySelect(World world)
{
  EntityThrowable ent;
  if (!this.worldObj.isDaytime())
    ent = new EntityShroomPod(world, this);
  else {
    ent = null;
  }
  return ent;
}
 
Example 31
Project: EndermanEvolution   File: EntityFrienderPearl.java   Source Code and License 4 votes vote down vote up
public static void registerFixesThrowable(DataFixer p_189663_0_) {
	EntityThrowable.registerFixesThrowable(p_189663_0_, "ThrownFrienderpearl");
}
 
Example 32
Project: Backmemed   File: EntityExpBottle.java   Source Code and License 4 votes vote down vote up
public static void registerFixesExpBottle(DataFixer fixer)
{
    EntityThrowable.registerFixesThrowable(fixer, "ThrowableExpBottle");
}
 
Example 33
Project: Backmemed   File: EntityEnderPearl.java   Source Code and License 4 votes vote down vote up
public static void registerFixesEnderPearl(DataFixer fixer)
{
    EntityThrowable.registerFixesThrowable(fixer, "ThrownEnderpearl");
}
 
Example 34
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;
}
 
Example 35
Project: CustomWorldGen   File: ThrowableImpactEvent.java   Source Code and License 4 votes vote down vote up
public ThrowableImpactEvent(EntityThrowable throwable, RayTraceResult ray)
{
    super(throwable);
    this.throwable = throwable;
    this.ray = ray;
}
 
Example 36
Project: CustomWorldGen   File: ThrowableImpactEvent.java   Source Code and License 4 votes vote down vote up
public EntityThrowable getEntityThrowable()
{
    return throwable;
}
 
Example 37
Project: CustomWorldGen   File: ForgeHooks.java   Source Code and License 4 votes vote down vote up
public static boolean onThrowableImpact(EntityThrowable throwable, RayTraceResult ray)
{
    return MinecraftForge.EVENT_BUS.post(new ThrowableImpactEvent(throwable, ray));
}
 
Example 38
Project: CustomWorldGen   File: EntityExpBottle.java   Source Code and License 4 votes vote down vote up
public static void registerFixesExpBottle(DataFixer fixer)
{
    EntityThrowable.registerFixesThrowable(fixer, "ThrowableExpBottle");
}
 
Example 39
Project: CustomWorldGen   File: EntityEnderPearl.java   Source Code and License 4 votes vote down vote up
public static void registerFixesEnderPearl(DataFixer fixer)
{
    EntityThrowable.registerFixesThrowable(fixer, "ThrownEnderpearl");
}
 
Example 40
Project: Aether-Legacy   File: AbilityRepulsion.java   Source Code and License 4 votes vote down vote up
public static boolean isProjectile(Entity entity)
{
	return entity instanceof EntityArrow || entity instanceof EntityFireball || entity instanceof EntityThrowable || entity instanceof EntityPotion || entity instanceof EntityDartBase || entity instanceof EntityZephyrSnowball;
}