public void func_72354_b(EntityPlayerMP p_72354_1_, WorldServer p_72354_2_) { p_72354_1_.field_71135_a.func_72567_b(new Packet4UpdateTime(p_72354_2_.func_82737_E(), p_72354_2_.func_72820_D(), p_72354_2_.func_82736_K().func_82766_b("doDaylightCycle"))); if(p_72354_2_.func_72896_J()) { p_72354_1_.field_71135_a.func_72567_b(new Packet70GameEvent(1, 0)); } }
/** * Updates the time and weather for the given player to those of the given world */ public void updateTimeAndWeatherForPlayer(EntityPlayerMP par1EntityPlayerMP, WorldServer par2WorldServer) { par1EntityPlayerMP.playerNetServerHandler.sendPacketToPlayer(new Packet4UpdateTime(par2WorldServer.getTotalWorldTime(), par2WorldServer.getWorldTime(), par2WorldServer.getGameRules().getGameRuleBooleanValue("doDaylightCycle"))); if (par2WorldServer.isRaining()) { par1EntityPlayerMP.playerNetServerHandler.sendPacketToPlayer(new Packet70GameEvent(1, 0)); } }
public static void updateTimeAndWeatherForPlayer(EntityPlayerMP par1EntityPlayerMP, WorldServer par2WorldServer) { par1EntityPlayerMP.playerNetServerHandler.sendPacketToPlayer(new Packet4UpdateTime(par2WorldServer.getTotalWorldTime(), par2WorldServer.getWorldTime(), par2WorldServer.getGameRules().getGameRuleBooleanValue("doDaylightCycle"))); if (par2WorldServer.isRaining()) { par1EntityPlayerMP.playerNetServerHandler.sendPacketToPlayer(new Packet70GameEvent(1, 0)); } }
@Override public void handleUpdateTime(Packet4UpdateTime par1Packet4UpdateTime) { nch.handleUpdateTime(par1Packet4UpdateTime); }
public void func_72497_a(Packet4UpdateTime p_72497_1_) { this.func_72509_a(p_72497_1_); }
public void func_72497_a(Packet4UpdateTime p_72497_1_) { this.field_72563_h.field_71441_e.func_82738_a(p_72497_1_.field_82562_a); this.field_72563_h.field_71441_e.func_72877_b(p_72497_1_.field_73301_a); }
public void func_71190_q() { this.field_71304_b.func_76320_a("levels"); int var1; for(var1 = 0; var1 < this.field_71305_c.length; ++var1) { long var2 = System.nanoTime(); if(var1 == 0 || this.func_71255_r()) { WorldServer var4 = this.field_71305_c[var1]; this.field_71304_b.func_76320_a(var4.func_72912_H().func_76065_j()); this.field_71304_b.func_76320_a("pools"); var4.func_82732_R().func_72343_a(); this.field_71304_b.func_76319_b(); if(this.field_71315_w % 20 == 0) { this.field_71304_b.func_76320_a("timeSync"); this.field_71318_t.func_72396_a(new Packet4UpdateTime(var4.func_82737_E(), var4.func_72820_D(), var4.func_82736_K().func_82766_b("doDaylightCycle")), var4.field_73011_w.field_76574_g); this.field_71304_b.func_76319_b(); } this.field_71304_b.func_76320_a("tick"); CrashReport var6; try { var4.func_72835_b(); } catch (Throwable var8) { var6 = CrashReport.func_85055_a(var8, "Exception ticking world"); var4.func_72914_a(var6); throw new ReportedException(var6); } try { var4.func_72939_s(); } catch (Throwable var7) { var6 = CrashReport.func_85055_a(var7, "Exception ticking world entities"); var4.func_72914_a(var6); throw new ReportedException(var6); } this.field_71304_b.func_76319_b(); this.field_71304_b.func_76320_a("tracker"); var4.func_73039_n().func_72788_a(); this.field_71304_b.func_76319_b(); this.field_71304_b.func_76319_b(); } this.field_71312_k[var1][this.field_71315_w % 100] = System.nanoTime() - var2; } this.field_71304_b.func_76318_c("connection"); this.func_71212_ac().func_71747_b(); this.field_71304_b.func_76318_c("players"); this.field_71318_t.func_72374_b(); this.field_71304_b.func_76318_c("tickables"); for(var1 = 0; var1 < this.field_71322_p.size(); ++var1) { ((IUpdatePlayerListBox)this.field_71322_p.get(var1)).func_73660_a(); } this.field_71304_b.func_76319_b(); }
public void func_72355_a(INetworkManager p_72355_1_, EntityPlayerMP p_72355_2_) { NBTTagCompound var3 = this.func_72380_a(p_72355_2_); p_72355_2_.func_70029_a(this.field_72400_f.func_71218_a(p_72355_2_.field_71093_bK)); p_72355_2_.field_71134_c.func_73080_a((WorldServer)p_72355_2_.field_70170_p); String var4 = "local"; if(p_72355_1_.func_74430_c() != null) { var4 = p_72355_1_.func_74430_c().toString(); } this.field_72400_f.func_98033_al().func_98233_a(p_72355_2_.func_70005_c_() + "[" + var4 + "] logged in with entity id " + p_72355_2_.field_70157_k + " at (" + p_72355_2_.field_70165_t + ", " + p_72355_2_.field_70163_u + ", " + p_72355_2_.field_70161_v + ")"); WorldServer var5 = this.field_72400_f.func_71218_a(p_72355_2_.field_71093_bK); ChunkCoordinates var6 = var5.func_72861_E(); this.func_72381_a(p_72355_2_, (EntityPlayerMP)null, var5); NetServerHandler var7 = new NetServerHandler(this.field_72400_f, p_72355_1_, p_72355_2_); var7.func_72567_b(new Packet1Login(p_72355_2_.field_70157_k, var5.func_72912_H().func_76067_t(), p_72355_2_.field_71134_c.func_73081_b(), var5.func_72912_H().func_76093_s(), var5.field_73011_w.field_76574_g, var5.field_73013_u, var5.func_72800_K(), this.func_72352_l())); var7.func_72567_b(new Packet250CustomPayload("MC|Brand", this.func_72365_p().getServerModName().getBytes(Charsets.UTF_8))); var7.func_72567_b(new Packet6SpawnPosition(var6.field_71574_a, var6.field_71572_b, var6.field_71573_c)); var7.func_72567_b(new Packet202PlayerAbilities(p_72355_2_.field_71075_bZ)); var7.func_72567_b(new Packet16BlockItemSwitch(p_72355_2_.field_71071_by.field_70461_c)); this.func_96456_a((ServerScoreboard)var5.func_96441_U(), p_72355_2_); this.func_72354_b(p_72355_2_, var5); this.func_92062_k(ChatMessageComponent.func_111082_b("multiplayer.player.joined", new Object[]{p_72355_2_.func_96090_ax()}).func_111059_a(EnumChatFormatting.YELLOW)); this.func_72377_c(p_72355_2_); var7.func_72569_a(p_72355_2_.field_70165_t, p_72355_2_.field_70163_u, p_72355_2_.field_70161_v, p_72355_2_.field_70177_z, p_72355_2_.field_70125_A); this.field_72400_f.func_71212_ac().func_71745_a(var7); var7.func_72567_b(new Packet4UpdateTime(var5.func_82737_E(), var5.func_72820_D(), var5.func_82736_K().func_82766_b("doDaylightCycle"))); if(this.field_72400_f.func_71202_P().length() > 0) { p_72355_2_.func_71115_a(this.field_72400_f.func_71202_P(), this.field_72400_f.func_71227_R()); } Iterator var8 = p_72355_2_.func_70651_bq().iterator(); while(var8.hasNext()) { PotionEffect var9 = (PotionEffect)var8.next(); var7.func_72567_b(new Packet41EntityEffect(p_72355_2_.field_70157_k, var9)); } p_72355_2_.func_71116_b(); if(var3 != null && var3.func_74764_b("Riding")) { Entity var10 = EntityList.func_75615_a(var3.func_74775_l("Riding"), var5); if(var10 != null) { var10.field_98038_p = true; var5.func_72838_d(var10); p_72355_2_.func_70078_a(var10); var10.field_98038_p = false; } } }
public void handleUpdateTime(Packet4UpdateTime par1Packet4UpdateTime) { this.mc.theWorld.func_82738_a(par1Packet4UpdateTime.worldAge); this.mc.theWorld.setWorldTime(par1Packet4UpdateTime.time); }
public void updateTimeLightAndEntities() { this.theProfiler.startSection("levels"); int i; Integer[] ids = DimensionManager.getIDs(this.tickCounter % 200 == 0); for (int x = 0; x < ids.length; x++) { int id = ids[x]; long j = System.nanoTime(); if (id == 0 || this.getAllowNether()) { WorldServer worldserver = DimensionManager.getWorld(id); this.theProfiler.startSection(worldserver.getWorldInfo().getWorldName()); this.theProfiler.startSection("pools"); worldserver.getWorldVec3Pool().clear(); this.theProfiler.endSection(); if (this.tickCounter % 20 == 0) { this.theProfiler.startSection("timeSync"); this.serverConfigManager.sendPacketToAllPlayersInDimension(new Packet4UpdateTime(worldserver.getTotalWorldTime(), worldserver.getWorldTime(), worldserver.getGameRules().getGameRuleBooleanValue("doDaylightCycle")), worldserver.provider.dimensionId); this.theProfiler.endSection(); } this.theProfiler.startSection("tick"); FMLCommonHandler.instance().onPreWorldTick(worldserver); CrashReport crashreport; try { worldserver.tick(); } catch (Throwable throwable) { crashreport = CrashReport.makeCrashReport(throwable, "Exception ticking world"); worldserver.addWorldInfoToCrashReport(crashreport); throw new ReportedException(crashreport); } try { worldserver.updateEntities(); } catch (Throwable throwable1) { crashreport = CrashReport.makeCrashReport(throwable1, "Exception ticking world entities"); worldserver.addWorldInfoToCrashReport(crashreport); throw new ReportedException(crashreport); } FMLCommonHandler.instance().onPostWorldTick(worldserver); this.theProfiler.endSection(); this.theProfiler.startSection("tracker"); worldserver.getEntityTracker().updateTrackedEntities(); this.theProfiler.endSection(); this.theProfiler.endSection(); } worldTickTimes.get(id)[this.tickCounter % 100] = System.nanoTime() - j; } this.theProfiler.endStartSection("dim_unloading"); DimensionManager.unloadWorlds(worldTickTimes); this.theProfiler.endStartSection("connection"); this.getNetworkThread().networkTick(); this.theProfiler.endStartSection("players"); this.serverConfigManager.sendPlayerInfoToAllPlayers(); this.theProfiler.endStartSection("tickables"); for (i = 0; i < this.tickables.size(); ++i) { ((IUpdatePlayerListBox)this.tickables.get(i)).update(); } this.theProfiler.endSection(); }
public void initializeConnectionToPlayer(INetworkManager par1INetworkManager, EntityPlayerMP par2EntityPlayerMP) { NBTTagCompound nbttagcompound = this.readPlayerDataFromFile(par2EntityPlayerMP); par2EntityPlayerMP.setWorld(this.mcServer.worldServerForDimension(par2EntityPlayerMP.dimension)); par2EntityPlayerMP.theItemInWorldManager.setWorld((WorldServer)par2EntityPlayerMP.worldObj); String s = "local"; if (par1INetworkManager.getSocketAddress() != null) { s = par1INetworkManager.getSocketAddress().toString(); } this.mcServer.getLogAgent().logInfo(par2EntityPlayerMP.getCommandSenderName() + "[" + s + "] logged in with entity id " + par2EntityPlayerMP.entityId + " at (" + par2EntityPlayerMP.posX + ", " + par2EntityPlayerMP.posY + ", " + par2EntityPlayerMP.posZ + ")"); WorldServer worldserver = this.mcServer.worldServerForDimension(par2EntityPlayerMP.dimension); ChunkCoordinates chunkcoordinates = worldserver.getSpawnPoint(); this.func_72381_a(par2EntityPlayerMP, (EntityPlayerMP)null, worldserver); NetServerHandler netserverhandler = new NetServerHandler(this.mcServer, par1INetworkManager, par2EntityPlayerMP); netserverhandler.sendPacketToPlayer(new Packet1Login(par2EntityPlayerMP.entityId, worldserver.getWorldInfo().getTerrainType(), par2EntityPlayerMP.theItemInWorldManager.getGameType(), worldserver.getWorldInfo().isHardcoreModeEnabled(), worldserver.provider.dimensionId, worldserver.difficultySetting, worldserver.getHeight(), this.getMaxPlayers())); netserverhandler.sendPacketToPlayer(new Packet250CustomPayload("MC|Brand", this.getServerInstance().getServerModName().getBytes(Charsets.UTF_8))); netserverhandler.sendPacketToPlayer(new Packet6SpawnPosition(chunkcoordinates.posX, chunkcoordinates.posY, chunkcoordinates.posZ)); netserverhandler.sendPacketToPlayer(new Packet202PlayerAbilities(par2EntityPlayerMP.capabilities)); netserverhandler.sendPacketToPlayer(new Packet16BlockItemSwitch(par2EntityPlayerMP.inventory.currentItem)); this.func_96456_a((ServerScoreboard)worldserver.getScoreboard(), par2EntityPlayerMP); this.updateTimeAndWeatherForPlayer(par2EntityPlayerMP, worldserver); this.sendChatMsg(ChatMessageComponent.createFromTranslationWithSubstitutions("multiplayer.player.joined", new Object[] {par2EntityPlayerMP.getTranslatedEntityName()}).setColor(EnumChatFormatting.YELLOW)); this.playerLoggedIn(par2EntityPlayerMP); netserverhandler.setPlayerLocation(par2EntityPlayerMP.posX, par2EntityPlayerMP.posY, par2EntityPlayerMP.posZ, par2EntityPlayerMP.rotationYaw, par2EntityPlayerMP.rotationPitch); this.mcServer.getNetworkThread().addPlayer(netserverhandler); netserverhandler.sendPacketToPlayer(new Packet4UpdateTime(worldserver.getTotalWorldTime(), worldserver.getWorldTime(), worldserver.getGameRules().getGameRuleBooleanValue("doDaylightCycle"))); if (this.mcServer.getTexturePack().length() > 0) { par2EntityPlayerMP.requestTexturePackLoad(this.mcServer.getTexturePack(), this.mcServer.textureSize()); } Iterator iterator = par2EntityPlayerMP.getActivePotionEffects().iterator(); while (iterator.hasNext()) { PotionEffect potioneffect = (PotionEffect)iterator.next(); netserverhandler.sendPacketToPlayer(new Packet41EntityEffect(par2EntityPlayerMP.entityId, potioneffect)); } par2EntityPlayerMP.addSelfToInternalCraftingInventory(); FMLNetworkHandler.handlePlayerLogin(par2EntityPlayerMP, netserverhandler, par1INetworkManager); if (nbttagcompound != null && nbttagcompound.hasKey("Riding")) { Entity entity = EntityList.createEntityFromNBT(nbttagcompound.getCompoundTag("Riding"), worldserver); if (entity != null) { entity.forceSpawn = true; worldserver.spawnEntityInWorld(entity); par2EntityPlayerMP.mountEntity(entity); entity.forceSpawn = false; } } }