Search in sources :

Example 1 with SpawnAeroParticles

use of uk.co.wehavecookies56.kk.common.network.packet.client.SpawnAeroParticles in project Kingdom-Keys-Re-Coded by Wehavecookies56.

the class EntityAero method onUpdate.

@Override
public void onUpdate() {
    if (player == null)
        return;
    int rotation = 0;
    if (!world.isRemote)
        PacketDispatcher.sendToAllAround(new SpawnAeroParticles(this, 1), player, 64.0D);
    double r = 1.5D;
    for (int a = 1; a <= 360; a += 15) {
        double x = this.posX + (r * Math.cos(Math.toRadians(a)));
        double z = this.posZ + (r * Math.sin(Math.toRadians(a)));
        this.world.spawnParticle(EnumParticleTypes.EXPLOSION_NORMAL, x, this.posY, z, 0.0D, 0.5D, 0.0D);
    }
    this.rotationYaw = (rotation + 1) % 360;
    if (ticksExisted > 30)
        setDead();
    if (ticksExisted < 10)
        player.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).setBaseValue(0D);
    else
        player.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).setBaseValue(0.10000000149011612D);
    AxisAlignedBB aabb = player.getEntityBoundingBox().grow(2, 2, 2);
    List list = this.world.getEntitiesWithinAABBExcludingEntity(player, aabb);
    if (!list.isEmpty())
        for (int i = 0; i < list.size(); i++) {
            Entity e = (Entity) list.get(i);
            if (e instanceof EntityLivingBase) {
                e.attackEntityFrom(DamageSource.causePlayerDamage(player), DamageCalculation.getMagicDamage(player, 1) * DamageCalculation.aeroMultiplier);
                double d = e.posX - posX;
                double d1;
                for (d1 = e.posZ - posZ; d * d + d1 * d1 < 0.0001D; d1 = (Math.random() - Math.random()) * 0.01D) d = (Math.random() - Math.random()) * 0.01D;
                ((EntityLivingBase) e).knockBack(e, 1, d, d1);
                e.motionY *= 1.2;
            }
        }
    aabb.grow(-2, -2, -2);
    super.onUpdate();
}
Also used : AxisAlignedBB(net.minecraft.util.math.AxisAlignedBB) Entity(net.minecraft.entity.Entity) EntityLivingBase(net.minecraft.entity.EntityLivingBase) SpawnAeroParticles(uk.co.wehavecookies56.kk.common.network.packet.client.SpawnAeroParticles) List(java.util.List)

Example 2 with SpawnAeroParticles

use of uk.co.wehavecookies56.kk.common.network.packet.client.SpawnAeroParticles in project Kingdom-Keys-Re-Coded by Wehavecookies56.

the class EntityAeroga method onUpdate.

@Override
public void onUpdate() {
    if (player == null)
        return;
    int rotation = 0;
    if (!world.isRemote)
        PacketDispatcher.sendToAllAround(new SpawnAeroParticles(this, 3), player, 64.0D);
    double r = 4D;
    for (int a = 1; a <= 360; a += 15) {
        double x = this.posX + (r * Math.cos(Math.toRadians(a)));
        double z = this.posZ + (r * Math.sin(Math.toRadians(a)));
        this.world.spawnParticle(EnumParticleTypes.EXPLOSION_NORMAL, x, this.posY, z, 0.0D, 0.5D, 0.0D);
    }
    this.rotationYaw = (rotation + 1) % 360;
    if (ticksExisted > 30)
        setDead();
    if (ticksExisted < 10)
        player.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).setBaseValue(0D);
    else
        player.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).setBaseValue(0.10000000149011612D);
    AxisAlignedBB aabb = player.getEntityBoundingBox().grow(r, r, r);
    List list = this.world.getEntitiesWithinAABBExcludingEntity(player, aabb);
    if (!list.isEmpty())
        for (int i = 0; i < list.size(); i++) {
            Entity e = (Entity) list.get(i);
            if (e instanceof EntityLivingBase) {
                e.attackEntityFrom(DamageSource.causePlayerDamage(player), DamageCalculation.getMagicDamage(player, 3) * DamageCalculation.aeroMultiplier);
                double d = e.posX - posX;
                double d1;
                for (d1 = e.posZ - posZ; d * d + d1 * d1 < 0.0001D; d1 = (Math.random() - Math.random()) * 0.01D) d = (Math.random() - Math.random()) * 0.01D;
                ((EntityLivingBase) e).knockBack(e, 1, d, d1);
                e.motionY *= 1.2;
            }
        }
    aabb.grow(-r, -r, -r);
    super.onUpdate();
}
Also used : AxisAlignedBB(net.minecraft.util.math.AxisAlignedBB) Entity(net.minecraft.entity.Entity) EntityLivingBase(net.minecraft.entity.EntityLivingBase) SpawnAeroParticles(uk.co.wehavecookies56.kk.common.network.packet.client.SpawnAeroParticles) List(java.util.List)

Example 3 with SpawnAeroParticles

use of uk.co.wehavecookies56.kk.common.network.packet.client.SpawnAeroParticles in project Kingdom-Keys-Re-Coded by Wehavecookies56.

the class EntityAerora method onUpdate.

@Override
public void onUpdate() {
    if (player == null)
        return;
    int rotation = 0;
    if (!world.isRemote)
        PacketDispatcher.sendToAllAround(new SpawnAeroParticles(this, 3), player, 64.0D);
    double r = 3D;
    for (int a = 1; a <= 360; a += 15) {
        double x = this.posX + (r * Math.cos(Math.toRadians(a)));
        double z = this.posZ + (r * Math.sin(Math.toRadians(a)));
        this.world.spawnParticle(EnumParticleTypes.EXPLOSION_NORMAL, x, this.posY, z, 0.0D, 0.5D, 0.0D);
    }
    this.rotationYaw = (rotation + 1) % 360;
    if (ticksExisted > 30)
        setDead();
    if (ticksExisted < 10)
        player.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).setBaseValue(0D);
    else
        player.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).setBaseValue(0.10000000149011612D);
    AxisAlignedBB aabb = player.getEntityBoundingBox().grow(r, r, r);
    List list = this.world.getEntitiesWithinAABBExcludingEntity(player, aabb);
    if (!list.isEmpty())
        for (int i = 0; i < list.size(); i++) {
            Entity e = (Entity) list.get(i);
            if (e instanceof EntityLivingBase) {
                e.attackEntityFrom(DamageSource.causePlayerDamage(player), DamageCalculation.getMagicDamage(player, 3) * DamageCalculation.aeroMultiplier);
                double d = e.posX - posX;
                double d1;
                for (d1 = e.posZ - posZ; d * d + d1 * d1 < 0.0001D; d1 = (Math.random() - Math.random()) * 0.01D) d = (Math.random() - Math.random()) * 0.01D;
                ((EntityLivingBase) e).knockBack(e, 1, d, d1);
                e.motionY *= 1.2;
            }
        }
    aabb.grow(-r, -r, -r);
    super.onUpdate();
}
Also used : AxisAlignedBB(net.minecraft.util.math.AxisAlignedBB) Entity(net.minecraft.entity.Entity) EntityLivingBase(net.minecraft.entity.EntityLivingBase) SpawnAeroParticles(uk.co.wehavecookies56.kk.common.network.packet.client.SpawnAeroParticles) List(java.util.List)

Example 4 with SpawnAeroParticles

use of uk.co.wehavecookies56.kk.common.network.packet.client.SpawnAeroParticles in project Kingdom-Keys-Re-Coded by Wehavecookies56.

the class MagicAero 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_Aero));
    World world = player.world;
    if (!world.isRemote) {
        switch(player.getCapability(ModCapabilities.MAGIC_STATE, null).getMagicLevel(Strings.Spell_Aero)) {
            case 1:
                world.spawnEntity(new EntityAero(world, player, player.posX, player.posY, player.posZ));
                PacketDispatcher.sendToAllAround(new SpawnAeroParticles(player, 1), player, 64.0D);
                break;
            case 2:
                world.spawnEntity(new EntityAerora(world, player, player.posX, player.posY, player.posZ));
                PacketDispatcher.sendToAllAround(new SpawnAeroParticles(player, 2), player, 64.0D);
                break;
            case 3:
                world.spawnEntity(new EntityAeroga(world, player, player.posX, player.posY, player.posZ));
                PacketDispatcher.sendToAllAround(new SpawnAeroParticles(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 : EntityAero(uk.co.wehavecookies56.kk.common.entity.magic.EntityAero) EntityAeroga(uk.co.wehavecookies56.kk.common.entity.magic.EntityAeroga) SpawnAeroParticles(uk.co.wehavecookies56.kk.common.network.packet.client.SpawnAeroParticles) EntityAerora(uk.co.wehavecookies56.kk.common.entity.magic.EntityAerora) SyncMagicData(uk.co.wehavecookies56.kk.common.network.packet.client.SyncMagicData) World(net.minecraft.world.World)

Aggregations

SpawnAeroParticles (uk.co.wehavecookies56.kk.common.network.packet.client.SpawnAeroParticles)4 List (java.util.List)3 Entity (net.minecraft.entity.Entity)3 EntityLivingBase (net.minecraft.entity.EntityLivingBase)3 AxisAlignedBB (net.minecraft.util.math.AxisAlignedBB)3 World (net.minecraft.world.World)1 EntityAero (uk.co.wehavecookies56.kk.common.entity.magic.EntityAero)1 EntityAeroga (uk.co.wehavecookies56.kk.common.entity.magic.EntityAeroga)1 EntityAerora (uk.co.wehavecookies56.kk.common.entity.magic.EntityAerora)1 SyncMagicData (uk.co.wehavecookies56.kk.common.network.packet.client.SyncMagicData)1