@Override protected void actionPerformed(GuiButton button) throws IOException { switch (button.id) { case 0: // Means Done ErrorHandling.CleanErrors(); /* Closes the text editor, saves the .oc file and attempts to compile and load it */ mc.thePlayer.closeScreen(); text.deleteCharAt(cursorLocation); saveFile(); try { Compiler.main( String.format(System.getProperty("user.dir") + "/ObsidiCode/Test/SimpleMiner.oc")); } catch (Exception e) { e.printStackTrace(); } ArrayList<String> currentErrors = (ArrayList<String>) ErrorHandling.GetErrors().clone(); if (currentErrors.size() == 0) { loadRobot(); } else { ErrorBook eb = ObsidiSkriveMaskineMod.errorBook(); ObsidiCodingMachine.dropErrorLog(eb); } break; case 1: // Means reset // Resets the text on the screen. text = text.delete(0, text.toString().length()); cursorLocation = 0; break; default: break; } super.actionPerformed(button); }
@SideOnly(Side.CLIENT) public void addInformation(ItemStack item, EntityPlayer player, List list, boolean b) { if (GuiScreen.isShiftKeyDown()) { list.add("Gives you speed II and jump boost II."); } if (!GuiScreen.isShiftKeyDown()) { list.add("Press shift for more informations."); } }
@SubscribeEvent public void onTick(RenderTickEvent t) { GuiScreen screen = Minecraft.getMinecraft().currentScreen; if (screen instanceof GuiMainMenu) { screen.drawCenteredString( Minecraft.getMinecraft().fontRendererObj, StatCollector.translateToLocal("ias.loggedinas") + Minecraft.getMinecraft().getSession().getUsername() + ".", screen.width / 2, screen.height / 4 + 48 + 72 + 12 + 22, 0xFFCC8888); } }
/** Draws the screen and all the components in it. */ public void drawScreen(int par1, int par2, float par3) { this.drawDefaultBackground(); StringTranslate stringtranslate = StringTranslate.getInstance(); if (this.clientHandler == null) { this.drawCenteredString( this.fontRenderer, stringtranslate.translateKey("connect.connecting"), this.width / 2, this.height / 2 - 50, 16777215); this.drawCenteredString( this.fontRenderer, "", this.width / 2, this.height / 2 - 10, 16777215); } else { this.drawCenteredString( this.fontRenderer, stringtranslate.translateKey("connect.authorizing"), this.width / 2, this.height / 2 - 50, 16777215); this.drawCenteredString( this.fontRenderer, this.clientHandler.field_72560_a, this.width / 2, this.height / 2 - 10, 16777215); } super.drawScreen(par1, par2, par3); }
@SuppressWarnings("unchecked") @Override public void initGui() { super.initGui(); this.buttonList.clear(); if (this.initialized) { final int var5 = (this.width - this.width / 4) / 2; final int var6 = (this.height - this.height / 4) / 2; this.buttonFlag_width = 81; this.buttonFlag_height = 58; this.buttonFlag_xPosition = this.width / 2 - buttonFlag_width / 2; this.buttonFlag_yPosition = this.height / 2 - this.height / 3 + 10; this.buttonList.add( new GuiElementGradientButton( 0, this.width / 2 - this.width / 3 + 15, this.height / 2 - this.height / 4 - 15, 50, 15, "Close")); int width = (int) (var5 / 1.0F); this.buttonList.add( new GuiElementGradientButton( 1, this.width / 2 - width / 2, (int) (this.buttonFlag_yPosition + this.buttonFlag_height + 60), width, 20, "Join " + this.spaceRaceData.getTeamName())); } }
@Override public void drawScreen(int par1, int par2, float par3) { this.drawBackground(par1); super.drawScreen(par1, par2, par3); int posX = (this.width) / 2; int posY = (this.height) / 2; try { fontRendererObj.drawSplitString( "Press Enter to confirm", posX + 1 - 75, posY - 1, 180, 0x000000); fontRendererObj.drawSplitString("Press Enter to confirm", posX - 75, posY, 180, 0xffffff); fontRendererObj.drawSplitString( "What Channel do you want to connect to ? : " + channelField.getText(), posX + 1 - 75, posY - 1 - 20, 180, 0x000000); fontRendererObj.drawSplitString( "What Channel do you want to connect to ? : " + channelField.getText(), posX - 75, posY - 20, 180, 0xff0000); } finally { if (channelName != null) channelField.drawTextBox(); } }
private void func_74164_b(char p_74164_1_, int p_74164_2_) { switch (p_74164_1_) { case 22: this.func_74160_b(GuiScreen.func_73870_l()); return; default: switch (p_74164_2_) { case 14: String var3 = this.func_74158_i(); if (var3.length() > 0) { this.func_74159_a(var3.substring(0, var3.length() - 1)); } return; case 28: case 156: this.func_74160_b("\n"); return; default: if (ChatAllowedCharacters.func_71566_a(p_74164_1_)) { this.func_74160_b(Character.toString(p_74164_1_)); } } } }
/** Draws the screen and all the components in it. */ @Override public void drawScreen(int mouseX, int mouseY, float par3) { GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); mc.renderEngine.bindTexture(new ResourceLocation("playblock:textures/gui/projector_bg.png")); int left = (width - xSize) / 2; int top = (height - ySize) / 2; drawTexturedModalRect(left, top, 0, 0, xSize, ySize); uriField.drawTextBox(); heightField.drawTextBox(); widthField.drawTextBox(); triggerRangeField.drawTextBox(); fadeRangeField.drawTextBox(); fontRendererObj.drawString( StringUtils.translate("options.url"), left + 10, top + 20, 0xff999999); fontRendererObj.drawString( StringUtils.translate("options.screenSize"), left + 10, top + 40, 0xff999999); fontRendererObj.drawString("x", left + 117, top + 40, 0xff999999); fontRendererObj.drawString( StringUtils.translate("options.turnOn"), left + 10, top + 60, 0xff999999); fontRendererObj.drawString( StringUtils.translate("options.blocksAway"), left + 117, top + 60, 0xff999999); fontRendererObj.drawString( StringUtils.translate("options.turnOff"), left + 10, top + 80, 0xff999999); fontRendererObj.drawString( StringUtils.translate("options.blocksAway"), left + 117, top + 80, 0xff999999); fontRendererObj.drawString("TEST VERSION - skcraft.com", left + 10, top + 132, 0xffffffff); super.drawScreen(mouseX, mouseY, par3); }
@Override protected void keyTyped(char par1, int par2) { super.keyTyped(par1, par2); if (par2 > 2 && nbt.getBoolean("canDisplay")) { PacketSenders.sendKeyEvent(par1, par2, tile); } }
@Override /** * Called when a mouse button is pressed and the mouse is moved around. Parameters are : mouseX, * mouseY, lastButtonClicked & timeSinceMouseClick. */ protected void mouseClickMove( int mouseX, int mouseY, int lastButtonClicked, long timeSinceMouseClick) { super.mouseClickMove(mouseX, mouseY, lastButtonClicked, timeSinceMouseClick); if (lastClick == 0) { gb.xPosition = mouseX - (lastClickX - lastButtonX); gb.yPosition = mouseY - (lastClickY - lastButtonY); } else if (lastClick == 1) { if (mouseX > gb.xPosition && mouseY > gb.yPosition) { int sizeY = mouseY - gb.yPosition; if (sizeY > 20) sizeY = 20; gb = new GuiButton(1, gb.xPosition, gb.yPosition, mouseX - gb.xPosition, sizeY, "text"); buttonList.set(0, gb); } } positionX = gb.xPosition; positionY = gb.yPosition; }
public void addInformation( ItemStack stack, EntityPlayer player, List lines, boolean advancedTooltips) { lines.add(EnumChatFormatting.DARK_GRAY + "Seems to stick around..."); if (GuiScreen.isShiftKeyDown()) { lines.add(EnumChatFormatting.WHITE + "Basic Crafting Material"); } }
@Override public void addTooltip(List<String> list) { int x = parent.getMouseX() + parent.getGuiLeft(), y = parent.getMouseY() + parent.getGuiTop(); for (int i = 0; i < 5; i++) { if (scrollAmount + i >= dial.glyphList.size()) break; int entryOffset = i * entryHeight; boolean mouseOverEntry = y >= posY + offsetY + entryOffset && y <= posY + offsetY + entryOffset + 20, mouseOverSmall = mouseOverEntry && x >= posX + offsetX + sizeMButton + buttonSpacing && x < posX + offsetX + sizeMButton + buttonSpacing + sizeSButton; if (mouseOverSmall) { if (GuiScreen.isShiftKeyDown()) { list.add(Localisation.get(EPMod.ID, Locale.GUI_DELETE)); break; } list.add(Localisation.get(EPMod.ID, Locale.GUI_EDIT)); break; } } }
@Override protected final void keyTyped(char typedChar, int keyCode) throws IOException { super.keyTyped(typedChar, keyCode); if (keyCode == 1 || this.mc.gameSettings.keyBindInventory.isActiveAndMatches(keyCode)) exitGui(); ComponentScreenManager.type(typedChar, keyCode); }
@Override public void drawScreen(int var1, int var2, float var3) { this.drawDefaultBackground(); this.drawCenteredString(this.fontRendererObj, this.screenTitle, this.width / 2, 40, 16777215); this.drawCenteredString( this.fontRendererObj, "Width: " + this.xzSize, this.width / 2, this.height / 4 + 40, 16777215); this.drawCenteredString( this.fontRendererObj, "Height: " + this.ySize, this.width / 2, this.height / 4 + 80, 16777215); GL11.glPushMatrix(); GL11.glTranslatef((float) (this.width / 2), 0.0F, 50.0F); float var4 = 93.75F; GL11.glScalef(-var4, -var4, -var4); GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F); GL11.glPopMatrix(); super.drawScreen(var1, var2, var3); }
/** Handles mouse input. */ public void handleMouseInput() throws IOException { super.handleMouseInput(); if (this.displaySlot != null) { this.displaySlot.func_178039_p(); } }
/** the element in the slot that was clicked, boolean for wether it was double clicked or not */ protected void elementClicked(int par1, boolean par2) { if (par1 < GuiMultiplayer.getInternetServerList(this.parentGui).countServers() + GuiMultiplayer.getListOfLanServers(this.parentGui).size()) { int j = GuiMultiplayer.getSelectedServer(this.parentGui); GuiMultiplayer.getAndSetSelectedServer(this.parentGui, par1); ServerData serverdata = GuiMultiplayer.getInternetServerList(this.parentGui).countServers() > par1 ? GuiMultiplayer.getInternetServerList(this.parentGui).getServerData(par1) : null; boolean flag1 = GuiMultiplayer.getSelectedServer(this.parentGui) >= 0 && GuiMultiplayer.getSelectedServer(this.parentGui) < this.getSize() && (serverdata == null || serverdata.field_82821_f == 61); boolean flag2 = GuiMultiplayer.getSelectedServer(this.parentGui) < GuiMultiplayer.getInternetServerList(this.parentGui).countServers(); GuiMultiplayer.getButtonSelect(this.parentGui).enabled = flag1; GuiMultiplayer.getButtonEdit(this.parentGui).enabled = flag2; GuiMultiplayer.getButtonDelete(this.parentGui).enabled = flag2; if (par2 && flag1) { GuiMultiplayer.func_74008_b(this.parentGui, par1); } else if (flag2 && GuiScreen.isShiftKeyDown() && j >= 0 && j < GuiMultiplayer.getInternetServerList(this.parentGui).countServers()) { GuiMultiplayer.getInternetServerList(this.parentGui) .swapServers(j, GuiMultiplayer.getSelectedServer(this.parentGui)); } } }
public void func_73863_a(int p_73863_1_, int p_73863_2_, float p_73863_3_) { this.func_73986_b(p_73863_1_, p_73863_2_, p_73863_3_); Tessellator var4 = Tessellator.field_78398_a; short var5 = 274; int var6 = this.field_73880_f / 2 - var5 / 2; int var7 = this.field_73881_g + 50; float var8 = -((float) this.field_73990_a + p_73863_3_) * this.field_73987_d; GL11.glPushMatrix(); GL11.glTranslatef(0.0F, var8, 0.0F); this.field_73882_e.func_110434_K().func_110577_a(field_110362_a); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); this.func_73729_b(var6, var7, 0, 0, 155, 44); this.func_73729_b(var6 + 155, var7, 0, 45, 155, 44); var4.func_78378_d(16777215); int var9 = var7 + 200; int var10; for (var10 = 0; var10 < this.field_73988_b.size(); ++var10) { if (var10 == this.field_73988_b.size() - 1) { float var11 = (float) var9 + var8 - (float) (this.field_73881_g / 2 - 6); if (var11 < 0.0F) { GL11.glTranslatef(0.0F, -var11, 0.0F); } } if ((float) var9 + var8 + 12.0F + 8.0F > 0.0F && (float) var9 + var8 < (float) this.field_73881_g) { String var12 = (String) this.field_73988_b.get(var10); if (var12.startsWith("[C]")) { this.field_73886_k.func_78261_a( var12.substring(3), var6 + (var5 - this.field_73886_k.func_78256_a(var12.substring(3))) / 2, var9, 16777215); } else { this.field_73886_k.field_78289_c.setSeed( (long) var10 * 4238972211L + (long) (this.field_73990_a / 4)); this.field_73886_k.func_78261_a(var12, var6, var9, 16777215); } } var9 += 12; } GL11.glPopMatrix(); this.field_73882_e.func_110434_K().func_110577_a(field_110361_b); GL11.glEnable(3042); GL11.glBlendFunc(0, 769); var4.func_78382_b(); var4.func_78369_a(1.0F, 1.0F, 1.0F, 1.0F); var10 = this.field_73880_f; int var13 = this.field_73881_g; var4.func_78374_a(0.0D, (double) var13, (double) this.field_73735_i, 0.0D, 1.0D); var4.func_78374_a((double) var10, (double) var13, (double) this.field_73735_i, 1.0D, 1.0D); var4.func_78374_a((double) var10, 0.0D, (double) this.field_73735_i, 1.0D, 0.0D); var4.func_78374_a(0.0D, 0.0D, (double) this.field_73735_i, 0.0D, 0.0D); var4.func_78381_a(); GL11.glDisable(3042); super.func_73863_a(p_73863_1_, p_73863_2_, p_73863_3_); }
public void func_73876_c() { super.func_73876_c(); if (!this.field_73882_e.field_71439_g.func_70089_S() || this.field_73882_e.field_71439_g.field_70128_L) { this.field_73882_e.field_71439_g.func_71053_j(); } }
@Override public boolean handleMouseClicked(int x, int y, int mouseButton) { x += parent.getGuiLeft(); y += parent.getGuiTop(); for (int i = 0; i < 5; i++) { if (scrollAmount + i >= dial.glyphList.size()) break; int entryOffset = i * entryHeight; boolean mouseOverEntry = y >= posY + offsetY + entryOffset && y <= posY + offsetY + entryOffset + 20, mouseOverMain = mouseOverEntry && x >= posX + offsetX && x < posX + offsetX + sizeMButton, mouseOverSmall = mouseOverEntry && x >= posX + offsetX + sizeMButton + buttonSpacing && x < posX + offsetX + sizeMButton + buttonSpacing + sizeSButton; if (mouseOverMain) { ((GuiDialingDevice) parent).onEntrySelected(scrollAmount + i); break; } else if (mouseOverSmall) { if (GuiScreen.isShiftKeyDown()) { ((GuiDialingDevice) parent).onEntryDeleted(scrollAmount + i); break; } ((GuiDialingDevice) parent).onEntryEdited(scrollAmount + i); break; } } return true; }
@SuppressWarnings("unchecked") @Override public void initGui() { super.initGui(); this.buttonList.clear(); final int var5 = (this.width - this.xSize) / 2; final int var6 = (this.height - this.ySize) / 2; this.checkboxRedstoneSignal = new GuiElementCheckbox(0, this, this.width / 2 - 78, var6 + 18, "Opens on Redstone Signal"); this.checkboxPlayerDistance = new GuiElementCheckbox(1, this, this.width / 2 - 78, var6 + 33, "Player is within: "); this.dropdownPlayerDistance = new GuiElementDropdown( 2, this, var5 + 105, var6 + 34, "1 Meter", "2 Meters", "5 Meters", "10 Meters"); this.checkboxOpenForPlayer = new GuiElementCheckbox(3, this, this.width / 2 - 62, var6 + 49, "Player name is: "); this.textBoxPlayerToOpenFor = new GuiElementTextBox( 4, this, this.width / 2 - 55, var6 + 64, 110, 15, "", false, 16, false); this.checkboxInvertSelection = new GuiElementCheckbox(5, this, this.width / 2 - 78, var6 + 80, "Invert Selection"); this.checkboxHorizontalMode = new GuiElementCheckbox(6, this, this.width / 2 - 78, var6 + 96, "Horizontal Mode"); this.buttonList.add(this.checkboxRedstoneSignal); this.buttonList.add(this.checkboxPlayerDistance); this.buttonList.add(this.dropdownPlayerDistance); this.buttonList.add(this.checkboxOpenForPlayer); this.buttonList.add(this.textBoxPlayerToOpenFor); this.buttonList.add(this.checkboxInvertSelection); this.buttonList.add(this.checkboxHorizontalMode); }
@Override public final void keyTyped(char c, int key) { super.keyTyped(c, key); if (ModList.NEI.isLoaded() && key == NEIClientConfig.getKeyBinding("gui.recipe")) { int x = ReikaGuiAPI.instance.getMouseRealX(); int y = ReikaGuiAPI.instance.getMouseRealY(); int j = (width - xSize) / 2 - 2; int k = (height - ySize) / 2 - 8; if (x >= j && y >= k && x < j + xSize && y < k + ySize) { ItemStack is = ReikaGuiAPI.instance.getItemRenderAt(x, y); if (is != null) { GuiCraftingRecipe.openRecipeGui("item", is); } } } if (key == Keyboard.KEY_LEFT) { this.prevPage(); } else if (key == Keyboard.KEY_RIGHT) { this.nextPage(); } else if (key == Keyboard.KEY_PRIOR) { this.prevScreen(); } else if (key == Keyboard.KEY_NEXT) { this.nextScreen(); } }
@Override public void drawScreen(int mouseX, int mouseY, float ticks) { rankList.drawScreen(mouseX, mouseY, ticks); drawCenteredString( fontRendererObj, I18n.format(Caveworld.CONFIG_LANG + "select.minerRank"), width / 2, 15, 0xFFFFFF); super.drawScreen(mouseX, mouseY, ticks); filterTextField.drawTextBox(); if (detailHoverChecker.checkHover(mouseX, mouseY)) { func_146283_a( fontRendererObj.listFormattedStringToWidth( I18n.format(Caveworld.CONFIG_LANG + "detail.hover"), 300), mouseX, mouseY); } else if (instantHoverChecker.checkHover(mouseX, mouseY)) { func_146283_a( fontRendererObj.listFormattedStringToWidth( I18n.format(Caveworld.CONFIG_LANG + "instant.hover"), 300), mouseX, mouseY); } }
public void initGui() { int guiX = (height - guiheight); int guiY = (width - guiwidth); GuiButton DevButton; // buttonList.add(DevButton = new GuiButton(0, guiX + 10, guiY + 30, 20, 10, "Enter")); super.initGui(); }
public void updateScreen() { super.updateScreen(); ++this.ticksPassed; if (!this.initialized) { return; } }
/** * Draws either a gradient over the background screen (when it exists) or a flat gradient over * background.png */ public void drawDefaultBackground() { super.drawDefaultBackground(); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); this.mc.getTextureManager().bindTexture(field_146348_f); int i = (this.width - 248) / 2; int j = (this.height - 166) / 2; this.drawTexturedModalRect(i, j, 0, 0, 248, 166); }
public void drawString( String p_154322_1_, int p_154322_2_, int p_154322_3_, int p_154322_4_, boolean p_154322_5_) { if (p_154322_5_) { super.drawString(this.fontRendererObj, p_154322_1_, p_154322_2_, p_154322_3_, p_154322_4_); } else { this.fontRendererObj.drawString(p_154322_1_, p_154322_2_, p_154322_3_, p_154322_4_); } }
@Override public void drawScreen(int mouseX, int mouseY, float partialTicks) { this.drawDefaultBackground(); this.drawCenteredString( this.fontRendererObj, "Debug options", this.width / 2, this.height / 4 - 40, 0xFFFFFF); super.drawScreen(mouseX, mouseY, partialTicks); }
@Override protected void keyTyped(char keyChar, int keyID) { if (this.textBoxPlayerToOpenFor.keyTyped(keyChar, keyID)) { return; } super.keyTyped(keyChar, keyID); }
/** Fired when a key is typed. This is the equivalent of KeyListener.keyTyped(KeyEvent e). */ protected void keyTyped(char par1, int par2) { if (par2 == this.mc.gameSettings.keyBindInventory.keyCode) { this.mc.displayGuiScreen((GuiScreen) null); this.mc.setIngameFocus(); } else { super.keyTyped(par1, par2); } }
@Override protected void keyTyped(char key, int par2) { super.keyTyped(key, par2); if (uriField.isFocused()) { uriField.textboxKeyTyped(key, par2); uri = uriField.getText(); if (MediaResolver.canPlayUri(MediaResolver.cleanUri(uri))) { uriField.setTextColor(defaultTextColor); } else { uriField.setTextColor(0xffff0000); } } if (Character.isDigit(key) || par2 == 14 || par2 == 52 || par2 == 199 || par2 == 203 || par2 == 205 || par2 == 207 || par2 == 211) { if (heightField.isFocused()) { heightField.textboxKeyTyped(key, par2); if (heightField.getText().length() != 0) { try { projectorHeight = Float.parseFloat(heightField.getText()); } catch (NumberFormatException e) { } } } else if (widthField.isFocused()) { widthField.textboxKeyTyped(key, par2); if (widthField.getText().length() != 0) { try { projectorWidth = Float.parseFloat(widthField.getText()); } catch (NumberFormatException e) { } } } else if (triggerRangeField.isFocused()) { triggerRangeField.textboxKeyTyped(key, par2); if (triggerRangeField.getText().length() != 0) { try { triggerRange = Float.parseFloat(triggerRangeField.getText()); } catch (NumberFormatException e) { } } } else if (fadeRangeField.isFocused()) { fadeRangeField.textboxKeyTyped(key, par2); if (fadeRangeField.getText().length() != 0) { try { fadeRange = Float.parseFloat(fadeRangeField.getText()); } catch (NumberFormatException e) { } } } } }