static void guiInstance(GuiOpenEvent e) { if (!(mc.currentScreen instanceof ScreenGUI)) { if (mc.currentScreen != e.gui) { if ((e.gui instanceof GuiIngameMenu) || ((e.gui instanceof GuiInventory) && (!OptionCore.DEFAULT_INVENTORY.getValue()))) { final boolean inv = (e.gui instanceof GuiInventory); if (mc.playerController.isInCreativeMode() && inv) e.gui = new GuiContainerCreative(mc.thePlayer); else { e.gui = new IngameMenuGUI((inv ? (GuiInventory) mc.currentScreen : null)); } } if ((e.gui instanceof GuiGameOver) && (!OptionCore.DEFAULT_DEATH_SCREEN.getValue())) { if (mc.ingameGUI instanceof IngameGUI) { e.gui = new DeathScreen(); } } } else e.setCanceled(true); } }
public Ghost() { super("Ghost", 0xC0FFB1, ModuleCategory.MISCELLANEOUS); listeners.add(new Listener<PlayerUpdate>() { @Override public void call(PlayerUpdate event) { if (mc.currentScreen instanceof GuiGameOver) { mc.currentScreen = null; mc.setIngameFocus(); hasGhosted = true; mc.thePlayer.setPlayerSPHealth(1); } } }); }
@SubscribeEvent public void onLivingUpdate(LivingUpdateEvent event) { if (event.entity instanceof EntityPlayer) { EntityPlayer player = (EntityPlayer)event.entity; ItemStack itemstack = player.getHeldItem(); if (player.ticksExisted % 2 == 0) { if (mc.getSoundHandler().isSoundPlaying(FNAFSoundHandler.deathStatic) && !(mc.currentScreen instanceof GuiGameOver)) { mc.getSoundHandler().stopSound(FNAFSoundHandler.deathStatic); } } } }
@SubscribeEvent public void onGuiOpen(GuiOpenEvent event) { // if (event.gui instanceof GuiMainMenu) // { // { // // } // } if (event.gui instanceof GuiGameOver) { GuiFNAFGameOver.ticksElapsed = 0; mc.getSoundHandler().stopSounds(); if (!mc.getSoundHandler().isSoundPlaying(FNAFSoundHandler.deathStatic)) { mc.getSoundHandler().playSound(FNAFSoundHandler.deathStatic); } } }
@SubscribeEvent public void onPlaySound(PlaySoundEvent17 event) { if (mc.currentScreen instanceof GuiGameOver) { if (!event.name.equals("static")) { event.result = null; } } // else if (mc.currentScreen instanceof GuiMonitor) // { // if (event.name.equals("gui.button.press")) // { // event.result = null; // } // } }
@SubscribeEvent public void onGuiOpen(GuiOpenEvent event) { GuiScreen gui = event.gui; if (!Settings.autoRespawn) { return; } if (gui instanceof GuiGameOver && !hasClicked) { Minecraft mc = Minecraft.getMinecraft(); if (!mc.theWorld.getWorldInfo().isHardcoreModeEnabled()) { hasClicked = true; mc.thePlayer.respawnPlayer(); mc.displayGuiScreen((GuiScreen) null); event.setCanceled(true); } } else if (!(gui instanceof GuiGameOver) && hasClicked) { hasClicked = false; } }
@SubscribeEvent public void onOpenGui(GuiOpenEvent event) { Minecraft mc = Minecraft.getMinecraft(); if (mc.player != null) { if (event.getGui() instanceof GuiGameOver && isKnockedOut && !acceptedDeath) { // Minor hack: isKnockedOut is always set AFTER the game over screen pops up, so we can abuse that here event.setGui(null); } else if (isKnockedOut && event.getGui() instanceof GuiInventory) { event.setGui(null); } } }
public void setDimensionAndSpawnPlayer(int dimension) { this.theWorld.setInitialSpawnLocation(); this.theWorld.removeAllEntities(); int i = 0; String s = null; if (this.thePlayer != null) { i = this.thePlayer.getEntityId(); this.theWorld.removeEntity(this.thePlayer); s = this.thePlayer.getClientBrand(); } this.renderViewEntity = null; EntityPlayerSP entityplayersp = this.thePlayer; this.thePlayer = this.playerController.func_178892_a(this.theWorld, this.thePlayer == null ? new StatFileWriter() : this.thePlayer.getStatFileWriter()); this.thePlayer.getDataWatcher().updateWatchedObjectsFromList(entityplayersp.getDataWatcher().getAllWatched()); this.thePlayer.dimension = dimension; this.renderViewEntity = this.thePlayer; this.thePlayer.preparePlayerToSpawn(); this.thePlayer.setClientBrand(s); this.theWorld.spawnEntityInWorld(this.thePlayer); this.playerController.flipPlayer(this.thePlayer); this.thePlayer.movementInput = new MovementInputFromOptions(this.gameSettings); this.thePlayer.setEntityId(i); this.playerController.setPlayerCapabilities(this.thePlayer); this.thePlayer.setReducedDebug(entityplayersp.hasReducedDebug()); if (this.currentScreen instanceof GuiGameOver) { this.displayGuiScreen((GuiScreen)null); } }
public void setDimensionAndSpawnPlayer(int dimension) { this.theWorld.setInitialSpawnLocation(); this.theWorld.removeAllEntities(); int i = 0; String s = null; if (this.thePlayer != null) { i = this.thePlayer.getEntityId(); this.theWorld.removeEntity(this.thePlayer); s = this.thePlayer.getClientBrand(); } this.renderViewEntity = null; EntityPlayerSP entityplayersp = this.thePlayer; this.thePlayer = this.playerController.func_178892_a(this.theWorld, this.thePlayer == null ? new StatFileWriter() : this.thePlayer.getStatFileWriter()); this.thePlayer.getDataWatcher().updateWatchedObjectsFromList(entityplayersp.getDataWatcher().getAllWatched()); this.thePlayer.dimension = dimension; this.renderViewEntity = this.thePlayer; this.thePlayer.preparePlayerToSpawn(); this.thePlayer.setClientBrand(s); this.theWorld.spawnEntityInWorld(this.thePlayer); this.playerController.flipPlayer(this.thePlayer); this.thePlayer.movementInput = new MovementInputFromOptions(this.gameSettings); this.thePlayer.setEntityId(i); this.playerController.setPlayerCapabilities(this.thePlayer); this.thePlayer.setReducedDebug(entityplayersp.hasReducedDebug()); if (this.currentScreen instanceof GuiGameOver) { this.displayGuiScreen((GuiScreen) null); } }
public void handleCombatEvent(SPacketCombatEvent packetIn) { PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); if (packetIn.eventType == SPacketCombatEvent.Event.ENTITY_DIED) { Entity entity = this.clientWorldController.getEntityByID(packetIn.playerId); if (entity == this.gameController.player) { this.gameController.displayGuiScreen(new GuiGameOver(packetIn.deathMessage)); } } }
public void setDimensionAndSpawnPlayer(int dimension) { this.world.setInitialSpawnLocation(); this.world.removeAllEntities(); int i = 0; String s = null; if (this.player != null) { i = this.player.getEntityId(); this.world.removeEntity(this.player); s = this.player.getServerBrand(); } this.renderViewEntity = null; EntityPlayerSP entityplayersp = this.player; this.player = this.playerController.createClientPlayer(this.world, this.player == null ? new StatisticsManager() : this.player.getStatFileWriter()); this.player.getDataManager().setEntryValues(entityplayersp.getDataManager().getAll()); this.player.dimension = dimension; this.renderViewEntity = this.player; this.player.preparePlayerToSpawn(); this.player.setServerBrand(s); this.world.spawnEntityInWorld(this.player); this.playerController.flipPlayer(this.player); this.player.movementInput = new MovementInputFromOptions(this.gameSettings); this.player.setEntityId(i); this.playerController.setPlayerCapabilities(this.player); this.player.setReducedDebug(entityplayersp.hasReducedDebug()); if (this.currentScreen instanceof GuiGameOver) { this.displayGuiScreen((GuiScreen)null); } }
public void handleCombatEvent(SPacketCombatEvent packetIn) { PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); if (packetIn.eventType == SPacketCombatEvent.Event.ENTITY_DIED) { Entity entity = this.clientWorldController.getEntityByID(packetIn.playerId); if (entity == this.gameController.thePlayer) { this.gameController.displayGuiScreen(new GuiGameOver(packetIn.deathMessage)); } } }
public void setDimensionAndSpawnPlayer(int dimension) { this.theWorld.setInitialSpawnLocation(); this.theWorld.removeAllEntities(); int i = 0; String s = null; if (this.thePlayer != null) { i = this.thePlayer.getEntityId(); this.theWorld.removeEntity(this.thePlayer); s = this.thePlayer.getServerBrand(); } this.renderViewEntity = null; EntityPlayerSP entityplayersp = this.thePlayer; this.thePlayer = this.playerController.createClientPlayer(this.theWorld, this.thePlayer == null ? new StatisticsManager() : this.thePlayer.getStatFileWriter()); this.thePlayer.getDataManager().setEntryValues(entityplayersp.getDataManager().getAll()); this.thePlayer.dimension = dimension; this.renderViewEntity = this.thePlayer; this.thePlayer.preparePlayerToSpawn(); this.thePlayer.setServerBrand(s); this.theWorld.spawnEntityInWorld(this.thePlayer); this.playerController.flipPlayer(this.thePlayer); this.thePlayer.movementInput = new MovementInputFromOptions(this.gameSettings); this.thePlayer.setEntityId(i); this.playerController.setPlayerCapabilities(this.thePlayer); this.thePlayer.setReducedDebug(entityplayersp.hasReducedDebug()); if (this.currentScreen instanceof GuiGameOver) { this.displayGuiScreen((GuiScreen)null); } }
@SubscribeEvent @SideOnly(Side.CLIENT) public void onPlayerDeathImage(GuiOpenEvent e) { EntityPlayer player = Minecraft.getMinecraft().thePlayer; if (!(e.getGui() instanceof GuiGameOver) || !Config.demiseImage || player == null || player.getHealth() <= 0F) return; // Getting discord and minecraft user try { User me = DiscordCE.client.getUserById(DiscordCE.client.getSelfInfo().getId()); Minecraft mc = Minecraft.getMinecraft(); ITextComponent t = ScreenShotHelper.saveScreenshot(mc.mcDataDir, mc.displayWidth, mc.displayHeight, mc.getFramebuffer()); String fileName = new JSONObject(TextComponentBase.Serializer.componentToJson(t)).getJSONArray("with") .getJSONObject(0).getJSONObject("clickEvent").getString("value"); File file = new File(fileName); TextChannel c = DiscordCE.client.getTextChannelById(Preferences.i.usingChannel); // Doing checks if (c == null || !c.checkPermission(me, Permission.MESSAGE_ATTACH_FILES)) return; //Sending file c.sendFileAsync(file, null, m -> file.delete()); } catch (Exception e1) { e1.printStackTrace(); } }
public DeathScreen(GuiGameOver guiGamOver) { super(); gameOver = guiGamOver; oldCursorStatus = CURSOR_STATUS; CURSOR_STATUS = CursorStatus.HIDDEN; }
public void preInit() { super.preInit(); GuiOverrideHelper.addOverride(GuiMainMenu.class, new GuiFNAFMainMenu()); GuiOverrideHelper.addOverride(GuiGameOver.class, new GuiFNAFGameOver()); MinecraftForge.EVENT_BUS.register(new GuiOverlay(Minecraft.getMinecraft())); MinecraftForge.EVENT_BUS.register(new ClientEventHandler()); FMLCommonHandler.instance().bus().register(new ClientEventHandler()); }
private void handleDeathpointCreation() { Minecraft mc = Minecraft.getMinecraft(); if(mc.currentScreen instanceof GuiGameOver) { if(!wasDead) { wasDead = true; int x = MathHelper.floor_double(mc.thePlayer.posX); int y = MathHelper.floor_double(mc.thePlayer.posY + 1); int z = MathHelper.floor_double(mc.thePlayer.posZ); Random rand = new Random(); int r = rand.nextInt(256); int g = rand.nextInt(256); int b = rand.nextInt(256); Waypoint pt = new Waypoint("Death Point", x, y, z, r << 16 | g << 8 | b, Waypoint.TYPE_DEATH); deathpoints.add(pt); if(deathpoints.size() > 3) { deathpoints.remove(0); } try { this.saveCurrentWaypoints(); } catch (IOException e) { e.printStackTrace(); } } } else { wasDead = false; Iterator<Waypoint> pts = deathpoints.iterator(); while(pts.hasNext()) { Waypoint nxt = pts.next(); if(nxt.getDistFromPlayer(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ) <= 2.0) { pts.remove(); } } } }
public void setDimensionAndSpawnPlayer(int par1) { this.theWorld.setSpawnLocation(); this.theWorld.removeAllEntities(); int var2 = 0; String var3 = null; if (this.thePlayer != null) { var2 = this.thePlayer.getEntityId(); this.theWorld.removeEntity(this.thePlayer); var3 = this.thePlayer.func_142021_k(); } this.renderViewEntity = null; this.thePlayer = this.playerController.func_147493_a(this.theWorld, this.thePlayer == null ? new StatFileWriter() : this.thePlayer.func_146107_m()); this.thePlayer.dimension = par1; this.renderViewEntity = this.thePlayer; this.thePlayer.preparePlayerToSpawn(); this.thePlayer.func_142020_c(var3); this.theWorld.spawnEntityInWorld(this.thePlayer); this.playerController.flipPlayer(this.thePlayer); this.thePlayer.movementInput = new MovementInputFromOptions(this.gameSettings); this.thePlayer.setEntityId(var2); this.playerController.setPlayerCapabilities(this.thePlayer); if (this.currentScreen instanceof GuiGameOver) { this.displayGuiScreen((GuiScreen)null); } }
public void setDimensionAndSpawnPlayer(int p_71354_1_) { this.theWorld.setSpawnLocation(); this.theWorld.removeAllEntities(); int j = 0; String s = null; if (this.thePlayer != null) { j = this.thePlayer.getEntityId(); this.theWorld.removeEntity(this.thePlayer); s = this.thePlayer.func_142021_k(); } this.renderViewEntity = null; this.thePlayer = this.playerController.func_147493_a(this.theWorld, this.thePlayer == null ? new StatFileWriter() : this.thePlayer.getStatFileWriter()); this.thePlayer.dimension = p_71354_1_; this.renderViewEntity = this.thePlayer; this.thePlayer.preparePlayerToSpawn(); this.thePlayer.func_142020_c(s); this.theWorld.spawnEntityInWorld(this.thePlayer); this.playerController.flipPlayer(this.thePlayer); this.thePlayer.movementInput = new MovementInputFromOptions(this.gameSettings); this.thePlayer.setEntityId(j); this.playerController.setPlayerCapabilities(this.thePlayer); if (this.currentScreen instanceof GuiGameOver) { this.displayGuiScreen((GuiScreen)null); } }
public void func_71354_a(int p_71354_1_) { this.field_71441_e.func_72974_f(); this.field_71441_e.func_73022_a(); int var2 = 0; String var3 = null; if(this.field_71439_g != null) { var2 = this.field_71439_g.field_70157_k; this.field_71441_e.func_72900_e(this.field_71439_g); var3 = this.field_71439_g.func_142021_k(); } this.field_71451_h = null; this.field_71439_g = this.field_71442_b.func_78754_a(this.field_71441_e); this.field_71439_g.field_71093_bK = p_71354_1_; this.field_71451_h = this.field_71439_g; this.field_71439_g.func_70065_x(); this.field_71439_g.func_142020_c(var3); this.field_71441_e.func_72838_d(this.field_71439_g); this.field_71442_b.func_78745_b(this.field_71439_g); this.field_71439_g.field_71158_b = new MovementInputFromOptions(this.field_71474_y); this.field_71439_g.field_70157_k = var2; this.field_71442_b.func_78748_a(this.field_71439_g); if(this.field_71462_r instanceof GuiGameOver) { this.func_71373_a((GuiScreen)null); } }
public void setDimensionAndSpawnPlayer(int par1) { this.theWorld.setSpawnLocation(); this.theWorld.removeAllEntities(); int j = 0; String s = null; if (this.thePlayer != null) { j = this.thePlayer.entityId; this.theWorld.removeEntity(this.thePlayer); s = this.thePlayer.func_142021_k(); } this.renderViewEntity = null; this.thePlayer = this.playerController.func_78754_a(this.theWorld); this.thePlayer.dimension = par1; this.renderViewEntity = this.thePlayer; this.thePlayer.preparePlayerToSpawn(); this.thePlayer.func_142020_c(s); this.theWorld.spawnEntityInWorld(this.thePlayer); this.playerController.flipPlayer(this.thePlayer); this.thePlayer.movementInput = new MovementInputFromOptions(this.gameSettings); this.thePlayer.entityId = j; this.playerController.setPlayerCapabilities(this.thePlayer); if (this.currentScreen instanceof GuiGameOver) { this.displayGuiScreen((GuiScreen)null); } }
@Override public void runCommand(String s, String[] args) { Wrapper.addChatMessage("You died at X: " + GuiGameOver.deathX + ", Y: " + GuiGameOver.deathY + ", Z: " + GuiGameOver.deathZ); }
@SubscribeEvent public void blockDeathGui(GuiOpenEvent event) { if(event.getGui() instanceof GuiGameOver && WeaponsCapability.get(Minecraft.getMinecraft().player).isFeign() && Minecraft.getMinecraft().player.getHealth() > 0f) { event.setCanceled(true); } }