Class Minecraft

All Implemented Interfaces:
WindowEventHandler, AutoCloseable, Executor, ProfilerMeasured, ProcessorHandle<Runnable>, IForgeMinecraft

public class Minecraft extends ReentrantBlockableEventLoop<Runnable> implements WindowEventHandler, IForgeMinecraft
  • Field Details

    • instance

      static Minecraft 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

      public static final ResourceLocation DEFAULT_FONT
    • UNIFORM_FONT

      public static final ResourceLocation UNIFORM_FONT
    • ALT_FONT

      public static final ResourceLocation ALT_FONT
    • REGIONAL_COMPLIANCIES

      private static final ResourceLocation REGIONAL_COMPLIANCIES
    • RESOURCE_RELOAD_INITIAL_TASK

      private static final CompletableFuture<Unit> RESOURCE_RELOAD_INITIAL_TASK
    • SOCIAL_INTERACTIONS_NOT_AVAILABLE

      private static final Component SOCIAL_INTERACTIONS_NOT_AVAILABLE
    • UPDATE_DRIVERS_ADVICE

      public static final String UPDATE_DRIVERS_ADVICE
      See Also:
    • canary

      private final long canary
    • resourcePackDirectory

      private final Path resourcePackDirectory
    • profileFuture

      private final CompletableFuture<com.mojang.authlib.yggdrasil.ProfileResult> profileFuture
    • textureManager

      public final TextureManager textureManager
    • fixerUpper

      private final com.mojang.datafixers.DataFixer fixerUpper
    • virtualScreen

      private final VirtualScreen virtualScreen
    • window

      private final Window window
    • timer

      private final Timer timer
    • renderBuffers

      private final RenderBuffers renderBuffers
    • levelRenderer

      public final LevelRenderer levelRenderer
    • entityRenderDispatcher

      private final EntityRenderDispatcher entityRenderDispatcher
    • itemRenderer

      private final ItemRenderer itemRenderer
    • particleEngine

      public final ParticleEngine particleEngine
    • searchRegistry

      private final SearchRegistry searchRegistry
    • user

      private final User user
    • font

      public final Font font
    • fontFilterFishy

      public final Font fontFilterFishy
    • gameRenderer

      public final GameRenderer gameRenderer
    • debugRenderer

      public final DebugRenderer debugRenderer
    • progressListener

      private final AtomicReference<StoringChunkProgressListener> progressListener
    • gui

      public final Gui gui
    • options

      public final Options options
    • hotbarManager

      private final HotbarManager hotbarManager
    • mouseHandler

      public final MouseHandler mouseHandler
    • keyboardHandler

      public final KeyboardHandler keyboardHandler
    • lastInputType

      private InputType lastInputType
    • gameDirectory

      public final File gameDirectory
    • launchedVersion

      private final String launchedVersion
    • versionType

      private final String versionType
    • proxy

      private final Proxy proxy
    • levelSource

      private final LevelStorageSource levelSource
    • is64bit

      private final boolean is64bit
    • demo

      private final boolean demo
    • allowsMultiplayer

      private final boolean allowsMultiplayer
    • allowsChat

      private final boolean allowsChat
    • resourceManager

      private final ReloadableResourceManager resourceManager
    • vanillaPackResources

      private final VanillaPackResources vanillaPackResources
    • downloadedPackSource

      private final DownloadedPackSource downloadedPackSource
    • resourcePackRepository

      private final PackRepository resourcePackRepository
    • languageManager

      private final LanguageManager languageManager
    • blockColors

      private final BlockColors blockColors
    • itemColors

      private final ItemColors itemColors
    • mainRenderTarget

      private final RenderTarget mainRenderTarget
    • soundManager

      private final SoundManager soundManager
    • musicManager

      private final MusicManager musicManager
    • fontManager

      private final FontManager fontManager
    • splashManager

      private final SplashManager splashManager
    • gpuWarnlistManager

      private final GpuWarnlistManager gpuWarnlistManager
    • regionalCompliancies

      private final PeriodicNotificationManager 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

      private final SkinManager skinManager
    • modelManager

      private final ModelManager modelManager
    • blockRenderer

      private final BlockRenderDispatcher blockRenderer
    • paintingTextures

      private final PaintingTextureManager paintingTextures
    • mobEffectTextures

      private final MobEffectTextureManager mobEffectTextures
    • guiSprites

      private final GuiSpriteManager guiSprites
    • toast

      private final ToastComponent toast
    • tutorial

      private final Tutorial tutorial
    • playerSocialManager

      private final PlayerSocialManager playerSocialManager
    • entityModels

      private final EntityModelSet entityModels
    • blockEntityRenderDispatcher

      private final BlockEntityRenderDispatcher blockEntityRenderDispatcher
    • telemetryManager

      private final ClientTelemetryManager telemetryManager
    • profileKeyPairManager

      private final ProfileKeyPairManager profileKeyPairManager
    • realmsDataFetcher

      private final RealmsDataFetcher realmsDataFetcher
    • quickPlayLog

      private final QuickPlayLog quickPlayLog
    • gameMode

      @Nullable public MultiPlayerGameMode gameMode
    • level

      @Nullable public ClientLevel level
    • player

      @Nullable public LocalPlayer player
    • singleplayerServer

      @Nullable private IntegratedServer singleplayerServer
    • pendingConnection

      @Nullable private Connection pendingConnection
    • isLocalServer

      private boolean isLocalServer
    • cameraEntity

      @Nullable public Entity cameraEntity
    • crosshairPickEntity

      @Nullable public Entity crosshairPickEntity
    • hitResult

      @Nullable public HitResult hitResult
    • rightClickDelay

      private int rightClickDelay
    • missTime

      protected int missTime
    • pause

      private volatile boolean pause
    • pausePartialTick

      private float pausePartialTick
    • lastNanoTime

      private long lastNanoTime
    • lastTime

      private long lastTime
    • frames

      private int frames
    • noRender

      public boolean noRender
    • screen

      @Nullable public Screen screen
    • overlay

      @Nullable private Overlay overlay
    • clientLevelTeardownInProgress

      private boolean clientLevelTeardownInProgress
    • gameThread

      private Thread gameThread
    • running

      private volatile boolean running
    • delayedCrash

      @Nullable private Supplier<CrashReport> delayedCrash
    • fps

      private static int fps
    • fpsString

      public String 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

      private final Queue<Runnable> progressTasks
    • pendingReload

      @Nullable private CompletableFuture<Void> pendingReload
    • socialInteractionsToast

      @Nullable private TutorialToast socialInteractionsToast
    • profiler

      private ProfilerFiller profiler
    • fpsPieRenderTicks

      private int fpsPieRenderTicks
    • fpsPieProfiler

      private final ContinuousProfiler fpsPieProfiler
    • fpsPieResults

      @Nullable private ProfileResults fpsPieResults
    • metricsRecorder

      private MetricsRecorder metricsRecorder
    • reloadStateTracker

      private final ResourceLoadStateTracker reloadStateTracker
    • savedCpuDuration

      private long savedCpuDuration
    • gpuUtilization

      private double gpuUtilization
    • currentFrameProfile

      @Nullable private TimerQuery.FrameProfile currentFrameProfile
    • realms32BitWarningStatus

      private final Realms32BitWarningStatus realms32BitWarningStatus
    • narrator

      private final GameNarrator narrator
    • chatListener

      private final ChatListener chatListener
    • reportingContext

      private ReportingContext reportingContext
    • commandHistory

      private final CommandHistory commandHistory
    • directoryValidator

      private final DirectoryValidator directoryValidator
    • gameLoadFinished

      private boolean gameLoadFinished
    • clientStartTimeMs

      private final long clientStartTimeMs
    • clientTickCount

      private long clientTickCount
    • debugPath

      private String debugPath
    • realPartialTick

      private float realPartialTick
  • Constructor Details

    • Minecraft

      public Minecraft(GameConfig p_91084_)
  • Method Details

    • onResourceLoadFinished

      private void onResourceLoadFinished(@Nullable Minecraft.GameLoadCookie p_299693_)
    • onGameLoadFinished

      private void onGameLoadFinished(@Nullable Minecraft.GameLoadCookie p_300808_)
    • isGameLoadFinished

      public boolean isGameLoadFinished()
    • buildInitialScreens

      private Runnable buildInitialScreens(@Nullable Minecraft.GameLoadCookie p_299870_)
    • addInitialScreens

      private void addInitialScreens(List<Function<Runnable,Screen>> p_297818_)
    • countryEqualsISO3

      private static boolean countryEqualsISO3(Object p_210783_)
    • updateTitle

      public void updateTitle()
    • createTitle

      private String createTitle()
    • createUserApiService

      private com.mojang.authlib.minecraft.UserApiService createUserApiService(com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService p_193586_, GameConfig p_193587_)
    • checkModStatus

      public static ModCheck checkModStatus()
    • rollbackResourcePacks

      private void rollbackResourcePacks(Throwable p_91240_, @Nullable Minecraft.GameLoadCookie p_299515_)
    • clearResourcePacksOnError

      public void clearResourcePacksOnError(Throwable p_91242_, @Nullable Component p_91243_, @Nullable Minecraft.GameLoadCookie p_299857_)
    • abortResourcePackRecovery

      private void abortResourcePackRecovery()
    • addResourcePackLoadFailToast

      private void addResourcePackLoadFailToast(@Nullable Component p_273566_)
    • run

      public void run()
    • selectMainFont

      void selectMainFont(boolean p_91337_)
    • createSearchTrees

      public void createSearchTrees()
    • onFullscreenError

      private void onFullscreenError(int p_91114_, long p_91115_)
    • checkIs64Bit

      private static boolean checkIs64Bit()
    • getMainRenderTarget

      public RenderTarget getMainRenderTarget()
    • getLaunchedVersion

      public String getLaunchedVersion()
    • getVersionType

      public String getVersionType()
    • delayCrash

      public void delayCrash(CrashReport p_231413_)
    • delayCrashRaw

      public void delayCrashRaw(CrashReport p_231440_)
    • handleDelayedCrash

      private void handleDelayedCrash()
    • emergencySaveAndCrash

      public void emergencySaveAndCrash(CrashReport p_313046_)
    • crash

      public static void crash(@Nullable Minecraft p_311916_, File p_309666_, CrashReport p_91333_)
    • isEnforceUnicode

      public boolean isEnforceUnicode()
    • reloadResourcePacks

      public CompletableFuture<Void> reloadResourcePacks()
    • reloadResourcePacks

      private CompletableFuture<Void> reloadResourcePacks(boolean p_168020_, @Nullable Minecraft.GameLoadCookie p_300647_)
    • selfTest

      private void selfTest()
    • getLevelSource

      public LevelStorageSource getLevelSource()
    • openChatScreen

      private void openChatScreen(String p_91327_)
    • setScreen

      public void setScreen(@Nullable Screen p_91153_)
    • setOverlay

      public void setOverlay(@Nullable Overlay p_91151_)
    • destroy

      public void destroy()
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface ProcessorHandle<Runnable>
    • runTick

      private void runTick(boolean p_91384_)
    • constructProfiler

      private ProfilerFiller constructProfiler(boolean p_167971_, @Nullable SingleTickProfiler p_167972_)
    • finishProfilers

      private void finishProfilers(boolean p_91339_, @Nullable SingleTickProfiler p_91340_)
    • resizeDisplay

      public void resizeDisplay()
      Specified by:
      resizeDisplay in interface WindowEventHandler
    • cursorEntered

      public void cursorEntered()
      Specified by:
      cursorEntered in interface WindowEventHandler
    • getFps

      public int getFps()
    • getFrameTimeNs

      public long getFrameTimeNs()
    • getFramerateLimit

      private int getFramerateLimit()
    • emergencySave

      private void emergencySave()
    • debugClientMetricsStart

      public boolean debugClientMetricsStart(Consumer<Component> p_167947_)
    • debugClientMetricsStop

      private void debugClientMetricsStop()
    • debugClientMetricsCancel

      private void debugClientMetricsCancel()
    • archiveProfilingReport

      private Path archiveProfilingReport(SystemReport p_167857_, List<Path> p_167858_)
    • debugFpsMeterKeyPress

      public void debugFpsMeterKeyPress(int p_91112_)
    • renderFpsMeter

      private void renderFpsMeter(GuiGraphics p_281277_, ProfileResults p_281574_)
    • stop

      public void stop()
    • isRunning

      public boolean isRunning()
    • pauseGame

      public void pauseGame(boolean p_91359_)
    • continueAttack

      private void continueAttack(boolean p_91387_)
    • startAttack

      private boolean startAttack()
    • startUseItem

      private void startUseItem()
    • getMusicManager

      public MusicManager getMusicManager()
    • tick

      public void tick()
    • isMultiplayerServer

      private boolean isMultiplayerServer()
    • handleKeybinds

      private void handleKeybinds()
    • getTelemetryManager

      public ClientTelemetryManager getTelemetryManager()
    • getGpuUtilization

      public double getGpuUtilization()
    • getProfileKeyPairManager

      public ProfileKeyPairManager getProfileKeyPairManager()
    • createWorldOpenFlows

      public WorldOpenFlows createWorldOpenFlows()
    • doWorldLoad

      public void doWorldLoad(LevelStorageSource.LevelStorageAccess p_261564_, PackRepository p_261826_, WorldStem p_261470_, boolean p_261465_)
    • setLevel

      public void setLevel(ClientLevel p_91157_)
    • disconnect

      public void disconnect()
    • disconnect

      public void disconnect(Screen p_91321_)
    • clearDownloadedResourcePacks

      public void clearDownloadedResourcePacks()
    • clearClientLevel

      public void clearClientLevel(Screen p_297406_)
    • updateScreenAndTick

      private void updateScreenAndTick(Screen p_91363_)
    • forceSetScreen

      public void forceSetScreen(Screen p_91347_)
    • updateLevelInEngines

      private void updateLevelInEngines(@Nullable ClientLevel p_91325_)
    • 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

      public boolean isBlocked(UUID p_91247_)
    • getChatStatus

      public Minecraft.ChatStatus getChatStatus()
    • isDemo

      public final boolean isDemo()
    • getConnection

      @Nullable public ClientPacketListener 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 p_263370_, BlockEntity p_263368_)
    • fillReport

      public CrashReport fillReport(CrashReport p_91355_)
    • fillReport

      public static void fillReport(@Nullable Minecraft p_167873_, @Nullable LanguageManager p_167874_, String p_167875_, @Nullable Options p_167876_, CrashReport p_167877_)
    • formatSeconds

      private static String formatSeconds(double p_311783_)
    • fillUptime

      private void fillUptime(CrashReportCategory p_309523_)
    • fillSystemReport

      private static SystemReport fillSystemReport(SystemReport p_167851_, @Nullable Minecraft p_167852_, @Nullable LanguageManager p_167853_, String p_167854_, @Nullable Options p_167855_)
    • getInstance

      public static Minecraft getInstance()
    • delayTextureReload

      public CompletableFuture<Void> delayTextureReload()
    • updateReportEnvironment

      public void updateReportEnvironment(ReportEnvironment p_239477_)
    • getCurrentServer

      @Nullable public ServerData getCurrentServer()
    • isLocalServer

      public boolean isLocalServer()
    • hasSingleplayerServer

      public boolean hasSingleplayerServer()
    • getSingleplayerServer

      @Nullable public IntegratedServer getSingleplayerServer()
    • isSingleplayer

      public boolean isSingleplayer()
    • isLocalPlayer

      public boolean isLocalPlayer(UUID p_298914_)
    • getUser

      public User getUser()
    • getGameProfile

      public com.mojang.authlib.GameProfile getGameProfile()
    • getProxy

      public Proxy getProxy()
    • getTextureManager

      public TextureManager getTextureManager()
    • getResourceManager

      public ResourceManager getResourceManager()
    • getResourcePackRepository

      public PackRepository getResourcePackRepository()
    • getVanillaPackResources

      public VanillaPackResources getVanillaPackResources()
    • getDownloadedPackSource

      public DownloadedPackSource getDownloadedPackSource()
    • getResourcePackDirectory

      public Path getResourcePackDirectory()
    • getLanguageManager

      public LanguageManager getLanguageManager()
    • getTextureAtlas

      public Function<ResourceLocation,TextureAtlasSprite> getTextureAtlas(ResourceLocation p_91259_)
    • is64Bit

      public boolean is64Bit()
    • isPaused

      public boolean isPaused()
    • getGpuWarnlistManager

      public GpuWarnlistManager getGpuWarnlistManager()
    • getSoundManager

      public SoundManager getSoundManager()
    • getSituationalMusic

      public Music getSituationalMusic()
    • getMinecraftSessionService

      public com.mojang.authlib.minecraft.MinecraftSessionService getMinecraftSessionService()
    • getSkinManager

      public SkinManager getSkinManager()
    • getCameraEntity

      @Nullable public Entity getCameraEntity()
    • setCameraEntity

      public void setCameraEntity(Entity p_91119_)
    • shouldEntityAppearGlowing

      public boolean shouldEntityAppearGlowing(Entity p_91315_)
    • getRunningThread

      protected Thread getRunningThread()
      Specified by:
      getRunningThread in class BlockableEventLoop<Runnable>
    • wrapRunnable

      protected Runnable wrapRunnable(Runnable p_91376_)
      Specified by:
      wrapRunnable in class BlockableEventLoop<Runnable>
    • shouldRun

      protected boolean shouldRun(Runnable p_91365_)
      Specified by:
      shouldRun in class BlockableEventLoop<Runnable>
    • getBlockRenderer

      public BlockRenderDispatcher getBlockRenderer()
    • getEntityRenderDispatcher

      public EntityRenderDispatcher getEntityRenderDispatcher()
    • getBlockEntityRenderDispatcher

      public BlockEntityRenderDispatcher getBlockEntityRenderDispatcher()
    • getItemRenderer

      public ItemRenderer getItemRenderer()
    • getSearchTree

      public <T> SearchTree<T> getSearchTree(SearchRegistry.Key<T> p_231373_)
    • populateSearchTree

      public <T> void populateSearchTree(SearchRegistry.Key<T> p_231375_, List<T> p_231376_)
    • getFixerUpper

      public com.mojang.datafixers.DataFixer getFixerUpper()
    • getFrameTime

      public float getFrameTime()
    • getDeltaFrameTime

      public float getDeltaFrameTime()
    • getBlockColors

      public BlockColors getBlockColors()
    • showOnlyReducedInfo

      public boolean showOnlyReducedInfo()
    • getToasts

      public ToastComponent getToasts()
    • getTutorial

      public Tutorial getTutorial()
    • isWindowActive

      public boolean isWindowActive()
    • getHotbarManager

      public HotbarManager getHotbarManager()
    • getModelManager

      public ModelManager getModelManager()
    • getPaintingTextures

      public PaintingTextureManager getPaintingTextures()
    • getMobEffectTextures

      public MobEffectTextureManager getMobEffectTextures()
    • getGuiSprites

      public GuiSpriteManager getGuiSprites()
    • setWindowActive

      public void setWindowActive(boolean p_91261_)
      Specified by:
      setWindowActive in interface WindowEventHandler
    • grabPanoramixScreenshot

      public Component grabPanoramixScreenshot(File p_167900_, int p_167901_, int p_167902_)
    • grabHugeScreenshot

      private Component grabHugeScreenshot(File p_167904_, int p_167905_, int p_167906_, int p_167907_, int p_167908_)
    • getProfiler

      public ProfilerFiller getProfiler()
    • getProgressListener

      @Nullable public StoringChunkProgressListener getProgressListener()
    • getSplashManager

      public SplashManager getSplashManager()
    • getOverlay

      @Nullable public Overlay getOverlay()
    • getPlayerSocialManager

      public PlayerSocialManager getPlayerSocialManager()
    • renderOnThread

      public boolean renderOnThread()
    • getWindow

      public Window getWindow()
    • getDebugOverlay

      public DebugScreenOverlay getDebugOverlay()
    • renderBuffers

      public RenderBuffers renderBuffers()
    • updateMaxMipLevel

      public void updateMaxMipLevel(int p_91313_)
    • getItemColors

      public ItemColors getItemColors()
    • getSearchTreeManager

      public SearchRegistry getSearchTreeManager()
    • getPartialTick

      public float getPartialTick()
    • getEntityModels

      public EntityModelSet getEntityModels()
    • isTextFilteringEnabled

      public boolean isTextFilteringEnabled()
    • prepareForMultiplayer

      public void prepareForMultiplayer()
    • getRealms32BitWarningStatus

      public Realms32BitWarningStatus getRealms32BitWarningStatus()
    • getProfileKeySignatureValidator

      @Nullable public SignatureValidator getProfileKeySignatureValidator()
    • canValidateProfileKeys

      public boolean canValidateProfileKeys()
    • getLastInputType

      public InputType getLastInputType()
    • setLastInputType

      public void setLastInputType(InputType p_265509_)
    • getNarrator

      public GameNarrator getNarrator()
    • getChatListener

      public ChatListener getChatListener()
    • getReportingContext

      public ReportingContext getReportingContext()
    • realmsDataFetcher

      public RealmsDataFetcher realmsDataFetcher()
    • quickPlayLog

      public QuickPlayLog quickPlayLog()
    • commandHistory

      public CommandHistory commandHistory()
    • directoryValidator

      public DirectoryValidator directoryValidator()
    • getTickTargetMillis

      private float getTickTargetMillis(float p_311597_)
    • getLauncherBrand

      @Nullable public static String getLauncherBrand()