Search in sources :

Example 1 with SyncMagicData

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

the class MagicFire 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_Fire));
    World world = player.world;
    switch(player.getCapability(ModCapabilities.MAGIC_STATE, null).getMagicLevel(Strings.Spell_Fire)) {
        case 1:
            world.spawnEntity(new EntityFire(world, player, player.posX, player.posY, player.posZ));
            break;
        case 2:
            world.spawnEntity(new EntityFira(world, player, player.posX, player.posY, player.posZ));
            break;
        case 3:
            world.spawnEntity(new EntityFiraga(world, player, player.posX, player.posY, player.posZ));
            break;
    }
    PacketDispatcher.sendTo(new SyncMagicData(player.getCapability(ModCapabilities.MAGIC_STATE, null), player.getCapability(ModCapabilities.PLAYER_STATS, null)), (EntityPlayerMP) player);
}
Also used : EntityFira(uk.co.wehavecookies56.kk.common.entity.magic.EntityFira) EntityFiraga(uk.co.wehavecookies56.kk.common.entity.magic.EntityFiraga) SyncMagicData(uk.co.wehavecookies56.kk.common.network.packet.client.SyncMagicData) World(net.minecraft.world.World) EntityFire(uk.co.wehavecookies56.kk.common.entity.magic.EntityFire)

Example 2 with SyncMagicData

use of uk.co.wehavecookies56.kk.common.network.packet.client.SyncMagicData 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 3 with SyncMagicData

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

the class OrgPortal method process.

@Override
public void process(EntityPlayer player, Side side) {
    if (!player.getCapability(ModCapabilities.CHEAT_MODE, null).getCheatMode())
        player.getCapability(ModCapabilities.PLAYER_STATS, null).setMP(0);
    PacketDispatcher.sendToAllAround(new SpawnPortalParticles(pos), player, 64.0D);
    EntityOrgPortal portal = new EntityOrgPortal(player.world, player, pos, destPos, dimension, true);
    player.world.spawnEntity(portal);
    EntityOrgPortal destPortal = new EntityOrgPortal(player.world, player, destPos, destPos, dimension, false);
    player.world.spawnEntity(destPortal);
    PacketDispatcher.sendToAll(new SyncOrgPortal(pos, destPos, dimension));
    PacketDispatcher.sendTo(new SyncMagicData(player.getCapability(ModCapabilities.MAGIC_STATE, null), player.getCapability(ModCapabilities.PLAYER_STATS, null)), (EntityPlayerMP) player);
}
Also used : SpawnPortalParticles(uk.co.wehavecookies56.kk.common.network.packet.client.SpawnPortalParticles) EntityOrgPortal(uk.co.wehavecookies56.kk.common.entity.magic.EntityOrgPortal) SyncMagicData(uk.co.wehavecookies56.kk.common.network.packet.client.SyncMagicData) SyncOrgPortal(uk.co.wehavecookies56.kk.common.network.packet.client.SyncOrgPortal)

Example 4 with SyncMagicData

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

the class OpenMenu method process.

@Override
public void process(EntityPlayer player, Side side) {
    PacketDispatcher.sendTo(new SyncMunnyData(player.getCapability(ModCapabilities.MUNNY, null)), (EntityPlayerMP) player);
    PacketDispatcher.sendTo(new SyncMagicData(player.getCapability(ModCapabilities.MAGIC_STATE, null), player.getCapability(ModCapabilities.PLAYER_STATS, null)), (EntityPlayerMP) player);
    PacketDispatcher.sendTo(new SyncDriveData(player.getCapability(ModCapabilities.DRIVE_STATE, null)), (EntityPlayerMP) player);
    PacketDispatcher.sendTo(new SyncLevelData(player.getCapability(ModCapabilities.PLAYER_STATS, null)), (EntityPlayerMP) player);
}
Also used : SyncDriveData(uk.co.wehavecookies56.kk.common.network.packet.client.SyncDriveData) SyncLevelData(uk.co.wehavecookies56.kk.common.network.packet.client.SyncLevelData) SyncMunnyData(uk.co.wehavecookies56.kk.common.network.packet.client.SyncMunnyData) SyncMagicData(uk.co.wehavecookies56.kk.common.network.packet.client.SyncMagicData)

Example 5 with SyncMagicData

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

the class BlockSavePoint method updateState.

private void updateState(World world, BlockPos pos) {
    List list = world.getEntitiesWithinAABBExcludingEntity((Entity) null, new AxisAlignedBB(pos.add(0, 0, 0), pos.add(1, 1, 1)));
    if (!list.isEmpty())
        for (int i = 0; i < list.size(); i++) {
            Entity e = (Entity) list.get(i);
            if (e instanceof EntityPlayer) {
                EntityPlayer player = (EntityPlayer) e;
                IPlayerStats STATS = player.getCapability(ModCapabilities.PLAYER_STATS, null);
                // System.out.println(player.getBedLocation());
                // System.out.println(pos.getX());
                boolean samePos;
                BlockPos bedPos;
                if (player.getBedLocation() == null) {
                    IFirstTimeJoin originalPos = player.getCapability(ModCapabilities.FIRST_TIME_JOIN, null);
                    bedPos = new BlockPos(originalPos.getPosX(), originalPos.getPosY(), originalPos.getPosZ());
                } else {
                    bedPos = player.getBedLocation();
                }
                samePos = bedPos.getX() == pos.getX() && bedPos.getY() == pos.getY() && bedPos.getZ() == pos.getZ();
                if (player.isSneaking() && !samePos) {
                    player.setSpawnChunk(pos, true, 0);
                    player.setSpawnPoint(pos, true);
                    TextHelper.sendFormattedChatMessage("Spawn point saved!", TextFormatting.GREEN, player);
                    world.playSound((EntityPlayer) null, player.getPosition(), ModSounds.savespawn, SoundCategory.BLOCKS, 1.0f, 1.0f);
                }
                if (player.getHealth() < player.getMaxHealth() || STATS.getMP() < STATS.getMaxMP()) {
                    player.heal(1);
                    STATS.addMP(2);
                    if (player.getFoodStats().getFoodLevel() < 20)
                        player.getFoodStats().addStats(4, 0);
                    if (timeHealed + 1 <= (int) Minecraft.getSystemTime() / 1000) {
                        world.playSound((EntityPlayer) null, player.getPosition(), ModSounds.savepoint, SoundCategory.BLOCKS, 1.0f, 1.0f);
                        PacketDispatcher.sendToAllAround(new SpawnCureParticles(pos, true), player, 64.0D);
                    }
                    PacketDispatcher.sendTo(new SyncMagicData(player.getCapability(ModCapabilities.MAGIC_STATE, null), STATS), (EntityPlayerMP) player);
                }
            }
        }
    world.scheduleUpdate(new BlockPos(pos), this, this.tickRate(world));
}
Also used : AxisAlignedBB(net.minecraft.util.math.AxisAlignedBB) SpawnCureParticles(uk.co.wehavecookies56.kk.common.network.packet.client.SpawnCureParticles) Entity(net.minecraft.entity.Entity) IFirstTimeJoin(uk.co.wehavecookies56.kk.common.capability.FirstTimeJoinCapability.IFirstTimeJoin) IPlayerStats(uk.co.wehavecookies56.kk.common.capability.PlayerStatsCapability.IPlayerStats) EntityPlayer(net.minecraft.entity.player.EntityPlayer) List(java.util.List) BlockPos(net.minecraft.util.math.BlockPos) EntityPlayerMP(net.minecraft.entity.player.EntityPlayerMP) SyncMagicData(uk.co.wehavecookies56.kk.common.network.packet.client.SyncMagicData)

Aggregations

SyncMagicData (uk.co.wehavecookies56.kk.common.network.packet.client.SyncMagicData)14 World (net.minecraft.world.World)7 EntityPlayer (net.minecraft.entity.player.EntityPlayer)4 EntityPlayerMP (net.minecraft.entity.player.EntityPlayerMP)4 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)3 IPlayerStats (uk.co.wehavecookies56.kk.common.capability.PlayerStatsCapability.IPlayerStats)3 SyncDriveData (uk.co.wehavecookies56.kk.common.network.packet.client.SyncDriveData)3 SyncLevelData (uk.co.wehavecookies56.kk.common.network.packet.client.SyncLevelData)3 Entity (net.minecraft.entity.Entity)2 TextComponentTranslation (net.minecraft.util.text.TextComponentTranslation)2 MunnyCapability (uk.co.wehavecookies56.kk.common.capability.MunnyCapability)2 SyncDriveInventory (uk.co.wehavecookies56.kk.common.network.packet.client.SyncDriveInventory)2 SyncMagicInventory (uk.co.wehavecookies56.kk.common.network.packet.client.SyncMagicInventory)2 GameProfile (com.mojang.authlib.GameProfile)1 List (java.util.List)1 UUID (java.util.UUID)1 EntityDragon (net.minecraft.entity.boss.EntityDragon)1 EntityWither (net.minecraft.entity.boss.EntityWither)1 EntityMob (net.minecraft.entity.monster.EntityMob)1 ItemStack (net.minecraft.item.ItemStack)1