Search in sources :

Example 1 with LargeFireball

use of net.minecraft.world.entity.projectile.LargeFireball in project SolarCraftRepository by FINDERFEED.

the class FireballAbility method cast.

@Override
public void cast(ServerPlayer entity, ServerLevel world) {
    super.cast(entity, world);
    if (allowed) {
        LargeFireball fireball = new LargeFireball(world, entity, entity.getLookAngle().x, entity.getLookAngle().y, entity.getLookAngle().z, 6);
        fireball.setPos(entity.position().x + entity.getLookAngle().x * 1.5, entity.position().y + entity.getLookAngle().y * 1.5, entity.position().z + entity.getLookAngle().z * 1.5);
        world.addFreshEntity(fireball);
    }
}
Also used : LargeFireball(net.minecraft.world.entity.projectile.LargeFireball)

Example 2 with LargeFireball

use of net.minecraft.world.entity.projectile.LargeFireball in project kit-api by HGLabor.

the class LaborPathfinderGhastAttack method tick.

@Override
public void tick() {
    LivingEntity entityliving = this.ghast.getTarget();
    double d0 = 64.0D;
    if (entityliving == null)
        return;
    if (entityliving.distanceToSqr((Entity) this.ghast) < 4096.0D && this.ghast.hasLineOfSight(entityliving)) {
        Level world = this.ghast.level;
        ++this.chargeTime;
        if (this.chargeTime == 10 && !this.ghast.isSilent()) {
            world.levelEvent((Player) null, 1015, this.ghast.blockPosition(), 0);
        }
        if (this.chargeTime == 20) {
            double d1 = 4.0D;
            Vec3 vec3d = this.ghast.getViewVector(1.0F);
            double d2 = entityliving.getX() - (this.ghast.getX() + vec3d.x * 4.0D);
            double d3 = entityliving.getY(0.5D) - (0.5D + this.ghast.getY(0.5D));
            double d4 = entityliving.getZ() - (this.ghast.getZ() + vec3d.z * 4.0D);
            if (!this.ghast.isSilent()) {
                world.levelEvent((Player) null, 1016, this.ghast.blockPosition(), 0);
            }
            LargeFireball entitylargefireball = new LargeFireball(world, this.ghast, d2, d3, d4, this.ghast.getExplosionPower());
            // CraftBukkit - set bukkitYield when setting explosionpower
            entitylargefireball.bukkitYield = entitylargefireball.explosionPower = this.ghast.getExplosionPower();
            entitylargefireball.setPos(this.ghast.getX() + vec3d.x * 4.0D, this.ghast.getY(0.5D) + 0.5D, entitylargefireball.getZ() + vec3d.z * 4.0D);
            world.addFreshEntity(entitylargefireball);
            this.chargeTime = -40;
        }
    } else if (this.chargeTime > 0) {
        --this.chargeTime;
    }
    this.ghast.setCharging(this.chargeTime > 10);
}
Also used : LivingEntity(net.minecraft.world.entity.LivingEntity) Vec3(net.minecraft.world.phys.Vec3) Level(net.minecraft.world.level.Level) LargeFireball(net.minecraft.world.entity.projectile.LargeFireball)

Example 3 with LargeFireball

use of net.minecraft.world.entity.projectile.LargeFireball in project ElementalCraft by Sirttas.

the class FireBallSpell method castOnSelf.

@Override
public InteractionResult castOnSelf(Entity sender) {
    Vec3 vec3d = sender.getLookAngle();
    // TODO config
    LargeFireball fireballentity = new LargeFireball(sender.level, (LivingEntity) sender, vec3d.x * 100, vec3d.y * 100, vec3d.z * 100, 1);
    fireballentity.setPos(sender.getX() + vec3d.x * 4.0D, sender.getY(0.5D) + 0.5D, fireballentity.getZ() + vec3d.z * 4.0D);
    sender.level.addFreshEntity(fireballentity);
    return InteractionResult.SUCCESS;
}
Also used : Vec3(net.minecraft.world.phys.Vec3) LargeFireball(net.minecraft.world.entity.projectile.LargeFireball)

Example 4 with LargeFireball

use of net.minecraft.world.entity.projectile.LargeFireball in project LivingThings by tristankechlo.

the class AncientBlazeEntity method performRangedAttack.

@Override
public void performRangedAttack(LivingEntity target, float distanceFactor) {
    // don't attack if disabled in config
    boolean peaceful = (this.level.getDifficulty() == Difficulty.PEACEFUL);
    boolean ambientMode = LivingThingsConfig.GENERAL.ambientMode.get();
    if (peaceful || ambientMode || !LivingThingsConfig.ANCIENT_BLAZE.canAttack.get()) {
        return;
    }
    double d1 = target.getX() - this.getX();
    double d2 = target.getY(0.5D) - this.getY(0.5D);
    double d3 = target.getZ() - this.getZ();
    int shoots = this.getShoots();
    double chance = (double) LivingThingsConfig.ANCIENT_BLAZE.largeFireballChance.get() / 100.0D;
    if (this.random.nextDouble() < chance && shoots > 0) {
        this.setShoots((byte) (shoots - 1));
        LargeFireball fireballentity = new LargeFireball(this.level, this, d1, d2, d3, 1);
        fireballentity.setPos(fireballentity.getX(), this.getY(0.5D) + 0.5D, fireballentity.getZ());
        this.level.addFreshEntity(fireballentity);
    } else {
        SmallFireball smallfireballentity = new SmallFireball(this.level, this, d1, d2, d3);
        smallfireballentity.setPos(smallfireballentity.getX(), this.getY(0.5D) + 0.5D, smallfireballentity.getZ());
        this.level.addFreshEntity(smallfireballentity);
    }
    if (!this.level.isClientSide()) {
        this.level.playSound(null, this.blockPosition(), ModSounds.ANCIENT_BLAZE_SHOOT.get(), SoundSource.HOSTILE, 2.0F, (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F);
    }
}
Also used : SmallFireball(net.minecraft.world.entity.projectile.SmallFireball) LargeFireball(net.minecraft.world.entity.projectile.LargeFireball)

Example 5 with LargeFireball

use of net.minecraft.world.entity.projectile.LargeFireball in project LivingThings by tristankechlo.

the class AncientBlazeChargeUpGoal method tick.

@Override
public void tick() {
    int chargedtime = this.blaze.getInvulnerableTime();
    int targetShoots = LivingThingsConfig.ANCIENT_BLAZE.largeFireballAmount.get();
    if (chargedtime > 0) {
        chargedtime--;
        int divider = LivingThingsConfig.ANCIENT_BLAZE.chargingTime.get() / targetShoots;
        if (chargedtime % divider < 1 && this.blaze.getShoots() < targetShoots) {
            this.blaze.setShoots((byte) (this.blaze.getShoots() + 1));
            if (!this.blaze.level.isClientSide()) {
                this.blaze.level.playSound(null, this.blaze.blockPosition(), ModSounds.ANCIENT_BLAZE_CHARGE_UP.get(), SoundSource.HOSTILE, 1.0F, 1.0F);
            }
        }
    }
    if (chargedtime == 0) {
        this.blaze.setHealth(this.blaze.getMaxHealth());
        this.blaze.setShoots((byte) targetShoots);
        if (!this.blaze.level.isClientSide()) {
            this.blaze.level.playSound(null, this.blaze.blockPosition(), ModSounds.ANCIENT_BLAZE_SPAWN.get(), SoundSource.HOSTILE, 1.0F, 1.0F);
        }
        for (int i = 0; i < 4; i++) {
            double accelX = Math.pow(-1, i) * 90;
            double accelZ = (i < 2) ? 90 : -90;
            SmallFireball smallfireballentity = new SmallFireball(this.blaze.level, this.blaze, accelX, -15D, accelZ);
            smallfireballentity.setPos(smallfireballentity.getX(), this.blaze.getY(0.5D), smallfireballentity.getZ());
            this.blaze.level.addFreshEntity(smallfireballentity);
        }
        for (int i = 0; i < 4; i++) {
            double accelX = (i > 1) ? Math.pow(-1, i) * 90 : 0;
            double accelZ = (i < 2) ? Math.pow(-1, i) * 90 : 0;
            LargeFireball smallfireballentity = new LargeFireball(this.blaze.level, this.blaze, accelX, -15D, accelZ, 1);
            smallfireballentity.setPos(smallfireballentity.getX(), this.blaze.getY(0.5D) + 0.5D, smallfireballentity.getZ());
            this.blaze.level.addFreshEntity(smallfireballentity);
        }
    }
    this.blaze.setInvulnerableTime(chargedtime);
}
Also used : SmallFireball(net.minecraft.world.entity.projectile.SmallFireball) LargeFireball(net.minecraft.world.entity.projectile.LargeFireball)

Aggregations

LargeFireball (net.minecraft.world.entity.projectile.LargeFireball)5 SmallFireball (net.minecraft.world.entity.projectile.SmallFireball)2 Vec3 (net.minecraft.world.phys.Vec3)2 LivingEntity (net.minecraft.world.entity.LivingEntity)1 Level (net.minecraft.world.level.Level)1