Package net.minecraft.client
Class Minecraft
- All Implemented Interfaces:
WindowEventHandler,AutoCloseable,Executor,ProfilerMeasured,ProcessorHandle<Runnable>,IMinecraftExtension
public class Minecraft
extends ReentrantBlockableEventLoop<Runnable>
implements WindowEventHandler, IMinecraftExtension
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum(package private) static final record -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final booleanprivate final booleanstatic final ResourceLocationprivate final com.mojang.authlib.yggdrasil.YggdrasilAuthenticationServiceprivate final BlockColorsprivate final BlockEntityRenderDispatcherprivate final BlockRenderDispatcherThe BlockRenderDispatcher instance that will be used based off gamesettingsprivate final longprivate final ChatListenerprivate booleanprivate final longprivate longprivate final CommandHistoryprivate TimerQuery.FrameProfileprivate Stringfinal DebugRendererstatic final ResourceLocationprivate Supplier<CrashReport> private final booleanprivate final DirectoryValidatorprivate final DownloadedPackSourceprivate final EntityModelSetprivate final EntityRenderDispatcherprivate final com.mojang.datafixers.DataFixerfinal Fontfinal Fontprivate final FontManagerprivate static intprivate final ContinuousProfilerprivate intprivate ProfileResultsprivate intprivate longfinal Fileprivate booleanfinal GameRendererprivate Threadprivate doubleprivate final GpuWarnlistManagerfinal Guiprivate final GuiSpriteManagerprivate final HotbarManager(package private) static Minecraftprivate booleanprivate final ItemColorsprivate final ItemRendererfinal KeyboardHandlerprivate final LanguageManagerprivate InputTypeprivate longTime in nanoseconds of when the class is loadedprivate longprivate final Stringfinal LevelRendererprivate final LevelStorageSourceprivate static final org.slf4j.Loggerprivate final RenderTargetprivate final MapDecorationTextureManagerprivate static final intprivate MetricsRecorderprivate final com.mojang.authlib.minecraft.MinecraftSessionServiceprotected intprivate final MobEffectTextureManagerprivate final ModelManagerfinal MouseHandlerprivate final MusicManagerprivate final GameNarratorbooleanstatic final booleanfinal Optionsprivate Overlayprivate final PaintingTextureManagerfinal ParticleEngineprivate booleanprivate Connectionprivate CompletableFuture<Void> private final PlayerSocialManagerprivate final CompletableFuture<com.mojang.authlib.yggdrasil.ProfileResult> private final ProfileKeyPairManagerprivate ProfilerFillerprivate final AtomicReference<StoringChunkProgressListener> private final Proxyprivate final QuickPlayLogprivate final RealmsDataFetcherprivate static final ResourceLocationprivate final PeriodicNotificationManagerprivate final ResourceLoadStateTrackerprivate final RenderBuffersprivate ReportingContextprivate static final CompletableFuture<Unit> private final ReloadableResourceManagerprivate final Pathprivate final PackRepositoryprivate intprivate booleanprivate longbooleanbooleanprivate IntegratedServerprivate final SkinManagerbooleanprivate static final Componentprivate TutorialToastprivate final SoundManagerprivate final SplashManagerprivate final ClientTelemetryManagerprivate final TextureManagerprivate final DeltaTracker.Timerprivate final ToastComponentprivate final Tutorialstatic final ResourceLocationstatic final Stringprivate final Userprivate final com.mojang.authlib.minecraft.UserApiServiceprivate final CompletableFuture<com.mojang.authlib.minecraft.UserApiService.UserProperties> private final VanillaPackResourcesprivate final Stringprivate final VirtualScreenprivate final Windowprivate booleanboolean -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidprivate voidaddCustomNbtData(ItemStack stack, BlockEntity blockEntity, RegistryAccess registryAccess) private voidaddInitialScreens(List<Function<Runnable, Screen>> output) private voidaddResourcePackLoadFailToast(Component message) booleanbooleanbooleanprivate PatharchiveProfilingReport(SystemReport report, List<Path> paths) private RunnablebuildInitialScreens(Minecraft.GameLoadCookie gameLoadCookie) booleanstatic ModCheckvoidclearClientLevel(Screen nextScreen) voidvoidclearResourcePacksOnError(Throwable throwable, Component errorMessage, Minecraft.GameLoadCookie gameLoadCookie) voidclose()private ProfilerFillerconstructProfiler(boolean renderFpsPie, SingleTickProfiler singleTickProfiler) private voidcontinueAttack(boolean leftClick) private static booleancountryEqualsISO3(Object country) static voidcrash(Minecraft minecraft, File gameDirectory, CrashReport crashReport) private Stringprivate com.mojang.authlib.minecraft.UserApiServicecreateUserApiService(com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService authenticationService, GameConfig gameConfig) voidprivate voidbooleandebugClientMetricsStart(Consumer<Component> logger) private voidvoiddebugFpsMeterKeyPress(int keyCount) Update debugProfilerName in response to number keys in debug screenvoiddelayCrash(CrashReport report) voiddelayCrashRaw(CrashReport report) voiddestroy()voidvoiddisconnect(Screen nextScreen) voiddisconnect(Screen nextScreen, boolean keepResourcePacks) voiddoWorldLoad(LevelStorageSource.LevelStorageAccess levelStorage, PackRepository packRepository, WorldStem worldStem, boolean newWorld) private voidvoidemergencySaveAndCrash(CrashReport crashReport) booleanstatic voidfillReport(Minecraft minecraft, LanguageManager languageManager, String launchVersion, Options options, CrashReport report) fillReport(CrashReport theCrash) Adds core server Info (GL version, Texture pack, isModded, type), and the worldInfo to the crash report.private static SystemReportfillSystemReport(SystemReport report, Minecraft minecraft, LanguageManager languageManager, String launchVersion, Options options) private voidfillUptime(CrashReportCategory category) private voidfinishProfilers(boolean renderFpsPie, SingleTickProfiler profiler) voidforceSetScreen(Screen screen) private static StringformatSeconds(double seconds) com.mojang.datafixers.DataFixerintgetFps()private intlongcom.mojang.authlib.GameProfiledoublestatic Minecraftstatic Stringcom.mojang.authlib.minecraft.MinecraftSessionServicegetProxy()protected ThreadgetTextureAtlas(ResourceLocation location) private floatgetTickTargetMillis(float defaultValue) getTimer()getUser()private ComponentgrabHugeScreenshot(File gameDirectory, int columnWidth, int rowHeight, int width, int height) grabPanoramixScreenshot(File gameDirectory, int width, int height) private voidprivate voidbooleanbooleanfinal booleanisDemo()booleanbooleanprivate booleanbooleanisLocalPlayer(UUID uuid) booleanprivate booleanbooleanbooleanisPaused()booleanbooleanbooleanbooleancom.mojang.authlib.minecraft.BanDetailsprivate voidonFullscreenError(int error, long description) private voidonGameLoadFinished(Minecraft.GameLoadCookie gameLoadCookie) private voidonResourceLoadFinished(Minecraft.GameLoadCookie gameLoadCookie) private voidopenChatScreen(String defaultText) voidpauseGame(boolean pauseOnly) Displays the ingame menuprivate voidvoidprivate CompletableFuture<Void> reloadResourcePacks(boolean error, Minecraft.GameLoadCookie gameLoadCookie) private voidrenderFpsMeter(GuiGraphics guiGraphics, ProfileResults profileResults) static booleanvoidprivate voidrollbackResourcePacks(Throwable throwable, Minecraft.GameLoadCookie gameLoadCookie) voidrun()private voidrunTick(boolean renderLevel) private voidselfTest()voidsetCameraEntity(Entity viewingEntity) voidsetLastInputType(InputType lastInputType) voidsetLevel(ClientLevel level, ReceivingLevelScreen.Reason reason) voidsetOverlay(Overlay loadingGui) voidvoidsetWindowActive(boolean focused) booleanshouldEntityAppearGlowing(Entity entity) protected booleanbooleanprivate booleanprivate voidvoidstop()booleanvoidtick()(package private) voidprivate voidupdateLevelInEngines(ClientLevel level) voidupdateMaxMipLevel(int mipMapLevel) voidupdateReportEnvironment(ReportEnvironment reportEnvironment) private voidupdateScreenAndTick(Screen screen) voidstatic booleanstatic booleanprivate com.mojang.authlib.minecraft.UserApiService.UserPropertiesstatic booleanprotected RunnablewrapRunnable(Runnable runnable) Methods inherited from class net.minecraft.util.thread.ReentrantBlockableEventLoop
doRunTask, runningTask, scheduleExecutablesMethods inherited from class net.minecraft.util.thread.BlockableEventLoop
dropAllTasks, execute, executeBlocking, executeIfPossible, getPendingTasksCount, isSameThread, managedBlock, name, pollTask, profiledMetrics, runAllTasks, submit, submit, submitAsync, tell, waitForTasksMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.neoforged.neoforge.client.extensions.IMinecraftExtension
getLocale, popGuiLayer, pushGuiLayerMethods inherited from interface net.minecraft.util.thread.ProcessorHandle
ask, askEither
-
Field Details
-
instance
-
LOGGER
private static final org.slf4j.Logger LOGGER -
ON_OSX
public static final boolean ON_OSX -
MAX_TICKS_PER_UPDATE
private static final int MAX_TICKS_PER_UPDATE- See Also:
-
DEFAULT_FONT
-
UNIFORM_FONT
-
ALT_FONT
-
REGIONAL_COMPLIANCIES
-
RESOURCE_RELOAD_INITIAL_TASK
-
SOCIAL_INTERACTIONS_NOT_AVAILABLE
-
UPDATE_DRIVERS_ADVICE
- See Also:
-
canary
private final long canary -
resourcePackDirectory
-
profileFuture
-
textureManager
-
fixerUpper
private final com.mojang.datafixers.DataFixer fixerUpper -
virtualScreen
-
window
-
timer
-
renderBuffers
-
levelRenderer
-
entityRenderDispatcher
-
itemRenderer
-
particleEngine
-
user
-
font
-
fontFilterFishy
-
gameRenderer
-
debugRenderer
-
progressListener
-
gui
-
options
-
hotbarManager
-
mouseHandler
-
keyboardHandler
-
lastInputType
-
gameDirectory
-
launchedVersion
-
versionType
-
proxy
-
levelSource
-
demo
private final boolean demo -
allowsMultiplayer
private final boolean allowsMultiplayer -
allowsChat
private final boolean allowsChat -
resourceManager
-
vanillaPackResources
-
downloadedPackSource
-
resourcePackRepository
-
languageManager
-
blockColors
-
itemColors
-
mainRenderTarget
-
soundManager
-
musicManager
-
fontManager
-
splashManager
-
gpuWarnlistManager
-
regionalCompliancies
-
authenticationService
private final com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService authenticationService -
minecraftSessionService
private final com.mojang.authlib.minecraft.MinecraftSessionService minecraftSessionService -
userApiService
private final com.mojang.authlib.minecraft.UserApiService userApiService -
userPropertiesFuture
private final CompletableFuture<com.mojang.authlib.minecraft.UserApiService.UserProperties> userPropertiesFuture -
skinManager
-
modelManager
-
blockRenderer
The BlockRenderDispatcher instance that will be used based off gamesettings -
paintingTextures
-
mobEffectTextures
-
mapDecorationTextures
-
guiSprites
-
toast
-
tutorial
-
playerSocialManager
-
entityModels
-
blockEntityRenderDispatcher
-
telemetryManager
-
profileKeyPairManager
-
realmsDataFetcher
-
quickPlayLog
-
gameMode
-
level
-
player
-
singleplayerServer
-
pendingConnection
-
isLocalServer
private boolean isLocalServer -
cameraEntity
-
crosshairPickEntity
-
hitResult
-
rightClickDelay
private int rightClickDelay -
missTime
protected int missTime -
pause
private volatile boolean pause -
lastNanoTime
private long lastNanoTimeTime in nanoseconds of when the class is loaded -
lastTime
private long lastTime -
frames
private int frames -
noRender
public boolean noRender -
screen
-
overlay
-
clientLevelTeardownInProgress
private boolean clientLevelTeardownInProgress -
gameThread
-
running
private volatile boolean running -
delayedCrash
-
fps
private static int fps -
fpsString
-
frameTimeNs
private long frameTimeNs -
wireframe
public boolean wireframe -
sectionPath
public boolean sectionPath -
sectionVisibility
public boolean sectionVisibility -
smartCull
public boolean smartCull -
windowActive
private boolean windowActive -
progressTasks
-
pendingReload
-
profiler
-
fpsPieRenderTicks
private int fpsPieRenderTicks -
fpsPieProfiler
-
fpsPieResults
-
metricsRecorder
-
reloadStateTracker
-
savedCpuDuration
private long savedCpuDuration -
gpuUtilization
private double gpuUtilization -
currentFrameProfile
-
narrator
-
chatListener
-
reportingContext
-
commandHistory
-
directoryValidator
-
gameLoadFinished
private boolean gameLoadFinished -
clientStartTimeMs
private final long clientStartTimeMs -
clientTickCount
private long clientTickCount -
debugPath
-
-
Constructor Details
-
Minecraft
-
-
Method Details
-
onResourceLoadFinished
-
onGameLoadFinished
-
isGameLoadFinished
public boolean isGameLoadFinished() -
buildInitialScreens
-
addInitialScreens
-
countryEqualsISO3
-
updateTitle
public void updateTitle() -
createTitle
-
createUserApiService
private com.mojang.authlib.minecraft.UserApiService createUserApiService(com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService authenticationService, GameConfig gameConfig) -
checkModStatus
-
rollbackResourcePacks
private void rollbackResourcePacks(Throwable throwable, @Nullable Minecraft.GameLoadCookie gameLoadCookie) -
clearResourcePacksOnError
public void clearResourcePacksOnError(Throwable throwable, @Nullable Component errorMessage, @Nullable Minecraft.GameLoadCookie gameLoadCookie) -
abortResourcePackRecovery
private void abortResourcePackRecovery() -
addResourcePackLoadFailToast
-
run
public void run() -
updateFontOptions
void updateFontOptions() -
onFullscreenError
private void onFullscreenError(int error, long description) -
getMainRenderTarget
-
getLaunchedVersion
-
getVersionType
-
delayCrash
-
delayCrashRaw
-
handleDelayedCrash
private void handleDelayedCrash() -
emergencySaveAndCrash
-
crash
public static void crash(@Nullable Minecraft minecraft, File gameDirectory, CrashReport crashReport) -
isEnforceUnicode
public boolean isEnforceUnicode() -
reloadResourcePacks
-
reloadResourcePacks
private CompletableFuture<Void> reloadResourcePacks(boolean error, @Nullable Minecraft.GameLoadCookie gameLoadCookie) -
selfTest
private void selfTest() -
getLevelSource
-
openChatScreen
-
setScreen
-
setOverlay
-
destroy
public void destroy() -
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceProcessorHandle<Runnable>
-
runTick
private void runTick(boolean renderLevel) -
constructProfiler
private ProfilerFiller constructProfiler(boolean renderFpsPie, @Nullable SingleTickProfiler singleTickProfiler) -
finishProfilers
-
resizeDisplay
public void resizeDisplay()- Specified by:
resizeDisplayin interfaceWindowEventHandler
-
cursorEntered
public void cursorEntered()- Specified by:
cursorEnteredin interfaceWindowEventHandler
-
getFps
public int getFps() -
getFrameTimeNs
public long getFrameTimeNs() -
getFramerateLimit
private int getFramerateLimit() -
emergencySave
private void emergencySave() -
debugClientMetricsStart
-
debugClientMetricsStop
private void debugClientMetricsStop() -
debugClientMetricsCancel
private void debugClientMetricsCancel() -
archiveProfilingReport
-
debugFpsMeterKeyPress
public void debugFpsMeterKeyPress(int keyCount) Update debugProfilerName in response to number keys in debug screen -
renderFpsMeter
-
stop
public void stop() -
isRunning
public boolean isRunning() -
pauseGame
public void pauseGame(boolean pauseOnly) Displays the ingame menu -
continueAttack
private void continueAttack(boolean leftClick) -
startAttack
private boolean startAttack() -
startUseItem
private void startUseItem() -
getMusicManager
-
tick
public void tick() -
isLevelRunningNormally
private boolean isLevelRunningNormally() -
isMultiplayerServer
private boolean isMultiplayerServer() -
handleKeybinds
private void handleKeybinds() -
getTelemetryManager
-
getGpuUtilization
public double getGpuUtilization() -
getProfileKeyPairManager
-
createWorldOpenFlows
-
doWorldLoad
public void doWorldLoad(LevelStorageSource.LevelStorageAccess levelStorage, PackRepository packRepository, WorldStem worldStem, boolean newWorld) -
setLevel
-
disconnect
public void disconnect() -
disconnect
-
disconnect
-
clearDownloadedResourcePacks
public void clearDownloadedResourcePacks() -
clearClientLevel
-
updateScreenAndTick
-
forceSetScreen
-
updateLevelInEngines
-
userProperties
private com.mojang.authlib.minecraft.UserApiService.UserProperties userProperties() -
telemetryOptInExtra
public boolean telemetryOptInExtra() -
extraTelemetryAvailable
public boolean extraTelemetryAvailable() -
allowsTelemetry
public boolean allowsTelemetry() -
allowsMultiplayer
public boolean allowsMultiplayer() -
allowsRealms
public boolean allowsRealms() -
multiplayerBan
@Nullable public com.mojang.authlib.minecraft.BanDetails multiplayerBan() -
isNameBanned
public boolean isNameBanned() -
isBlocked
-
getChatStatus
-
isDemo
public final boolean isDemo() -
getConnection
-
renderNames
public static boolean renderNames() -
useFancyGraphics
public static boolean useFancyGraphics() -
useShaderTransparency
public static boolean useShaderTransparency() -
useAmbientOcclusion
public static boolean useAmbientOcclusion() -
pickBlock
private void pickBlock() -
addCustomNbtData
private void addCustomNbtData(ItemStack stack, BlockEntity blockEntity, RegistryAccess registryAccess) -
fillReport
Adds core server Info (GL version, Texture pack, isModded, type), and the worldInfo to the crash report. -
fillReport
public static void fillReport(@Nullable Minecraft minecraft, @Nullable LanguageManager languageManager, String launchVersion, @Nullable Options options, CrashReport report) -
formatSeconds
-
fillUptime
-
fillSystemReport
private static SystemReport fillSystemReport(SystemReport report, @Nullable Minecraft minecraft, @Nullable LanguageManager languageManager, String launchVersion, @Nullable Options options) -
getInstance
-
delayTextureReload
-
updateReportEnvironment
-
getCurrentServer
-
isLocalServer
public boolean isLocalServer() -
hasSingleplayerServer
public boolean hasSingleplayerServer() -
getSingleplayerServer
-
isSingleplayer
public boolean isSingleplayer() -
isLocalPlayer
-
getUser
-
getGameProfile
public com.mojang.authlib.GameProfile getGameProfile() -
getProxy
-
getTextureManager
-
getResourceManager
-
getResourcePackRepository
-
getVanillaPackResources
-
getDownloadedPackSource
-
getResourcePackDirectory
-
getLanguageManager
-
getTextureAtlas
-
isPaused
public boolean isPaused() -
getGpuWarnlistManager
-
getSoundManager
-
getSituationalMusic
-
getMinecraftSessionService
public com.mojang.authlib.minecraft.MinecraftSessionService getMinecraftSessionService() -
getSkinManager
-
getCameraEntity
-
setCameraEntity
-
shouldEntityAppearGlowing
-
getRunningThread
- Specified by:
getRunningThreadin classBlockableEventLoop<Runnable>
-
wrapRunnable
- Specified by:
wrapRunnablein classBlockableEventLoop<Runnable>
-
shouldRun
- Specified by:
shouldRunin classBlockableEventLoop<Runnable>
-
getBlockRenderer
-
getEntityRenderDispatcher
-
getBlockEntityRenderDispatcher
-
getItemRenderer
-
getFixerUpper
public com.mojang.datafixers.DataFixer getFixerUpper() -
getTimer
-
getBlockColors
-
showOnlyReducedInfo
public boolean showOnlyReducedInfo() -
getToasts
-
getTutorial
-
isWindowActive
public boolean isWindowActive() -
getHotbarManager
-
getModelManager
-
getPaintingTextures
-
getMobEffectTextures
-
getMapDecorationTextures
-
getGuiSprites
-
setWindowActive
public void setWindowActive(boolean focused) - Specified by:
setWindowActivein interfaceWindowEventHandler
-
grabPanoramixScreenshot
-
grabHugeScreenshot
-
getProfiler
-
getProgressListener
-
getSplashManager
-
getOverlay
-
getPlayerSocialManager
-
getWindow
-
getDebugOverlay
-
renderBuffers
-
updateMaxMipLevel
public void updateMaxMipLevel(int mipMapLevel) -
getItemColors
-
getEntityModels
-
isTextFilteringEnabled
public boolean isTextFilteringEnabled() -
prepareForMultiplayer
public void prepareForMultiplayer() -
getProfileKeySignatureValidator
-
canValidateProfileKeys
public boolean canValidateProfileKeys() -
getLastInputType
-
setLastInputType
-
getNarrator
-
getChatListener
-
getReportingContext
-
realmsDataFetcher
-
quickPlayLog
-
commandHistory
-
directoryValidator
-
getTickTargetMillis
private float getTickTargetMillis(float defaultValue) -
getLauncherBrand
-
socialInteractionsToast