Package net.minecraft.client.renderer
Class LevelRenderer
java.lang.Object
net.minecraft.client.renderer.LevelRenderer
- All Implemented Interfaces:
AutoCloseable,PreparableReloadListener,ResourceManagerReloadListener
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface net.minecraft.server.packs.resources.PreparableReloadListener
PreparableReloadListener.PreparationBarrier, PreparableReloadListener.SharedState, PreparableReloadListener.StateKey<T> -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final BlockEntityRenderDispatcherprivate Frustumprivate booleanprivate final CloudRendererfinal DebugRendererprivate final it.unimi.dsi.fastutil.ints.Int2ObjectMap<BlockDestructionProgress> private final it.unimi.dsi.fastutil.longs.Long2ObjectMap<SortedSet<BlockDestructionProgress>> private static final ResourceLocationprivate RenderTargetprivate final EntityRenderDispatcherprivate final FeatureRenderDispatcherstatic final intprivate intprivate intprivate intprivate BlockPosprivate intprivate ClientLevel(package private) final LevelRenderStateprivate static final org.slf4j.Loggerprivate 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 SectionRenderDispatcherprivate final SkyRendererprivate final SubmitNodeStorageprivate final LevelTargetBundleprivate intprivate intprivate static final ResourceLocationprivate 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 frameGraphBuilder, CloudStatus cloudStatus, Vec3 cameraPosition, float ticks, int cloudColor, float cloudHeight) Deprecated.private voidaddCloudsPass(FrameGraphBuilder frameGraphBuilder, CloudStatus cloudStatus, Vec3 cameraPosition, float ticks, int cloudColor, float cloudHeight, Matrix4f modelViewMatrix) private voidaddLateDebugPass(FrameGraphBuilder frameGraphBuilder, Vec3 cameraPosition, GpuBufferSlice shaderFog, Frustum frustum) private voidaddMainPass(FrameGraphBuilder frameGraphBuilder, Frustum frustum, Matrix4f frustumMatrix, GpuBufferSlice shaderFog, boolean renderBlockOutline, LevelRenderState renderState, DeltaTracker deltaTracker, ProfilerFiller profier) private voidaddParticlesPass(FrameGraphBuilder frameGraphBuilder, GpuBufferSlice shaderFog) Deprecated.Neo: useaddParticlesPass(FrameGraphBuilder, GpuBufferSlice, Matrix4f)insteadprivate voidaddParticlesPass(FrameGraphBuilder frameGraphBuilder, GpuBufferSlice shaderFog, Matrix4f modelViewMatrix) voidaddRecentlyCompiledSection(SectionRenderDispatcher.RenderSection renderSection) private voidaddSkyPass(FrameGraphBuilder frameGraphBuilder, Camera camera, GpuBufferSlice shaderFog) Deprecated.Neo: useaddSkyPass(FrameGraphBuilder, Camera, GpuBufferSlice, Matrix4f)insteadprivate voidaddSkyPass(FrameGraphBuilder frameGraphBuilder, Camera camera, GpuBufferSlice shaderFog, Matrix4f modelViewMatrix) private voidaddWeatherPass(FrameGraphBuilder frameGraphBuilder, Vec3 cameraPosition, GpuBufferSlice shaderFog) Deprecated.Neo: useaddWeatherPass(FrameGraphBuilder, Vec3, GpuBufferSlice, Matrix4f)insteadprivate voidaddWeatherPass(FrameGraphBuilder frameGraphBuilder, Vec3 cameraPosition, GpuBufferSlice shaderFog, Matrix4f modelViewMatrix) voidprivate voidapplyFrustum(Frustum frustum) voidblockChanged(BlockGetter level, BlockPos pos, BlockState oldState, BlockState newState, int flags) voidprivate 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 breakerId, BlockPos pos, int progress) voidprivate booleandoesMobEffectBlockSky(Camera camera) voidendFrame()private voidextractBlockDestroyAnimation(Camera camera, LevelRenderState renderState) private voidextractBlockOutline(Camera camera, LevelRenderState renderState) private EntityRenderStateextractEntity(Entity entity, float partialTick) private voidextractVisibleBlockEntities(Camera camera, float partialTick, LevelRenderState renderState) Deprecated.private voidextractVisibleBlockEntities(Camera camera, float partialTick, LevelRenderState renderState, Frustum frustum) private voidextractVisibleEntities(Camera camera, Frustum frustum, DeltaTracker deltaTracker, LevelRenderState renderState) doublestatic intgetLightColor(LevelRenderer.BrightnessGetter brightnessGetter, BlockAndTintGetter level, BlockState state, BlockPos pos) static intgetLightColor(BlockAndTintGetter level, BlockPos pos) Iterable<? extends IRenderableSection> intgetTicks()doubleprivate PostChainit.unimi.dsi.fastutil.objects.ObjectArrayList<SectionRenderDispatcher.RenderSection> booleanvoidbooleanvoiditerateVisibleBlockEntities(Consumer<BlockEntity> blockEntityConsumer) voidvoidstatic FrustumoffsetFrustum(Frustum frustum) voidonChunkReadyToRender(ChunkPos chunkPos) voidonResourceManagerReload(ResourceManager resourceManager) voidonSectionBecomingNonEmpty(long sectionPos) private ChunkSectionsToRenderprepareChunkRenders(Matrix4fc frustumMatrix, double x, double y, double z) private FrustumprepareCullFrustum(Matrix4f frustumMatrix, Matrix4f projectionMatrix, Vec3 cameraPosition) private voidprivate voidremoveProgress(BlockDestructionProgress progress) private voidrenderBlockDestroyAnimation(PoseStack poseStack, MultiBufferSource.BufferSource bufferSource, LevelRenderState renderState) private voidrenderBlockOutline(MultiBufferSource.BufferSource bufferSource, PoseStack poseStack, boolean translucent, LevelRenderState renderState) private voidrenderHitOutline(PoseStack poseStack, VertexConsumer consumer, double camX, double camY, double camZ, BlockOutlineRenderState outlineRenderState, int color) voidrenderLevel(GraphicsResourceAllocator graphicsResourceAllocator, DeltaTracker deltaTracker, boolean renderBlockOutline, Camera camera, Matrix4f frustumMatrix, Matrix4f projectionMatrix, Matrix4f cullingProjectionMatrix, GpuBufferSlice shaderFog, Vector4f fogColor, boolean renderSky) voidresize(int width, int height) private voidscheduleResort(SectionRenderDispatcher.RenderSection section, TranslucencyPointOfView pointOfView, Vec3 cameraPosition, boolean force, boolean ignoreAxisAlignment) private voidscheduleTranslucentSectionResort(Vec3 cameraPosition) private voidsetBlockDirty(BlockPos pos, boolean reRenderOnMainThread) voidsetBlockDirty(BlockPos pos, BlockState oldState, BlockState newState) voidsetBlocksDirty(int minX, int minY, int minZ, int maxX, int maxY, int maxZ) Re-renders all blocks in the specified range.voidsetLevel(ClientLevel level) voidsetSectionDirty(int sectionX, int sectionY, int sectionZ) private voidsetSectionDirty(int sectionX, int sectionY, int sectionZ, boolean reRenderOnMainThread) voidsetSectionDirtyWithNeighbors(int sectionX, int sectionY, int sectionZ) voidsetSectionRangeDirty(int minY, int minX, int minZ, int maxY, int maxX, int maxZ) booleanprivate voidsubmitBlockEntities(PoseStack poseStack, LevelRenderState renderState, SubmitNodeStorage nodeStorage) private voidsubmitEntities(PoseStack poseStack, LevelRenderState renderState, SubmitNodeCollector nodeCollector) voidMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.minecraft.server.packs.resources.PreparableReloadListener
getName, prepareSharedStateMethods inherited from interface net.minecraft.server.packs.resources.ResourceManagerReloadListener
reload
-
Field Details
-
LOGGER
private static final org.slf4j.Logger LOGGER -
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:
-
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 -
captureFrustum
private boolean captureFrustum -
capturedFrustum
-
lastTranslucentSortBlockPos
-
translucencyResortIterationIndex
private int translucencyResortIterationIndex -
levelRenderState
-
submitNodeStorage
-
featureRenderDispatcher
-
-
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() -
getEntityStatistics
-
cullTerrain
-
offsetFrustum
-
applyFrustum
-
addRecentlyCompiledSection
-
prepareCullFrustum
-
renderLevel
public void renderLevel(GraphicsResourceAllocator graphicsResourceAllocator, DeltaTracker deltaTracker, boolean renderBlockOutline, Camera camera, Matrix4f frustumMatrix, Matrix4f projectionMatrix, Matrix4f cullingProjectionMatrix, GpuBufferSlice shaderFog, Vector4f fogColor, boolean renderSky) -
addMainPass
private void addMainPass(FrameGraphBuilder frameGraphBuilder, Frustum frustum, Matrix4f frustumMatrix, GpuBufferSlice shaderFog, boolean renderBlockOutline, LevelRenderState renderState, DeltaTracker deltaTracker, ProfilerFiller profier) -
addParticlesPass
@Deprecated private void addParticlesPass(FrameGraphBuilder frameGraphBuilder, GpuBufferSlice shaderFog) Deprecated.Neo: useaddParticlesPass(FrameGraphBuilder, GpuBufferSlice, Matrix4f)instead -
addParticlesPass
private void addParticlesPass(FrameGraphBuilder frameGraphBuilder, GpuBufferSlice shaderFog, Matrix4f modelViewMatrix) -
addCloudsPass
@Deprecated private void addCloudsPass(FrameGraphBuilder frameGraphBuilder, CloudStatus cloudStatus, Vec3 cameraPosition, float ticks, int cloudColor, float cloudHeight) Deprecated. -
addCloudsPass
private void addCloudsPass(FrameGraphBuilder frameGraphBuilder, CloudStatus cloudStatus, Vec3 cameraPosition, float ticks, int cloudColor, float cloudHeight, Matrix4f modelViewMatrix) -
addWeatherPass
@Deprecated private void addWeatherPass(FrameGraphBuilder frameGraphBuilder, Vec3 cameraPosition, GpuBufferSlice shaderFog) Deprecated.Neo: useaddWeatherPass(FrameGraphBuilder, Vec3, GpuBufferSlice, Matrix4f)instead -
addWeatherPass
private void addWeatherPass(FrameGraphBuilder frameGraphBuilder, Vec3 cameraPosition, GpuBufferSlice shaderFog, Matrix4f modelViewMatrix) -
addLateDebugPass
private void addLateDebugPass(FrameGraphBuilder frameGraphBuilder, Vec3 cameraPosition, GpuBufferSlice shaderFog, Frustum frustum) -
extractVisibleEntities
private void extractVisibleEntities(Camera camera, Frustum frustum, DeltaTracker deltaTracker, LevelRenderState renderState) -
submitEntities
private void submitEntities(PoseStack poseStack, LevelRenderState renderState, SubmitNodeCollector nodeCollector) -
extractVisibleBlockEntities
@Deprecated private void extractVisibleBlockEntities(Camera camera, float partialTick, LevelRenderState renderState) Deprecated. -
extractVisibleBlockEntities
private void extractVisibleBlockEntities(Camera camera, float partialTick, LevelRenderState renderState, @Nullable Frustum frustum) -
submitBlockEntities
private void submitBlockEntities(PoseStack poseStack, LevelRenderState renderState, SubmitNodeStorage nodeStorage) -
extractBlockDestroyAnimation
-
renderBlockDestroyAnimation
private void renderBlockDestroyAnimation(PoseStack poseStack, MultiBufferSource.BufferSource bufferSource, LevelRenderState renderState) -
extractBlockOutline
-
renderBlockOutline
private void renderBlockOutline(MultiBufferSource.BufferSource bufferSource, PoseStack poseStack, boolean translucent, LevelRenderState renderState) -
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 cameraPosition, boolean force, boolean ignoreAxisAlignment) -
prepareChunkRenders
private ChunkSectionsToRender prepareChunkRenders(Matrix4fc frustumMatrix, double x, double y, double z) -
endFrame
public void endFrame() -
captureFrustum
public void captureFrustum() -
killFrustum
public void killFrustum() -
tick
-
removeBlockBreakingProgress
private void removeBlockBreakingProgress() -
removeProgress
-
addSkyPass
@Deprecated private void addSkyPass(FrameGraphBuilder frameGraphBuilder, Camera camera, GpuBufferSlice shaderFog) Deprecated.Neo: useaddSkyPass(FrameGraphBuilder, Camera, GpuBufferSlice, Matrix4f)instead -
addSkyPass
private void addSkyPass(FrameGraphBuilder frameGraphBuilder, Camera camera, GpuBufferSlice shaderFog, Matrix4f modelViewMatrix) -
doesMobEffectBlockSky
-
compileSections
-
renderHitOutline
private void renderHitOutline(PoseStack poseStack, VertexConsumer consumer, double camX, double camY, double camZ, BlockOutlineRenderState outlineRenderState, int color) -
blockChanged
public void blockChanged(BlockGetter level, BlockPos pos, BlockState oldState, BlockState newState, int flags) -
setBlockDirty
-
setBlocksDirty
public void setBlocksDirty(int minX, int minY, int minZ, int maxX, int maxY, int maxZ) Re-renders all blocks in the specified range. -
setBlockDirty
-
setSectionDirtyWithNeighbors
public void setSectionDirtyWithNeighbors(int sectionX, int sectionY, int sectionZ) -
setSectionRangeDirty
public void setSectionRangeDirty(int minY, int minX, int minZ, int maxY, int maxX, int maxZ) -
setSectionDirty
public void setSectionDirty(int sectionX, int sectionY, int sectionZ) -
setSectionDirty
private void setSectionDirty(int sectionX, int sectionY, int sectionZ, boolean reRenderOnMainThread) -
onSectionBecomingNonEmpty
public void onSectionBecomingNonEmpty(long sectionPos) -
destroyBlockProgress
-
hasRenderedAllSections
public boolean hasRenderedAllSections() -
onChunkReadyToRender
-
needsUpdate
public void needsUpdate() -
getLightColor
-
getLightColor
public static int getLightColor(LevelRenderer.BrightnessGetter brightnessGetter, BlockAndTintGetter level, BlockState state, BlockPos pos) -
isSectionCompiled
-
entityOutlineTarget
-
getTranslucentTarget
-
getItemEntityTarget
-
getParticlesTarget
-
getWeatherTarget
-
getCloudsTarget
-
getVisibleSections
public it.unimi.dsi.fastutil.objects.ObjectArrayList<SectionRenderDispatcher.RenderSection> getVisibleSections() -
getSectionOcclusionGraph
-
getCapturedFrustum
-
getCloudRenderer
-
getTicks
public int getTicks() -
iterateVisibleBlockEntities
-
getRenderableSections
-
addCloudsPass(FrameGraphBuilder, CloudStatus, Vec3, float, int, float, Matrix4f)instead