Search in sources :

Example 1 with EntityThunder

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

the class MagicThunder 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_Thunder));
    World world = player.world;
    if (!world.isRemote)
        switch(player.getCapability(ModCapabilities.MAGIC_STATE, null).getMagicLevel(Strings.Spell_Thunder)) {
            case 1:
                world.spawnEntity(new EntityThunder(world, player, player.posX, player.posY, player.posZ));
                PacketDispatcher.sendToAllAround(new SpawnThunderParticles(player, 1), player, 64.0D);
                break;
            case 2:
                world.spawnEntity(new EntityThundara(world, player, player.posX, player.posY, player.posZ));
                PacketDispatcher.sendToAllAround(new SpawnThunderParticles(player, 2), player, 64.0D);
                break;
            case 3:
                world.spawnEntity(new EntityThundaga(world, player, player.posX, player.posY, player.posZ));
                PacketDispatcher.sendToAllAround(new SpawnThunderParticles(player, 3), player, 64.0D);
                break;
        }
    PacketDispatcher.sendTo(new SyncMagicData(player.getCapability(ModCapabilities.MAGIC_STATE, null), player.getCapability(ModCapabilities.PLAYER_STATS, null)), (EntityPlayerMP) player);
}
Also used : EntityThundara(uk.co.wehavecookies56.kk.common.entity.magic.EntityThundara) SpawnThunderParticles(uk.co.wehavecookies56.kk.common.network.packet.client.SpawnThunderParticles) EntityThundaga(uk.co.wehavecookies56.kk.common.entity.magic.EntityThundaga) SyncMagicData(uk.co.wehavecookies56.kk.common.network.packet.client.SyncMagicData) World(net.minecraft.world.World) EntityThunder(uk.co.wehavecookies56.kk.common.entity.magic.EntityThunder)

Example 2 with EntityThunder

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

the class EntityAIYellowOpera method shouldContinueExecuting.

@Override
public boolean shouldContinueExecuting() {
    if (this.taskOwner.getAttackTarget() != null && this.taskOwner.getDistanceSqToEntity(this.taskOwner.getAttackTarget()) < MAX_DISTANCE) {
        /*if(this.taskOwner.getDistanceSqToEntity(this.taskOwner.getAttackTarget()) < 12)
            {
                EntityHelper.setAnimation(this.taskOwner, 1);
            }*/
        if (ticksBeforeNextFlame <= 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;
            EntityThunder esfb = new EntityThunder(this.taskOwner.world, this.taskOwner, this.taskOwner.posX, this.taskOwner.posY, this.taskOwner.posZ);
            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.posY = this.taskOwner.posY + (double) (this.taskOwner.height / 2.0F) + 0.5D;
            this.taskOwner.world.spawnEntity(esfb);
            ticksBeforeNextFlame = 30 + this.taskOwner.getRNG().nextInt(10);
        } else {
            ticksBeforeNextFlame--;
        }
        return true;
    }
    return false;
}
Also used : EntityThunder(uk.co.wehavecookies56.kk.common.entity.magic.EntityThunder)

Aggregations

EntityThunder (uk.co.wehavecookies56.kk.common.entity.magic.EntityThunder)2 World (net.minecraft.world.World)1 EntityThundaga (uk.co.wehavecookies56.kk.common.entity.magic.EntityThundaga)1 EntityThundara (uk.co.wehavecookies56.kk.common.entity.magic.EntityThundara)1 SpawnThunderParticles (uk.co.wehavecookies56.kk.common.network.packet.client.SpawnThunderParticles)1 SyncMagicData (uk.co.wehavecookies56.kk.common.network.packet.client.SyncMagicData)1