Class LevelRenderer
java.lang.Object
net.minecraft.client.renderer.LevelRenderer
- All Implemented Interfaces:
AutoCloseable, PreparableReloadListener, ResourceManagerReloadListener
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceprivate static final recordNested classes/interfaces inherited from interface PreparableReloadListener
PreparableReloadListener.PreparationBarrier, PreparableReloadListener.SharedState, PreparableReloadListener.StateKey<T> -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final BlockEntityRenderDispatcherprivate static final floatprivate @Nullable GpuSamplerprivate final CloudRendererprivate final SimpleGizmoCollectorfinal DebugRendererprivate final it.unimi.dsi.fastutil.ints.Int2ObjectMap<BlockDestructionProgress> private final it.unimi.dsi.fastutil.longs.Long2ObjectMap<SortedSet<BlockDestructionProgress>> private static final Identifierprivate @Nullable RenderTargetprivate final EntityRenderDispatcherprivate final FeatureRenderDispatcherprivate LevelRenderer.FinalizedGizmosstatic final intprivate intprivate intprivate intprivate @Nullable BlockPosprivate intprivate @Nullable ClientLevel(package private) final LevelRenderStateprivate final Minecraftprivate static final intstatic final intprivate final it.unimi.dsi.fastutil.objects.ObjectArrayList<SectionRenderDispatcher.RenderSection> private final ParticlesRenderStateprivate doubleprivate doubleprivate doubleprivate doubleprivate doubleprivate final RenderBuffersstatic final intprivate final SectionOcclusionGraphprivate @Nullable SectionRenderDispatcherprivate @Nullable SkyRendererprivate final SubmitNodeStorageprivate final LevelTargetBundleprivate intprivate intprivate static final Identifierprivate @Nullable ViewAreaprivate final it.unimi.dsi.fastutil.objects.ObjectArrayList<SectionRenderDispatcher.RenderSection> private final WeatherEffectRendererprivate final WorldBorderRenderer -
Constructor Summary
ConstructorsConstructorDescriptionLevelRenderer(Minecraft minecraft, EntityRenderDispatcher entityRenderDispatcher, BlockEntityRenderDispatcher blockEntityRenderDispatcher, RenderBuffers renderBuffers, LevelRenderState levelRenderState, FeatureRenderDispatcher featureRenderDispatcher) -
Method Summary
Modifier and TypeMethodDescriptionprivate voidaddCloudsPass(FrameGraphBuilder frame, CloudStatus cloudsType, Vec3 cameraPosition, long gameTime, float partialTicks, int cloudColor, float cloudHeight) Deprecated.private voidaddCloudsPass(FrameGraphBuilder frame, CloudStatus cloudsType, Vec3 cameraPosition, long gameTime, float partialTicks, int cloudColor, float cloudHeight, Matrix4f modelViewMatrix) private voidaddLateDebugPass(FrameGraphBuilder frame, CameraRenderState camera, GpuBufferSlice fog, Matrix4f modelViewMatrix) private voidaddMainPass(FrameGraphBuilder frame, Frustum frustum, Matrix4f modelViewMatrix, GpuBufferSlice terrainFog, boolean renderOutline, LevelRenderState levelRenderState, DeltaTracker deltaTracker, ProfilerFiller profiler, ChunkSectionsToRender chunkSectionsToRender) voidprivate voidaddSkyPass(FrameGraphBuilder frame, CameraRenderState cameraState, GpuBufferSlice skyFog) Deprecated.private voidaddSkyPass(FrameGraphBuilder frame, CameraRenderState cameraState, GpuBufferSlice skyFog, Matrix4f modelViewMatrix) private voidaddWeatherPass(FrameGraphBuilder frame, GpuBufferSlice fog) Deprecated.Neo: useaddWeatherPass(FrameGraphBuilder, GpuBufferSlice, Matrix4f)insteadprivate voidaddWeatherPass(FrameGraphBuilder frame, GpuBufferSlice fog, Matrix4f modelViewMatrix) voidprivate voidapplyFrustum(Frustum frustum) voidblockChanged(BlockGetter level, BlockPos pos, BlockState old, BlockState current, int updateFlags) private voidcheckPoseStack(PoseStack poseStack) Asserts that the specifiedposeStackis.invalid reference
clear
private voidvoidclose()private voidcompileSections(Camera camera) intprivate voidcullTerrain(Camera camera, Frustum frustum, boolean spectator) voiddestroyBlockProgress(int id, BlockPos pos, int progress) voidvoidendFrame()@Nullable RenderTargetprivate voidextractBlockDestroyAnimation(Camera camera, LevelRenderState levelRenderState) private voidextractBlockOutline(Camera camera, LevelRenderState levelRenderState) private EntityRenderStateextractEntity(Entity entity, float partialTickTime) voidextractLevel(DeltaTracker deltaTracker, Camera camera, float deltaPartialTick) private voidextractVisibleBlockEntities(Camera camera, float deltaPartialTick, LevelRenderState levelRenderState) Deprecated.private voidextractVisibleBlockEntities(Camera camera, float deltaPartialTick, LevelRenderState levelRenderState, @Nullable Frustum frustum) private voidextractVisibleEntities(Camera camera, Frustum frustum, DeltaTracker deltaTracker, LevelRenderState output) private void@Nullable RenderTarget@Nullable String@Nullable RenderTargetdoublestatic intgetLightCoords(LevelRenderer.BrightnessGetter brightnessGetter, BlockAndTintGetter level, BlockState state, BlockPos pos) static intgetLightCoords(BlockAndTintGetter level, BlockPos pos) @Nullable RenderTargetIterable<? extends IRenderableSection> @Nullable SectionRenderDispatcher@Nullable StringintgetTicks()double@Nullable RenderTargetprivate @Nullable PostChainit.unimi.dsi.fastutil.objects.ObjectArrayList<SectionRenderDispatcher.RenderSection> @Nullable RenderTargetbooleanvoidbooleanisSectionCompiledAndVisible(BlockPos blockPos) voiditerateVisibleBlockEntities(Consumer<BlockEntity> blockEntityConsumer) voidstatic FrustumoffsetFrustum(Frustum frustum) voidvoidonResourceManagerReload(ResourceManager resourceManager) voidonSectionBecomingNonEmpty(long sectionNode) prepareChunkRenders(Matrix4fc modelViewMatrix) private voidprivate voidprivate voidrenderBlockDestroyAnimation(PoseStack poseStack, MultiBufferSource.BufferSource bufferSource, LevelRenderState levelRenderState) private voidrenderBlockOutline(MultiBufferSource.BufferSource bufferSource, PoseStack poseStack, boolean onlyTranslucentBlocks, LevelRenderState levelRenderState) private voidrenderHitOutline(PoseStack poseStack, VertexConsumer builder, double camX, double camY, double camZ, BlockOutlineRenderState state, int color, float width) voidrenderLevel(GraphicsResourceAllocator resourceAllocator, DeltaTracker deltaTracker, boolean renderOutline, CameraRenderState cameraState, Matrix4f modelViewMatrix, GpuBufferSlice terrainFog, Vector4f fogColor, boolean shouldRenderSky, ChunkSectionsToRender chunkSectionsToRender) voidvoidresize(int width, int height) private voidscheduleResort(SectionRenderDispatcher.RenderSection section, TranslucencyPointOfView pointOfView, Vec3 cameraPos, boolean blockPosChanged, boolean isNearby) private voidscheduleTranslucentSectionResort(Vec3 cameraPos) private voidsetBlockDirty(BlockPos pos, boolean playerChanged) voidsetBlockDirty(BlockPos pos, BlockState oldState, BlockState newState) voidsetBlocksDirty(int x0, int y0, int z0, int x1, int y1, int z1) Re-renders all blocks in the specified range.voidsetLevel(@Nullable ClientLevel level) voidsetSectionDirty(int sectionX, int sectionY, int sectionZ) private voidsetSectionDirty(int sectionX, int sectionY, int sectionZ, boolean playerChanged) voidsetSectionDirtyWithNeighbors(int sectionX, int sectionY, int sectionZ) voidsetSectionRangeDirty(int minSectionX, int minSectionY, int minSectionZ, int maxSectionX, int maxSectionY, int maxSectionZ) booleanprivate voidsubmitBlockEntities(PoseStack poseStack, LevelRenderState levelRenderState, SubmitNodeStorage submitNodeStorage) private voidsubmitEntities(PoseStack poseStack, LevelRenderState levelRenderState, SubmitNodeCollector output) voidvoidMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface PreparableReloadListener
getName, prepareSharedStateMethods inherited from interface ResourceManagerReloadListener
reload
-
Field Details
-
TRANSPARENCY_POST_CHAIN_ID
-
ENTITY_OUTLINE_POST_CHAIN_ID
-
SECTION_SIZE
public static final int SECTION_SIZE- See Also:
-
HALF_SECTION_SIZE
public static final int HALF_SECTION_SIZE- See Also:
-
NEARBY_SECTION_DISTANCE_IN_BLOCKS
public static final int NEARBY_SECTION_DISTANCE_IN_BLOCKS- See Also:
-
MINIMUM_TRANSPARENT_SORT_COUNT
private static final int MINIMUM_TRANSPARENT_SORT_COUNT- See Also:
-
CHUNK_VISIBILITY_THRESHOLD
private static final float CHUNK_VISIBILITY_THRESHOLD- See Also:
-
minecraft
-
entityRenderDispatcher
-
blockEntityRenderDispatcher
-
renderBuffers
-
skyRenderer
-
cloudRenderer
-
worldBorderRenderer
-
weatherEffectRenderer
-
particlesRenderState
-
debugRenderer
-
gameTestBlockHighlightRenderer
-
level
-
sectionOcclusionGraph
-
visibleSections
private final it.unimi.dsi.fastutil.objects.ObjectArrayList<SectionRenderDispatcher.RenderSection> visibleSections -
nearbyVisibleSections
private final it.unimi.dsi.fastutil.objects.ObjectArrayList<SectionRenderDispatcher.RenderSection> nearbyVisibleSections -
viewArea
-
ticks
private int ticks -
destroyingBlocks
-
destructionProgress
private final it.unimi.dsi.fastutil.longs.Long2ObjectMap<SortedSet<BlockDestructionProgress>> destructionProgress -
entityOutlineTarget
-
targets
-
lastCameraSectionX
private int lastCameraSectionX -
lastCameraSectionY
private int lastCameraSectionY -
lastCameraSectionZ
private int lastCameraSectionZ -
prevCamX
private double prevCamX -
prevCamY
private double prevCamY -
prevCamZ
private double prevCamZ -
prevCamRotX
private double prevCamRotX -
prevCamRotY
private double prevCamRotY -
sectionRenderDispatcher
-
lastViewDistance
private int lastViewDistance -
lastTranslucentSortBlockPos
-
translucencyResortIterationIndex
private int translucencyResortIterationIndex -
levelRenderState
-
submitNodeStorage
-
featureRenderDispatcher
-
chunkLayerSampler
-
collectedGizmos
-
finalizedGizmos
-
-
Constructor Details
-
LevelRenderer
public LevelRenderer(Minecraft minecraft, EntityRenderDispatcher entityRenderDispatcher, BlockEntityRenderDispatcher blockEntityRenderDispatcher, RenderBuffers renderBuffers, LevelRenderState levelRenderState, FeatureRenderDispatcher featureRenderDispatcher)
-
-
Method Details
-
close
public void close()- Specified by:
closein interfaceAutoCloseable
-
onResourceManagerReload
- Specified by:
onResourceManagerReloadin interfaceResourceManagerReloadListener
-
initOutline
public void initOutline() -
getTransparencyChain
-
doEntityOutline
public void doEntityOutline() -
shouldShowEntityOutlines
public boolean shouldShowEntityOutlines() -
setLevel
- Parameters:
level- the level to set, ornullto clear
-
clearVisibleSections
private void clearVisibleSections() -
allChanged
public void allChanged() -
resize
public void resize(int width, int height) -
getSectionStatistics
-
getSectionRenderDispatcher
-
getTotalSections
public double getTotalSections() -
getLastViewDistance
public double getLastViewDistance() -
countRenderedSections
public int countRenderedSections() -
resetSampler
public void resetSampler() -
getEntityStatistics
-
cullTerrain
-
offsetFrustum
-
applyFrustum
-
addRecentlyCompiledSection
-
update
-
renderLevel
public void renderLevel(GraphicsResourceAllocator resourceAllocator, DeltaTracker deltaTracker, boolean renderOutline, CameraRenderState cameraState, Matrix4f modelViewMatrix, GpuBufferSlice terrainFog, Vector4f fogColor, boolean shouldRenderSky, ChunkSectionsToRender chunkSectionsToRender) -
extractLevel
-
addMainPass
private void addMainPass(FrameGraphBuilder frame, Frustum frustum, Matrix4f modelViewMatrix, GpuBufferSlice terrainFog, boolean renderOutline, LevelRenderState levelRenderState, DeltaTracker deltaTracker, ProfilerFiller profiler, ChunkSectionsToRender chunkSectionsToRender) -
addCloudsPass
@Deprecated private void addCloudsPass(FrameGraphBuilder frame, CloudStatus cloudsType, Vec3 cameraPosition, long gameTime, float partialTicks, int cloudColor, float cloudHeight) Deprecated. -
addCloudsPass
private void addCloudsPass(FrameGraphBuilder frame, CloudStatus cloudsType, Vec3 cameraPosition, long gameTime, float partialTicks, int cloudColor, float cloudHeight, Matrix4f modelViewMatrix) -
addWeatherPass
Deprecated.Neo: useaddWeatherPass(FrameGraphBuilder, GpuBufferSlice, Matrix4f)instead -
addWeatherPass
-
addLateDebugPass
private void addLateDebugPass(FrameGraphBuilder frame, CameraRenderState camera, GpuBufferSlice fog, Matrix4f modelViewMatrix) -
extractVisibleEntities
private void extractVisibleEntities(Camera camera, Frustum frustum, DeltaTracker deltaTracker, LevelRenderState output) -
submitEntities
private void submitEntities(PoseStack poseStack, LevelRenderState levelRenderState, SubmitNodeCollector output) -
extractVisibleBlockEntities
@Deprecated private void extractVisibleBlockEntities(Camera camera, float deltaPartialTick, LevelRenderState levelRenderState) Deprecated. -
extractVisibleBlockEntities
private void extractVisibleBlockEntities(Camera camera, float deltaPartialTick, LevelRenderState levelRenderState, @Nullable Frustum frustum) -
submitBlockEntities
private void submitBlockEntities(PoseStack poseStack, LevelRenderState levelRenderState, SubmitNodeStorage submitNodeStorage) -
extractBlockDestroyAnimation
-
renderBlockDestroyAnimation
private void renderBlockDestroyAnimation(PoseStack poseStack, MultiBufferSource.BufferSource bufferSource, LevelRenderState levelRenderState) -
extractBlockOutline
-
renderBlockOutline
private void renderBlockOutline(MultiBufferSource.BufferSource bufferSource, PoseStack poseStack, boolean onlyTranslucentBlocks, LevelRenderState levelRenderState) -
checkPoseStack
Asserts that the specifiedposeStackis.invalid reference
clear
- Throws:
IllegalStateException- if the specifiedposeStackis not clear
-
extractEntity
-
scheduleTranslucentSectionResort
-
scheduleResort
private void scheduleResort(SectionRenderDispatcher.RenderSection section, TranslucencyPointOfView pointOfView, Vec3 cameraPos, boolean blockPosChanged, boolean isNearby) -
prepareChunkRenders
-
endFrame
public void endFrame() -
tick
-
removeBlockBreakingProgress
private void removeBlockBreakingProgress() -
removeProgress
-
addSkyPass
@Deprecated private void addSkyPass(FrameGraphBuilder frame, CameraRenderState cameraState, GpuBufferSlice skyFog) Deprecated. -
addSkyPass
private void addSkyPass(FrameGraphBuilder frame, CameraRenderState cameraState, GpuBufferSlice skyFog, Matrix4f modelViewMatrix) -
compileSections
-
renderHitOutline
private void renderHitOutline(PoseStack poseStack, VertexConsumer builder, double camX, double camY, double camZ, BlockOutlineRenderState state, int color, float width) -
blockChanged
public void blockChanged(BlockGetter level, BlockPos pos, BlockState old, BlockState current, int updateFlags) -
setBlockDirty
-
setBlocksDirty
public void setBlocksDirty(int x0, int y0, int z0, int x1, int y1, int z1) Re-renders all blocks in the specified range. -
setBlockDirty
-
setSectionDirtyWithNeighbors
public void setSectionDirtyWithNeighbors(int sectionX, int sectionY, int sectionZ) -
setSectionRangeDirty
public void setSectionRangeDirty(int minSectionX, int minSectionY, int minSectionZ, int maxSectionX, int maxSectionY, int maxSectionZ) -
setSectionDirty
public void setSectionDirty(int sectionX, int sectionY, int sectionZ) -
setSectionDirty
private void setSectionDirty(int sectionX, int sectionY, int sectionZ, boolean playerChanged) -
onSectionBecomingNonEmpty
public void onSectionBecomingNonEmpty(long sectionNode) -
destroyBlockProgress
-
hasRenderedAllSections
public boolean hasRenderedAllSections() -
onChunkReadyToRender
-
needsUpdate
public void needsUpdate() -
getLightCoords
-
getLightCoords
public static int getLightCoords(LevelRenderer.BrightnessGetter brightnessGetter, BlockAndTintGetter level, BlockState state, BlockPos pos) -
isSectionCompiledAndVisible
-
entityOutlineTarget
-
getTranslucentTarget
-
getItemEntityTarget
-
getParticlesTarget
-
getWeatherTarget
-
getCloudsTarget
-
getVisibleSections
public it.unimi.dsi.fastutil.objects.ObjectArrayList<SectionRenderDispatcher.RenderSection> getVisibleSections() -
getSectionOcclusionGraph
-
getCloudRenderer
-
getTicks
public int getTicks() -
iterateVisibleBlockEntities
-
getRenderableSections
-
collectPerFrameGizmos
-
finalizeGizmoCollection
private void finalizeGizmoCollection()
-
addCloudsPass(FrameGraphBuilder, CloudStatus, Vec3, long, float, int, float, Matrix4f)instead