Search in sources :

Example 1 with EntityCura

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

the class MagicCure 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);
    World world = player.world;
    player.extinguish();
    switch(player.getCapability(ModCapabilities.MAGIC_STATE, null).getMagicLevel(Strings.Spell_Cure)) {
        case 1:
            if (player.getCapability(ModCapabilities.PLAYER_STATS, null).getHP() / 3 + player.getHealth() > player.getCapability(ModCapabilities.PLAYER_STATS, null).getHP())
                player.heal(player.getCapability(ModCapabilities.PLAYER_STATS, null).getHP() - player.getHealth());
            else
                player.heal(player.getCapability(ModCapabilities.PLAYER_STATS, null).getHP() / 3);
            world.spawnEntity(new EntityCure(world, player, player.posX, player.posY, player.posZ));
            break;
        case 2:
            if (player.getCapability(ModCapabilities.PLAYER_STATS, null).getHP() / 3 * 2 + player.getHealth() > player.getCapability(ModCapabilities.PLAYER_STATS, null).getHP())
                player.heal(player.getCapability(ModCapabilities.PLAYER_STATS, null).getHP() - player.getHealth());
            else
                player.heal(player.getCapability(ModCapabilities.PLAYER_STATS, null).getHP() / 3 * 2);
            world.spawnEntity(new EntityCura(world, player, player.posX, player.posY, player.posZ));
            break;
        case 3:
            player.heal(player.getCapability(ModCapabilities.PLAYER_STATS, null).getHP() - player.getHealth());
            world.spawnEntity(new EntityCuraga(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 : EntityCura(uk.co.wehavecookies56.kk.common.entity.magic.EntityCura) EntityCuraga(uk.co.wehavecookies56.kk.common.entity.magic.EntityCuraga) SyncMagicData(uk.co.wehavecookies56.kk.common.network.packet.client.SyncMagicData) World(net.minecraft.world.World) EntityCure(uk.co.wehavecookies56.kk.common.entity.magic.EntityCure)

Aggregations

World (net.minecraft.world.World)1 EntityCura (uk.co.wehavecookies56.kk.common.entity.magic.EntityCura)1 EntityCuraga (uk.co.wehavecookies56.kk.common.entity.magic.EntityCuraga)1 EntityCure (uk.co.wehavecookies56.kk.common.entity.magic.EntityCure)1 SyncMagicData (uk.co.wehavecookies56.kk.common.network.packet.client.SyncMagicData)1