Class Minecraft
- All Implemented Interfaces:
WindowEventHandler, AutoCloseable, Executor, ProfilerMeasured, TaskScheduler<Runnable>, IMinecraftExtension
public class Minecraft
extends ReentrantBlockableEventLoop<Runnable>
implements WindowEventHandler, IMinecraftExtension
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final booleanprivate final booleanprivate final AtlasManagerprivate @Nullable BackendCreationExceptionprivate final BlockColorsprivate final BlockEntityRenderDispatcherprivate final BlockModelResolverprivate final longprivate final longprivate longfinal DebugScreenEntryListstatic final Identifierprivate final DeltaTracker.Timerprivate final booleanprivate final DirectoryValidatorprivate final DownloadedPackSourceprivate List<SimpleGizmoCollector.GizmoInstance> private final EntityRenderDispatcherprivate final com.mojang.datafixers.DataFixerfinal Fontfinal Fontprivate final FontManagerprivate static intprivate final ContinuousProfilerprivate intprivate final FramerateLimitTrackerprivate intprivate longfinal Fileprivate booleanfinal GameRendererprivate Threadprivate doubleprivate final GpuWarnlistManagerfinal Guiprivate final HotbarManagerprivate static Minecraftprivate booleanprivate final ItemModelResolverfinal KeyboardHandlerprivate final LanguageManagerprivate longprivate InputTypeprivate longprivate longprivate final Stringfinal LevelExtractorfinal LevelRendererprivate final LevelStorageSourceprivate static final org.slf4j.Loggerprivate final MapRendererprivate final MapTextureManagerprivate static final intprivate MetricsRecorderprotected intprivate final ModelManagerprivate final MonitorManagerfinal MouseHandlerprivate final MusicManagerprivate final GameNarratorprivate final booleanfinal Optionsprivate final PacketProcessorfinal ParticleEngineprivate booleanprivate @Nullable Connectionprivate @Nullable CompletableFuture<Void> private final SimpleGizmoCollectorprivate final PlayerSkinRenderCacheprivate final PlayerSocialManagerprivate final CompletableFuture<@Nullable com.mojang.authlib.yggdrasil.ProfileResult> private final ProfileKeyPairManagerprivate final Proxyprivate final QuickPlayLogprivate final RealmsDataFetcherprivate static final Identifierprivate final PeriodicNotificationManagerprivate final ResourceLoadStateTrackerprivate final RemoteFriendListUpdateHandlerprivate ReportingContextprivate static final CompletableFuture<Unit> private final ReloadableResourceManagerprivate final Pathprivate final PackRepositoryprivate intprivate booleanprivate longprivate final Servicesprivate final ShaderManagerprivate @Nullable IntegratedServerprivate final SkinManagerbooleanprivate final SoundManagerprivate booleanprivate final ClientTelemetryManagerprivate final TextInputManagerprivate final TextureManagerprivate final TimerQueryprivate final @Nullable TracyFrameCaptureprivate final Tutorialstatic final Stringprivate final Userprivate final com.mojang.authlib.minecraft.UserApiServiceprivate final CompletableFuture<com.mojang.authlib.minecraft.UserApiService.UserProperties> private final VanillaPackResourcesprivate final Windowprivate final GpuSurfaceprivate booleanbooleanFields inherited from class BlockableEventLoop
BLOCK_TIME_NANOS -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidprivate voidbooleanbooleanbooleanbooleanbooleanprivate PatharchiveProfilingReport(SystemReport systemReport, List<Path> profilingResultPaths) booleanfinal booleanstatic ModCheckvoidclearClientLevel(Screen screen) voidvoidclearResourcePacksOnError(Throwable t, @Nullable Component message, @Nullable GameLoadCookie loadCookie) voidclose()private ProfilerFillerconstructProfiler(boolean shouldCollectFrameProfile, @Nullable SingleTickProfiler tickProfiler) private voidcontinueAttack(boolean down) private static booleancountryEqualsISO3(Object iso3Locale) static voidcrash(@Nullable Minecraft minecraft, File gameDirectory, CrashReport crash, int exitCode) private Stringprivate static com.mojang.authlib.minecraft.UserApiServicecreateUserApiService(com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService authService, GameConfig config) voidprivate voidbooleandebugClientMetricsStart(Consumer<Component> debugFeedback) private voidvoiddelayCrash(CrashReport crash) voiddisconnect(Screen screen, boolean keepResourcePacks) voiddisconnect(Screen screen, boolean keepResourcePacks, boolean stopSound) voiddisconnectFromWorld(Component message) voidvoiddisconnectWithProgressScreen(boolean stopSound) voidvoiddoWorldLoad(LevelStorageSource.LevelStorageAccess levelSourceAccess, PackRepository packRepository, WorldStem worldStem, Optional<GameRules> gameRules, boolean newWorld) private voidvoidemergencySaveAndCrash(CrashReport partialReport) voidbooleanstatic voidfillReport(@Nullable Minecraft minecraft, @Nullable LanguageManager languageManager, @Nullable String launchedVersion, @Nullable Options options, CrashReport report) fillReport(CrashReport report) private static SystemReportfillSystemReport(SystemReport systemReport, @Nullable Minecraft minecraft, @Nullable LanguageManager languageManager, @Nullable String launchedVersion, @Nullable Options options) private voidfillUptime(CrashReportCategory category) private voidfinishProfilers(boolean shouldCollectFrameProfile, @Nullable SingleTickProfiler tickProfiler) private static StringformatSeconds(double timeInSeconds) voidbooleancom.mojang.datafixers.DataFixerintgetFps()longcom.mojang.authlib.GameProfiledoublestatic Minecraftfloat@Nullable com.mojang.authlib.yggdrasil.ProfileResultgetProxy()private floatgetTickTargetMillis(float defaultTickTargetMillis) getUser()grabPanoramixScreenshot(File folder) booleanhandleGlobalKeyPress(InputConstants.Key key, boolean controlDown) private voidbooleanbooleanbooleanbooleanvoidbooleanfinal booleanisDemo()booleanbooleanisFriendOnlyRestricted(UUID uuid) booleanprivate booleanprivate booleanisLocalOrUnknownPlayer(UUID uuid) booleanisLocalPlayer(UUID profileId) booleanbooleanbooleanbooleanbooleanisPaused()booleanbooleanbooleanprivate void@Nullable com.mojang.authlib.minecraft.BanDetailsprivate voidonFullscreenError(int error, long description) private voidprivate voidonResourceLoadFinished(@Nullable GameLoadCookie loadCookie) voidonTextInputFocusChange(GuiEventListener element, boolean isFocused) voidpauseGame(boolean suppressPauseMenuIfWeReallyArePausing) private voidprivate voidpick(float partialTicks) private voidvoidprivate CompletableFuture<Void> reloadResourcePacks(boolean isRecovery, @Nullable GameLoadCookie loadCookie) voidrenderFrame(boolean advanceGameTime) voidprivate voidrollbackResourcePacks(Throwable t, @Nullable GameLoadCookie loadCookie) voidrun()private voidrunTick(boolean advanceGameTime) static voidsaveReport(File gameDirectory, CrashReport crash) static intsaveReport(File gameDirectory, CrashReport crash, int reportExitCode) static intsaveReportAndShutdownSoundManager(@Nullable Minecraft minecraft, File gameDirectory, CrashReport crash, int exitCode) private voidselfTest()voidservices()voidsetCameraEntity(@Nullable Entity cameraEntity) voidsetLastInputType(InputType lastInputType) voidsetLevel(ClientLevel level) voidsetScreenAndShow(Screen screen) booleanshouldEntityAppearGlowing(Entity entity) protected booleanvoidshowDebugChat(Component message) booleanprivate booleanprivate voidvoidstop()booleanvoidtick()private booleanprivate voidvoidtriggerResourcePackRecovery(Exception exception) (package private) voidprivate voidprivate voidupdateLevelInEngines(@Nullable ClientLevel level, boolean stopSound) voidupdateMaxMipLevel(int mipmapLevels) voidupdateReportEnvironment(ReportEnvironment environment) voidprivate com.mojang.authlib.minecraft.UserApiService.UserPropertieswrapRunnable(Runnable runnable) Methods inherited from class ReentrantBlockableEventLoop
doRunTask, runningTask, scheduleExecutablesMethods inherited from class BlockableEventLoop
dropAllTasks, execute, executeBlocking, executeIfPossible, getPendingTasksCount, isNonRecoverable, isSameThread, managedBlock, name, pollTask, profiledMetrics, relayDelayCrash, runAllTasks, schedule, shouldRunAllTasks, submit, submit, submitAsync, waitForTasksMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface IMinecraftExtension
getLocaleMethods inherited from interface TaskScheduler
scheduleWithResult
-
Field Details
-
instance
-
LOGGER
private static final org.slf4j.Logger LOGGER -
MAX_TICKS_PER_UPDATE
private static final int MAX_TICKS_PER_UPDATE- See Also:
-
DEFAULT_FONT
-
REGIONAL_COMPLIANCIES
-
RESOURCE_RELOAD_INITIAL_TASK
-
UPDATE_DRIVERS_ADVICE
- See Also:
-
canary
private final long canary -
resourcePackDirectory
-
profileFuture
-
textureManager
-
shaderManager
-
fixerUpper
private final com.mojang.datafixers.DataFixer fixerUpper -
monitorManager
-
window
-
windowSurface
-
textInputManager
-
deltaTracker
-
levelExtractor
-
levelRenderer
-
entityRenderDispatcher
-
blockModelResolver
-
itemModelResolver
-
mapRenderer
-
particleEngine
-
user
-
font
-
fontFilterFishy
-
gameRenderer
-
gui
-
options
-
debugEntries
-
hotbarManager
-
mouseHandler
-
keyboardHandler
-
lastInputType
-
gameDirectory
-
launchedVersion
-
proxy
-
offlineDeveloperMode
private final boolean offlineDeveloperMode -
levelSource
-
demo
private final boolean demo -
allowsMultiplayer
private final boolean allowsMultiplayer -
allowsChat
private final boolean allowsChat -
resourceManager
-
vanillaPackResources
-
downloadedPackSource
-
resourcePackRepository
-
languageManager
-
blockColors
-
tracyFrameCapture
-
soundManager
-
musicManager
-
fontManager
-
gpuWarnlistManager
-
regionalCompliancies
-
userApiService
private final com.mojang.authlib.minecraft.UserApiService userApiService -
userPropertiesFuture
private final CompletableFuture<com.mojang.authlib.minecraft.UserApiService.UserProperties> userPropertiesFuture -
skinManager
-
atlasManager
-
modelManager
-
mapTextureManager
-
tutorial
-
playerSocialManager
-
remoteFriendListUpdateHandler
-
blockEntityRenderDispatcher
-
telemetryManager
-
profileKeyPairManager
-
realmsDataFetcher
-
quickPlayLog
-
services
-
playerSkinRenderCache
-
timerQuery
-
gameMode
-
level
-
player
-
singleplayerServer
-
pendingConnection
-
isLocalServer
private boolean isLocalServer -
crosshairPickEntity
-
hitResult
-
rightClickDelay
private int rightClickDelay -
missTime
protected int missTime -
pause
private volatile boolean pause -
lastNanoTime
private long lastNanoTime -
lastTime
private long lastTime -
frames
private int frames -
gameThread
-
running
private volatile boolean running -
fps
private static int fps -
frameTimeNs
private long frameTimeNs -
framerateLimitTracker
-
wireframe
public boolean wireframe -
smartCull
public boolean smartCull -
lastActiveTime
private long lastActiveTime -
pendingReload
-
fpsPieRenderTicks
private int fpsPieRenderTicks -
fpsPieProfiler
-
metricsRecorder
-
reloadStateTracker
-
savedCpuDuration
private long savedCpuDuration -
gpuUtilization
private double gpuUtilization -
narrator
-
reportingContext
-
directoryValidator
-
gameLoadFinished
private boolean gameLoadFinished -
clientStartTimeMs
private final long clientStartTimeMs -
clientTickCount
private long clientTickCount -
packetProcessor
-
perTickGizmos
-
drainedLatestTickGizmos
-
windowSurfaceNeedsReconfiguring
private boolean windowSurfaceNeedsReconfiguring -
surfaceIsInvalid
private boolean surfaceIsInvalid -
backendCreationException
-
-
Constructor Details
-
Minecraft
-
-
Method Details
-
hasShiftDown
public boolean hasShiftDown() -
hasControlDown
public boolean hasControlDown() -
hasAltDown
public boolean hasAltDown() -
onResourceLoadFinished
-
onGameLoadFinished
-
isGameLoadFinished
public boolean isGameLoadFinished() -
countryEqualsISO3
-
updateTitle
public void updateTitle() -
createTitle
-
createUserApiService
private static com.mojang.authlib.minecraft.UserApiService createUserApiService(com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService authService, GameConfig config) -
isOfflineDeveloperMode
public boolean isOfflineDeveloperMode() -
checkModStatus
-
loadCriticalShaders
private void loadCriticalShaders() -
rollbackResourcePacks
-
clearResourcePacksOnError
public void clearResourcePacksOnError(Throwable t, @Nullable Component message, @Nullable GameLoadCookie loadCookie) -
abortResourcePackRecovery
private void abortResourcePackRecovery() -
addResourcePackLoadFailToast
-
triggerResourcePackRecovery
-
run
public void run() -
updateFontOptions
void updateFontOptions() -
onFullscreenError
private void onFullscreenError(int error, long description) -
getLaunchedVersion
-
delayCrash
- Overrides:
delayCrashin classBlockableEventLoop<Runnable>
-
emergencySaveAndCrash
-
saveReport
-
saveReport
-
crash
public static void crash(@Nullable Minecraft minecraft, File gameDirectory, CrashReport crash, int exitCode) -
saveReportAndShutdownSoundManager
public static int saveReportAndShutdownSoundManager(@Nullable Minecraft minecraft, File gameDirectory, CrashReport crash, int exitCode) -
isEnforceUnicode
public boolean isEnforceUnicode() -
reloadResourcePacks
-
reloadResourcePacks
private CompletableFuture<Void> reloadResourcePacks(boolean isRecovery, @Nullable GameLoadCookie loadCookie) -
selfTest
private void selfTest() -
getLevelSource
-
exitWorldAndClose
public void exitWorldAndClose() -
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceTaskScheduler<Runnable>
-
runTick
private void runTick(boolean advanceGameTime) -
renderFrame
public void renderFrame(boolean advanceGameTime) -
pauseIfInactive
private void pauseIfInactive() -
constructProfiler
private ProfilerFiller constructProfiler(boolean shouldCollectFrameProfile, @Nullable SingleTickProfiler tickProfiler) -
finishProfilers
private void finishProfilers(boolean shouldCollectFrameProfile, @Nullable SingleTickProfiler tickProfiler) -
framebufferSizeChanged
public void framebufferSizeChanged()- Specified by:
framebufferSizeChangedin interfaceWindowEventHandler
-
resizeGui
public void resizeGui()- Specified by:
resizeGuiin interfaceWindowEventHandler
-
cursorEntered
public void cursorEntered()- Specified by:
cursorEnteredin interfaceWindowEventHandler
-
getFps
public int getFps() -
getFrameTimeNs
public long getFrameTimeNs() -
sendLowDiskSpaceWarning
public void sendLowDiskSpaceWarning() -
emergencySave
private void emergencySave() -
debugClientMetricsStart
-
debugClientMetricsStop
private void debugClientMetricsStop() -
debugClientMetricsCancel
private void debugClientMetricsCancel() -
archiveProfilingReport
-
stop
public void stop() -
isRunning
public boolean isRunning() -
pauseGame
public void pauseGame(boolean suppressPauseMenuIfWeReallyArePausing) -
continueAttack
private void continueAttack(boolean down) -
startAttack
private boolean startAttack() -
startUseItem
private void startUseItem() -
getMusicManager
-
tick
public void tick() -
isLevelRunningNormally
private boolean isLevelRunningNormally() -
isMultiplayerServer
public boolean isMultiplayerServer() -
handleKeybinds
private void handleKeybinds() -
getQuickActionsDialog
-
getTelemetryManager
-
getMetricsRecorder
-
getGpuUtilization
public double getGpuUtilization() -
getProfileKeyPairManager
-
createWorldOpenFlows
-
doWorldLoad
public void doWorldLoad(LevelStorageSource.LevelStorageAccess levelSourceAccess, PackRepository packRepository, WorldStem worldStem, Optional<GameRules> gameRules, boolean newWorld) -
setLevel
-
disconnectFromWorld
-
disconnectWithSavingScreen
public void disconnectWithSavingScreen() -
disconnectWithProgressScreen
public void disconnectWithProgressScreen() -
disconnectWithProgressScreen
public void disconnectWithProgressScreen(boolean stopSound) -
disconnect
-
disconnect
-
clearDownloadedResourcePacks
public void clearDownloadedResourcePacks() -
clearClientLevel
-
setScreenAndShow
-
updateLevelInEngines
-
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() -
friendsEnabled
public boolean friendsEnabled() -
handleGlobalKeyPress
-
toggleFullscreen
private void toggleFullscreen() -
toggleFriendsScreen
private boolean toggleFriendsScreen() -
allowFriendRequests
public boolean allowFriendRequests() -
allowChatOnlyWithFriend
public boolean allowChatOnlyWithFriend() -
multiplayerBan
-
isNameBanned
public boolean isNameBanned() -
isBlocked
-
isFriendOnlyRestricted
-
isLocalOrUnknownPlayer
-
computeChatAbilities
-
isDemo
public final boolean isDemo() -
canSwitchGameMode
public final boolean canSwitchGameMode() -
getConnection
-
pickBlockOrEntity
private void pickBlockOrEntity() -
fillReport
-
fillReport
public static void fillReport(@Nullable Minecraft minecraft, @Nullable LanguageManager languageManager, @Nullable String launchedVersion, @Nullable Options options, CrashReport report) -
formatSeconds
-
fillUptime
-
fillSystemReport
private static SystemReport fillSystemReport(SystemReport systemReport, @Nullable Minecraft minecraft, @Nullable LanguageManager languageManager, @Nullable String launchedVersion, @Nullable Options options) -
getInstance
-
delayTextureReload
-
updateReportEnvironment
-
getCurrentServer
-
isLocalServer
public boolean isLocalServer() -
hasSingleplayerServer
public boolean hasSingleplayerServer() -
getSingleplayerServer
-
isLocalPlayer
-
getUser
-
getProfileResult
-
getGameProfile
public com.mojang.authlib.GameProfile getGameProfile() -
getProxy
-
getTextureManager
-
getShaderManager
-
getResourceManager
-
getResourcePackRepository
-
getVanillaPackResources
-
getDownloadedPackSource
-
getResourcePackDirectory
-
getLanguageManager
-
isPaused
public boolean isPaused() -
getGpuWarnlistManager
-
getSoundManager
-
getSituationalMusic
-
getMusicVolume
public float getMusicVolume() -
services
-
getSkinManager
-
getCameraEntity
-
setCameraEntity
-
shouldEntityAppearGlowing
-
getRunningThread
- Specified by:
getRunningThreadin classBlockableEventLoop<Runnable>
-
wrapRunnable
- Specified by:
wrapRunnablein interfaceTaskScheduler<Runnable>
-
shouldRun
- Specified by:
shouldRunin classBlockableEventLoop<Runnable>
-
getEntityRenderDispatcher
-
getBlockEntityRenderDispatcher
-
getMapRenderer
-
getFixerUpper
public com.mojang.datafixers.DataFixer getFixerUpper() -
getDeltaTracker
-
getBlockColors
-
showOnlyReducedInfo
public boolean showOnlyReducedInfo() -
getTutorial
-
isWindowActive
public boolean isWindowActive() -
getHotbarManager
-
getModelManager
-
getAtlasManager
-
getMapTextureManager
-
grabPanoramixScreenshot
-
getPlayerSocialManager
-
getWindow
-
textInputManager
-
onTextInputFocusChange
-
windowSurface
-
getFramerateLimitTracker
-
getDebugOverlay
-
updateMaxMipLevel
public void updateMaxMipLevel(int mipmapLevels) -
getEntityModels
-
isTextFilteringEnabled
public boolean isTextFilteringEnabled() -
prepareForMultiplayer
public void prepareForMultiplayer() -
getLastInputType
-
setLastInputType
-
getNarrator
-
getReportingContext
-
realmsDataFetcher
-
quickPlayLog
-
directoryValidator
-
playerSkinRenderCache
-
getTickTargetMillis
private float getTickTargetMillis(float defaultTickTargetMillis) -
getBlockModelResolver
-
getItemModelResolver
-
canInterruptScreen
public boolean canInterruptScreen() -
invalidateSurfaceConfiguration
public void invalidateSurfaceConfiguration() -
getLauncherBrand
-
packetProcessor
-
collectPerTickGizmos
-
getPerTickGizmos
-
pick
private void pick(float partialTicks) -
showDebugChat
-