use of micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStats in project Galacticraft by micdoodle8.
the class GCPlayerHandler method onPlayerCloned.
// @SubscribeEvent
// public void onPlayerLogout(PlayerLoggedOutEvent event)
// {
// if (event.player instanceof EntityPlayerMP)
// {
// this.onPlayerLogout((EntityPlayerMP) event.player);
// }
// }
//
// @SubscribeEvent
// public void onPlayerRespawn(PlayerRespawnEvent event)
// {
// if (event.player instanceof EntityPlayerMP)
// {
// this.onPlayerRespawn((EntityPlayerMP) event.player);
// }
// }
@SubscribeEvent
public void onPlayerCloned(PlayerEvent.Clone event) {
GCPlayerStats oldStats = GCPlayerStats.get(event.getOriginal());
GCPlayerStats newStats = GCPlayerStats.get(event.getEntityPlayer());
newStats.copyFrom(oldStats, !event.isWasDeath() || event.getOriginal().world.getGameRules().getBoolean("keepInventory"));
if (event.getOriginal() instanceof EntityPlayerMP && event.getEntityPlayer() instanceof EntityPlayerMP) {
TileEntityTelemetry.updateLinkedPlayer((EntityPlayerMP) event.getOriginal(), (EntityPlayerMP) event.getEntityPlayer());
}
if (event.isWasDeath() && event.getOriginal() instanceof EntityPlayerMP) {
UUID uu = event.getOriginal().getPersistentID();
if (event.getOriginal().world.provider instanceof IGalacticraftWorldProvider) {
Integer timeA = deathTimes.get(uu);
int bb = ((EntityPlayerMP) event.getOriginal()).mcServer.getTickCounter();
if (timeA != null && (bb - timeA) < 1500) {
String msg = EnumColor.YELLOW + GCCoreUtil.translate("commands.gchouston.help.1") + " " + EnumColor.WHITE + GCCoreUtil.translate("commands.gchouston.help.2");
event.getOriginal().sendMessage(new TextComponentString(msg));
}
deathTimes.put(uu, bb);
} else {
deathTimes.remove(uu);
}
}
}
use of micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStats in project Galacticraft by micdoodle8.
the class GCPlayerHandler method onPlayerLogin.
// @SubscribeEvent
// public void onEntityConstructing(EntityEvent.EntityConstructing event)
// {
// if (event.getEntity() instanceof EntityPlayerMP && GCPlayerStats.get((EntityPlayerMP) event.getEntity()) == null)
// {
// GCPlayerStats.register((EntityPlayerMP) event.getEntity());
// }
//
// if (event.entity instanceof EntityPlayer && event.entity.world.isRemote)
// {
// this.onEntityConstructingClient(event);
// }
// }
//
// @SideOnly(Side.CLIENT)
// public void onEntityConstructingClient(EntityEvent.EntityConstructing event)
// {
// if (event.getEntity() instanceof EntityPlayerSP)
// {
// if (GCPlayerStatsClient.get((EntityPlayerSP) event.getEntity()) == null)
// {
// GCPlayerStatsClient.register((EntityPlayerSP) event.getEntity());
// }
//
// Minecraft.getMinecraft().gameSettings.sendSettingsToServer();
// }
// }
private void onPlayerLogin(EntityPlayerMP player) {
// GCPlayerStats oldData = this.playerStatsMap.remove(player.getPersistentID());
// if (oldData != null)
// {
// oldData.saveNBTData(player.getEntityData());
// }
GCPlayerStats stats = GCPlayerStats.get(player);
GalacticraftCore.packetPipeline.sendTo(new PacketSimple(EnumSimplePacket.C_GET_CELESTIAL_BODY_LIST, GCCoreUtil.getDimensionID(player.world), new Object[] {}), player);
int repeatCount = stats.getBuildFlags() >> 9;
if (repeatCount < 3) {
stats.setBuildFlags(stats.getBuildFlags() & 1536);
}
GalacticraftCore.packetPipeline.sendTo(new PacketSimple(EnumSimplePacket.C_UPDATE_STATS, GCCoreUtil.getDimensionID(player.world), stats.getMiscNetworkedStats()), player);
ColorUtil.sendUpdatedColorsToPlayer(stats);
}
use of micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStats in project Galacticraft by micdoodle8.
the class GCPlayerHandler method checkShield.
protected void checkShield(EntityPlayerMP playerMP, GCPlayerStats playerStats) {
if (playerMP.ticksExisted % 20 == 0 && playerMP.world.provider instanceof IGalacticraftWorldProvider) {
if (((IGalacticraftWorldProvider) playerMP.world.provider).shouldCorrodeArmor()) {
ItemStack shieldController = playerStats.getExtendedInventory().getStackInSlot(10);
boolean valid = false;
if (!shieldController.isEmpty()) {
int gearID = GalacticraftRegistry.findMatchingGearID(shieldController, EnumExtendedInventorySlot.SHIELD_CONTROLLER);
if (gearID != -1) {
valid = true;
}
}
if (!valid) {
for (ItemStack armor : playerMP.getArmorInventoryList()) {
if (!armor.isEmpty() && armor.getItem() instanceof ItemArmor && !(armor.getItem() instanceof IArmorCorrosionResistant)) {
armor.damageItem(1, playerMP);
}
}
}
}
}
}
use of micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStats in project Galacticraft by micdoodle8.
the class GCPlayerHandler method setUsingParachute.
public static void setUsingParachute(EntityPlayerMP player, GCPlayerStats playerStats, boolean tf) {
playerStats.setUsingParachute(tf);
if (tf) {
int subtype = GCPlayerHandler.GEAR_NOT_PRESENT;
if (!playerStats.getParachuteInSlot().isEmpty()) {
subtype = playerStats.getParachuteInSlot().getItemDamage();
}
GCPlayerHandler.sendGearUpdatePacket(player, EnumModelPacketType.ADD, EnumExtendedInventorySlot.PARACHUTE, subtype);
} else {
GCPlayerHandler.sendGearUpdatePacket(player, EnumModelPacketType.REMOVE, EnumExtendedInventorySlot.PARACHUTE);
}
}
use of micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStats in project Galacticraft by micdoodle8.
the class TeleportTypeVenus method onSpaceDimensionChanged.
@Override
public void onSpaceDimensionChanged(World newWorld, EntityPlayerMP player, boolean ridingAutoRocket) {
if (!ridingAutoRocket && player != null) {
GCPlayerStats stats = GCPlayerStats.get(player);
if (stats.getTeleportCooldown() <= 0) {
if (player.capabilities.isFlying) {
player.capabilities.isFlying = false;
}
if (!newWorld.isRemote) {
EntityEntryPodVenus entryPod = new EntityEntryPodVenus(player);
boolean previous = CompatibilityManager.forceLoadChunks((WorldServer) newWorld);
entryPod.forceSpawn = true;
newWorld.spawnEntity(entryPod);
CompatibilityManager.forceLoadChunksEnd((WorldServer) newWorld, previous);
}
stats.setTeleportCooldown(10);
}
}
}
Aggregations