Package net.minecraft.client.gui
Class Gui
java.lang.Object
net.minecraft.client.gui.Gui
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final ResourceLocation
private static final ResourceLocation
private boolean
private static final ResourceLocation
private static final ResourceLocation
private static final ResourceLocation
private static final float
private float
private final BossHealthOverlay
private final ChatComponent
private boolean
private static final ResourceLocation
private static final ResourceLocation
private static final ResourceLocation
private static final ResourceLocation
private final DebugScreenOverlay
private static final Component
private int
private static final ResourceLocation
private static final ResourceLocation
private static final ResourceLocation
private static final ResourceLocation
private static final ResourceLocation
private static final ResourceLocation
private static final ResourceLocation
private static final ResourceLocation
private static final ResourceLocation
private static final ResourceLocation
private long
Used with updateCounter to make the heart bar flashprivate static final int
private static final int
private static final ResourceLocation
private static final ResourceLocation
private static final ResourceLocation
private static final ResourceLocation
private static final ResourceLocation
private static final ResourceLocation
private static final ResourceLocation
private static final ResourceLocation
private static final ResourceLocation
private static final ResourceLocation
private static final ResourceLocation
private static final ResourceLocation
private float
private int
private long
The last recorded system timeprivate ItemStack
private final GuiLayerManager
private final LayeredDraw
Deprecated.int
Neo: This variable controls the height of overlays on the left of the hotbar (e.g.private static final int
private static final float
private final Minecraft
private static final int
private Component
private int
private static final float
private static final ResourceLocation
private static final ResourceLocation
private final RandomSource
int
Neo: This variable controls the height of overlays on the right of the hotbar (e.g.private static final Component
private float
private static final Comparator
<PlayerScoreEntry> private static final String
private final SpectatorGui
The spectator GUI for this in-game GUI instanceprivate static final ResourceLocation
private Component
The current sub-title displayedprivate final SubtitleOverlay
private final PlayerTabOverlay
private int
private Component
The current title displayedprivate int
The time that the title take to fade inprivate int
The time that the title take to fade outprivate int
The time that the title is displayprivate int
A timer for the current title and subtitle displayedprivate int
private static final ResourceLocation
float
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate boolean
canRenderCrosshairForSpectator
(HitResult rayTrace) Checks if the crosshair can be rendered for a spectator based on the providedHitResult
.void
clear()
void
private void
displayScoreboardSidebar
(GuiGraphics guiGraphics, Objective objective) Displays the scoreboard sidebar on the screen using the provided GuiGraphics object and objective.private Player
getChat()
getFont()
int
int
private LivingEntity
private int
getVehicleMaxHearts
(LivingEntity vehicle) Retrieves the maximum number of hearts representing the vehicle's health for the given mount entity.private int
getVisibleVehicleHeartRows
(int vehicleHealth) Retrieves the number of rows of visible hearts needed to represent the given mount health.void
private boolean
boolean
private void
maybeRenderExperienceBar
(GuiGraphics p_316628_, DeltaTracker p_348543_) private void
maybeRenderJumpMeter
(GuiGraphics p_316628_, DeltaTracker p_348543_) private void
maybeRenderPlayerHealth
(GuiGraphics p_316628_, DeltaTracker p_348543_) private void
maybeRenderSelectedItemName
(GuiGraphics p_316628_, DeltaTracker p_348543_) private void
maybeRenderSpectatorTooltip
(GuiGraphics p_316628_, DeltaTracker p_348543_) private void
maybeRenderVehicleHealth
(GuiGraphics p_316628_, DeltaTracker p_348543_) void
void
render
(GuiGraphics guiGraphics, DeltaTracker deltaTracker) private void
renderAirLevel
(GuiGraphics p_283143_) private static void
renderArmor
(GuiGraphics guiGraphics, Player player, int y, int heartRows, int height, int x) private void
renderArmorLevel
(GuiGraphics p_283143_) private void
renderCameraOverlays
(GuiGraphics guiGraphics, DeltaTracker deltaTracker) private void
renderChat
(GuiGraphics guiGraphics, DeltaTracker deltaTracker) private void
renderCrosshair
(GuiGraphics guiGraphics, DeltaTracker deltaTracker) private void
renderDemoOverlay
(GuiGraphics guiGraphics, DeltaTracker deltaTracker) private void
renderEffects
(GuiGraphics guiGraphics, DeltaTracker deltaTracker) private void
renderExperienceBar
(GuiGraphics guiGraphics, int x) Renders the experience bar on the screen using the provided GuiGraphics object and x-coordinate.private void
renderExperienceLevel
(GuiGraphics guiGraphics, DeltaTracker deltaTracker) private void
renderFood
(GuiGraphics guiGraphics, Player player, int y, int x) private void
renderFoodLevel
(GuiGraphics p_283143_) private void
renderHealthLevel
(GuiGraphics p_283143_) private void
renderHeart
(GuiGraphics guiGraphics, Gui.HeartType heartType, int x, int y, boolean hardcore, boolean halfHeart, boolean blinking) 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.private void
renderHotbar
(GuiGraphics p_316628_, DeltaTracker p_348543_) private void
renderHotbarAndDecorations
(GuiGraphics guiGraphics, DeltaTracker deltaTracker) Deprecated.private void
renderItemHotbar
(GuiGraphics guiGraphics, DeltaTracker deltaTracker) 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.private void
renderOverlayMessage
(GuiGraphics guiGraphics, DeltaTracker deltaTracker) private void
renderPlayerHealth
(GuiGraphics guiGraphics) Deprecated.private void
renderPortalOverlay
(GuiGraphics guiGraphics, float alpha) Renders the portal overlay effect on the screen with the specified alpha value.void
renderSavingIndicator
(GuiGraphics guiGraphics, DeltaTracker deltaTracker) private void
renderScoreboardSidebar
(GuiGraphics guiGraphics, DeltaTracker deltaTracker) private void
renderSelectedItemName
(GuiGraphics guiGraphics) Renders the name of the selected item on the screen using the provided GuiGraphics object.void
renderSelectedItemName
(GuiGraphics guiGraphics, int yShift) Renders the name of the selected item on the screen using the provided GuiGraphics object.private void
renderSleepOverlay
(GuiGraphics guiGraphics, DeltaTracker deltaTracker) private void
renderSlot
(GuiGraphics guiGraphics, int x, int y, DeltaTracker deltaTracker, Player player, ItemStack stack, int seed) private void
renderSpyglassOverlay
(GuiGraphics guiGraphics, float scopeScale) Renders the overlay for the spyglass effect.private void
renderTabList
(GuiGraphics guiGraphics, DeltaTracker deltaTracker) private void
renderTextureOverlay
(GuiGraphics guiGraphics, ResourceLocation shaderLocation, float alpha) Renders a texture overlay on the screen with the specified shader location and alpha value.private void
renderTitle
(GuiGraphics guiGraphics, DeltaTracker deltaTracker) private void
renderVehicleHealth
(GuiGraphics guiGraphics) Renders the health of the player's vehicle on the screen.private void
renderVignette
(GuiGraphics guiGraphics, Entity entity) Renders the vignette effect on the screen based on the distance to the world border and the entity's position.void
void
setChatDisabledByPlayerShown
(boolean chatDisabledByPlayerShown) Returnstrue
if the chat is disabled,false
if chat is enabled.void
setNowPlaying
(Component displayName) Sets the currently playing record display name and updates the overlay message.void
setOverlayMessage
(Component component, boolean animateColor) Sets the overlay message to be displayed on the screen.void
setSubtitle
(Component subtitle) Sets the subtitle to be displayed in the title screen.void
setTimes
(int titleFadeInTime, int titleStayTime, int titleFadeOutTime) Sets the fade-in, stay, and fade-out times for the title display.void
Sets the title to be displayed in the title screen.private void
tick()
void
tick
(boolean pause) Advances the tick for the autosave indicator and optionally ticks the object if not paused.private void
private void
updateVignetteBrightness
(Entity entity) Updates the brightness of the vignette effect based on the brightness of the given entity's position.
-
Field Details
-
CROSSHAIR_SPRITE
-
CROSSHAIR_ATTACK_INDICATOR_FULL_SPRITE
-
CROSSHAIR_ATTACK_INDICATOR_BACKGROUND_SPRITE
-
CROSSHAIR_ATTACK_INDICATOR_PROGRESS_SPRITE
-
EFFECT_BACKGROUND_AMBIENT_SPRITE
-
EFFECT_BACKGROUND_SPRITE
-
HOTBAR_SPRITE
-
HOTBAR_SELECTION_SPRITE
-
HOTBAR_OFFHAND_LEFT_SPRITE
-
HOTBAR_OFFHAND_RIGHT_SPRITE
-
HOTBAR_ATTACK_INDICATOR_BACKGROUND_SPRITE
-
HOTBAR_ATTACK_INDICATOR_PROGRESS_SPRITE
-
JUMP_BAR_BACKGROUND_SPRITE
-
JUMP_BAR_COOLDOWN_SPRITE
-
JUMP_BAR_PROGRESS_SPRITE
-
EXPERIENCE_BAR_BACKGROUND_SPRITE
-
EXPERIENCE_BAR_PROGRESS_SPRITE
-
ARMOR_EMPTY_SPRITE
-
ARMOR_HALF_SPRITE
-
ARMOR_FULL_SPRITE
-
FOOD_EMPTY_HUNGER_SPRITE
-
FOOD_HALF_HUNGER_SPRITE
-
FOOD_FULL_HUNGER_SPRITE
-
FOOD_EMPTY_SPRITE
-
FOOD_HALF_SPRITE
-
FOOD_FULL_SPRITE
-
AIR_SPRITE
-
AIR_BURSTING_SPRITE
-
HEART_VEHICLE_CONTAINER_SPRITE
-
HEART_VEHICLE_FULL_SPRITE
-
HEART_VEHICLE_HALF_SPRITE
-
VIGNETTE_LOCATION
-
PUMPKIN_BLUR_LOCATION
-
SPYGLASS_SCOPE_LOCATION
-
POWDER_SNOW_OUTLINE_LOCATION
-
SCORE_DISPLAY_ORDER
-
DEMO_EXPIRED_TEXT
-
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
- 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
-
minecraft
-
chat
-
tickCount
private int tickCount -
overlayMessageString
-
overlayMessageTime
private int overlayMessageTime -
animateOverlayMessageColor
private boolean animateOverlayMessageColor -
chatDisabledByPlayerShown
private boolean chatDisabledByPlayerShown -
vignetteBrightness
public float vignetteBrightness -
toolHighlightTimer
private int toolHighlightTimer -
lastToolHighlight
-
debugOverlay
-
subtitleOverlay
-
spectatorGui
The spectator GUI for this in-game GUI instance -
tabList
-
bossOverlay
-
titleTime
private int titleTimeA timer for the current title and subtitle displayed -
title
The current title displayed -
subtitle
The current sub-title displayed -
titleFadeInTime
private int titleFadeInTimeThe time that the title take to fade in -
titleStayTime
private int titleStayTimeThe time that the title is display -
titleFadeOutTime
private int titleFadeOutTimeThe time that the title take to fade out -
lastHealth
private int lastHealth -
displayHealth
private int displayHealth -
lastHealthTime
private long lastHealthTimeThe last recorded system time -
healthBlinkTime
private long healthBlinkTimeUsed with updateCounter to make the heart bar flash -
autosaveIndicatorValue
private float autosaveIndicatorValue -
lastAutosaveIndicatorValue
private float lastAutosaveIndicatorValue -
layers
Deprecated.Neo: This is empty and unused, rendering goes throughlayerManager
instead. -
layerManager
-
scopeScale
private float scopeScale -
leftHeight
public int leftHeightNeo: This variable controls the height of overlays on the left of the hotbar (e.g. health, armor). -
rightHeight
public int rightHeightNeo: This variable controls the height of overlays on the right of the hotbar (e.g. food, vehicle health, air).
-
-
Constructor Details
-
Gui
-
-
Method Details
-
resetTitleTimes
public void resetTitleTimes() -
render
-
renderCameraOverlays
-
renderSleepOverlay
-
renderOverlayMessage
-
renderTitle
-
renderChat
-
renderScoreboardSidebar
-
renderTabList
-
renderCrosshair
-
canRenderCrosshairForSpectator
Checks if the crosshair can be rendered for a spectator based on the providedHitResult
.- Parameters:
rayTrace
- the result of a ray trace operation.- Returns:
true
if the crosshair can be rendered for a spectator,false
otherwise.
-
renderEffects
-
renderHotbarAndDecorations
@Deprecated private void renderHotbarAndDecorations(GuiGraphics guiGraphics, DeltaTracker deltaTracker) Deprecated. -
renderHotbar
-
maybeRenderJumpMeter
-
maybeRenderExperienceBar
-
maybeRenderPlayerHealth
-
maybeRenderVehicleHealth
-
maybeRenderSelectedItemName
-
maybeRenderSpectatorTooltip
-
renderItemHotbar
-
renderJumpMeter
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
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
-
isExperienceBarVisible
private boolean isExperienceBarVisible() -
renderSelectedItemName
Renders the name of the selected item on the screen using the provided GuiGraphics object.- Parameters:
guiGraphics
- the GuiGraphics object used for rendering.
-
renderSelectedItemName
Renders the name of the selected item on the screen using the provided GuiGraphics object.- Parameters:
guiGraphics
- the GuiGraphics object used for rendering.
-
renderDemoOverlay
-
displayScoreboardSidebar
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
-
getPlayerVehicleWithHealth
-
getVehicleMaxHearts
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.Renders the player's health, armor, food, and air bars on the screen.- Parameters:
guiGraphics
- the graphics object used for rendering.
-
renderHealthLevel
-
renderArmorLevel
-
renderFoodLevel
-
renderAirLevel
-
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
-
renderVehicleHealth
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
Renders the overlay for the spyglass effect.- Parameters:
guiGraphics
- the graphics object used for rendering.scopeScale
- the scale factor for the spyglass scope.
-
updateVignetteBrightness
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
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
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
Sets the currently playing record display name and updates the overlay message.- Parameters:
displayName
- the display name of the currently playing record.
-
setOverlayMessage
Sets the overlay message to be displayed on the screen.- Parameters:
component
- theComponent
representing the overlay message.animateColor
- a boolean indicating whether to animate the color of the overlay message.
-
setChatDisabledByPlayerShown
public void setChatDisabledByPlayerShown(boolean chatDisabledByPlayerShown) Returnstrue
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
Sets the subtitle to be displayed in the title screen.- Parameters:
subtitle
- the subtitleComponent
to be displayed.
-
setTitle
Sets the title to be displayed in the title screen.- Parameters:
title
- the titleComponent
to be displayed.
-
clear
public void clear() -
getChat
-
getGuiTicks
public int getGuiTicks() -
getFont
-
getSpectatorGui
-
getTabList
-
onDisconnected
public void onDisconnected() -
getBossOverlay
-
getDebugOverlay
-
clearCache
public void clearCache() -
renderSavingIndicator
-
initModdedOverlays
@Internal public void initModdedOverlays() -
getLayerCount
public int getLayerCount()
-