/** * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the * window resizes, the buttonList is cleared beforehand. */ public void initGui() { this.screenTitle = I18n.format("gui.stats", new Object[0]); this.doesGuiPauseGame = true; this.mc.getConnection().sendPacket(new CPacketClientStatus(CPacketClientStatus.State.REQUEST_STATS)); }
/** * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the * window resizes, the buttonList is cleared beforehand. */ public void initGui() { this.mc.getConnection().sendPacket(new CPacketClientStatus(CPacketClientStatus.State.REQUEST_STATS)); this.buttonList.clear(); this.buttonList.add(new GuiOptionButton(1, this.width / 2 + 24, this.height / 2 + 74, 80, 20, I18n.format("gui.done", new Object[0]))); }
@Override public void initGui() { this.mc.getConnection().sendPacket(new CPacketClientStatus(CPacketClientStatus.State.REQUEST_STATS)); this.mc.player.getCapability(TF2weapons.PLAYER_CAP, null).newContracts=false; this.mc.player.getCapability(TF2weapons.PLAYER_CAP, null).newRewards=false; super.initGui(); this.guiLeft=this.width/2-128; this.guiTop=this.height/2-108; this.buttonList.add(new GuiButton(0,this.guiLeft+7,this.guiTop+189,100,20,I18n.format("gui.contracts.accept"))); this.buttonList.add(new GuiButton(1,this.guiLeft+107,this.guiTop+189,71,20,I18n.format("gui.contracts.reject"))); this.buttonList.add(new GuiButton(2,this.guiLeft+178,this.guiTop+189,71,20,I18n.format("gui.done"))); if(this.selectedContract != null) { this.buttonList.get(1).enabled=true; this.buttonList.get(0).enabled=!this.selectedContract.active || this.selectedContract.rewards>0; this.buttonList.get(0).displayString=I18n.format(this.selectedContract.active?"gui.contracts.claim":"gui.contracts.accept"); } else { this.buttonList.get(1).enabled=false; this.buttonList.get(0).enabled=false; this.buttonList.get(0).displayString=I18n.format("gui.contracts.select"); } for(int i=0;i<this.mc.player.getCapability(TF2weapons.PLAYER_CAP,null).contracts.size();i++) { Contract contract=this.mc.player.getCapability(TF2weapons.PLAYER_CAP,null).contracts.get(i); this.buttonList.add(new GuiButton(i+3,this.guiLeft+7,this.guiTop+16+i*20,74,20,I18n.format("gui.contracts."+contract.className, new Object[0])+": "+contract.progress+" CP")); } }
/** * Processes the client status updates: respawn attempt from player, opening statistics or achievements, or * acquiring 'open inventory' achievement */ public void processClientStatus(CPacketClientStatus packetIn) { PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.playerEntity.getServerWorld()); this.playerEntity.markPlayerActive(); CPacketClientStatus.State cpacketclientstatus$state = packetIn.getStatus(); switch (cpacketclientstatus$state) { case PERFORM_RESPAWN: if (this.playerEntity.playerConqueredTheEnd) { this.playerEntity.playerConqueredTheEnd = false; this.playerEntity = this.serverController.getPlayerList().recreatePlayerEntity(this.playerEntity, 0, true); } else { if (this.playerEntity.getHealth() > 0.0F) { return; } this.playerEntity = this.serverController.getPlayerList().recreatePlayerEntity(this.playerEntity, playerEntity.dimension, false); if (this.serverController.isHardcore()) { this.playerEntity.setGameType(GameType.SPECTATOR); this.playerEntity.getServerWorld().getGameRules().setOrCreateGameRule("spectatorsGenerateChunks", "false"); } } break; case REQUEST_STATS: this.playerEntity.getStatFile().sendStats(this.playerEntity); break; case OPEN_INVENTORY_ACHIEVEMENT: this.playerEntity.addStat(AchievementList.OPEN_INVENTORY); } }
/** * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the * window resizes, the buttonList is cleared beforehand. */ public void initGui() { this.mc.getConnection().sendPacket(new CPacketClientStatus(CPacketClientStatus.State.REQUEST_STATS)); this.buttonList.clear(); this.buttonList.add(new GuiOptionButton(1, this.width / 2 + 24, this.height / 2 + 74, 80, 20, I18n.format("gui.done", new Object[0]))); this.buttonList.add(button = new GuiButton(2, (width - imageWidth) / 2 + 24, height / 2 + 74, 125, 20, net.minecraftforge.common.AchievementPage.getTitle(currentPage))); }
/** * Processes the client status updates: respawn attempt from player, opening statistics or achievements, or * acquiring 'open inventory' achievement */ public void processClientStatus(CPacketClientStatus packetIn) { PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.playerEntity.getServerWorld()); this.playerEntity.markPlayerActive(); CPacketClientStatus.State cpacketclientstatus$state = packetIn.getStatus(); switch (cpacketclientstatus$state) { case PERFORM_RESPAWN: if (this.playerEntity.playerConqueredTheEnd) { this.playerEntity.playerConqueredTheEnd = false; this.playerEntity = this.serverController.getPlayerList().recreatePlayerEntity(this.playerEntity, 0, true); } else { if (this.playerEntity.getHealth() > 0.0F) { return; } this.playerEntity = this.serverController.getPlayerList().recreatePlayerEntity(this.playerEntity, 0, false); if (this.serverController.isHardcore()) { this.playerEntity.setGameType(GameType.SPECTATOR); this.playerEntity.getServerWorld().getGameRules().setOrCreateGameRule("spectatorsGenerateChunks", "false"); } } break; case REQUEST_STATS: this.playerEntity.getStatFile().sendStats(this.playerEntity); break; case OPEN_INVENTORY_ACHIEVEMENT: this.playerEntity.addStat(AchievementList.OPEN_INVENTORY); } }
public void respawnPlayer() { this.connection.sendPacket(new CPacketClientStatus(CPacketClientStatus.State.PERFORM_RESPAWN)); }
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); } }
private void sendRespawnPacket() { this.mc.player.connection.sendPacket(new CPacketClientStatus(CPacketClientStatus.State.PERFORM_RESPAWN)); this.mc.displayGuiScreen((GuiScreen)null); }
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 sendRespawnPacket() { this.mc.thePlayer.connection.sendPacket(new CPacketClientStatus(CPacketClientStatus.State.PERFORM_RESPAWN)); this.mc.displayGuiScreen((GuiScreen)null); }
@Override public void processClientStatus(CPacketClientStatus p_147342_1_) { }
@Override public void processClientStatus(@Nonnull CPacketClientStatus p_147342_1_) { }
@Override public void processClientStatus(CPacketClientStatus packetIn) { }
/** * Processes the client status updates: respawn attempt from player, opening statistics or achievements, or * acquiring 'open inventory' achievement */ void processClientStatus(CPacketClientStatus packetIn);