Java 类net.minecraft.entity.projectile.EntityThrowable 实例源码

项目:ZeldaSwordSkills    文件:RenderEntitySwordBeam.java   
@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();
}
项目:IceAndShadow2    文件:EntityNyxNecromancer.java   
@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);
}
项目:IceAndShadow2    文件:EntityNyxSkeleton.java   
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);
}
项目:CountryGamer_PlantsVsZombies    文件:EntityPlantShooterBase.java   
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);
    }
}
项目:CountryGamer_PlantsVsZombies    文件:EntityFumeShroom.java   
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);
    }
  }
}
项目:Uranium    文件:ActivationRange.java   
/**
 * 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;
}
项目:Rival-Rebels-Mod    文件:EntityRhodes.java   
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;
}
项目:Aether-Legacy    文件:AbilityRepulsion.java   
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;
}
项目:ThermosRebased    文件:ActivationRange.java   
/**
 * 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;
}
项目:ForageCraft    文件:RockItem.java   
@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);
   }
项目:Thermos    文件:ActivationRange.java   
/**
 * 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;
}
项目:KCauldron    文件:ActivationRange.java   
/**
 * 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;
}
项目:CauldronGit    文件:ActivationRange.java   
/**
 * 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;
}
项目:Cauldron-Old    文件:ActivationRange.java   
/**
 * 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;
}
项目:Cauldron-Reloaded    文件:ActivationRange.java   
/**
 * 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;
}
项目:Cyclic    文件:BaseItemRapidScepter.java   
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);
}
项目:Cyclic    文件:BaseItemRapidScepter.java   
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);
}
项目:Cyclic    文件:BaseItemChargeScepter.java   
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);
}
项目:Cyclic    文件:BaseItemChargeScepter.java   
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);
}
项目:Cyclic    文件:BaseItemProjectile.java   
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);
}
项目:FFoKC    文件:ActivationRange.java   
/**
 * 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;
}
项目:Quantum-Anomalies    文件:ItemRiftArmor.java   
@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();
            }
        }
    }
}
项目:Cauldron    文件:ActivationRange.java   
/**
 * 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;
}
项目:Blockbender    文件:ProjectileLauncher.java   
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);
}
项目:ZeldaSwordSkills    文件:EntitySwordBeam.java   
@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");
    }
}
项目:ZeldaSwordSkills    文件:CustomExplosion.java   
/**
 * 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);
}
项目:ZeldaSwordSkills    文件:RenderEntitySwordBeam.java   
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;
}
项目:MyEssentials-Core    文件:ProjectileImpactEvent.java   
/**
 * Creates a new event for an impacting EntityThrowable
 */
public ProjectileImpactEvent(EntityThrowable throwable, MovingObjectPosition mop)
{
    super(throwable);
    this.firingEntity = throwable.getThrower();
    this.movingObjectPosition = mop;
}
项目:CountryGamer_PlantsVsZombies    文件:EntityShroomShooterBase.java   
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);
  }
}
项目:CountryGamer_PlantsVsZombies    文件:EntityShroomShooterBase.java   
public EntityThrowable entitySelect(World world)
{
  EntityThrowable ent;
  if (!this.worldObj.isDaytime())
    ent = new EntityShroomPod(world, this);
  else {
    ent = null;
  }
  return ent;
}
项目:EndermanEvolution    文件:EntityFrienderPearl.java   
public static void registerFixesThrowable(DataFixer p_189663_0_) {
    EntityThrowable.registerFixesThrowable(p_189663_0_, "ThrownFrienderpearl");
}
项目:Backmemed    文件:EntityExpBottle.java   
public static void registerFixesExpBottle(DataFixer fixer)
{
    EntityThrowable.registerFixesThrowable(fixer, "ThrowableExpBottle");
}
项目:Backmemed    文件:EntityEnderPearl.java   
public static void registerFixesEnderPearl(DataFixer fixer)
{
    EntityThrowable.registerFixesThrowable(fixer, "ThrownEnderpearl");
}
项目:Mods    文件:EntityAIAirblast.java   
@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;
}
项目:CustomWorldGen    文件:ThrowableImpactEvent.java   
public ThrowableImpactEvent(EntityThrowable throwable, RayTraceResult ray)
{
    super(throwable);
    this.throwable = throwable;
    this.ray = ray;
}
项目:CustomWorldGen    文件:ThrowableImpactEvent.java   
public EntityThrowable getEntityThrowable()
{
    return throwable;
}
项目:CustomWorldGen    文件:ForgeHooks.java   
public static boolean onThrowableImpact(EntityThrowable throwable, RayTraceResult ray)
{
    return MinecraftForge.EVENT_BUS.post(new ThrowableImpactEvent(throwable, ray));
}
项目:CustomWorldGen    文件:EntityExpBottle.java   
public static void registerFixesExpBottle(DataFixer fixer)
{
    EntityThrowable.registerFixesThrowable(fixer, "ThrowableExpBottle");
}
项目:CustomWorldGen    文件:EntityEnderPearl.java   
public static void registerFixesEnderPearl(DataFixer fixer)
{
    EntityThrowable.registerFixesThrowable(fixer, "ThrownEnderpearl");
}
项目:Aether-Legacy    文件:AbilityRepulsion.java   
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;
}