net.minecraft.client.gui.GuiChat Java Examples
The following examples show how to use
net.minecraft.client.gui.GuiChat.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: HyperiumCommandHandler.java From Hyperium with GNU Lesser General Public License v3.0 | 6 votes |
/** * @author Forge */ public void autoComplete(String leftOfCursor) { latestAutoComplete = null; if (leftOfCursor.length() == 0) return; if (leftOfCursor.charAt(0) == '/') { leftOfCursor = leftOfCursor.substring(1); if (mc.currentScreen instanceof GuiChat) { List<String> completions = getTabCompletionOptions(leftOfCursor); if (completions != null && !completions.isEmpty()) { if (leftOfCursor.indexOf(' ') == -1) { int bound = completions.size(); for (int i = 0; i < bound; i++) { completions.set(i, ChatColor.GRAY + "/" + completions.get(i) + ChatColor.RESET); } } Collections.sort(completions); latestAutoComplete = completions.toArray(new String[0]); } } } }
Example #2
Source File: GuiMoveModule.java From seppuku with GNU General Public License v3.0 | 5 votes |
@Listener public void onUpdate(EventPlayerUpdate event) { if (event.getStage() == EventStageable.EventStage.PRE) { final Minecraft mc = Minecraft.getMinecraft(); if (mc.currentScreen instanceof GuiChat || mc.currentScreen == null) { return; } final int[] keys = new int[]{mc.gameSettings.keyBindForward.getKeyCode(), mc.gameSettings.keyBindLeft.getKeyCode(), mc.gameSettings.keyBindRight.getKeyCode(), mc.gameSettings.keyBindBack.getKeyCode()}; for (int keyCode : keys) { if (Keyboard.isKeyDown(keyCode)) { KeyBinding.setKeyBindState(keyCode, true); } else { KeyBinding.setKeyBindState(keyCode, false); } } if (Keyboard.isKeyDown(mc.gameSettings.keyBindJump.getKeyCode())) { if (mc.player.isInLava() || mc.player.isInWater()) { mc.player.motionY += 0.039f; } else { if (mc.player.onGround) { mc.player.jump(); } } } if (Mouse.isButtonDown(2)) { Mouse.setGrabbed(true); mc.inGameHasFocus = true; } else { Mouse.setGrabbed(false); mc.inGameHasFocus = false; } } }
Example #3
Source File: CommandsModule.java From seppuku with GNU General Public License v3.0 | 5 votes |
@Listener public void keyPress(EventKeyPress event) { if(this.prefix.getValue().length() == 1) { final char key = Keyboard.getEventCharacter(); if(this.prefix.getValue().charAt(0) == key) { Minecraft.getMinecraft().displayGuiScreen(new GuiChat()); } } }
Example #4
Source File: HudManager.java From seppuku with GNU General Public License v3.0 | 5 votes |
/** * Update our anchor point positions when we render * * @param event */ @Listener public void onRender(EventRender2D event) { final Minecraft mc = Minecraft.getMinecraft(); if (this.firstLaunchComponent != null && mc.world != null) { if (Seppuku.INSTANCE.getConfigManager().isFirstLaunch()) { if (mc.currentScreen instanceof GuiHudEditor) { firstLaunchComponent.onClose(); } else if (firstLaunchComponent.isVisible()) { firstLaunchComponent.render(0, 0, event.getPartialTicks()); } } } final int chatHeight = (mc.currentScreen instanceof GuiChat) ? 14 : 0; for (AnchorPoint point : this.anchorPoints) { if (point.getPoint() == AnchorPoint.Point.TOP_LEFT) { point.setX(2); point.setY(2); } if (point.getPoint() == AnchorPoint.Point.TOP_RIGHT) { point.setX(event.getScaledResolution().getScaledWidth() - 2); point.setY(2); } if (point.getPoint() == AnchorPoint.Point.BOTTOM_LEFT) { point.setX(2); point.setY(event.getScaledResolution().getScaledHeight() - chatHeight - 2); } if (point.getPoint() == AnchorPoint.Point.BOTTOM_RIGHT) { point.setX(event.getScaledResolution().getScaledWidth() - 2); point.setY(event.getScaledResolution().getScaledHeight() - chatHeight - 2); } if (point.getPoint() == AnchorPoint.Point.TOP_CENTER) { point.setX(event.getScaledResolution().getScaledWidth() / 2); point.setY(2); } } }
Example #5
Source File: HUD.java From LiquidBounce with GNU General Public License v3.0 | 5 votes |
@EventTarget(ignoreCondition = true) public void onScreen(final ScreenEvent event) { if (mc.theWorld == null || mc.thePlayer == null) return; if (getState() && blurValue.get() && !mc.entityRenderer.isShaderActive() && event.getGuiScreen() != null && !(event.getGuiScreen() instanceof GuiChat || event.getGuiScreen() instanceof GuiHudDesigner)) mc.entityRenderer.loadShader(new ResourceLocation(LiquidBounce.CLIENT_NAME.toLowerCase() + "/blur.json")); else if (mc.entityRenderer.getShaderGroup() != null && mc.entityRenderer.getShaderGroup().getShaderGroupName().contains("liquidbounce/blur.json")) mc.entityRenderer.stopUseShader(); }
Example #6
Source File: BlurHandler.java From Hyperium with GNU Lesser General Public License v3.0 | 5 votes |
@InvokeEvent public void onTick(TickEvent event) { Minecraft mc = Minecraft.getMinecraft(); if (mc != null && mc.entityRenderer != null) { // Enable the blur if criteria is met. if (!Settings.MOTION_BLUR_ENABLED && Settings.BLUR_GUI && mc.currentScreen != null && !(mc.currentScreen instanceof GuiChat) && !mc.entityRenderer.isShaderActive() && mc.theWorld != null) { HyperiumEntityRenderer.INSTANCE.enableBlurShader(); } // Disable the blur if criteria is met. if (!Settings.MOTION_BLUR_ENABLED && Settings.BLUR_GUI && mc.entityRenderer.isShaderActive() && mc.currentScreen == null && mc.theWorld != null) { HyperiumEntityRenderer.INSTANCE.disableBlurShader(); } // Enable/disable when switching via the settings. if (!Settings.MOTION_BLUR_ENABLED && !Settings.BLUR_GUI && prevBlurOption) { // Disable GUI blur since the option was just disabled. HyperiumEntityRenderer.INSTANCE.disableBlurShader(); } else if (Settings.BLUR_GUI && !prevBlurOption) { // Enable GUI blur since the option was just enabled. if (!Settings.MOTION_BLUR_ENABLED) { HyperiumEntityRenderer.INSTANCE.enableBlurShader(); } else { // Warn user. Hyperium.INSTANCE.getHandlers().getGeneralChatHandler().sendMessage("Warning: Background blur will not take effect unless motion blur is disabled."); } } prevBlurOption = Settings.BLUR_GUI; } }
Example #7
Source File: ActiveModList.java From ForgeHax with MIT License | 5 votes |
@SubscribeEvent public void onRenderScreen(RenderGameOverlayEvent.Text event) { int align = alignment.get().ordinal(); List<String> text = new ArrayList<>(); if (tps_meter.get()) { text.add(generateTickRateText()); } if (MC.currentScreen instanceof GuiChat || MC.gameSettings.showDebugInfo) { long enabledMods = getModManager() .getMods() .stream() .filter(BaseMod::isEnabled) .filter(mod -> !mod.isHidden()) .count(); text.add(enabledMods + " mods enabled"); } else { getModManager() .getMods() .stream() .filter(BaseMod::isEnabled) .filter(mod -> !mod.isHidden()) .map(mod -> debug.get() ? mod.getDebugDisplayText() : mod.getDisplayText()) .sorted(sortMode.get().getComparator()) .forEach(name -> text.add(AlignHelper.getFlowDirX2(align) == 1 ? ">" + name : name + "<")); } SurfaceHelper.drawTextAlign(text, getPosX(0), getPosY(0), Colors.WHITE.toBuffer(), scale.get(), true, align); }
Example #8
Source File: RenderEventHandler.java From enderutilities with GNU Lesser General Public License v3.0 | 5 votes |
@SubscribeEvent public void onRenderGameOverlay(RenderGameOverlayEvent.Post event) { if (event.getType() != ElementType.ALL) { return; } if ((this.mc.currentScreen instanceof GuiChat) == false && this.mc.player != null) { this.buildersWandRenderer.renderHud(this.mc.player); this.rulerRenderer.renderHud(); this.renderPlacementPropertiesHud(this.mc.player); } }
Example #9
Source File: HUDTickHandler.java From SimplyJetpacks with MIT License | 5 votes |
private static void tickEnd() { if (mc.thePlayer != null) { if ((mc.currentScreen == null || Config.showHUDWhileChatting && mc.currentScreen instanceof GuiChat) && !mc.gameSettings.hideGUI && !mc.gameSettings.showDebugInfo) { ItemStack chestplate = mc.thePlayer.getCurrentArmor(2); if (chestplate != null && chestplate.getItem() instanceof IHUDInfoProvider) { IHUDInfoProvider provider = (IHUDInfoProvider) chestplate.getItem(); List<String> info = new ArrayList<String>(); provider.addHUDInfo(info, chestplate, Config.enableFuelHUD, Config.enableStateHUD); if (info.isEmpty()) { return; } GL11.glPushMatrix(); mc.entityRenderer.setupOverlayRendering(); GL11.glScaled(Config.HUDScale, Config.HUDScale, 1.0D); int i = 0; for (String s : info) { RenderUtils.drawStringAtHUDPosition(s, HUDPositions.values()[Config.HUDPosition], mc.fontRenderer, Config.HUDOffsetX, Config.HUDOffsetY, Config.HUDScale, 0xeeeeee, true, i); i++; } GL11.glPopMatrix(); } } } }
Example #10
Source File: WrapperGuiChat.java From ClientBase with MIT License | 4 votes |
public WrapperGuiChat(GuiChat var1) { super(var1); this.real = var1; }
Example #11
Source File: WrapperGuiChat.java From ClientBase with MIT License | 4 votes |
public GuiChat unwrap() { return this.real; }
Example #12
Source File: MixinS2EPacketCloseWindow.java From Hyperium with GNU Lesser General Public License v3.0 | 4 votes |
@Inject(method = "processPacket", at = @At("HEAD"), cancellable = true) private void processPacket(INetHandlerPlayClient handler, CallbackInfo ci) { if (Minecraft.getMinecraft().currentScreen instanceof GuiChat) ci.cancel(); }