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 ResourceLocationprivate RenderTargetprivate final EntityRenderDispatcherprivate final Set<BlockEntity> Global block entities; these are always rendered, even if off-screen.static 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, org.joml.Matrix4f modelViewMatrix, org.joml.Matrix4f projectionMatrix) private voidaddLateDebugPass(FrameGraphBuilder frameGraphBuilder, Vec3 cameraPosition, FogParameters fog) private voidaddMainPass(FrameGraphBuilder frameGraphBuilder, Frustum frustum, Camera camera, org.joml.Matrix4f frustumMatrix, org.joml.Matrix4f projectionMatrix, FogParameters fogParameters, 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, FogParameters fog) Deprecated.private voidaddParticlesPass(FrameGraphBuilder frameGraphBuilder, Camera camera, float partialTick, FogParameters fog, Frustum frustum, org.joml.Matrix4f modelViewMatrix, org.joml.Matrix4f projectionMatrix) voidaddRecentlyCompiledSection(SectionRenderDispatcher.RenderSection renderSection) private voidaddSkyPass(FrameGraphBuilder frameGraphBuilder, Camera camera, float partialTick, FogParameters fog) Deprecated.private voidaddSkyPass(FrameGraphBuilder frameGraphBuilder, Camera camera, float partialTick, FogParameters fog, org.joml.Matrix4f modelViewMatrix, org.joml.Matrix4f projectionMatrix) private voidaddWeatherPass(FrameGraphBuilder frameGraphBuilder, Vec3 cameraPosition, float partialTick, FogParameters fog) Deprecated.private voidaddWeatherPass(FrameGraphBuilder frameGraphBuilder, Vec3 cameraPosition, float partialTick, FogParameters fog, org.joml.Matrix4f modelViewMatrix, org.joml.Matrix4f projectionMatrix, 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) 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) voidprepareCullFrustum(Vec3 cameraPosition, org.joml.Matrix4f frustumMatrix, org.joml.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, GameRenderer gameRenderer, org.joml.Matrix4f frustumMatrix, org.joml.Matrix4f projectionMatrix) private voidrenderSectionLayer(RenderType renderType, double x, double y, double z, org.joml.Matrix4f frustrumMatrix, org.joml.Matrix4f projectionMatrix) voidresize(int width, int height) private voidscheduleResort(SectionRenderDispatcher.RenderSection section, SectionRenderDispatcher.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) voidupdateGlobalBlockEntities(Collection<BlockEntity> blockEntitiesToRemove, Collection<BlockEntity> blockEntitiesToAdd) 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:
-
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 -
globalBlockEntities
Global block entities; these are always rendered, even if off-screen. Any block entity is added to this ifBlockEntityRenderer.shouldRenderOffScreen(net.minecraft.world.level.block.entity.BlockEntity)returnstrue. -
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
public void prepareCullFrustum(Vec3 cameraPosition, org.joml.Matrix4f frustumMatrix, org.joml.Matrix4f projectionMatrix) -
renderLevel
public void renderLevel(GraphicsResourceAllocator graphicsResourceAllocator, DeltaTracker deltaTracker, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, org.joml.Matrix4f frustumMatrix, org.joml.Matrix4f projectionMatrix) -
addMainPass
private void addMainPass(FrameGraphBuilder frameGraphBuilder, Frustum frustum, Camera camera, org.joml.Matrix4f frustumMatrix, org.joml.Matrix4f projectionMatrix, FogParameters fogParameters, boolean renderBlockOutline, boolean renderEntityOutline, DeltaTracker deltaTracker, ProfilerFiller profiler) -
addParticlesPass
@Deprecated private void addParticlesPass(FrameGraphBuilder frameGraphBuilder, Camera camera, float partialTick, FogParameters fog) Deprecated. -
addParticlesPass
private void addParticlesPass(FrameGraphBuilder frameGraphBuilder, Camera camera, float partialTick, FogParameters fog, Frustum frustum, org.joml.Matrix4f modelViewMatrix, org.joml.Matrix4f projectionMatrix) -
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, org.joml.Matrix4f modelViewMatrix, org.joml.Matrix4f projectionMatrix) -
addWeatherPass
@Deprecated private void addWeatherPass(FrameGraphBuilder frameGraphBuilder, Vec3 cameraPosition, float partialTick, FogParameters fog) Deprecated. -
addWeatherPass
private void addWeatherPass(FrameGraphBuilder frameGraphBuilder, Vec3 cameraPosition, float partialTick, FogParameters fog, org.joml.Matrix4f modelViewMatrix, org.joml.Matrix4f projectionMatrix, Camera camera) -
addLateDebugPass
private void addLateDebugPass(FrameGraphBuilder frameGraphBuilder, Vec3 cameraPosition, FogParameters fog) -
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, SectionRenderDispatcher.TranslucencyPointOfView pointOfView, Vec3 cameraPosition, boolean force, boolean ignoreAxisAlignment) - Parameters:
force- Iftrue, will schedule a resort even if the point of view hasn't changed
-
renderSectionLayer
private void renderSectionLayer(RenderType renderType, double x, double y, double z, org.joml.Matrix4f frustrumMatrix, org.joml.Matrix4f projectionMatrix) -
captureFrustum
public void captureFrustum() -
killFrustum
public void killFrustum() -
tick
public void tick() -
removeProgress
-
addSkyPass
@Deprecated private void addSkyPass(FrameGraphBuilder frameGraphBuilder, Camera camera, float partialTick, FogParameters fog) Deprecated. -
addSkyPass
private void addSkyPass(FrameGraphBuilder frameGraphBuilder, Camera camera, float partialTick, FogParameters fog, org.joml.Matrix4f modelViewMatrix, org.joml.Matrix4f projectionMatrix) -
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() -
updateGlobalBlockEntities
public void updateGlobalBlockEntities(Collection<BlockEntity> blockEntitiesToRemove, Collection<BlockEntity> blockEntitiesToAdd) -
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, Matrix4f)instead