net.minecraft.entity.projectile.EntityThrowable Java Examples

The following examples show how to use net.minecraft.entity.projectile.EntityThrowable. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: EntityTofuSpider.java    From TofuCraftReload with MIT License 6 votes vote down vote up
@Override
public void attackEntityWithRangedAttack(EntityLivingBase target, float distanceFactor) {
    for (int i = 0; i < 4; i++) {
        EntityThrowable projectile = new EntityFukumame(this.world, this);

        Vec3d vec3d = this.getLook(1.0F);

        playSound(SoundEvents.ENTITY_SNOWBALL_THROW, 1.0F, 1.0F / (this.getRNG().nextFloat() * 0.4F + 0.8F));

        projectile.setLocationAndAngles(this.posX + vec3d.x * 1.3D, this.posY + this.getEyeHeight(), this.posZ + vec3d.z * 1.3D, this.rotationYaw, this.rotationPitch);

        float d0 = (this.rand.nextFloat() * 16.0F) - 8.0F;

        projectile.shoot(this, this.rotationPitch,this.rotationYaw + d0,0.0F, 1.5f, 0.8F);
        this.world.spawnEntity(projectile);
    }
}
 
Example #2
Source File: ActivationRange.java    From Kettle with GNU General Public License v3.0 6 votes vote down vote up
/**
 * These entities are excluded from Activation range checks.
 *
 * @param entity
 * @return boolean If it should always tick.
 */
public static boolean initializeEntityActivationState(Entity entity, SpigotWorldConfig config) {
    if (config == null && DimensionManager.getWorld(0) != null) {
        config = DimensionManager.getWorld(0).spigotConfig;
    } else {
        return true;
    }

    return ((entity.activationType == 3 && config.miscActivationRange == 0)
            || (entity.activationType == 2 && config.animalActivationRange == 0)
            || (entity.activationType == 1 && config.monsterActivationRange == 0)
            || entity instanceof EntityPlayer
            || entity instanceof EntityThrowable
            || entity instanceof MultiPartEntityPart
            || entity instanceof EntityWither
            || entity instanceof EntityFireball
            || entity instanceof EntityFallingBlock
            || entity instanceof EntityWeatherEffect
            || entity instanceof EntityTNTPrimed
            || entity instanceof EntityEnderCrystal
            || entity instanceof EntityFireworkRocket
            || (entity.getClass().getSuperclass() == Entity.class && !entity.isCreatureType(EnumCreatureType.CREATURE, false))
            && !entity.isCreatureType(EnumCreatureType.AMBIENT, false) && !entity.isCreatureType(EnumCreatureType.MONSTER, false)
            && !entity.isCreatureType(EnumCreatureType.WATER_CREATURE, false)
    );
}
 
Example #3
Source File: EntityTofuGandlem.java    From TofuCraftReload with MIT License 5 votes vote down vote up
@Override
public void updateTask() {
    super.updateTask();
    --this.shottick;

    if (this.shottick == 60 || this.shottick == 80) {
        EntityTofuGandlem.this.playSound(SoundEvents.BLOCK_IRON_TRAPDOOR_OPEN, 2.0F, 1.4F);
        ((WorldServer) EntityTofuGandlem.this.world).spawnParticle(EnumParticleTypes.CRIT, EntityTofuGandlem.this.posX, EntityTofuGandlem.this.posY, EntityTofuGandlem.this.posZ, 15, 0.2D, 0.2D, 0.2D, 0.0D);
    }

    if (this.shottick <= 20) {
        if (EntityTofuGandlem.this.ticksExisted % 5 == 0) {
            for (int i = 0; i < 6; i++) {
                EntityThrowable projectile = new EntityFukumame(EntityTofuGandlem.this.world, EntityTofuGandlem.this);

                Vec3d vec3d = EntityTofuGandlem.this.getLook(1.0F);

                playSound(SoundEvents.ENTITY_SNOWBALL_THROW, 3.0F, 1.0F / (EntityTofuGandlem.this.getRNG().nextFloat() * 0.4F + 0.8F));

                projectile.setLocationAndAngles(EntityTofuGandlem.this.posX + vec3d.x * 1.3D, EntityTofuGandlem.this.posY + (EntityTofuGandlem.this.getEyeHeight() / 2), EntityTofuGandlem.this.posZ + vec3d.z * 1.2D, EntityTofuGandlem.this.rotationYaw, EntityTofuGandlem.this.rotationPitch);

                float d0 = (EntityTofuGandlem.this.rand.nextFloat() * 12.0F) - 6.0F;

                projectile.shoot(EntityTofuGandlem.this, EntityTofuGandlem.this.rotationPitch, EntityTofuGandlem.this.rotationYaw + d0, 0.0F, 1.5f, 0.8F);
                EntityTofuGandlem.this.world.spawnEntity(projectile);
            }
        }
    }
}
 
Example #4
Source File: ActivationRange.java    From Thermos with GNU General Public License v3.0 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 #5
Source File: CraftProjectile.java    From Kettle with GNU General Public License v3.0 4 votes vote down vote up
@Override
public EntityThrowable getHandle() {
    return (EntityThrowable) entity;
}