Search in sources :

Example 1 with EntityBlizzard

use of uk.co.wehavecookies56.kk.common.entity.magic.EntityBlizzard in project Kingdom-Keys-Re-Coded by Wehavecookies56.

the class EntityAIBlueRhapsody method shouldContinueExecuting.

@Override
public boolean shouldContinueExecuting() {
    if (this.taskOwner.getAttackTarget() != null && this.taskOwner.getDistanceSqToEntity(this.taskOwner.getAttackTarget()) < MAX_DISTANCE_FOR_SPECIALATTACK) {
        /*if(this.taskOwner.getDistanceSqToEntity(this.taskOwner.getAttackTarget()) < 12)
            {
                EntityHelper.setAnimation(this.taskOwner, 1);
            }*/
        if (ticksBeforeNextBlizzard <= 0) {
            double d0 = this.taskOwner.getDistanceSqToEntity(this.taskOwner.getAttackTarget());
            float f = MathHelper.sqrt(MathHelper.sqrt(d0));
            double d1 = this.taskOwner.getAttackTarget().posX - this.taskOwner.posX;
            double d2 = this.taskOwner.getAttackTarget().getEntityBoundingBox().minY + (double) (this.taskOwner.getAttackTarget().height / 2.0F) - (this.taskOwner.posY + (double) (this.taskOwner.height / 2.0F));
            double d3 = this.taskOwner.getAttackTarget().posZ - this.taskOwner.posZ;
            EntityBlizzard esfb = new EntityBlizzard(this.taskOwner.world, this.taskOwner);
            this.taskOwner.world.playSound(null, this.taskOwner.posX, this.taskOwner.posY, this.taskOwner.posZ, SoundEvents.ENTITY_GHAST_SHOOT, SoundCategory.HOSTILE, 1.0F, 1.0F);
            esfb.setThrowableHeading(d1, d2, d3, 1, 0);
            esfb.posY = this.taskOwner.posY + (double) (this.taskOwner.height / 2.0F) + 0.5D;
            this.taskOwner.world.spawnEntity(esfb);
            ticksBeforeNextBlizzard = 30 + this.taskOwner.getRNG().nextInt(10);
        } else {
            ticksBeforeNextBlizzard--;
        }
        return true;
    }
    return false;
}
Also used : EntityBlizzard(uk.co.wehavecookies56.kk.common.entity.magic.EntityBlizzard)

Example 2 with EntityBlizzard

use of uk.co.wehavecookies56.kk.common.entity.magic.EntityBlizzard in project Kingdom-Keys-Re-Coded by Wehavecookies56.

the class MagicBlizzard method process.

@Override
public void process(EntityPlayer player, Side side) {
    if (!player.getCapability(ModCapabilities.CHEAT_MODE, null).getCheatMode())
        player.getCapability(ModCapabilities.PLAYER_STATS, null).remMP(Constants.getCost(Strings.Spell_Blizzard));
    World world = player.world;
    switch(player.getCapability(ModCapabilities.MAGIC_STATE, null).getMagicLevel(Strings.Spell_Blizzard)) {
        case 1:
            EntityBlizzard entityBlizzard = new EntityBlizzard(world, player);
            world.spawnEntity(entityBlizzard);
            entityBlizzard.setHeadingFromThrower(player, player.rotationPitch, player.rotationYaw, 0, 1, 0);
            // PacketDispatcher.sendToAllAround(new SpawnBlizzardParticles(new EntityBlizzard(world), 1), player, 64.0D);
            break;
        case 2:
            EntityBlizzara entityBlizzara = new EntityBlizzara(world, player);
            world.spawnEntity(entityBlizzara);
            entityBlizzara.setHeadingFromThrower(player, player.rotationPitch, player.rotationYaw, 0, 2, 0);
            // PacketDispatcher.sendToAllAround(new SpawnBlizzardParticles(new EntityBlizzara(world), 2), player, 64.0D);
            break;
        case 3:
            EntityBlizzaga entityBlizzaga = new EntityBlizzaga(world, player);
            world.spawnEntity(entityBlizzaga);
            entityBlizzaga.setHeadingFromThrower(player, player.rotationPitch, player.rotationYaw, 0, 3, 0);
            // PacketDispatcher.sendToAllAround(new SpawnBlizzardParticles(new EntityBlizzaga(world), 3), player, 64.0D);
            break;
    }
    world.playSound(player.posX, player.posY, player.posZ, SoundEvents.BLOCK_GLASS_BREAK, SoundCategory.PLAYERS, 1, 1, false);
    PacketDispatcher.sendTo(new SyncMagicData(player.getCapability(ModCapabilities.MAGIC_STATE, null), player.getCapability(ModCapabilities.PLAYER_STATS, null)), (EntityPlayerMP) player);
}
Also used : EntityBlizzaga(uk.co.wehavecookies56.kk.common.entity.magic.EntityBlizzaga) SyncMagicData(uk.co.wehavecookies56.kk.common.network.packet.client.SyncMagicData) World(net.minecraft.world.World) EntityBlizzard(uk.co.wehavecookies56.kk.common.entity.magic.EntityBlizzard) EntityBlizzara(uk.co.wehavecookies56.kk.common.entity.magic.EntityBlizzara)

Aggregations

EntityBlizzard (uk.co.wehavecookies56.kk.common.entity.magic.EntityBlizzard)2 World (net.minecraft.world.World)1 EntityBlizzaga (uk.co.wehavecookies56.kk.common.entity.magic.EntityBlizzaga)1 EntityBlizzara (uk.co.wehavecookies56.kk.common.entity.magic.EntityBlizzara)1 SyncMagicData (uk.co.wehavecookies56.kk.common.network.packet.client.SyncMagicData)1