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 -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final BlockEntityRenderDispatcherprivate Frustumprivate booleanprivate final CloudRendererprivate Frustumprivate final it.unimi.dsi.fastutil.ints.Int2ObjectMap<BlockDestructionProgress> private final it.unimi.dsi.fastutil.longs.Long2ObjectMap<SortedSet<BlockDestructionProgress>> private static final Comparator<Entity> private static final ResourceLocationprivate RenderTargetprivate final EntityRenderDispatcherstatic final intprivate intprivate intprivate intprivate BlockPosprivate intprivate ClientLevelprivate static final org.slf4j.Loggerprivate final Minecraftprivate static final intstatic final intprivate final it.unimi.dsi.fastutil.objects.ObjectArrayList<SectionRenderDispatcher.RenderSection> private doubleprivate doubleprivate doubleprivate doubleprivate doubleprivate final RenderBuffersstatic final intprivate final SectionOcclusionGraphprivate SectionRenderDispatcherprivate final SkyRendererprivate final LevelTargetBundleprivate intprivate intprivate static final ResourceLocationprivate ViewAreaprivate intprivate 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) -
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) private voidaddMainPass(FrameGraphBuilder frameGraphBuilder, Frustum frustum, Camera camera, Matrix4f frustumMatrix, GpuBufferSlice shaderFog, boolean renderBlockOutline, boolean renderEntityOutline, DeltaTracker deltaTracker, ProfilerFiller profiler) voidaddParticle(ParticleOptions options, boolean force, boolean decreased, double x, double y, double z, double xSpeed, double ySpeed, double zSpeed) voidaddParticle(ParticleOptions options, boolean force, double x, double y, double z, double xSpeed, double ySpeed, double zSpeed) <T extends ParticleOptions>
voidaddParticle(T options, double x, double y, double z, double xSpeed, double ySpeed, double zSpeed) private ParticleaddParticleInternal(ParticleOptions options, boolean force, boolean decreased, double x, double y, double z, double xSpeed, double ySpeed, double zSpeed) (package private) ParticleaddParticleInternal(ParticleOptions options, boolean force, double x, double y, double z, double xSpeed, double ySpeed, double zSpeed) private voidaddParticlesPass(FrameGraphBuilder frameGraphBuilder, Camera camera, float partialTick, GpuBufferSlice shaderFog) Deprecated.private voidaddParticlesPass(FrameGraphBuilder frameGraphBuilder, Camera camera, float partialTick, GpuBufferSlice shaderFog, Frustum frustum, Matrix4f modelViewMatrix) voidaddRecentlyCompiledSection(SectionRenderDispatcher.RenderSection renderSection) private voidaddSkyPass(FrameGraphBuilder frameGraphBuilder, Camera camera, float partialTick, GpuBufferSlice shaderFog) Deprecated.private voidaddSkyPass(FrameGraphBuilder frameGraphBuilder, Camera camera, float partialTick, GpuBufferSlice shaderFog, Matrix4f modelViewMatrix) private voidaddWeatherPass(FrameGraphBuilder frameGraphBuilder, Vec3 cameraPosition, float partialTick, GpuBufferSlice shaderFog) Deprecated.private voidaddWeatherPass(FrameGraphBuilder frameGraphBuilder, Vec3 cameraPosition, float partialTick, GpuBufferSlice shaderFog, Matrix4f modelViewMatrix, Camera camera) voidprivate voidapplyFrustum(Frustum frustum) voidblockChanged(BlockGetter level, BlockPos pos, BlockState oldState, BlockState newState, int flags) private ParticleStatuscalculateParticleLevel(boolean decreased) voidprivate voidcheckPoseStack(PoseStack poseStack) Asserts that the specifiedposeStackis.invalid reference
clear
private voidvoidclose()private booleancollectVisibleEntities(Camera camera, Frustum frustum, List<Entity> output) private voidcompileSections(Camera camera) intvoiddestroyBlockProgress(int breakerId, BlockPos pos, int progress) voidprivate booleandoesMobEffectBlockSky(Camera camera) voidendFrame()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) voidprepareCullFrustum(Vec3 cameraPosition, Matrix4f frustumMatrix, Matrix4f projectionMatrix) private voidremoveProgress(BlockDestructionProgress progress) private voidrenderBlockDestroyAnimation(PoseStack poseStack, Camera camera, MultiBufferSource.BufferSource bufferSource) private voidrenderBlockEntities(PoseStack poseStack, MultiBufferSource.BufferSource bufferSource, MultiBufferSource.BufferSource crumblingBufferSource, Camera camera, float partialTick) private voidrenderBlockOutline(Camera camera, MultiBufferSource.BufferSource bufferSource, PoseStack poseStack, boolean sort) private voidrenderEntities(PoseStack poseStack, MultiBufferSource.BufferSource bufferSource, Camera camera, DeltaTracker deltaTracker, List<Entity> entities) private voidrenderEntity(Entity entity, double camX, double camY, double camZ, float partialTick, PoseStack poseStack, MultiBufferSource bufferSource) private voidrenderHitOutline(PoseStack poseStack, VertexConsumer buffer, Entity entity, double camX, double camY, double camZ, BlockPos pos, BlockState state, int color) voidrenderLevel(GraphicsResourceAllocator graphicsResourceAllocator, DeltaTracker deltaTracker, boolean renderBlockOutline, Camera camera, Matrix4f frustumMatrix, Matrix4f projectionMatrix, GpuBufferSlice fogBuffer, 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) private voidsetupRender(Camera camera, Frustum frustum, boolean hasCapturedFrustum, boolean isSpectator) private booleanshouldRenderDarkDisc(float partialTick) booleanvoidtick()voidtickParticles(Camera camera) Methods 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
getNameMethods 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:
-
ENTITY_COMPARATOR
-
minecraft
-
entityRenderDispatcher
-
blockEntityRenderDispatcher
-
renderBuffers
-
skyRenderer
-
cloudRenderer
-
worldBorderRenderer
-
weatherEffectRenderer
-
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 -
visibleEntities
-
visibleEntityCount
private int visibleEntityCount -
cullingFrustum
-
captureFrustum
private boolean captureFrustum -
capturedFrustum
-
lastTranslucentSortBlockPos
-
translucencyResortIterationIndex
private int translucencyResortIterationIndex
-
-
Constructor Details
-
LevelRenderer
public LevelRenderer(Minecraft minecraft, EntityRenderDispatcher entityRenderDispatcher, BlockEntityRenderDispatcher blockEntityRenderDispatcher, RenderBuffers renderBuffers)
-
-
Method Details
-
tickParticles
-
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
-
setupRender
-
offsetFrustum
-
applyFrustum
-
addRecentlyCompiledSection
-
prepareCullFrustum
-
renderLevel
public void renderLevel(GraphicsResourceAllocator graphicsResourceAllocator, DeltaTracker deltaTracker, boolean renderBlockOutline, Camera camera, Matrix4f frustumMatrix, Matrix4f projectionMatrix, GpuBufferSlice fogBuffer, Vector4f fogColor, boolean renderSky) -
addMainPass
private void addMainPass(FrameGraphBuilder frameGraphBuilder, Frustum frustum, Camera camera, Matrix4f frustumMatrix, GpuBufferSlice shaderFog, boolean renderBlockOutline, boolean renderEntityOutline, DeltaTracker deltaTracker, ProfilerFiller profiler) -
addParticlesPass
@Deprecated private void addParticlesPass(FrameGraphBuilder frameGraphBuilder, Camera camera, float partialTick, GpuBufferSlice shaderFog) Deprecated. -
addParticlesPass
private void addParticlesPass(FrameGraphBuilder frameGraphBuilder, Camera camera, float partialTick, GpuBufferSlice shaderFog, Frustum frustum, 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, float partialTick, GpuBufferSlice shaderFog) Deprecated. -
addWeatherPass
private void addWeatherPass(FrameGraphBuilder frameGraphBuilder, Vec3 cameraPosition, float partialTick, GpuBufferSlice shaderFog, Matrix4f modelViewMatrix, Camera camera) -
addLateDebugPass
private void addLateDebugPass(FrameGraphBuilder frameGraphBuilder, Vec3 cameraPosition, GpuBufferSlice shaderFog) -
collectVisibleEntities
-
renderEntities
private void renderEntities(PoseStack poseStack, MultiBufferSource.BufferSource bufferSource, Camera camera, DeltaTracker deltaTracker, List<Entity> entities) -
renderBlockEntities
private void renderBlockEntities(PoseStack poseStack, MultiBufferSource.BufferSource bufferSource, MultiBufferSource.BufferSource crumblingBufferSource, Camera camera, float partialTick) -
renderBlockDestroyAnimation
private void renderBlockDestroyAnimation(PoseStack poseStack, Camera camera, MultiBufferSource.BufferSource bufferSource) -
renderBlockOutline
private void renderBlockOutline(Camera camera, MultiBufferSource.BufferSource bufferSource, PoseStack poseStack, boolean sort) -
checkPoseStack
Asserts that the specifiedposeStackis.invalid reference
clear
- Throws:
IllegalStateException- if the specifiedposeStackis not clear
-
renderEntity
private void renderEntity(Entity entity, double camX, double camY, double camZ, float partialTick, PoseStack poseStack, MultiBufferSource bufferSource) -
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
public void tick() -
removeProgress
-
addSkyPass
@Deprecated private void addSkyPass(FrameGraphBuilder frameGraphBuilder, Camera camera, float partialTick, GpuBufferSlice shaderFog) Deprecated. -
addSkyPass
private void addSkyPass(FrameGraphBuilder frameGraphBuilder, Camera camera, float partialTick, GpuBufferSlice shaderFog, Matrix4f modelViewMatrix) -
shouldRenderDarkDisc
private boolean shouldRenderDarkDisc(float partialTick) -
doesMobEffectBlockSky
-
compileSections
-
renderHitOutline
private void renderHitOutline(PoseStack poseStack, VertexConsumer buffer, Entity entity, double camX, double camY, double camZ, BlockPos pos, BlockState state, 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) -
addParticle
public void addParticle(ParticleOptions options, boolean force, double x, double y, double z, double xSpeed, double ySpeed, double zSpeed) - Parameters:
force- iftrue, the particle will be created regardless of its distance from the camera and thecalculateParticleLevel(boolean) calculated particle level}invalid @linkplain
{@linkplain #
-
addParticle
public void addParticle(ParticleOptions options, boolean force, boolean decreased, double x, double y, double z, double xSpeed, double ySpeed, double zSpeed) - Parameters:
force- iftrue, the particle will be created regardless of its distance from the camera and thecalculateParticleLevel(boolean) calculated particle level}invalid @linkplain
{@linkplain #decreased- iftrue, and the particles option is set to minimal, attempts to spawn the particle at a decreased level
-
addParticle
public <T extends ParticleOptions> void addParticle(T options, double x, double y, double z, double xSpeed, double ySpeed, double zSpeed) -
addParticleInternal
@Nullable Particle addParticleInternal(ParticleOptions options, boolean force, double x, double y, double z, double xSpeed, double ySpeed, double zSpeed) - Parameters:
force- iftrue, the particle will be created regardless of its distance from the camera and thecalculateParticleLevel(boolean) calculated particle level}invalid @linkplain
{@linkplain #
-
addParticleInternal
@Nullable private Particle addParticleInternal(ParticleOptions options, boolean force, boolean decreased, double x, double y, double z, double xSpeed, double ySpeed, double zSpeed) - Parameters:
force- iftrue, the particle will be created regardless of its distance from the camera and thecalculateParticleLevel(boolean) calculated particle level}invalid @linkplain
{@linkplain #decreased- iftrue, and the particles option is set to minimal, attempts to spawn the particle at a decreased level
-
calculateParticleLevel
-
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
-
getFrustum
-
getTicks
public int getTicks() -
iterateVisibleBlockEntities
-
getRenderableSections
-
addCloudsPass(FrameGraphBuilder, CloudStatus, Vec3, float, int, float, Matrix4f)instead