Search in sources :

Example 1 with SyncDriveData

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

the class DriveForm method initDrive.

public void initDrive(EntityPlayer player) {
    String form = getName();
    if (!summonKeyblades(player)) {
        player.world.playSound(player, player.getPosition(), ModSounds.error, SoundCategory.MASTER, 1.0f, 1.0f);
        return;
    }
    player.getCapability(ModCapabilities.DRIVE_STATE, null).setActiveDriveName(getName());
    player.getCapability(ModCapabilities.DRIVE_STATE, null).setInDrive(true);
    player.getCapability(ModCapabilities.DRIVE_STATE, null).setFP(player.getCapability(ModCapabilities.DRIVE_STATE, null).getFormGaugeLevel(getName()) * 100);
    PacketDispatcher.sendTo(new SyncDriveData(player.getCapability(ModCapabilities.DRIVE_STATE, null)), (EntityPlayerMP) player);
    PacketDispatcher.sendToAllAround(new SpawnDriveFormParticles(player), player, 64.0D);
    player.world.playSound((EntityPlayer) null, player.getPosition(), ModSounds.drive, SoundCategory.MASTER, 1.0f, 1.0f);
}
Also used : SyncDriveData(uk.co.wehavecookies56.kk.common.network.packet.client.SyncDriveData) SpawnDriveFormParticles(uk.co.wehavecookies56.kk.common.network.packet.client.SpawnDriveFormParticles)

Example 2 with SyncDriveData

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

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

the class DriveFormFinal method getXP.

@SubscribeEvent
public static void getXP(LivingDeathEvent event) {
    if (!event.getEntity().world.isRemote && event.getEntity() instanceof EntityEnderman) {
        if (event.getSource().getTrueSource() instanceof EntityPlayer) {
            EntityPlayer player = (EntityPlayer) event.getSource().getTrueSource();
            IDriveState DRIVE = player.getCapability(ModCapabilities.DRIVE_STATE, null);
            if (DRIVE.getActiveDriveName().equals(Strings.Form_Final)) {
                DRIVE.setDriveExp(DRIVE.getActiveDriveName(), DRIVE.getDriveExp(DRIVE.getActiveDriveName()) + 1);
                int[] costs = DriveFormRegistry.get(DRIVE.getActiveDriveName()).getExpCosts();
                int actualLevel = DRIVE.getDriveLevel(DRIVE.getActiveDriveName());
                int actualExp = DRIVE.getDriveExp(DRIVE.getActiveDriveName());
                if (costs.length == 7 && actualLevel < 7) {
                    if (actualExp >= costs[actualLevel]) {
                        System.out.println("LEVEL UP");
                        DRIVE.setDriveLevel(DRIVE.getActiveDriveName(), actualLevel + 1);
                        DRIVE.displayLevelUpMessage(player, DRIVE.getActiveDriveName());
                    }
                }
                PacketDispatcher.sendTo(new SyncDriveData(DRIVE), (EntityPlayerMP) player);
            }
        }
    }
}
Also used : SyncDriveData(uk.co.wehavecookies56.kk.common.network.packet.client.SyncDriveData) EntityPlayer(net.minecraft.entity.player.EntityPlayer) EntityEnderman(net.minecraft.entity.monster.EntityEnderman) IDriveState(uk.co.wehavecookies56.kk.common.capability.DriveStateCapability.IDriveState) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

Example 4 with SyncDriveData

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

the class DriveFormLimit method getXP.

@SubscribeEvent
public static void getXP(LivingHurtEvent event) {
    if (event.getSource().getImmediateSource() instanceof EntityPlayer) {
        EntityPlayer player = (EntityPlayer) event.getSource().getImmediateSource();
        PlayerStatsCapability.IPlayerStats STATS = player.getCapability(ModCapabilities.PLAYER_STATS, null);
        DriveStateCapability.IDriveState DRIVE = player.getCapability(ModCapabilities.DRIVE_STATE, null);
        if (DRIVE.getActiveDriveName().equals(Strings.Form_Limit)) {
            DRIVE.setDriveExp(DRIVE.getActiveDriveName(), DRIVE.getDriveExp(DRIVE.getActiveDriveName()) + 1);
            int[] costs = DriveFormRegistry.get(DRIVE.getActiveDriveName()).getExpCosts();
            int actualLevel = DRIVE.getDriveLevel(DRIVE.getActiveDriveName());
            int actualExp = DRIVE.getDriveExp(DRIVE.getActiveDriveName());
            if (costs.length == 7 && actualLevel < 7) {
                if (actualExp >= costs[actualLevel]) {
                    System.out.println("LEVEL UP");
                    DRIVE.setDriveLevel(DRIVE.getActiveDriveName(), actualLevel + 1);
                    DRIVE.displayLevelUpMessage(player, DRIVE.getActiveDriveName());
                }
            }
            PacketDispatcher.sendTo(new SyncDriveData(DRIVE), (EntityPlayerMP) player);
        }
    }
}
Also used : SyncDriveData(uk.co.wehavecookies56.kk.common.network.packet.client.SyncDriveData) DriveStateCapability(uk.co.wehavecookies56.kk.common.capability.DriveStateCapability) PlayerStatsCapability(uk.co.wehavecookies56.kk.common.capability.PlayerStatsCapability) EntityPlayer(net.minecraft.entity.player.EntityPlayer) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

Example 5 with SyncDriveData

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

the class DriveFormValor method getXP.

@SubscribeEvent
public static void getXP(LivingHurtEvent event) {
    if (event.getSource().getImmediateSource() instanceof EntityPlayer) {
        EntityPlayer player = (EntityPlayer) event.getSource().getImmediateSource();
        PlayerStatsCapability.IPlayerStats STATS = player.getCapability(ModCapabilities.PLAYER_STATS, null);
        DriveStateCapability.IDriveState DRIVE = player.getCapability(ModCapabilities.DRIVE_STATE, null);
        if (DRIVE.getActiveDriveName().equals(Strings.Form_Valor)) {
            DRIVE.setDriveExp(DRIVE.getActiveDriveName(), DRIVE.getDriveExp(DRIVE.getActiveDriveName()) + 1);
            int[] costs = DriveFormRegistry.get(DRIVE.getActiveDriveName()).getExpCosts();
            int actualLevel = DRIVE.getDriveLevel(DRIVE.getActiveDriveName());
            int actualExp = DRIVE.getDriveExp(DRIVE.getActiveDriveName());
            if (costs.length == 7 && actualLevel < 7) {
                if (actualExp >= costs[actualLevel]) {
                    System.out.println("LEVEL UP");
                    DRIVE.setDriveLevel(DRIVE.getActiveDriveName(), actualLevel + 1);
                    DRIVE.displayLevelUpMessage(player, DRIVE.getActiveDriveName());
                }
            }
            PacketDispatcher.sendTo(new SyncDriveData(DRIVE), (EntityPlayerMP) player);
        }
    }
}
Also used : SyncDriveData(uk.co.wehavecookies56.kk.common.network.packet.client.SyncDriveData) DriveStateCapability(uk.co.wehavecookies56.kk.common.capability.DriveStateCapability) PlayerStatsCapability(uk.co.wehavecookies56.kk.common.capability.PlayerStatsCapability) EntityPlayer(net.minecraft.entity.player.EntityPlayer) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

Aggregations

SyncDriveData (uk.co.wehavecookies56.kk.common.network.packet.client.SyncDriveData)15 EntityPlayer (net.minecraft.entity.player.EntityPlayer)10 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)9 EntityPlayerMP (net.minecraft.entity.player.EntityPlayerMP)4 IDriveState (uk.co.wehavecookies56.kk.common.capability.DriveStateCapability.IDriveState)4 SyncLevelData (uk.co.wehavecookies56.kk.common.network.packet.client.SyncLevelData)4 TextComponentTranslation (net.minecraft.util.text.TextComponentTranslation)3 DriveStateCapability (uk.co.wehavecookies56.kk.common.capability.DriveStateCapability)3 PlayerStatsCapability (uk.co.wehavecookies56.kk.common.capability.PlayerStatsCapability)3 SyncDriveInventory (uk.co.wehavecookies56.kk.common.network.packet.client.SyncDriveInventory)3 SyncMagicData (uk.co.wehavecookies56.kk.common.network.packet.client.SyncMagicData)3 MunnyCapability (uk.co.wehavecookies56.kk.common.capability.MunnyCapability)2 IPlayerStats (uk.co.wehavecookies56.kk.common.capability.PlayerStatsCapability.IPlayerStats)2 IKHMob (uk.co.wehavecookies56.kk.common.entity.mobs.IKHMob)2 IOrgWeapon (uk.co.wehavecookies56.kk.common.item.org.IOrgWeapon)2 SyncKeybladeData (uk.co.wehavecookies56.kk.common.network.packet.client.SyncKeybladeData)2 SyncMunnyData (uk.co.wehavecookies56.kk.common.network.packet.client.SyncMunnyData)2 SyncOrgXIIIData (uk.co.wehavecookies56.kk.common.network.packet.client.SyncOrgXIIIData)2 GameProfile (com.mojang.authlib.GameProfile)1 UUID (java.util.UUID)1