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);
}
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);
}
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);
}
}
}
}
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);
}
}
}
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);
}
}
}
Aggregations