Search in sources :

Example 1 with SpawnStopParticles

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

the class EntityStopra method onUpdate.

@Override
public void onUpdate() {
    if (player == null)
        return;
    int rotation = 0;
    if (!world.isRemote)
        PacketDispatcher.sendToAllAround(new SpawnStopParticles(this, 2), player, 64.0D);
    this.rotationYaw = (rotation + 1) % 360;
    if (ticksExisted > TICKS)
        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(DISTANCE, DISTANCE, DISTANCE);
    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 EntityLiving) {
                if (ticksExisted < TICKS) {
                    ((EntityLivingBase) e).motionX = 0;
                    ((EntityLivingBase) e).motionY = 0;
                    ((EntityLivingBase) e).motionZ = 0;
                }
            }
            if (e instanceof EntityPlayerMP) {
                ((EntityPlayerMP) e).getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).setBaseValue(0D);
            }
        }
    }
    aabb.grow(-DISTANCE, -DISTANCE, -DISTANCE);
    super.onUpdate();
}
Also used : AxisAlignedBB(net.minecraft.util.math.AxisAlignedBB) Entity(net.minecraft.entity.Entity) EntityLiving(net.minecraft.entity.EntityLiving) SpawnStopParticles(uk.co.wehavecookies56.kk.common.network.packet.client.SpawnStopParticles) List(java.util.List) EntityPlayerMP(net.minecraft.entity.player.EntityPlayerMP)

Example 2 with SpawnStopParticles

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

the class EntityStop method onUpdate.

@Override
public void onUpdate() {
    if (player == null)
        return;
    int rotation = 0;
    if (!world.isRemote)
        PacketDispatcher.sendToAllAround(new SpawnStopParticles(this, 1), player, 64.0D);
    this.rotationYaw = (rotation + 1) % 360;
    if (ticksExisted > TICKS)
        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(DISTANCE, DISTANCE, DISTANCE);
    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 EntityLiving) {
                if (ticksExisted < TICKS) {
                    ((EntityLivingBase) e).motionX = 0;
                    ((EntityLivingBase) e).motionY = 0;
                    ((EntityLivingBase) e).motionZ = 0;
                }
            }
            if (e instanceof EntityPlayerMP) {
                ((EntityPlayerMP) e).getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).setBaseValue(0D);
            }
        /*if (!world.isRemote) {
                    if (ticksExisted < 50) {
                        ((EntityPlayerMP) player).connection.sendPacket(new SPacketEntityVelocity(e.getEntityId(), 0, 0, 0));
                    }
                }*/
        }
    }
    aabb.grow(-DISTANCE, -DISTANCE, -DISTANCE);
    super.onUpdate();
}
Also used : AxisAlignedBB(net.minecraft.util.math.AxisAlignedBB) Entity(net.minecraft.entity.Entity) EntityLiving(net.minecraft.entity.EntityLiving) SpawnStopParticles(uk.co.wehavecookies56.kk.common.network.packet.client.SpawnStopParticles) List(java.util.List) EntityPlayerMP(net.minecraft.entity.player.EntityPlayerMP)

Example 3 with SpawnStopParticles

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

the class EntityStopga method onUpdate.

@Override
public void onUpdate() {
    if (player == null)
        return;
    int rotation = 0;
    if (!world.isRemote)
        PacketDispatcher.sendToAllAround(new SpawnStopParticles(this, 3), player, 64.0D);
    this.rotationYaw = (rotation + 1) % 360;
    if (ticksExisted > TICKS)
        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(DISTANCE, DISTANCE, DISTANCE);
    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 EntityLiving) {
                if (ticksExisted < TICKS) {
                    ((EntityLivingBase) e).motionX = 0;
                    ((EntityLivingBase) e).motionY = 0;
                    ((EntityLivingBase) e).motionZ = 0;
                }
            }
            if (e instanceof EntityPlayerMP) {
                ((EntityPlayerMP) e).getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).setBaseValue(0D);
            }
        }
    }
    aabb.grow(-DISTANCE, -DISTANCE, -DISTANCE);
    super.onUpdate();
}
Also used : AxisAlignedBB(net.minecraft.util.math.AxisAlignedBB) Entity(net.minecraft.entity.Entity) EntityLiving(net.minecraft.entity.EntityLiving) SpawnStopParticles(uk.co.wehavecookies56.kk.common.network.packet.client.SpawnStopParticles) List(java.util.List) EntityPlayerMP(net.minecraft.entity.player.EntityPlayerMP)

Example 4 with SpawnStopParticles

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

the class MagicStop 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_Stop)) {
            case 1:
                world.spawnEntity(new EntityStop(world, player, player.posX, player.posY, player.posZ));
                PacketDispatcher.sendToAllAround(new SpawnStopParticles(player, 1), player, 64.0D);
                break;
            case 2:
                world.spawnEntity(new EntityStopra(world, player, player.posX, player.posY, player.posZ));
                PacketDispatcher.sendToAllAround(new SpawnStopParticles(player, 2), player, 64.0D);
                break;
            case 3:
                world.spawnEntity(new EntityStopga(world, player, player.posX, player.posY, player.posZ));
                PacketDispatcher.sendToAllAround(new SpawnStopParticles(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 : SpawnStopParticles(uk.co.wehavecookies56.kk.common.network.packet.client.SpawnStopParticles) EntityStopra(uk.co.wehavecookies56.kk.common.entity.magic.EntityStopra) EntityStop(uk.co.wehavecookies56.kk.common.entity.magic.EntityStop) SyncMagicData(uk.co.wehavecookies56.kk.common.network.packet.client.SyncMagicData) World(net.minecraft.world.World) EntityStopga(uk.co.wehavecookies56.kk.common.entity.magic.EntityStopga)

Aggregations

SpawnStopParticles (uk.co.wehavecookies56.kk.common.network.packet.client.SpawnStopParticles)4 List (java.util.List)3 Entity (net.minecraft.entity.Entity)3 EntityLiving (net.minecraft.entity.EntityLiving)3 EntityPlayerMP (net.minecraft.entity.player.EntityPlayerMP)3 AxisAlignedBB (net.minecraft.util.math.AxisAlignedBB)3 World (net.minecraft.world.World)1 EntityStop (uk.co.wehavecookies56.kk.common.entity.magic.EntityStop)1 EntityStopga (uk.co.wehavecookies56.kk.common.entity.magic.EntityStopga)1 EntityStopra (uk.co.wehavecookies56.kk.common.entity.magic.EntityStopra)1 SyncMagicData (uk.co.wehavecookies56.kk.common.network.packet.client.SyncMagicData)1