Class Gui

java.lang.Object
net.minecraft.client.gui.Gui

public class Gui extends Object
  • Field Details

    • CROSSHAIR_SPRITE

      private static final ResourceLocation CROSSHAIR_SPRITE
    • CROSSHAIR_ATTACK_INDICATOR_FULL_SPRITE

      private static final ResourceLocation CROSSHAIR_ATTACK_INDICATOR_FULL_SPRITE
    • CROSSHAIR_ATTACK_INDICATOR_BACKGROUND_SPRITE

      private static final ResourceLocation CROSSHAIR_ATTACK_INDICATOR_BACKGROUND_SPRITE
    • CROSSHAIR_ATTACK_INDICATOR_PROGRESS_SPRITE

      private static final ResourceLocation CROSSHAIR_ATTACK_INDICATOR_PROGRESS_SPRITE
    • EFFECT_BACKGROUND_AMBIENT_SPRITE

      private static final ResourceLocation EFFECT_BACKGROUND_AMBIENT_SPRITE
    • EFFECT_BACKGROUND_SPRITE

      private static final ResourceLocation EFFECT_BACKGROUND_SPRITE
    • HOTBAR_SPRITE

      private static final ResourceLocation HOTBAR_SPRITE
    • HOTBAR_SELECTION_SPRITE

      private static final ResourceLocation HOTBAR_SELECTION_SPRITE
    • HOTBAR_OFFHAND_LEFT_SPRITE

      private static final ResourceLocation HOTBAR_OFFHAND_LEFT_SPRITE
    • HOTBAR_OFFHAND_RIGHT_SPRITE

      private static final ResourceLocation HOTBAR_OFFHAND_RIGHT_SPRITE
    • HOTBAR_ATTACK_INDICATOR_BACKGROUND_SPRITE

      private static final ResourceLocation HOTBAR_ATTACK_INDICATOR_BACKGROUND_SPRITE
    • HOTBAR_ATTACK_INDICATOR_PROGRESS_SPRITE

      private static final ResourceLocation HOTBAR_ATTACK_INDICATOR_PROGRESS_SPRITE
    • JUMP_BAR_BACKGROUND_SPRITE

      private static final ResourceLocation JUMP_BAR_BACKGROUND_SPRITE
    • JUMP_BAR_COOLDOWN_SPRITE

      private static final ResourceLocation JUMP_BAR_COOLDOWN_SPRITE
    • JUMP_BAR_PROGRESS_SPRITE

      private static final ResourceLocation JUMP_BAR_PROGRESS_SPRITE
    • EXPERIENCE_BAR_BACKGROUND_SPRITE

      private static final ResourceLocation EXPERIENCE_BAR_BACKGROUND_SPRITE
    • EXPERIENCE_BAR_PROGRESS_SPRITE

      private static final ResourceLocation EXPERIENCE_BAR_PROGRESS_SPRITE
    • ARMOR_EMPTY_SPRITE

      private static final ResourceLocation ARMOR_EMPTY_SPRITE
    • ARMOR_HALF_SPRITE

      private static final ResourceLocation ARMOR_HALF_SPRITE
    • ARMOR_FULL_SPRITE

      private static final ResourceLocation ARMOR_FULL_SPRITE
    • FOOD_EMPTY_HUNGER_SPRITE

      private static final ResourceLocation FOOD_EMPTY_HUNGER_SPRITE
    • FOOD_HALF_HUNGER_SPRITE

      private static final ResourceLocation FOOD_HALF_HUNGER_SPRITE
    • FOOD_FULL_HUNGER_SPRITE

      private static final ResourceLocation FOOD_FULL_HUNGER_SPRITE
    • FOOD_EMPTY_SPRITE

      private static final ResourceLocation FOOD_EMPTY_SPRITE
    • FOOD_HALF_SPRITE

      private static final ResourceLocation FOOD_HALF_SPRITE
    • FOOD_FULL_SPRITE

      private static final ResourceLocation FOOD_FULL_SPRITE
    • AIR_SPRITE

      private static final ResourceLocation AIR_SPRITE
    • AIR_BURSTING_SPRITE

      private static final ResourceLocation AIR_BURSTING_SPRITE
    • HEART_VEHICLE_CONTAINER_SPRITE

      private static final ResourceLocation HEART_VEHICLE_CONTAINER_SPRITE
    • HEART_VEHICLE_FULL_SPRITE

      private static final ResourceLocation HEART_VEHICLE_FULL_SPRITE
    • HEART_VEHICLE_HALF_SPRITE

      private static final ResourceLocation HEART_VEHICLE_HALF_SPRITE
    • VIGNETTE_LOCATION

      private static final ResourceLocation VIGNETTE_LOCATION
    • PUMPKIN_BLUR_LOCATION

      private static final ResourceLocation PUMPKIN_BLUR_LOCATION
    • SPYGLASS_SCOPE_LOCATION

      private static final ResourceLocation SPYGLASS_SCOPE_LOCATION
    • POWDER_SNOW_OUTLINE_LOCATION

      private static final ResourceLocation POWDER_SNOW_OUTLINE_LOCATION
    • SCORE_DISPLAY_ORDER

      private static final Comparator<PlayerScoreEntry> SCORE_DISPLAY_ORDER
    • DEMO_EXPIRED_TEXT

      private static final Component DEMO_EXPIRED_TEXT
    • SAVING_TEXT

      private static final Component SAVING_TEXT
    • MIN_CROSSHAIR_ATTACK_SPEED

      private static final float MIN_CROSSHAIR_ATTACK_SPEED
      See Also:
    • NUM_HEARTS_PER_ROW

      private static final int NUM_HEARTS_PER_ROW
      See Also:
    • LINE_HEIGHT

      private static final int LINE_HEIGHT
      See Also:
    • SPACER

      private static final String SPACER
      See Also:
    • PORTAL_OVERLAY_ALPHA_MIN

      private static final float PORTAL_OVERLAY_ALPHA_MIN
      See Also:
    • HEART_SIZE

      private static final int HEART_SIZE
      See Also:
    • HEART_SEPARATION

      private static final int HEART_SEPARATION
      See Also:
    • AUTOSAVE_FADE_SPEED_FACTOR

      private static final float AUTOSAVE_FADE_SPEED_FACTOR
      See Also:
    • random

      private final RandomSource random
    • minecraft

      private final Minecraft minecraft
    • chat

      private final ChatComponent chat
    • tickCount

      private int tickCount
    • overlayMessageString

      @Nullable private Component overlayMessageString
    • overlayMessageTime

      private int overlayMessageTime
    • animateOverlayMessageColor

      private boolean animateOverlayMessageColor
    • chatDisabledByPlayerShown

      private boolean chatDisabledByPlayerShown
    • vignetteBrightness

      public float vignetteBrightness
    • toolHighlightTimer

      private int toolHighlightTimer
    • lastToolHighlight

      private ItemStack lastToolHighlight
    • debugOverlay

      private final DebugScreenOverlay debugOverlay
    • subtitleOverlay

      private final SubtitleOverlay subtitleOverlay
    • spectatorGui

      private final SpectatorGui spectatorGui
      The spectator GUI for this in-game GUI instance
    • tabList

      private final PlayerTabOverlay tabList
    • bossOverlay

      private final BossHealthOverlay bossOverlay
    • titleTime

      private int titleTime
      A timer for the current title and subtitle displayed
    • title

      @Nullable private Component title
      The current title displayed
    • subtitle

      @Nullable private Component subtitle
      The current sub-title displayed
    • titleFadeInTime

      private int titleFadeInTime
      The time that the title take to fade in
    • titleStayTime

      private int titleStayTime
      The time that the title is display
    • titleFadeOutTime

      private int titleFadeOutTime
      The time that the title take to fade out
    • lastHealth

      private int lastHealth
    • displayHealth

      private int displayHealth
    • lastHealthTime

      private long lastHealthTime
      The last recorded system time
    • healthBlinkTime

      private long healthBlinkTime
      Used with updateCounter to make the heart bar flash
    • autosaveIndicatorValue

      private float autosaveIndicatorValue
    • lastAutosaveIndicatorValue

      private float lastAutosaveIndicatorValue
    • layers

      @Deprecated private final LayeredDraw layers
      Deprecated.
      Neo: This is empty and unused, rendering goes through layerManager instead.
    • layerManager

      private final GuiLayerManager layerManager
    • scopeScale

      private float scopeScale
    • leftHeight

      public int leftHeight
      Neo: This variable controls the height of overlays on the left of the hotbar (e.g. health, armor).
    • rightHeight

      public int rightHeight
      Neo: This variable controls the height of overlays on the right of the hotbar (e.g. food, vehicle health, air).
  • Constructor Details

  • Method Details

    • resetTitleTimes

      public void resetTitleTimes()
    • render

      public void render(GuiGraphics guiGraphics, DeltaTracker deltaTracker)
    • renderCameraOverlays

      private void renderCameraOverlays(GuiGraphics guiGraphics, DeltaTracker deltaTracker)
    • renderSleepOverlay

      private void renderSleepOverlay(GuiGraphics guiGraphics, DeltaTracker deltaTracker)
    • renderOverlayMessage

      private void renderOverlayMessage(GuiGraphics guiGraphics, DeltaTracker deltaTracker)
    • renderTitle

      private void renderTitle(GuiGraphics guiGraphics, DeltaTracker deltaTracker)
    • renderChat

      private void renderChat(GuiGraphics guiGraphics, DeltaTracker deltaTracker)
    • renderScoreboardSidebar

      private void renderScoreboardSidebar(GuiGraphics guiGraphics, DeltaTracker deltaTracker)
    • renderTabList

      private void renderTabList(GuiGraphics guiGraphics, DeltaTracker deltaTracker)
    • renderCrosshair

      private void renderCrosshair(GuiGraphics guiGraphics, DeltaTracker deltaTracker)
    • canRenderCrosshairForSpectator

      private boolean canRenderCrosshairForSpectator(@Nullable HitResult rayTrace)
      Checks if the crosshair can be rendered for a spectator based on the provided HitResult.

      Parameters:
      rayTrace - the result of a ray trace operation.
      Returns:
      true if the crosshair can be rendered for a spectator, false otherwise.
    • renderEffects

      private void renderEffects(GuiGraphics guiGraphics, DeltaTracker deltaTracker)
    • renderHotbarAndDecorations

      @Deprecated private void renderHotbarAndDecorations(GuiGraphics guiGraphics, DeltaTracker deltaTracker)
      Deprecated.
    • renderHotbar

      private void renderHotbar(GuiGraphics p_316628_, DeltaTracker p_348543_)
    • maybeRenderJumpMeter

      private void maybeRenderJumpMeter(GuiGraphics p_316628_, DeltaTracker p_348543_)
    • maybeRenderExperienceBar

      private void maybeRenderExperienceBar(GuiGraphics p_316628_, DeltaTracker p_348543_)
    • maybeRenderPlayerHealth

      private void maybeRenderPlayerHealth(GuiGraphics p_316628_, DeltaTracker p_348543_)
    • maybeRenderVehicleHealth

      private void maybeRenderVehicleHealth(GuiGraphics p_316628_, DeltaTracker p_348543_)
    • maybeRenderSelectedItemName

      private void maybeRenderSelectedItemName(GuiGraphics p_316628_, DeltaTracker p_348543_)
    • maybeRenderSpectatorTooltip

      private void maybeRenderSpectatorTooltip(GuiGraphics p_316628_, DeltaTracker p_348543_)
    • renderItemHotbar

      private void renderItemHotbar(GuiGraphics guiGraphics, DeltaTracker deltaTracker)
    • renderJumpMeter

      private void renderJumpMeter(PlayerRideableJumping rideable, GuiGraphics guiGraphics, int x)
      Renders the jump meter for a rideable entity on the screen using the provided rideable object, GuiGraphics object, and x-coordinate.
      Parameters:
      rideable - the PlayerRideableJumping object representing the rideable entity.
      guiGraphics - the GuiGraphics object used for rendering.
      x - the x-coordinate for rendering the jump meter.
    • renderExperienceBar

      private void renderExperienceBar(GuiGraphics guiGraphics, int x)
      Renders the experience bar on the screen using the provided GuiGraphics object and x-coordinate.
      Parameters:
      guiGraphics - the GuiGraphics object used for rendering.
      x - the x-coordinate for rendering the experience bar.
    • renderExperienceLevel

      private void renderExperienceLevel(GuiGraphics guiGraphics, DeltaTracker deltaTracker)
    • isExperienceBarVisible

      private boolean isExperienceBarVisible()
    • renderSelectedItemName

      private void renderSelectedItemName(GuiGraphics guiGraphics)
      Renders the name of the selected item on the screen using the provided GuiGraphics object.
      Parameters:
      guiGraphics - the GuiGraphics object used for rendering.
    • renderSelectedItemName

      public void renderSelectedItemName(GuiGraphics guiGraphics, int yShift)
      Renders the name of the selected item on the screen using the provided GuiGraphics object.
      Parameters:
      guiGraphics - the GuiGraphics object used for rendering.
    • renderDemoOverlay

      private void renderDemoOverlay(GuiGraphics guiGraphics, DeltaTracker deltaTracker)
    • displayScoreboardSidebar

      private void displayScoreboardSidebar(GuiGraphics guiGraphics, Objective objective)
      Displays the scoreboard sidebar on the screen using the provided GuiGraphics object and objective.
      Parameters:
      guiGraphics - the GuiGraphics object used for rendering.
      objective - the objective representing the scoreboard sidebar.
    • getCameraPlayer

      @Nullable private Player getCameraPlayer()
    • getPlayerVehicleWithHealth

      @Nullable private LivingEntity getPlayerVehicleWithHealth()
    • getVehicleMaxHearts

      private int getVehicleMaxHearts(@Nullable LivingEntity vehicle)
      Retrieves the maximum number of hearts representing the vehicle's health for the given mount entity.

      Parameters:
      vehicle - the living entity representing the vehicle.
      Returns:
      the maximum number of hearts representing the vehicle's health, or 0 if the mount entity is null or does not show vehicle health.
    • getVisibleVehicleHeartRows

      private int getVisibleVehicleHeartRows(int vehicleHealth)
      Retrieves the number of rows of visible hearts needed to represent the given mount health.

      Parameters:
      vehicleHealth - the health of the mount entity.
      Returns:
      the number of rows of visible hearts needed to represent the mount health.
    • renderPlayerHealth

      @Deprecated private void renderPlayerHealth(GuiGraphics guiGraphics)
      Deprecated.
      Renders the player's health, armor, food, and air bars on the screen.
      Parameters:
      guiGraphics - the graphics object used for rendering.
    • renderHealthLevel

      private void renderHealthLevel(GuiGraphics p_283143_)
    • renderArmorLevel

      private void renderArmorLevel(GuiGraphics p_283143_)
    • renderFoodLevel

      private void renderFoodLevel(GuiGraphics p_283143_)
    • renderAirLevel

      private void renderAirLevel(GuiGraphics p_283143_)
    • renderArmor

      private static void renderArmor(GuiGraphics guiGraphics, Player player, int y, int heartRows, int height, int x)
    • renderHearts

      private void renderHearts(GuiGraphics guiGraphics, Player player, int x, int y, int height, int offsetHeartIndex, float maxHealth, int currentHealth, int displayHealth, int absorptionAmount, boolean renderHighlight)
      Renders the player's hearts, including health, absorption, and highlight hearts, on the screen.
      Parameters:
      guiGraphics - the graphics object used for rendering.
      player - the player entity.
      x - the x-coordinate of the hearts' position.
      y - the y-coordinate of the hearts' position.
      height - the height of each heart.
      offsetHeartIndex - the index of the offset heart.
      maxHealth - the maximum health of the player.
      currentHealth - the current health of the player.
      displayHealth - the displayed health of the player.
      absorptionAmount - the absorption amount of the player.
      renderHighlight - determines whether to render the highlight hearts.
    • renderHeart

      private void renderHeart(GuiGraphics guiGraphics, Gui.HeartType heartType, int x, int y, boolean hardcore, boolean halfHeart, boolean blinking)
    • renderFood

      private void renderFood(GuiGraphics guiGraphics, Player player, int y, int x)
    • renderVehicleHealth

      private void renderVehicleHealth(GuiGraphics guiGraphics)
      Renders the health of the player's vehicle on the screen.
      Parameters:
      guiGraphics - the graphics object used for rendering.
    • renderTextureOverlay

      private void renderTextureOverlay(GuiGraphics guiGraphics, ResourceLocation shaderLocation, float alpha)
      Renders a texture overlay on the screen with the specified shader location and alpha value.
      Parameters:
      guiGraphics - the graphics object used for rendering.
      shaderLocation - the location of the shader texture.
      alpha - the alpha value to apply to the overlay.
    • renderSpyglassOverlay

      private void renderSpyglassOverlay(GuiGraphics guiGraphics, float scopeScale)
      Renders the overlay for the spyglass effect.
      Parameters:
      guiGraphics - the graphics object used for rendering.
      scopeScale - the scale factor for the spyglass scope.
    • updateVignetteBrightness

      private void updateVignetteBrightness(Entity entity)
      Updates the brightness of the vignette effect based on the brightness of the given entity's position.
      Parameters:
      entity - the entity used to determine the brightness.
    • renderVignette

      private void renderVignette(GuiGraphics guiGraphics, @Nullable Entity entity)
      Renders the vignette effect on the screen based on the distance to the world border and the entity's position.
      Parameters:
      guiGraphics - the graphics object used for rendering.
      entity - the entity used to determine the distance to the world border.
    • renderPortalOverlay

      private void renderPortalOverlay(GuiGraphics guiGraphics, float alpha)
      Renders the portal overlay effect on the screen with the specified alpha value.
      Parameters:
      guiGraphics - the graphics object used for rendering.
      alpha - the alpha value of the overlay.
    • renderSlot

      private void renderSlot(GuiGraphics guiGraphics, int x, int y, DeltaTracker deltaTracker, Player player, ItemStack stack, int seed)
    • tick

      public void tick(boolean pause)
      Advances the tick for the autosave indicator and optionally ticks the object if not paused.
    • tick

      private void tick()
    • tickAutosaveIndicator

      private void tickAutosaveIndicator()
    • setNowPlaying

      public void setNowPlaying(Component displayName)
      Sets the currently playing record display name and updates the overlay message.
      Parameters:
      displayName - the display name of the currently playing record.
    • setOverlayMessage

      public void setOverlayMessage(Component component, boolean animateColor)
      Sets the overlay message to be displayed on the screen.
      Parameters:
      component - the Component representing the overlay message.
      animateColor - a boolean indicating whether to animate the color of the overlay message.
    • setChatDisabledByPlayerShown

      public void setChatDisabledByPlayerShown(boolean chatDisabledByPlayerShown)
      Returns true if the chat is disabled, false if chat is enabled.
    • isShowingChatDisabledByPlayer

      public boolean isShowingChatDisabledByPlayer()
    • setTimes

      public void setTimes(int titleFadeInTime, int titleStayTime, int titleFadeOutTime)
      Sets the fade-in, stay, and fade-out times for the title display.
      Parameters:
      titleFadeInTime - the fade-in time for the title message in ticks.
      titleStayTime - the stay time for the title message in ticks.
      titleFadeOutTime - the fade-out time for the title message in ticks.
    • setSubtitle

      public void setSubtitle(Component subtitle)
      Sets the subtitle to be displayed in the title screen.
      Parameters:
      subtitle - the subtitle Component to be displayed.
    • setTitle

      public void setTitle(Component title)
      Sets the title to be displayed in the title screen.
      Parameters:
      title - the title Component to be displayed.
    • clear

      public void clear()
    • getChat

      public ChatComponent getChat()
    • getGuiTicks

      public int getGuiTicks()
    • getFont

      public Font getFont()
    • getSpectatorGui

      public SpectatorGui getSpectatorGui()
    • getTabList

      public PlayerTabOverlay getTabList()
    • onDisconnected

      public void onDisconnected()
    • getBossOverlay

      public BossHealthOverlay getBossOverlay()
    • getDebugOverlay

      public DebugScreenOverlay getDebugOverlay()
    • clearCache

      public void clearCache()
    • renderSavingIndicator

      public void renderSavingIndicator(GuiGraphics guiGraphics, DeltaTracker deltaTracker)
    • initModdedOverlays

      @Internal public void initModdedOverlays()
    • getLayerCount

      public int getLayerCount()