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 ResourceLocationprivate static final ResourceLocationprivate booleanprivate static final ResourceLocationprivate static final ResourceLocationprivate static final ResourceLocationprivate static final floatprivate floatprivate final BossHealthOverlayprivate final ChatComponentprivate booleanprivate static final ResourceLocationprivate static final ResourceLocationprivate static final ResourceLocationprivate static final ResourceLocationprivate final DebugScreenOverlayprivate static final Componentprivate intprivate static final ResourceLocationprivate static final ResourceLocationprivate static final ResourceLocationprivate static final ResourceLocationprivate static final ResourceLocationprivate static final ResourceLocationprivate static final ResourceLocationprivate static final ResourceLocationprivate static final ResourceLocationprivate static final ResourceLocationprivate longUsed with updateCounter to make the heart bar flashprivate static final intprivate static final intprivate static final ResourceLocationprivate static final ResourceLocationprivate static final ResourceLocationprivate static final ResourceLocationprivate static final ResourceLocationprivate static final ResourceLocationprivate static final ResourceLocationprivate static final ResourceLocationprivate static final ResourceLocationprivate static final ResourceLocationprivate static final ResourceLocationprivate static final ResourceLocationprivate floatprivate intprivate longThe last recorded system timeprivate ItemStackprivate final GuiLayerManagerprivate final LayeredDrawDeprecated.intNeo: This variable controls the height of overlays on the left of the hotbar (e.g.private static final intprivate static final floatprivate final Minecraftprivate static final intprivate Componentprivate intprivate static final floatprivate static final ResourceLocationprivate static final ResourceLocationprivate final RandomSourceintNeo: This variable controls the height of overlays on the right of the hotbar (e.g.private static final Componentprivate floatprivate static final Comparator<PlayerScoreEntry> private static final Stringprivate final SpectatorGuiThe spectator GUI for this in-game GUI instanceprivate static final ResourceLocationprivate ComponentThe current sub-title displayedprivate final SubtitleOverlayprivate final PlayerTabOverlayprivate intprivate ComponentThe current title displayedprivate intThe time that the title take to fade inprivate intThe time that the title take to fade outprivate intThe time that the title is displayprivate intA timer for the current title and subtitle displayedprivate intprivate static final ResourceLocationfloat -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate booleancanRenderCrosshairForSpectator(HitResult rayTrace) Checks if the crosshair can be rendered for a spectator based on the providedHitResult.voidclear()voidprivate voiddisplayScoreboardSidebar(GuiGraphics guiGraphics, Objective objective) Displays the scoreboard sidebar on the screen using the provided GuiGraphics object and objective.private PlayergetChat()getFont()intintprivate LivingEntityprivate intgetVehicleMaxHearts(LivingEntity vehicle) Retrieves the maximum number of hearts representing the vehicle's health for the given mount entity.private intgetVisibleVehicleHeartRows(int vehicleHealth) Retrieves the number of rows of visible hearts needed to represent the given mount health.voidprivate booleanbooleanprivate voidmaybeRenderExperienceBar(GuiGraphics p_316628_, DeltaTracker p_348543_) private voidmaybeRenderJumpMeter(GuiGraphics p_316628_, DeltaTracker p_348543_) private voidmaybeRenderPlayerHealth(GuiGraphics p_316628_, DeltaTracker p_348543_) private voidmaybeRenderSelectedItemName(GuiGraphics p_316628_, DeltaTracker p_348543_) private voidmaybeRenderSpectatorTooltip(GuiGraphics p_316628_, DeltaTracker p_348543_) private voidmaybeRenderVehicleHealth(GuiGraphics p_316628_, DeltaTracker p_348543_) voidvoidrender(GuiGraphics guiGraphics, DeltaTracker deltaTracker) private voidrenderAirLevel(GuiGraphics p_283143_) private static voidrenderArmor(GuiGraphics guiGraphics, Player player, int y, int heartRows, int height, int x) private voidrenderArmorLevel(GuiGraphics p_283143_) private voidrenderCameraOverlays(GuiGraphics guiGraphics, DeltaTracker deltaTracker) private voidrenderChat(GuiGraphics guiGraphics, DeltaTracker deltaTracker) private voidrenderCrosshair(GuiGraphics guiGraphics, DeltaTracker deltaTracker) private voidrenderDemoOverlay(GuiGraphics guiGraphics, DeltaTracker deltaTracker) private voidrenderEffects(GuiGraphics guiGraphics, DeltaTracker deltaTracker) private voidrenderExperienceBar(GuiGraphics guiGraphics, int x) Renders the experience bar on the screen using the provided GuiGraphics object and x-coordinate.private voidrenderExperienceLevel(GuiGraphics guiGraphics, DeltaTracker deltaTracker) private voidrenderFood(GuiGraphics guiGraphics, Player player, int y, int x) private voidrenderFoodLevel(GuiGraphics p_283143_) private voidrenderHealthLevel(GuiGraphics p_283143_) private voidrenderHeart(GuiGraphics guiGraphics, Gui.HeartType heartType, int x, int y, boolean hardcore, boolean halfHeart, boolean blinking) private voidrenderHearts(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 voidrenderHotbar(GuiGraphics p_316628_, DeltaTracker p_348543_) private voidrenderHotbarAndDecorations(GuiGraphics guiGraphics, DeltaTracker deltaTracker) Deprecated.private voidrenderItemHotbar(GuiGraphics guiGraphics, DeltaTracker deltaTracker) private voidrenderJumpMeter(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 voidrenderOverlayMessage(GuiGraphics guiGraphics, DeltaTracker deltaTracker) private voidrenderPlayerHealth(GuiGraphics guiGraphics) Deprecated.private voidrenderPortalOverlay(GuiGraphics guiGraphics, float alpha) Renders the portal overlay effect on the screen with the specified alpha value.voidrenderSavingIndicator(GuiGraphics guiGraphics, DeltaTracker deltaTracker) private voidrenderScoreboardSidebar(GuiGraphics guiGraphics, DeltaTracker deltaTracker) private voidrenderSelectedItemName(GuiGraphics guiGraphics) Renders the name of the selected item on the screen using the provided GuiGraphics object.voidrenderSelectedItemName(GuiGraphics guiGraphics, int yShift) Renders the name of the selected item on the screen using the provided GuiGraphics object.private voidrenderSleepOverlay(GuiGraphics guiGraphics, DeltaTracker deltaTracker) private voidrenderSlot(GuiGraphics guiGraphics, int x, int y, DeltaTracker deltaTracker, Player player, ItemStack stack, int seed) private voidrenderSpyglassOverlay(GuiGraphics guiGraphics, float scopeScale) Renders the overlay for the spyglass effect.private voidrenderTabList(GuiGraphics guiGraphics, DeltaTracker deltaTracker) private voidrenderTextureOverlay(GuiGraphics guiGraphics, ResourceLocation shaderLocation, float alpha) Renders a texture overlay on the screen with the specified shader location and alpha value.private voidrenderTitle(GuiGraphics guiGraphics, DeltaTracker deltaTracker) private voidrenderVehicleHealth(GuiGraphics guiGraphics) Renders the health of the player's vehicle on the screen.private voidrenderVignette(GuiGraphics guiGraphics, Entity entity) Renders the vignette effect on the screen based on the distance to the world border and the entity's position.voidvoidsetChatDisabledByPlayerShown(boolean chatDisabledByPlayerShown) Returnstrueif the chat is disabled,falseif chat is enabled.voidsetNowPlaying(Component displayName) Sets the currently playing record display name and updates the overlay message.voidsetOverlayMessage(Component component, boolean animateColor) Sets the overlay message to be displayed on the screen.voidsetSubtitle(Component subtitle) Sets the subtitle to be displayed in the title screen.voidsetTimes(int titleFadeInTime, int titleStayTime, int titleFadeOutTime) Sets the fade-in, stay, and fade-out times for the title display.voidSets the title to be displayed in the title screen.private voidtick()voidtick(boolean pause) Advances the tick for the autosave indicator and optionally ticks the object if not paused.private voidprivate voidupdateVignetteBrightness(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 throughlayerManagerinstead. -
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:
trueif the crosshair can be rendered for a spectator,falseotherwise.
-
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- theComponentrepresenting the overlay message.animateColor- a boolean indicating whether to animate the color of the overlay message.
-
setChatDisabledByPlayerShown
public void setChatDisabledByPlayerShown(boolean chatDisabledByPlayerShown) Returnstrueif the chat is disabled,falseif 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 subtitleComponentto be displayed.
-
setTitle
Sets the title to be displayed in the title screen.- Parameters:
title- the titleComponentto 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()
-