/** * Registers some server properties (gametype,hardcore-mode,terraintype,difficulty,player limit), creates a new * WorldClient and sets the player initial dimension */ public void handleJoinGame(S01PacketJoinGame packetIn) { PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); this.gameController.playerController = new PlayerControllerMP(this.gameController, this); this.clientWorldController = new WorldClient(this, new WorldSettings(0L, packetIn.getGameType(), false, packetIn.isHardcoreMode(), packetIn.getWorldType()), packetIn.getDimension(), packetIn.getDifficulty(), this.gameController.mcProfiler); this.gameController.gameSettings.difficulty = packetIn.getDifficulty(); this.gameController.loadWorld(this.clientWorldController); this.gameController.thePlayer.dimension = packetIn.getDimension(); this.gameController.displayGuiScreen(new GuiDownloadTerrain(this)); this.gameController.thePlayer.setEntityId(packetIn.getEntityId()); this.currentServerMaxPlayers = packetIn.getMaxPlayers(); this.gameController.thePlayer.setReducedDebug(packetIn.isReducedDebugInfo()); this.gameController.playerController.setGameType(packetIn.getGameType()); this.gameController.gameSettings.sendSettingsToServer(); this.netManager.sendPacket(new C17PacketCustomPayload("MC|Brand", (new PacketBuffer(Unpooled.buffer())).writeString(ClientBrandRetriever.getClientModName()))); }
public void handleRespawn(S07PacketRespawn packetIn) { PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); if (packetIn.getDimensionID() != this.gameController.thePlayer.dimension) { this.doneLoadingTerrain = false; Scoreboard scoreboard = this.clientWorldController.getScoreboard(); this.clientWorldController = new WorldClient(this, new WorldSettings(0L, packetIn.getGameType(), false, this.gameController.theWorld.getWorldInfo().isHardcoreModeEnabled(), packetIn.getWorldType()), packetIn.getDimensionID(), packetIn.getDifficulty(), this.gameController.mcProfiler); this.clientWorldController.setWorldScoreboard(scoreboard); this.gameController.loadWorld(this.clientWorldController); this.gameController.thePlayer.dimension = packetIn.getDimensionID(); this.gameController.displayGuiScreen(new GuiDownloadTerrain(this)); } this.gameController.setDimensionAndSpawnPlayer(packetIn.getDimensionID()); this.gameController.playerController.setGameType(packetIn.getGameType()); }
/** * Registers some server properties * (gametype,hardcore-mode,terraintype,difficulty,player limit), creates a new * WorldClient and sets the player initial dimension */ public void handleJoinGame(S01PacketJoinGame packetIn) { PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); this.gameController.playerController = new PlayerControllerMP(this.gameController, this); this.clientWorldController = new WorldClient(this, new WorldSettings(0L, packetIn.getGameType(), false, packetIn.isHardcoreMode(), packetIn.getWorldType()), packetIn.getDimension(), packetIn.getDifficulty(), this.gameController.mcProfiler); this.gameController.gameSettings.difficulty = packetIn.getDifficulty(); this.gameController.loadWorld(this.clientWorldController); this.gameController.thePlayer.dimension = packetIn.getDimension(); this.gameController.displayGuiScreen(new GuiDownloadTerrain(this)); this.gameController.thePlayer.setEntityId(packetIn.getEntityId()); this.currentServerMaxPlayers = packetIn.getMaxPlayers(); this.gameController.thePlayer.setReducedDebug(packetIn.isReducedDebugInfo()); this.gameController.playerController.setGameType(packetIn.getGameType()); this.gameController.gameSettings.sendSettingsToServer(); this.netManager.sendPacket(new C17PacketCustomPayload("MC|Brand", (new PacketBuffer(Unpooled.buffer())).writeString(ClientBrandRetriever.getClientModName()))); }
/** * Registers some server properties (gametype,hardcore-mode,terraintype,difficulty,player limit), creates a new * WorldClient and sets the player initial dimension */ public void handleJoinGame(SPacketJoinGame packetIn) { PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); this.gameController.playerController = new PlayerControllerMP(this.gameController, this); this.clientWorldController = new WorldClient(this, new WorldSettings(0L, packetIn.getGameType(), false, packetIn.isHardcoreMode(), packetIn.getWorldType()), packetIn.getDimension(), packetIn.getDifficulty(), this.gameController.mcProfiler); this.gameController.gameSettings.difficulty = packetIn.getDifficulty(); this.gameController.loadWorld(this.clientWorldController); this.gameController.player.dimension = packetIn.getDimension(); this.gameController.displayGuiScreen(new GuiDownloadTerrain(this)); this.gameController.player.setEntityId(packetIn.getPlayerId()); this.currentServerMaxPlayers = packetIn.getMaxPlayers(); this.gameController.player.setReducedDebug(packetIn.isReducedDebugInfo()); this.gameController.playerController.setGameType(packetIn.getGameType()); this.gameController.gameSettings.sendSettingsToServer(); this.netManager.sendPacket(new CPacketCustomPayload("MC|Brand", (new PacketBuffer(Unpooled.buffer())).writeString(ClientBrandRetriever.getClientModName()))); }
public void handleRespawn(SPacketRespawn packetIn) { PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); if (packetIn.getDimensionID() != this.gameController.player.dimension) { this.doneLoadingTerrain = false; Scoreboard scoreboard = this.clientWorldController.getScoreboard(); this.clientWorldController = new WorldClient(this, new WorldSettings(0L, packetIn.getGameType(), false, this.gameController.world.getWorldInfo().isHardcoreModeEnabled(), packetIn.getWorldType()), packetIn.getDimensionID(), packetIn.getDifficulty(), this.gameController.mcProfiler); this.clientWorldController.setWorldScoreboard(scoreboard); this.gameController.loadWorld(this.clientWorldController); this.gameController.player.dimension = packetIn.getDimensionID(); this.gameController.displayGuiScreen(new GuiDownloadTerrain(this)); } this.gameController.setDimensionAndSpawnPlayer(packetIn.getDimensionID()); this.gameController.playerController.setGameType(packetIn.getGameType()); }
/** * Registers some server properties (gametype,hardcore-mode,terraintype,difficulty,player limit), creates a new * WorldClient and sets the player initial dimension */ public void handleJoinGame(SPacketJoinGame packetIn) { PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); this.gameController.playerController = new PlayerControllerMP(this.gameController, this); this.clientWorldController = new WorldClient(this, new WorldSettings(0L, packetIn.getGameType(), false, packetIn.isHardcoreMode(), packetIn.getWorldType()), net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.get(getNetworkManager()).getOverrideDimension(packetIn), packetIn.getDifficulty(), this.gameController.mcProfiler); this.gameController.gameSettings.difficulty = packetIn.getDifficulty(); this.gameController.loadWorld(this.clientWorldController); this.gameController.thePlayer.dimension = packetIn.getDimension(); this.gameController.displayGuiScreen(new GuiDownloadTerrain(this)); this.gameController.thePlayer.setEntityId(packetIn.getPlayerId()); this.currentServerMaxPlayers = packetIn.getMaxPlayers(); this.gameController.thePlayer.setReducedDebug(packetIn.isReducedDebugInfo()); this.gameController.playerController.setGameType(packetIn.getGameType()); this.gameController.gameSettings.sendSettingsToServer(); this.netManager.sendPacket(new CPacketCustomPayload("MC|Brand", (new PacketBuffer(Unpooled.buffer())).writeString(ClientBrandRetriever.getClientModName()))); }
public void handleRespawn(SPacketRespawn packetIn) { PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); if (packetIn.getDimensionID() != this.gameController.thePlayer.dimension) { this.doneLoadingTerrain = false; Scoreboard scoreboard = this.clientWorldController.getScoreboard(); this.clientWorldController = new WorldClient(this, new WorldSettings(0L, packetIn.getGameType(), false, this.gameController.theWorld.getWorldInfo().isHardcoreModeEnabled(), packetIn.getWorldType()), packetIn.getDimensionID(), packetIn.getDifficulty(), this.gameController.mcProfiler); this.clientWorldController.setWorldScoreboard(scoreboard); this.gameController.loadWorld(this.clientWorldController); this.gameController.thePlayer.dimension = packetIn.getDimensionID(); this.gameController.displayGuiScreen(new GuiDownloadTerrain(this)); } this.gameController.setDimensionAndSpawnPlayer(packetIn.getDimensionID()); this.gameController.playerController.setGameType(packetIn.getGameType()); }
@Override public void handleJoinGame(SPacketJoinGame packetIn) { PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.mc); if (clientWorldController == null) super.handleJoinGame(packetIn); this.mc.playerController = new PlayerControllerMP(this.mc, this); //Replaces the playerController with my own patched PlayerControllerMP ReflectionHelper.set(ObfuscatedField.NetHandlerPlayClient_clientWorldController, clientWorldController, this, new WorldClient(this, new WorldSettings(0L, packetIn.getGameType(), false, packetIn.isHardcoreMode(), packetIn.getWorldType()), net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.get(getNetworkManager()).getOverrideDimension(packetIn), packetIn.getDifficulty(), this.mc.mcProfiler)); this.mc.gameSettings.difficulty = packetIn.getDifficulty(); this.mc.loadWorld(ReflectionHelper.get(ObfuscatedField.NetHandlerPlayClient_clientWorldController, clientWorldController, this)); this.mc.player.dimension = packetIn.getDimension(); this.mc.displayGuiScreen(new GuiDownloadTerrain()); this.mc.player.setEntityId(packetIn.getPlayerId()); this.currentServerMaxPlayers = packetIn.getMaxPlayers(); this.mc.player.setReducedDebug(packetIn.isReducedDebugInfo()); this.mc.playerController.setGameType(packetIn.getGameType()); this.mc.gameSettings.sendSettingsToServer(); this.getNetworkManager().sendPacket(new CPacketCustomPayload("MC|Brand", (new PacketBuffer(Unpooled.buffer())).writeString(ClientBrandRetriever.getClientModName()))); }
public void handleRespawn(S07PacketRespawn p_147280_1_) { if (p_147280_1_.func_149082_c() != this.gameController.thePlayer.dimension) { this.doneLoadingTerrain = false; Scoreboard var2 = this.clientWorldController.getScoreboard(); this.clientWorldController = new WorldClient(this, new WorldSettings(0L, p_147280_1_.func_149083_e(), false, this.gameController.theWorld.getWorldInfo().isHardcoreModeEnabled(), p_147280_1_.func_149080_f()), p_147280_1_.func_149082_c(), p_147280_1_.func_149081_d(), this.gameController.mcProfiler); this.clientWorldController.setWorldScoreboard(var2); this.clientWorldController.isClient = true; this.gameController.loadWorld(this.clientWorldController); this.gameController.thePlayer.dimension = p_147280_1_.func_149082_c(); this.gameController.displayGuiScreen(new GuiDownloadTerrain(this)); } this.gameController.setDimensionAndSpawnPlayer(p_147280_1_.func_149082_c()); this.gameController.playerController.setGameType(p_147280_1_.func_149083_e()); }
public void handleRespawn(S07PacketRespawn p_147280_1_) { if (p_147280_1_.func_149082_c() != this.gameController.thePlayer.dimension) { this.doneLoadingTerrain = false; Scoreboard scoreboard = this.clientWorldController.getScoreboard(); this.clientWorldController = new WorldClient(this, new WorldSettings(0L, p_147280_1_.func_149083_e(), false, this.gameController.theWorld.getWorldInfo().isHardcoreModeEnabled(), p_147280_1_.func_149080_f()), p_147280_1_.func_149082_c(), p_147280_1_.func_149081_d(), this.gameController.mcProfiler); this.clientWorldController.setWorldScoreboard(scoreboard); this.clientWorldController.isRemote = true; this.gameController.loadWorld(this.clientWorldController); this.gameController.thePlayer.dimension = p_147280_1_.func_149082_c(); this.gameController.displayGuiScreen(new GuiDownloadTerrain(this)); } this.gameController.setDimensionAndSpawnPlayer(p_147280_1_.func_149082_c()); this.gameController.playerController.setGameType(p_147280_1_.func_149083_e()); }
public void handleLogin(Packet1Login par1Packet1Login) { this.mc.playerController = new PlayerControllerMP(this.mc, this); this.mc.statFileWriter.readStat(StatList.joinMultiplayerStat, 1); this.worldClient = new WorldClient(this, new WorldSettings(0L, par1Packet1Login.gameType, false, par1Packet1Login.hardcoreMode, par1Packet1Login.terrainType), par1Packet1Login.dimension, par1Packet1Login.difficultySetting, this.mc.mcProfiler, this.mc.getLogAgent()); this.worldClient.isRemote = true; this.mc.loadWorld(this.worldClient); this.mc.thePlayer.dimension = par1Packet1Login.dimension; this.mc.displayGuiScreen(new GuiDownloadTerrain(this)); this.mc.thePlayer.entityId = par1Packet1Login.clientEntityId; this.currentServerMaxPlayers = par1Packet1Login.maxPlayers; this.mc.playerController.setGameType(par1Packet1Login.gameType); FMLNetworkHandler.onConnectionEstablishedToServer(this, netManager, par1Packet1Login); this.mc.gameSettings.sendSettingsToServer(); this.netManager.addToSendQueue(new Packet250CustomPayload("MC|Brand", ClientBrandRetriever.getClientModName().getBytes(Charsets.UTF_8))); }
/** * respawns the player */ public void handleRespawn(Packet9Respawn par1Packet9Respawn) { if (par1Packet9Respawn.respawnDimension != this.mc.thePlayer.dimension) { this.doneLoadingTerrain = false; Scoreboard scoreboard = this.worldClient.getScoreboard(); this.worldClient = new WorldClient(this, new WorldSettings(0L, par1Packet9Respawn.gameType, false, this.mc.theWorld.getWorldInfo().isHardcoreModeEnabled(), par1Packet9Respawn.terrainType), par1Packet9Respawn.respawnDimension, par1Packet9Respawn.difficulty, this.mc.mcProfiler, this.mc.getLogAgent()); this.worldClient.func_96443_a(scoreboard); this.worldClient.isRemote = true; this.mc.loadWorld(this.worldClient); this.mc.thePlayer.dimension = par1Packet9Respawn.respawnDimension; this.mc.displayGuiScreen(new GuiDownloadTerrain(this)); } this.mc.setDimensionAndSpawnPlayer(par1Packet9Respawn.respawnDimension); this.mc.playerController.setGameType(par1Packet9Respawn.gameType); }
public void handleJoinGame(S01PacketJoinGame p_147282_1_) { this.gameController.playerController = new HookPlayerControllerMP(this.gameController, this); this.clientWorldController = new WorldClient(this, new WorldSettings(0L, p_147282_1_.func_149198_e(), false, p_147282_1_.func_149195_d(), p_147282_1_.func_149196_i()), p_147282_1_.func_149194_f(), p_147282_1_.func_149192_g(), this.gameController.mcProfiler); this.clientWorldController.isClient = true; this.gameController.loadWorld(this.clientWorldController); this.gameController.thePlayer.dimension = p_147282_1_.func_149194_f(); this.gameController.displayGuiScreen(new GuiDownloadTerrain(this)); this.gameController.thePlayer.setEntityId(p_147282_1_.func_149197_c()); this.currentServerMaxPlayers = p_147282_1_.func_149193_h(); this.gameController.playerController.setGameType(p_147282_1_.func_149198_e()); this.gameController.gameSettings.sendSettingsToServer(); this.netManager.scheduleOutboundPacket(new C17PacketCustomPayload("MC|Brand", ClientBrandRetriever.getClientModName().getBytes(Charsets.UTF_8)), new GenericFutureListener[0]); }
public void handleJoinGame(S01PacketJoinGame p_147282_1_) { this.gameController.playerController = new PlayerControllerMP(this.gameController, this); this.clientWorldController = new WorldClient(this, new WorldSettings(0L, p_147282_1_.func_149198_e(), false, p_147282_1_.func_149195_d(), p_147282_1_.func_149196_i()), p_147282_1_.func_149194_f(), p_147282_1_.func_149192_g(), this.gameController.mcProfiler); this.clientWorldController.isRemote = true; this.gameController.loadWorld(this.clientWorldController); this.gameController.thePlayer.dimension = p_147282_1_.func_149194_f(); this.gameController.displayGuiScreen(new GuiDownloadTerrain(this)); this.gameController.thePlayer.setEntityId(p_147282_1_.func_149197_c()); this.currentServerMaxPlayers = p_147282_1_.func_149193_h(); this.gameController.playerController.setGameType(p_147282_1_.func_149198_e()); this.gameController.gameSettings.sendSettingsToServer(); this.netManager.scheduleOutboundPacket(new C17PacketCustomPayload("MC|Brand", ClientBrandRetriever.getClientModName().getBytes(Charsets.UTF_8)), new GenericFutureListener[0]); }
public void func_72455_a(Packet1Login p_72455_1_) { this.field_72563_h.field_71442_b = new PlayerControllerMP(this.field_72563_h, this); this.field_72563_h.field_71413_E.func_77450_a(StatList.field_75950_i, 1); this.field_72564_i = new WorldClient(this, new WorldSettings(0L, p_72455_1_.field_73557_d, false, p_72455_1_.field_73560_c, p_72455_1_.field_73559_b), p_72455_1_.field_73558_e, p_72455_1_.field_73555_f, this.field_72563_h.field_71424_I, this.field_72563_h.func_98033_al()); this.field_72564_i.field_72995_K = true; this.field_72563_h.func_71403_a(this.field_72564_i); this.field_72563_h.field_71439_g.field_71093_bK = p_72455_1_.field_73558_e; this.field_72563_h.func_71373_a(new GuiDownloadTerrain(this)); this.field_72563_h.field_71439_g.field_70157_k = p_72455_1_.field_73561_a; this.field_72556_d = p_72455_1_.field_73562_h; this.field_72563_h.field_71442_b.func_78746_a(p_72455_1_.field_73557_d); this.field_72563_h.field_71474_y.func_82879_c(); this.field_72555_g.func_74429_a(new Packet250CustomPayload("MC|Brand", ClientBrandRetriever.getClientModName().getBytes(Charsets.UTF_8))); }
public void func_72483_a(Packet9Respawn p_72483_1_) { if(p_72483_1_.field_73373_a != this.field_72563_h.field_71439_g.field_71093_bK) { this.field_72561_j = false; Scoreboard var2 = this.field_72564_i.func_96441_U(); this.field_72564_i = new WorldClient(this, new WorldSettings(0L, p_72483_1_.field_73369_d, false, this.field_72563_h.field_71441_e.func_72912_H().func_76093_s(), p_72483_1_.field_73370_e), p_72483_1_.field_73373_a, p_72483_1_.field_73371_b, this.field_72563_h.field_71424_I, this.field_72563_h.func_98033_al()); this.field_72564_i.func_96443_a(var2); this.field_72564_i.field_72995_K = true; this.field_72563_h.func_71403_a(this.field_72564_i); this.field_72563_h.field_71439_g.field_71093_bK = p_72483_1_.field_73373_a; this.field_72563_h.func_71373_a(new GuiDownloadTerrain(this)); } this.field_72563_h.func_71354_a(p_72483_1_.field_73373_a); this.field_72563_h.field_71442_b.func_78746_a(p_72483_1_.field_73369_d); }
private void waitForServerThread() { this.serverWaitTimeCurrent = 0; if (Config.isSmoothWorld() && Config.isSingleProcessor()) { if (this.mc.isIntegratedServerRunning()) { IntegratedServer integratedserver = this.mc.getIntegratedServer(); if (integratedserver != null) { boolean flag = this.mc.isGamePaused(); if (!flag && !(this.mc.currentScreen instanceof GuiDownloadTerrain)) { if (this.serverWaitTime > 0) { Lagometer.timerServer.start(); Config.sleep((long) this.serverWaitTime); Lagometer.timerServer.end(); this.serverWaitTimeCurrent = this.serverWaitTime; } long i = System.nanoTime() / 1000000L; if (this.lastServerTime != 0L && this.lastServerTicks != 0) { long j = i - this.lastServerTime; if (j < 0L) { this.lastServerTime = i; j = 0L; } if (j >= 50L) { this.lastServerTime = i; int k = integratedserver.getTickCounter(); int l = k - this.lastServerTicks; if (l < 0) { this.lastServerTicks = k; l = 0; } if (l < 1 && this.serverWaitTime < 100) { this.serverWaitTime += 2; } if (l > 1 && this.serverWaitTime > 0) { --this.serverWaitTime; } this.lastServerTicks = k; } } else { this.lastServerTime = i; this.lastServerTicks = integratedserver.getTickCounter(); this.avgServerTickDiff = 1.0F; this.avgServerTimeDiff = 50.0F; } } else { if (this.mc.currentScreen instanceof GuiDownloadTerrain) { Config.sleep(20L); } this.lastServerTime = 0L; this.lastServerTicks = 0; } } } } else { this.lastServerTime = 0L; this.lastServerTicks = 0; } }
public void handleChangeGameState(SPacketChangeGameState packetIn) { PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); EntityPlayer entityplayer = this.gameController.player; int i = packetIn.getGameState(); float f = packetIn.getValue(); int j = MathHelper.floor(f + 0.5F); if (i >= 0 && i < SPacketChangeGameState.MESSAGE_NAMES.length && SPacketChangeGameState.MESSAGE_NAMES[i] != null) { entityplayer.addChatComponentMessage(new TextComponentTranslation(SPacketChangeGameState.MESSAGE_NAMES[i], new Object[0]), false); } if (i == 1) { this.clientWorldController.getWorldInfo().setRaining(true); this.clientWorldController.setRainStrength(0.0F); } else if (i == 2) { this.clientWorldController.getWorldInfo().setRaining(false); this.clientWorldController.setRainStrength(1.0F); } else if (i == 3) { this.gameController.playerController.setGameType(GameType.getByID(j)); } else if (i == 4) { if (j == 0) { this.gameController.player.connection.sendPacket(new CPacketClientStatus(CPacketClientStatus.State.PERFORM_RESPAWN)); this.gameController.displayGuiScreen(new GuiDownloadTerrain(this)); } else if (j == 1) { this.gameController.displayGuiScreen(new GuiWinGame()); } } else if (i == 5) { GameSettings gamesettings = this.gameController.gameSettings; if (f == 0.0F) { this.gameController.displayGuiScreen(new GuiScreenDemo()); } else if (f == 101.0F) { this.gameController.ingameGUI.getChatGUI().printChatMessage(new TextComponentTranslation("demo.help.movement", new Object[] {GameSettings.getKeyDisplayString(gamesettings.keyBindForward.getKeyCode()), GameSettings.getKeyDisplayString(gamesettings.keyBindLeft.getKeyCode()), GameSettings.getKeyDisplayString(gamesettings.keyBindBack.getKeyCode()), GameSettings.getKeyDisplayString(gamesettings.keyBindRight.getKeyCode())})); } else if (f == 102.0F) { this.gameController.ingameGUI.getChatGUI().printChatMessage(new TextComponentTranslation("demo.help.jump", new Object[] {GameSettings.getKeyDisplayString(gamesettings.keyBindJump.getKeyCode())})); } else if (f == 103.0F) { this.gameController.ingameGUI.getChatGUI().printChatMessage(new TextComponentTranslation("demo.help.inventory", new Object[] {GameSettings.getKeyDisplayString(gamesettings.keyBindInventory.getKeyCode())})); } } else if (i == 6) { this.clientWorldController.playSound(entityplayer, entityplayer.posX, entityplayer.posY + (double)entityplayer.getEyeHeight(), entityplayer.posZ, SoundEvents.ENTITY_ARROW_HIT_PLAYER, SoundCategory.PLAYERS, 0.18F, 0.45F); } else if (i == 7) { this.clientWorldController.setRainStrength(f); } else if (i == 8) { this.clientWorldController.setThunderStrength(f); } else if (i == 10) { this.clientWorldController.spawnParticle(EnumParticleTypes.MOB_APPEARANCE, entityplayer.posX, entityplayer.posY, entityplayer.posZ, 0.0D, 0.0D, 0.0D, new int[0]); this.clientWorldController.playSound(entityplayer, entityplayer.posX, entityplayer.posY, entityplayer.posZ, SoundEvents.ENTITY_ELDER_GUARDIAN_CURSE, SoundCategory.HOSTILE, 1.0F, 1.0F); } }
public void handleChangeGameState(SPacketChangeGameState packetIn) { PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); EntityPlayer entityplayer = this.gameController.thePlayer; int i = packetIn.getGameState(); float f = packetIn.getValue(); int j = MathHelper.floor_float(f + 0.5F); if (i >= 0 && i < SPacketChangeGameState.MESSAGE_NAMES.length && SPacketChangeGameState.MESSAGE_NAMES[i] != null) { entityplayer.addChatComponentMessage(new TextComponentTranslation(SPacketChangeGameState.MESSAGE_NAMES[i], new Object[0])); } if (i == 1) { this.clientWorldController.getWorldInfo().setRaining(true); this.clientWorldController.setRainStrength(0.0F); } else if (i == 2) { this.clientWorldController.getWorldInfo().setRaining(false); this.clientWorldController.setRainStrength(1.0F); } else if (i == 3) { this.gameController.playerController.setGameType(GameType.getByID(j)); } else if (i == 4) { if (j == 0) { this.gameController.thePlayer.connection.sendPacket(new CPacketClientStatus(CPacketClientStatus.State.PERFORM_RESPAWN)); this.gameController.displayGuiScreen(new GuiDownloadTerrain(this)); } else if (j == 1) { this.gameController.displayGuiScreen(new GuiWinGame()); } } else if (i == 5) { GameSettings gamesettings = this.gameController.gameSettings; if (f == 0.0F) { this.gameController.displayGuiScreen(new GuiScreenDemo()); } else if (f == 101.0F) { this.gameController.ingameGUI.getChatGUI().printChatMessage(new TextComponentTranslation("demo.help.movement", new Object[] {gamesettings.keyBindForward.getDisplayName(), gamesettings.keyBindLeft.getDisplayName(), gamesettings.keyBindBack.getDisplayName(), gamesettings.keyBindRight.getDisplayName()})); } else if (f == 102.0F) { this.gameController.ingameGUI.getChatGUI().printChatMessage(new TextComponentTranslation("demo.help.jump", new Object[] {gamesettings.keyBindJump.getDisplayName()})); } else if (f == 103.0F) { this.gameController.ingameGUI.getChatGUI().printChatMessage(new TextComponentTranslation("demo.help.inventory", new Object[] {gamesettings.keyBindInventory.getDisplayName()})); } } else if (i == 6) { this.clientWorldController.playSound(entityplayer, entityplayer.posX, entityplayer.posY + (double)entityplayer.getEyeHeight(), entityplayer.posZ, SoundEvents.ENTITY_ARROW_HIT_PLAYER, SoundCategory.PLAYERS, 0.18F, 0.45F); } else if (i == 7) { this.clientWorldController.setRainStrength(f); } else if (i == 8) { this.clientWorldController.setThunderStrength(f); } else if (i == 10) { this.clientWorldController.spawnParticle(EnumParticleTypes.MOB_APPEARANCE, entityplayer.posX, entityplayer.posY, entityplayer.posZ, 0.0D, 0.0D, 0.0D, new int[0]); this.clientWorldController.playSound(entityplayer, entityplayer.posX, entityplayer.posY, entityplayer.posZ, SoundEvents.ENTITY_ELDER_GUARDIAN_CURSE, SoundCategory.HOSTILE, 1.0F, 1.0F); } }
private void waitForServerThread() { this.serverWaitTimeCurrent = 0; if (!Config.isSmoothWorld()) { this.lastServerTime = 0L; this.lastServerTicks = 0; } else if (this.mc.getIntegratedServer() != null) { IntegratedServer srv = this.mc.getIntegratedServer(); boolean paused = this.mc.func_147113_T(); if (!paused && !(this.mc.currentScreen instanceof GuiDownloadTerrain)) { if (this.serverWaitTime > 0) { Config.sleep((long)this.serverWaitTime); this.serverWaitTimeCurrent = this.serverWaitTime; } long timeNow = System.nanoTime() / 1000000L; if (this.lastServerTime != 0L && this.lastServerTicks != 0) { long timeDiff = timeNow - this.lastServerTime; if (timeDiff < 0L) { this.lastServerTime = timeNow; timeDiff = 0L; } if (timeDiff >= 50L) { this.lastServerTime = timeNow; int ticks = srv.getTickCounter(); int tickDiff = ticks - this.lastServerTicks; if (tickDiff < 0) { this.lastServerTicks = ticks; tickDiff = 0; } if (tickDiff < 1 && this.serverWaitTime < 100) { this.serverWaitTime += 2; } if (tickDiff > 1 && this.serverWaitTime > 0) { --this.serverWaitTime; } this.lastServerTicks = ticks; } } else { this.lastServerTime = timeNow; this.lastServerTicks = srv.getTickCounter(); this.avgServerTickDiff = 1.0F; this.avgServerTimeDiff = 50.0F; } } else { if (this.mc.currentScreen instanceof GuiDownloadTerrain) { Config.sleep(20L); } this.lastServerTime = 0L; this.lastServerTicks = 0; } } }
@SubscribeEvent public void onGuiShow(GuiOpenEvent event) { if (CommonUtils.isHypixel()) { // The user is confirmed to be on the Hypixel network and the time // of last show is more than 5000ms ago if ((event.gui instanceof GuiDownloadTerrain) && (lastGuiShow < (System.currentTimeMillis() - 5000))) { // Save the current time, to ensure we don't show the update // dialogue too often. lastGuiShow = System.currentTimeMillis(); // Create the runnable TimerTask timerTask = (new TimerTask() { @Override public void run() { // If the config is disabled, then just return if (!((Boolean) ConfigurationHandler .getConfigurationAttribute(ConfigAttribute.DO_API))) { return; } // This implies it is a server change ServerLocationUtils.sendServer(); // Do the check for updates UpdateChecker.checkForUpdate(); // Check if it's the first join if ((Boolean) ConfigurationHandler .getConfigurationAttribute(ConfigAttribute.FIRST_JOIN)) { ConfigurationHandler.setConfigurationAttribute( ConfigAttribute.FIRST_JOIN, false); } } }); // Run it in 2 seconds new Timer().schedule(timerTask, 2000l); } } }