private boolean isCorrectModeActive() { switch (mode.toLowerCase()) { case MODE_SHIFT: return GuiScreen.isShiftKeyDown(); case MODE_CTRL: return GuiScreen.isCtrlKeyDown(); case MODE_ALT: return GuiScreen.isAltKeyDown(); case MODE_NO_SHIFT: return !GuiScreen.isShiftKeyDown(); case MODE_NO_CTRL: return !GuiScreen.isCtrlKeyDown(); case MODE_NO_ALT: return !GuiScreen.isAltKeyDown(); default: return true; } }
@Override protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException { ItemStack programmedItem = te.getIteminProgrammingSlot(); if (nameField.isFocused() && !programmedItem.isEmpty()) { programmedItem.setStackDisplayName(nameField.getText()); NetworkHandler.sendToServer(new PacketUpdateTextfield(te, 0)); } super.mouseClicked(mouseX, mouseY, mouseButton); if (mouseButton == 1 && showingWidgetProgress == 0) { IProgWidget widget = programmerUnit.getHoveredWidget(mouseX, mouseY); if (widget != null) { GuiScreen screen = widget.getOptionWindow(this); if (screen != null) mc.displayGuiScreen(screen); } } }
public GuiScreenRealmsProxy getNotificationScreen(GuiScreen p_getNotificationScreen_1_) { try { this.previousScreen = p_getNotificationScreen_1_; Class<?> oclass = Class.forName("com.mojang.realmsclient.gui.screens.RealmsNotificationsScreen"); Constructor<?> constructor = oclass.getDeclaredConstructor(new Class[] {RealmsScreen.class}); constructor.setAccessible(true); Object object = constructor.newInstance(new Object[] {this}); return ((RealmsScreen)object).getProxy(); } catch (ClassNotFoundException var5) { LOGGER.error("Realms module missing"); } catch (Exception exception) { LOGGER.error((String)"Failed to load Realms module", (Throwable)exception); } return null; }
@Inject(method = "drawScreen", at = @At("HEAD"), cancellable = true) public void onDrawScreen(int mouseX, int mouseY, float partialTicks, CallbackInfo ci) { Minecraft mc = Minecraft.getMinecraft(); GuiScreen thisScreen = (GuiScreen) (Object) this; RenderGuiScreen renderGuiScreen = new RenderGuiScreen(thisScreen); EventManager.post(renderGuiScreen); if (renderGuiScreen.isCancelled()) { if (mc.currentScreen != null && mc.currentScreen != thisScreen) { mc.currentScreen.drawScreen(mouseX, mouseY, partialTicks); } ci.cancel(); } }
@SideOnly(Side.CLIENT) @Override public void addInformation(ItemStack stack, @Nullable World player, List<String> tooltip, ITooltipFlag advanced) { if (NBTHelper.hasTag(stack, BrewUtils.BREW_DESC)) { tooltip.add(TextFormatting.ITALIC + I18n.format(NBTHelper.getString(stack, BrewUtils.BREW_DESC))); } if (GuiScreen.isShiftKeyDown()) { tooltip.add(TextFormatting.DARK_GRAY + "" + TextFormatting.ITALIC + I18n.format("tooltip.brew.data")); BrewUtils.addBrewTooltip(stack, tooltip); tooltip.add(TextFormatting.DARK_GRAY + "" + TextFormatting.ITALIC + I18n.format("tooltip.potion.data")); BrewUtils.addPotionTooltip(stack, tooltip); } else { tooltip.add(TextFormatting.DARK_GRAY + "" + TextFormatting.ITALIC + I18n.format("tooltip.shift_for_info")); } }
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 NetHandlerPlayClient(Minecraft mcIn, GuiScreen p_i46300_2_, NetworkManager networkManagerIn, GameProfile profileIn) { this.gameController = mcIn; this.guiScreenServer = p_i46300_2_; this.netManager = networkManagerIn; this.profile = profileIn; }
/** * Fired when a key is typed (except F11 which toggles full screen). This is the equivalent of * KeyListener.keyTyped(KeyEvent e). Args : character (character on the key), keyCode (lwjgl Keyboard key code) */ protected void keyTyped(char typedChar, int keyCode) throws IOException { if (keyCode == this.mc.gameSettings.keyBindInventory.getKeyCode()) { this.mc.displayGuiScreen((GuiScreen)null); this.mc.setIngameFocus(); } else { super.keyTyped(typedChar, keyCode); } }
public GuiAchievements(GuiScreen parentScreenIn, StatFileWriter statFileWriterIn) { this.parentScreen = parentScreenIn; this.statFileWriter = statFileWriterIn; int i = 141; int j = 141; this.field_146569_s = this.field_146567_u = this.field_146565_w = (double)(AchievementList.openInventory.displayColumn * 24 - i / 2 - 12); this.field_146568_t = this.field_146566_v = this.field_146573_x = (double)(AchievementList.openInventory.displayRow * 24 - j / 2); }
public DrawScreenEvent(GuiScreen gui, int mouseX, int mouseY, float renderPartialTicks) { super(gui); this.mouseX = mouseX; this.mouseY = mouseY; this.renderPartialTicks = renderPartialTicks; }
public GuiStreamUnavailable(GuiScreen parentScreenIn, GuiStreamUnavailable.Reason p_i46311_2_, List<ChatComponentTranslation> p_i46311_3_) { this.field_152324_f = new ChatComponentTranslation("stream.unavailable.title", new Object[0]); this.field_152323_r = Lists.<String>newArrayList(); this.parentScreen = parentScreenIn; this.field_152326_h = p_i46311_2_; this.field_152327_i = p_i46311_3_; }
private void modifyButton(GuiScreen gui, GuiButton button) { if (text != null) { button.displayString = text; } if (width != Length.ZERO) { button.width = width.getLength(gui.width); } if (height != Length.ZERO) { button.height = height.getLength(gui.height); } if (offsetX != Length.ZERO) { button.x = getLeft(gui, button.width); } if (offsetY != Length.ZERO) { button.y = getTop(gui, button.height); } }
public GuiConnecting(GuiScreen p_i1181_1_, Minecraft mcIn, ServerData p_i1181_3_) { this.mc = mcIn; this.previousGuiScreen = p_i1181_1_; ServerAddress serveraddress = ServerAddress.func_78860_a(p_i1181_3_.serverIP); mcIn.loadWorld((WorldClient)null); mcIn.setServerData(p_i1181_3_); this.connect(serveraddress.getIP(), serveraddress.getPort()); }
/** * Called by the controls from the buttonList when activated. (Mouse pressed for buttons) */ protected void actionPerformed(GuiButton button) throws IOException { if (button.enabled) { if (button.id == 0) { this.tileSign.markDirty(); this.mc.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); } }
/** * Fired when a key is typed. This is the equivalent of * KeyListener.keyTyped(KeyEvent e). */ @Override protected void keyTyped(char par1, int par2) { prevScreen.setKey(Keyboard.getKeyName(par2)); mc.displayGuiScreen((GuiScreen)prevScreen); }
public KeybindEditorScreen(GuiScreen prevScreen, String key, String commands) { this.prevScreen = prevScreen; this.key = key; oldKey = key; oldCommands = commands; }
/** * Called by the controls from the buttonList when activated. (Mouse pressed for buttons) */ protected void actionPerformed(GuiButton button) throws IOException { if (button.enabled) { if (button.id == 0) { this.stream.func_152917_b("/ban " + this.field_152337_h.displayName); } else if (button.id == 3) { this.stream.func_152917_b("/unban " + this.field_152337_h.displayName); } else if (button.id == 2) { this.stream.func_152917_b("/mod " + this.field_152337_h.displayName); } else if (button.id == 4) { this.stream.func_152917_b("/unmod " + this.field_152337_h.displayName); } else if (button.id == 1) { this.stream.func_152917_b("/timeout " + this.field_152337_h.displayName); } this.mc.displayGuiScreen((GuiScreen)null); } }
public GuiConnecting(GuiScreen parent, Minecraft mcIn, String hostName, int port) { this.mc = mcIn; this.previousGuiScreen = parent; mcIn.loadWorld((WorldClient)null); this.connect(hostName, port); }
@Override public void keyTyped(char c, int key) { if (c >= '0' && c <= '9') { if (!amount.contains(".") || amount.contains(".") && amount.substring(amount.lastIndexOf(".")).length() < 3) { System.out.println("WHAT"); amount = amount.concat("" + c); } } if (c == '.') { if (!amount.isEmpty() && !amount.contains(".")) { amount = amount.concat("" + c); } else if (amount.isEmpty()) { amount = amount.concat("0" + c); } } if (key == Keyboard.KEY_BACK && amount != null && !amount.isEmpty()) { amount = amount.substring(0, amount.length() - 1); } if (key == Keyboard.KEY_RETURN) { AccountCapability cap = player.getCapability(Currency.ACCOUNT_DATA, null); if (amount != null && !amount.isEmpty() && Float.parseFloat(amount) <= 100000) { // if (!deposit.enabled) { // cap.addClientAmount(Float.parseFloat(amount), true); // CurrencyUtils.depositMoney(player, Float.parseFloat(amount)); // } else if (!withdraw.enabled && Float.parseFloat(amount) <= // cap.getAmount()) { // cap.subtractClientAmount(Float.parseFloat(amount), true); // PacketDispatcher.sendToServer(new MessageSyncDrops(player, // Float.parseFloat(amount))); // } } this.mc.displayGuiScreen((GuiScreen) null); } if (key == Keyboard.KEY_E || key == Keyboard.KEY_ESCAPE) { this.mc.displayGuiScreen((GuiScreen) null); } }
public GuiAchievements(GuiScreen parentScreenIn, StatisticsManager statFileWriterIn) { this.parentScreen = parentScreenIn; this.statFileWriter = statFileWriterIn; int i = 141; int j = 141; this.xScrollTarget = (double)(AchievementList.OPEN_INVENTORY.displayColumn * 24 - 70 - 12); this.xScrollO = this.xScrollTarget; this.xScrollP = this.xScrollTarget; this.yScrollTarget = (double)(AchievementList.OPEN_INVENTORY.displayRow * 24 - 70); this.yScrollO = this.yScrollTarget; this.yScrollP = this.yScrollTarget; }
/** * Called by the controls from the buttonList when activated. (Mouse pressed for buttons) */ @Override protected void actionPerformed(GuiButton button) throws IOException { if (button.enabled) { SortType type = SortType.getTypeForButton(button); if (type != null) { for (GuiButton b : buttonList) { if (SortType.getTypeForButton(b) != null) { b.enabled = true; } } button.enabled = false; sorted = false; sortType = type; this.mods = modList.getMods(); } else { switch (button.id) { case 6: { this.mc.displayGuiScreen(this.mainMenu); return; } case 20: { try { IModGuiFactory guiFactory = FMLClientHandler.instance().getGuiFactoryFor(selectedMod); GuiScreen newScreen = guiFactory.mainConfigGuiClass().getConstructor(GuiScreen.class).newInstance(this); this.mc.displayGuiScreen(newScreen); } catch (Exception e) { FMLLog.log(Level.ERROR, e, "There was a critical issue trying to build the config GUI for %s", selectedMod.getModId()); } return; } } } } super.actionPerformed(button); }
public static void reconnectToLastServer(GuiScreen prevScreen) { if(lastServer == null) return; currentServerIP = lastServer.getServerData().serverIP; if(!currentServerIP.contains(":")) currentServerIP += ":25565"; Minecraft mc = Minecraft.getMinecraft(); mc.displayGuiScreen( new GuiConnecting(prevScreen, mc, lastServer.getServerData())); }
@Override public void handleMouseInput() throws IOException { int mouseX = Mouse.getEventX() * width / mc.displayWidth; int mouseY = height - Mouse.getEventY() * height / mc.displayHeight - 1; int button = Mouse.getEventButton(); if (Mouse.getEventButtonState()) { //if (GuiScreen.isCtrlKeyDown()) { if (GuiScreen.isAltKeyDown()) { if (button == 0) { Slot slot = getSlotAtPos(mouseX, mouseY); if (slot != null && !slot.getStack().isEmpty()) { if (!ItemUtils.areItemsEqual(DankNullUtils.getSelectedStack(getDankNullInventory()), slot.getStack())) { int count = 0; for (Slot slotHovered : inventorySlots.inventorySlots) { count++; if (slotHovered.equals(slot)) { DankNullUtils.setSelectedStackIndex(getDankNullInventory(), (count - 1) - 36); return; } } } } } //} } } super.handleMouseInput(); }
public GuiInvited(Invite invite, GuiScreen parent) { this.invite = invite; this.parent = parent; server = new ServerListEntryPublic(new MockServerListEntryNormal(new ServerDataPublic(invite.server))); canConnect = invite.project == Integer.valueOf(Config.getInstance().curseProjectID); }
public static void drawProgressText(GuiScreen gui, int mouseX, int mouseY, int progress, int maxProgress, boolean reverse){ if(maxProgress > 0){ int i = (int) ((progress / (maxProgress * 1.0F)) * 100.0); if(reverse){ i = 100 - i; } gui.drawHoveringText(i + "%", mouseX, mouseY); } }
/** * @param player * @param gui */ public void displayGuiScreen(EntityPlayer player, GuiScreen gui) { if (client.thePlayer==player && gui != null) { client.displayGuiScreen(gui); } }
@SubscribeEvent public void onInitGui(GuiScreenEvent.InitGuiEvent.Post event) { Minecraft mc = event.getGui().mc; if (mc.player != null && isKnockedOut && event.getGui() instanceof GuiChat) { GuiScreen gui = event.getGui(); enableButtonTimer = 0; buttonDie = new GuiButton(-2, gui.width / 2 - 100, gui.height / 2 - 30, I18n.format("gui.hardcorerevival.die")); buttonDie.enabled = false; event.getButtonList().add(buttonDie); } }
@SideOnly(Side.CLIENT) public static GuiScreen getCurrentScreen() { return getMinecraft().currentScreen; }
public TooltipManager(GuiScreen p_i85_1_) { this.guiScreen = p_i85_1_; }
@Override public GuiScreen createConfigGui(GuiScreen parentScreen) { return new YouTubeConfigurationGui(parentScreen); }
@Override public GuiScreen getParentScreen(final GuiDisconnected dcgui) { return dcgui.parentScreen; }
public GuiScreen getDisplayer() { return new ClickGuiDisplayer(); }
public GuiPastebin(GuiScreen parentScreen, NBTTagCompound tag) { this(parentScreen, new NBTToJsonConverter(tag).convert()); }
@Override public Class<? extends GuiScreen> mainConfigGuiClass() { return Config.class; }
public GuiInGameConfig(GuiScreen parent) { super(parent, Main.MODID_LOWER, false, false, Main.MODID + " configuration", ConfigData.class); titleLine2 = "Hover with the mouse over a variable to see a description"; }
public void handlePlayerPosLook(SPacketPlayerPosLook packetIn) { PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); EntityPlayer entityplayer = this.gameController.thePlayer; double d0 = packetIn.getX(); double d1 = packetIn.getY(); double d2 = packetIn.getZ(); float f = packetIn.getYaw(); float f1 = packetIn.getPitch(); if (packetIn.getFlags().contains(SPacketPlayerPosLook.EnumFlags.X)) { d0 += entityplayer.posX; } else { entityplayer.motionX = 0.0D; } if (packetIn.getFlags().contains(SPacketPlayerPosLook.EnumFlags.Y)) { d1 += entityplayer.posY; } else { entityplayer.motionY = 0.0D; } if (packetIn.getFlags().contains(SPacketPlayerPosLook.EnumFlags.Z)) { d2 += entityplayer.posZ; } else { entityplayer.motionZ = 0.0D; } if (packetIn.getFlags().contains(SPacketPlayerPosLook.EnumFlags.X_ROT)) { f1 += entityplayer.rotationPitch; } if (packetIn.getFlags().contains(SPacketPlayerPosLook.EnumFlags.Y_ROT)) { f += entityplayer.rotationYaw; } entityplayer.setPositionAndRotation(d0, d1, d2, f, f1); this.netManager.sendPacket(new CPacketConfirmTeleport(packetIn.getTeleportId())); this.netManager.sendPacket(new CPacketPlayer.PositionRotation(entityplayer.posX, entityplayer.getEntityBoundingBox().minY, entityplayer.posZ, entityplayer.rotationYaw, entityplayer.rotationPitch, false)); if (!this.doneLoadingTerrain) { this.gameController.thePlayer.prevPosX = this.gameController.thePlayer.posX; this.gameController.thePlayer.prevPosY = this.gameController.thePlayer.posY; this.gameController.thePlayer.prevPosZ = this.gameController.thePlayer.posZ; this.doneLoadingTerrain = true; this.gameController.displayGuiScreen((GuiScreen)null); } }
public GuiLogisticsLiquidFilter(GuiScreen parentScreen) { super(new ProgWidgetLiquidFilter(), null); this.parentScreen = parentScreen; }
public ConfigGUI(GuiScreen parentScreen) { super(parentScreen, new ConfigElement(KorTech.config.getCategory(Configuration.CATEGORY_GENERAL)).getChildElements(), References.MODID, false, false, GuiConfig.getAbridgedConfigPath(KorTech.config.toString())); }