private void buildAutoCompletes(GuiTextField inputField, GuiChat chat) { String leftOfCursor; if(inputField.getCursorPosition() == 0) leftOfCursor = ""; else leftOfCursor = inputField.getText().substring(0, inputField.getCursorPosition()); if(leftOfCursor.length() == 0 || leftOfCursor.charAt(0) == '/') return; completions = getNames(leftOfCursor); if(completions.isEmpty()) return; position = -1; //ReflectionHelper.setPrivateValue(GuiChat.class, chat, true, LibObfuscation.COMPLETE_FLAG); StringBuilder stringbuilder = new StringBuilder(); CompletionData data; for(Iterator<CompletionData> iterator = completions.iterator(); iterator.hasNext(); stringbuilder.append(data.string)) { data = iterator.next(); if(stringbuilder.length() > 0) stringbuilder.append(", "); } Minecraft.getMinecraft().ingameGUI.getChatGUI().printChatMessageWithOptionalDeletion(new TextComponentString(stringbuilder.toString()), 1); isAutoCompleted = true; originalString = inputField.getText(); }
@Override public void update(int mouseX, int mouseY) { caretCounter = (byte) ((Minecraft.getMinecraft().ingameGUI.getUpdateCounter() - counterOffset) & 63); // if (selecting) { // FontRenderer font = getFontRenderer(); // int pos = mouseX - posX - 1; // for (int i = renderStart, width = 0; i < textLength; ++i) { // } // } }
private void drawCoinage(int x, int y, long gold) { String formatted = String.valueOf(formatter.format(gold)); ShopFontRenderer.render(this, x + 220, y, formatted, true); GlStateManager.disableDepth(); mc.renderEngine.bindTexture(HFModInfo.ELEMENTS); mc.ingameGUI.drawTexturedModalRect((x + 224), y - 1, 244, 0, 12, 12); GlStateManager.enableDepth(); }
Minecraft.getMinecraft().ingameGUI.drawTexturedModalRect(x, y, 11, 0, 24, 24); Minecraft.getMinecraft().getRenderItem().renderItemAndEffectIntoGUI(broomStack, x + 3, y + 3); Minecraft.getMinecraft().getRenderItem().renderItemOverlayIntoGUI( Minecraft.getMinecraft().ingameGUI.getFontRenderer(), broomStack, x + 3, y + 3, ""); RenderHelper.enableStandardItemLighting(); GlStateManager.disableLighting();
public void setOrder(Order order) { if (this.world.isRemote) { if (this.owner != null) { EntityPlayer player = this.world.getPlayerEntityByUUID(this.owner); if (player != null) { TextComponentString change = new TextComponentString(LangUtils.translate(LangUtils.SET_ORDER).replace("{order}", LangUtils.translate(LangUtils.ORDER_VALUE.get(order.name().toLowerCase(Locale.ENGLISH))))); change.getStyle().setColor(TextFormatting.GOLD); Minecraft.getMinecraft().ingameGUI.addChatMessage(ChatType.GAME_INFO, change); } } JurassiCraft.NETWORK_WRAPPER.sendToServer(new SetOrderMessage(this)); } }
private void renderAt(Minecraft mc, StackSold stack, int x, int y) { StackRenderHelper.drawStack(stack.getStack(), x + 4, y - 24, 1.25F); mc.getTextureManager().bindTexture(HFModInfo.ELEMENTS); mc.ingameGUI.drawTexturedModalRect(x + 30, y - 16, 244, 0, 12, 12); String text = NumberFormat.getNumberInstance(Locale.ENGLISH).format(stack.getSellValue()); mc.fontRendererObj.drawStringWithShadow(text, x + 44, y - 13, 0xFFFFFFFF); }
@Override public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand) { ItemStack stack = player.getHeldItem(hand); if(player.isSneaking()) { int mode = this.changeMode(stack); if (world.isRemote) { TextComponentString change = new TextComponentString(LangUtils.translate(LangUtils.GENDER_CHANGE.get("spawnegg")).replace("{mode}", LangUtils.getGenderMode(mode))); change.getStyle().setColor(TextFormatting.GOLD); Minecraft.getMinecraft().ingameGUI.addChatMessage(ChatType.GAME_INFO, change); } } return new ActionResult<>(EnumActionResult.SUCCESS, stack); }
String cmd = "/botania-share " + entry.getUnlocalizedName(); mc.ingameGUI.getChatGUI().addToSentMessages(cmd); mc.player.sendChatMessage(cmd); break;
@SideOnly(Side.CLIENT) @Override public void renderHUDEffect(int x, int y, PotionEffect effect, Minecraft mc, float alpha) { mc.getTextureManager().bindTexture(POTIONS_LOCATION); int iconIndex = this.getStatusIconIndex(); mc.ingameGUI.drawTexturedModalRect(x + 3, y + 3, iconIndex % 8 * 18, 198 + iconIndex / 8 * 18, 18, 18); } }
@Override public void update(int mouseX, int mouseY, float partialTicks) { caretCounter = (byte) (Minecraft.getMinecraft().ingameGUI.getUpdateCounter() & 0xFF); // if (selecting) { // FontRenderer font = getFontRenderer(); // int pos = mouseX - posX - 1; // for (int i = renderStart, width = 0; i < textLength; ++i) { // } // } }
@Override public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand) { ItemStack stack = player.getHeldItem(hand); if (this.isSkeleton(stack)) { if (player.isSneaking()) { int oldVariant = this.getSkeletonType(stack); int variant = this.changeSkeletonVariant(stack); if (variant != oldVariant && world.isRemote) { TextComponentString change = new TextComponentString(LangUtils.translate(LangUtils.SKELETON_CHANGE.get("variant")).replace("{mode}", LangUtils.getSkeletonMode(EntityHandler.getDinosaurById(this.getDinosaurID(stack)), variant))); change.getStyle().setColor(TextFormatting.YELLOW); Minecraft.getMinecraft().ingameGUI.addChatMessage(ChatType.GAME_INFO, change); } } } return new ActionResult<>(EnumActionResult.SUCCESS, stack); } }
@SubscribeEvent public static void buttonPressed(KeyboardInputEvent.Post event) { Minecraft mc = Minecraft.getMinecraft(); if(mc.world == null || !supportedGuiFilter.test(mc.currentScreen) || Keyboard.getEventKey() != ClientProxy.CORPOREA_REQUEST.getKeyCode() || !Keyboard.getEventKeyState() || Keyboard.isRepeatEvent() || TileCorporeaIndex.InputHandler.getNearbyIndexes(mc.player).isEmpty()) return; ItemStack stack = getStackUnderMouse(); if(stack != null && !stack.isEmpty()) { int count = 1; int max = stack.getMaxStackSize(); if(GuiScreen.isShiftKeyDown()) { count = max; if(GuiScreen.isCtrlKeyDown()) count /= 4; } else if(GuiScreen.isCtrlKeyDown()) count = max / 2; if(count > 0) { String name = CorporeaHelper.stripControlCodes(stack.getDisplayName()); String full = count + " " + name; mc.ingameGUI.getChatGUI().addToSentMessages(full); mc.player.sendChatMessage(full); event.setCanceled(true); } } }
/** * Draws a texture at the specified 2D coordinates * @param x X coordinate * @param y Y coordinate * @param u X coordinate of the texture inside of the .png * @param v Y coordinate of the texture inside of the .png * @param width width of the texture * @param height height of the texture * @param resourceLocation A reference to the texture's ResourceLocation. If null, it'll use the last used resource. * @param scale How much to scale the texture by when rendering it */ public static void RenderCustomTexture(int x, int y, int u, int v, int width, int height, ResourceLocation resourceLocation, float scale) { x /= scale; y /= scale; GL11.glPushMatrix(); //GL11.glDisable(GL11.GL_LIGHTING); GL11.glScalef(scale, scale, scale); if(resourceLocation != null) mc.getTextureManager().bindTexture(resourceLocation); mc.ingameGUI.drawTexturedModalRect(x, y, u, v, width, height); GL11.glPopMatrix(); }
protected void resetCaretFlash() { int v = Minecraft.getMinecraft().ingameGUI.getUpdateCounter(); counterOffset = (byte) ((v - counterOffset) & 63); counterOffset += (byte) ((v - counterOffset) & 63); caretCounter = 0; }
TextComponentString denied = new TextComponentString(LangUtils.translate("message.too_young.name")); denied.getStyle().setColor(TextFormatting.RED); Minecraft.getMinecraft().ingameGUI.addChatMessage(ChatType.GAME_INFO, denied); TextComponentString denied = new TextComponentString(LangUtils.translate("message.not_owned.name")); denied.getStyle().setColor(TextFormatting.RED); Minecraft.getMinecraft().ingameGUI.addChatMessage(ChatType.GAME_INFO, denied); TextComponentString denied = new TextComponentString(LangUtils.translate("message.not_owned.name")); denied.getStyle().setColor(TextFormatting.RED); Minecraft.getMinecraft().ingameGUI.addChatMessage(ChatType.GAME_INFO, denied);
@Override public void addIndexedChatMessage(ITextComponent chat, int index) { if (chat == null) { Minecraft.getMinecraft().ingameGUI.getChatGUI().deleteChatLine(index); } else { Minecraft.getMinecraft().ingameGUI.getChatGUI().printChatMessageWithOptionalDeletion(chat, index); } }
ingameGUI.drawTexturedModalRect(airIndicatorX - airUnitIndex * 8 - 9, airIndicatorTop, 16, 18, 9, 9); ingameGUI.drawTexturedModalRect(airIndicatorX - airUnitIndex * 8 - 9, airIndicatorTop, 25, 18, 9, 9);
TextComponentString change = new TextComponentString(LangUtils.translate(LangUtils.GENDER_CHANGE.get("actionfigure")).replace("{mode}", LangUtils.getGenderMode(mode))); change.getStyle().setColor(TextFormatting.GOLD); Minecraft.getMinecraft().ingameGUI.addChatMessage(ChatType.GAME_INFO, change);
@SuppressWarnings("unchecked") @ClientSideOnlyMethodContent private void storeSendMessages() { sendChatMessages = new ArrayList<>(); sendChatMessages.addAll(FMLClientHandler.instance().getClient().ingameGUI.getChatGUI().getSentMessages()); }
public void renderPlayerDisplay(long renderTicks) { if (!displayRenderer()) { return; } Minecraft mc = FMLClientHandler.instance().getClient(); if (displayHUD() && displayCross) { ScaledResolution res = new ScaledResolution(mc); int width = res.getScaledWidth(); int height = res.getScaledHeight(); if (GuiIngameForge.renderCrosshairs && mc.ingameGUI != null) { mc.renderEngine.bindTexture(LogisticsHUDRenderer.TEXTURE); GL11.glColor4d(0.0D, 0.0D, 0.0D, 1.0D); GL11.glDisable(GL11.GL_BLEND); mc.ingameGUI.drawTexturedModalRect(width / 2 - 7, height / 2 - 7, 0, 0, 16, 16); } } }