Search in sources :

Example 1 with WitherSkullEntity

use of net.minecraft.entity.projectile.WitherSkullEntity in project Enigmatic-Legacy by Aizistral-Studios.

the class AngelBlessing method redirect.

public void redirect(LivingEntity bearer, Entity redirected) {
    if (redirected instanceof UltimateWitherSkullEntity || redirected instanceof WitherSkullEntity)
        return;
    /*if (redirected instanceof TridentEntity)
	 	 if (((TridentEntity)redirected).getShooter() == bearer)
	 		 return;*/
    Vector3 entityPos = Vector3.fromEntityCenter(redirected);
    Vector3 bearerPos = Vector3.fromEntityCenter(bearer);
    Vector3 redirection = entityPos.subtract(bearerPos);
    redirection = redirection.normalize();
    if (redirected instanceof AbstractArrowEntity && ((AbstractArrowEntity) redirected).getShooter() == bearer) {
        if (redirected instanceof TridentEntity) {
            TridentEntity trident = (TridentEntity) redirected;
            if (trident.returningTicks > 0)
                return;
        }
        redirected.setMotion(redirected.getMotion().x * 1.75D, redirected.getMotion().y * 1.75D, redirected.getMotion().z * 1.75D);
    } else
        redirected.setMotion(redirection.x, redirection.y, redirection.z);
    if (redirected instanceof DamagingProjectileEntity) {
        DamagingProjectileEntity redirectedProjectile = (DamagingProjectileEntity) redirected;
        redirectedProjectile.accelerationX = (redirection.x / 4.0);
        redirectedProjectile.accelerationY = (redirection.y / 4.0);
        redirectedProjectile.accelerationZ = (redirection.z / 4.0);
    }
}
Also used : UltimateWitherSkullEntity(com.integral.enigmaticlegacy.entities.UltimateWitherSkullEntity) DamagingProjectileEntity(net.minecraft.entity.projectile.DamagingProjectileEntity) Vector3(com.integral.enigmaticlegacy.helpers.Vector3) TridentEntity(net.minecraft.entity.projectile.TridentEntity) UltimateWitherSkullEntity(com.integral.enigmaticlegacy.entities.UltimateWitherSkullEntity) WitherSkullEntity(net.minecraft.entity.projectile.WitherSkullEntity) AbstractArrowEntity(net.minecraft.entity.projectile.AbstractArrowEntity)

Example 2 with WitherSkullEntity

use of net.minecraft.entity.projectile.WitherSkullEntity in project bewitchment by MoriyaShiine.

the class LilithEntity method tick.

@Override
public void tick() {
    super.tick();
    if (!world.isClient) {
        bossBar.setPercent(getHealth() / getMaxHealth());
        LivingEntity target = getTarget();
        int timer = age + getId();
        if (timer % 10 == 0) {
            heal(1);
        }
        if (target != null) {
            timeSinceLastAttack++;
            if (timeSinceLastAttack >= 600) {
                BWUtil.teleport(this, target.getX(), target.getY(), target.getZ(), true);
                timeSinceLastAttack = 0;
            }
            lookAtEntity(target, 360, 360);
            if (timer % 40 == 0) {
                for (int i = -1; i <= 1; i++) {
                    WitherSkullEntity witherSkull = new WitherSkullEntity(world, this, target.getX() - getX() + (i * 2), target.getBodyY(0.5) - getBodyY(0.5), target.getZ() - getZ() + (i * 2));
                    witherSkull.updatePosition(witherSkull.getX(), getBodyY(0.5), witherSkull.getZ());
                    witherSkull.setOwner(this);
                    world.playSound(null, getBlockPos(), SoundEvents.ENTITY_WITHER_SHOOT, getSoundCategory(), getSoundVolume(), getSoundPitch());
                    world.spawnEntity(witherSkull);
                }
                swingHand(Hand.MAIN_HAND);
            }
            if (timer % 600 == 0) {
                summonMinions(this);
            }
        } else {
            if (getY() > -64) {
                heal(8);
            }
            timeSinceLastAttack = 0;
        }
    }
}
Also used : LivingEntity(net.minecraft.entity.LivingEntity) WitherSkullEntity(net.minecraft.entity.projectile.WitherSkullEntity)

Example 3 with WitherSkullEntity

use of net.minecraft.entity.projectile.WitherSkullEntity in project Neutrino by FrostWizard4.

the class WitherlingEntity method shootSkullAt.

private void shootSkullAt(int headIndex, double targetX, double targetY, double targetZ, boolean charged) {
    if (!this.isSilent()) {
        this.world.syncWorldEvent((PlayerEntity) null, WorldEvents.WITHER_SHOOTS, this.getBlockPos(), 0);
    }
    double d = this.getHeadX(headIndex);
    double e = this.getHeadY(headIndex);
    double f = this.getHeadZ(headIndex);
    double g = targetX - d;
    double h = targetY - e;
    double i = targetZ - f;
    WitherSkullEntity witherSkullEntity = new WitherSkullEntity(this.world, this, g, h, i);
    witherSkullEntity.setOwner(this);
    if (charged) {
        witherSkullEntity.setCharged(true);
    }
    witherSkullEntity.setPos(d, e, f);
    this.world.spawnEntity(witherSkullEntity);
}
Also used : WitherSkullEntity(net.minecraft.entity.projectile.WitherSkullEntity)

Aggregations

WitherSkullEntity (net.minecraft.entity.projectile.WitherSkullEntity)3 UltimateWitherSkullEntity (com.integral.enigmaticlegacy.entities.UltimateWitherSkullEntity)1 Vector3 (com.integral.enigmaticlegacy.helpers.Vector3)1 LivingEntity (net.minecraft.entity.LivingEntity)1 AbstractArrowEntity (net.minecraft.entity.projectile.AbstractArrowEntity)1 DamagingProjectileEntity (net.minecraft.entity.projectile.DamagingProjectileEntity)1 TridentEntity (net.minecraft.entity.projectile.TridentEntity)1