Class MinecraftClient

All Implemented Interfaces:
AutoCloseable, Executor, WindowEventHandler, SnooperListener, MessageListener<Runnable>

@Environment(CLIENT)
public class MinecraftClient
extends ReentrantThreadExecutor<Runnable>
implements SnooperListener, WindowEventHandler
Represents a logical Minecraft client. The logical Minecraft client is responsible for rendering, sound playback and control input. The Minecraft client also manages connections to a logical server which may be the client's IntegratedServer or a remote server. The Minecraft client instance may be obtained using getInstance().

Rendering on a Minecraft client is split into several facilities. The primary entrypoint for rendering is GameRenderer.render(float, long, boolean).

Thing to render Rendering facility
World WorldRenderer
Blocks and Fluids BlockRenderManager
Entities EntityRenderDispatcher
Block entities BlockEntityRenderDispatcher
Items ItemRenderer
Items held in hand HeldItemRenderer
Text TextRenderer
Game hud (health bar, hunger bar) InGameHud
See Also:
IntegratedServer, GameRenderer
  • Field Details

    • instance

      private static MinecraftClient instance
    • LOGGER

      private static final Logger LOGGER
    • IS_SYSTEM_MAC

      public static final boolean IS_SYSTEM_MAC
    • DEFAULT_FONT_ID

      public static final Identifier DEFAULT_FONT_ID
    • UNICODE_FONT_ID

      public static final Identifier UNICODE_FONT_ID
    • ALT_TEXT_RENDERER_ID

      public static final Identifier ALT_TEXT_RENDERER_ID
    • COMPLETED_UNIT_FUTURE

      private static final CompletableFuture<Unit> COMPLETED_UNIT_FUTURE
    • field_26841

      private static final Text field_26841
    • memoryReservedForCrash

      public static byte[] memoryReservedForCrash
    • currentFps

      private static int currentFps
    • resourcePackDir

      private final File resourcePackDir
    • sessionPropertyMap

      private final com.mojang.authlib.properties.PropertyMap sessionPropertyMap
    • textureManager

      private final TextureManager textureManager
    • dataFixer

      private final com.mojang.datafixers.DataFixer dataFixer
    • windowProvider

      private final WindowProvider windowProvider
    • window

      private final Window window
    • renderTickCounter

      private final RenderTickCounter renderTickCounter
    • snooper

      private final Snooper snooper
    • bufferBuilders

      private final BufferBuilderStorage bufferBuilders
    • worldRenderer

      public final WorldRenderer worldRenderer
    • entityRenderDispatcher

      private final EntityRenderDispatcher entityRenderDispatcher
    • itemRenderer

      private final ItemRenderer itemRenderer
    • heldItemRenderer

      private final HeldItemRenderer heldItemRenderer
    • particleManager

      public final ParticleManager particleManager
    • searchManager

      private final SearchManager searchManager
    • session

      private final Session session
    • textRenderer

      public final TextRenderer textRenderer
    • gameRenderer

      public final GameRenderer gameRenderer
    • debugRenderer

      public final DebugRenderer debugRenderer
    • worldGenProgressTracker

      private final AtomicReference<WorldGenerationProgressTracker> worldGenProgressTracker
    • inGameHud

      public final InGameHud inGameHud
    • options

      public final GameOptions options
    • creativeHotbarStorage

      private final HotbarStorage creativeHotbarStorage
    • mouse

      public final Mouse mouse
    • keyboard

      public final Keyboard keyboard
    • runDirectory

      public final File runDirectory
    • gameVersion

      private final String gameVersion
    • versionType

      private final String versionType
    • netProxy

      private final Proxy netProxy
    • levelStorage

      private final LevelStorage levelStorage
    • metricsData

      public final MetricsData metricsData
    • is64Bit

      private final boolean is64Bit
    • isDemo

      private final boolean isDemo
    • multiplayerEnabled

      private final boolean multiplayerEnabled
    • onlineChatEnabled

      private final boolean onlineChatEnabled
    • resourceManager

      private final ReloadableResourceManager resourceManager
    • builtinPackProvider

      private final ClientBuiltinResourcePackProvider builtinPackProvider
    • resourcePackManager

      private final ResourcePackManager resourcePackManager
    • languageManager

      private final LanguageManager languageManager
    • blockColors

      private final BlockColors blockColors
    • itemColors

      private final ItemColors itemColors
    • framebuffer

      private final Framebuffer framebuffer
    • soundManager

      private final SoundManager soundManager
    • musicTracker

      private final MusicTracker musicTracker
    • fontManager

      private final FontManager fontManager
    • splashTextLoader

      private final SplashTextResourceSupplier splashTextLoader
    • videoWarningManager

      private final VideoWarningManager videoWarningManager
    • sessionService

      private final com.mojang.authlib.minecraft.MinecraftSessionService sessionService
    • socialInteractionsService

      private final com.mojang.authlib.minecraft.SocialInteractionsService socialInteractionsService
    • skinProvider

      private final PlayerSkinProvider skinProvider
    • bakedModelManager

      private final BakedModelManager bakedModelManager
    • blockRenderManager

      private final BlockRenderManager blockRenderManager
    • paintingManager

      private final PaintingManager paintingManager
    • statusEffectSpriteManager

      private final StatusEffectSpriteManager statusEffectSpriteManager
    • toastManager

      private final ToastManager toastManager
    • game

      private final MinecraftClientGame game
    • tutorialManager

      private final TutorialManager tutorialManager
    • socialInteractionsManager

      private final SocialInteractionsManager socialInteractionsManager
    • entityModelLoader

      private final EntityModelLoader entityModelLoader
    • blockEntityRenderDispatcher

      private final BlockEntityRenderDispatcher blockEntityRenderDispatcher
    • interactionManager

      @Nullable public ClientPlayerInteractionManager interactionManager
    • world

      @Nullable public ClientWorld world
      Represents the world the client is currently viewing. This field is not null when in game.
    • player

      Represents the client's own player. This field is not null when in game.
    • server

      @Nullable private IntegratedServer server
    • currentServerEntry

      @Nullable private ServerInfo currentServerEntry
    • integratedServerConnection

      @Nullable private ClientConnection integratedServerConnection
      The client connection to the integrated server. This is only used when connecting to the integrated server.
      See Also:
      ConnectScreen
    • integratedServerRunning

      private boolean integratedServerRunning
    • cameraEntity

      @Nullable public Entity cameraEntity
    • targetedEntity

      @Nullable public Entity targetedEntity
    • crosshairTarget

      @Nullable public HitResult crosshairTarget
    • itemUseCooldown

      private int itemUseCooldown
    • attackCooldown

      protected int attackCooldown
    • paused

      private boolean paused
    • pausedTickDelta

      private float pausedTickDelta
    • lastMetricsSampleTime

      private long lastMetricsSampleTime
    • nextDebugInfoUpdateTime

      private long nextDebugInfoUpdateTime
    • fpsCounter

      private int fpsCounter
    • skipGameRender

      public boolean skipGameRender
    • currentScreen

      @Nullable public Screen currentScreen
      The Minecraft client's currently open screen. This field should only be used to get the current screen. For changing the screen use openScreen(Screen)
      See Also:
      openScreen(Screen)
    • overlay

      @Nullable public Overlay overlay
    • connectedToRealms

      private boolean connectedToRealms
    • thread

      private Thread thread
    • running

      private volatile boolean running
    • crashReport

      @Nullable private CrashReport crashReport
    • fpsDebugString

      public String fpsDebugString
    • debugChunkInfo

      public boolean debugChunkInfo
    • debugChunkOcclusion

      public boolean debugChunkOcclusion
    • chunkCullingEnabled

      public boolean chunkCullingEnabled
    • windowFocused

      private boolean windowFocused
    • renderTaskQueue

      private final Queue<Runnable> renderTaskQueue
    • resourceReloadFuture

      @Nullable private CompletableFuture<Void> resourceReloadFuture
    • field_26843

      @Nullable private TutorialToast field_26843
    • profiler

      private Profiler profiler
    • trackingTick

      private int trackingTick
    • tickTimeTracker

      private final TickTimeTracker tickTimeTracker
    • tickProfilerResult

      @Nullable private ProfileResult tickProfilerResult
    • openProfilerSection

      private String openProfilerSection
  • Constructor Details

    • MinecraftClient

      public MinecraftClient​(RunArgs args)
  • Method Details