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 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 pMinecraft, EntityRenderDispatcher pEntityRenderDispatcher, BlockEntityRenderDispatcher pBlockEntityRenderDispatcher, RenderBuffers pRenderBuffers) -
Method Summary
Modifier and TypeMethodDescriptionprivate voidaddCloudsPass(FrameGraphBuilder pFrameGraphBuilder, Matrix4f pFrustumMatrix, Matrix4f pProjectionMatrix, CloudStatus pCloudStatus, Vec3 pCameraPosition, float pAgeInTicks, int pHeight, float pTicks) private voidaddLateDebugPass(FrameGraphBuilder pFrameGraphBuilder, Vec3 pCameraPosition, FogParameters pFog) private voidaddMainPass(FrameGraphBuilder pFrameGraphBuilder, Frustum pFrustum, Camera pCamera, Matrix4f pFrustumMatrix, Matrix4f pProjectionMatrix, FogParameters pFogParameters, boolean pRenderBlockOutline, boolean pRenderEntityOutline, DeltaTracker pDeltaTracker, ProfilerFiller pProfiler) voidaddParticle(ParticleOptions pOptions, boolean pForce, boolean pDecreased, double pX, double pY, double pZ, double pXSpeed, double pYSpeed, double pZSpeed) voidaddParticle(ParticleOptions pOptions, boolean pForce, double pX, double pY, double pZ, double pXSpeed, double pYSpeed, double pZSpeed) <T extends ParticleOptions>
voidaddParticle(T pOptions, double pX, double pY, double pZ, double pXSpeed, double pYSpeed, double pZSpeed) private ParticleaddParticleInternal(ParticleOptions pOptions, boolean pForce, boolean pDecreased, double pX, double pY, double pZ, double pXSpeed, double pYSpeed, double pZSpeed) (package private) ParticleaddParticleInternal(ParticleOptions pOptions, boolean pForce, double pX, double pY, double pZ, double pXSpeed, double pYSpeed, double pZSpeed) private voidaddParticlesPass(FrameGraphBuilder pFrameGraphBuilder, Camera pCamera, float pPartialTick, FogParameters pFog) Deprecated.private voidaddParticlesPass(FrameGraphBuilder pFrameGraphBuilder, Camera pCamera, float pPartialTick, FogParameters pFog, Frustum frustum, Matrix4f modelViewMatrix, Matrix4f projectionMatrix) voidaddRecentlyCompiledSection(SectionRenderDispatcher.RenderSection pRenderSection) private voidaddSkyPass(FrameGraphBuilder pFrameGraphBuilder, Camera pCamera, float pPartialTick, FogParameters pFog) Deprecated.private voidaddSkyPass(FrameGraphBuilder pFrameGraphBuilder, Camera pCamera, float pPartialTick, FogParameters pFog, Matrix4f modelViewMatrix, Matrix4f projectionMatrix) private voidaddWeatherPass(FrameGraphBuilder pFrameGraphBuilder, Vec3 pCameraPosition, float pPartialTick, FogParameters pFog) Deprecated.private voidaddWeatherPass(FrameGraphBuilder pFrameGraphBuilder, Vec3 pCameraPosition, float pPartialTick, FogParameters pFog, Matrix4f modelViewMatrix, Matrix4f projectionMatrix, Camera camera) voidprivate voidapplyFrustum(Frustum pFrustum) voidblockChanged(BlockGetter pLevel, BlockPos pPos, BlockState pOldState, BlockState pNewState, int pFlags) private ParticleStatuscalculateParticleLevel(boolean pDecreased) voidprivate voidcheckPoseStack(PoseStack pPoseStack) Asserts that the specifiedposeStackis clear.private voidvoidclose()private booleancollectVisibleEntities(Camera pCamera, Frustum pFrustum, List<Entity> pOutput) private voidcompileSections(Camera pCamera) intvoiddestroyBlockProgress(int pBreakerId, BlockPos pPos, int pProgress) voidprivate booleandoesMobEffectBlockSky(Camera pCamera) doublestatic intgetLightColor(BlockAndTintGetter pLevel, BlockPos pPos) static intgetLightColor(BlockAndTintGetter pLevel, BlockState pState, BlockPos pPos) Iterable<? extends IRenderableSection> intgetTicks()doubleprivate PostChainit.unimi.dsi.fastutil.objects.ObjectArrayList<SectionRenderDispatcher.RenderSection> booleanvoidbooleanisSectionCompiled(BlockPos pPos) voiditerateVisibleBlockEntities(Consumer<BlockEntity> blockEntityConsumer) voidvoidstatic FrustumoffsetFrustum(Frustum pFrustum) voidonChunkReadyToRender(ChunkPos pChunkPos) voidonResourceManagerReload(ResourceManager pResourceManager) voidonSectionBecomingNonEmpty(long pSectionPos) voidprepareCullFrustum(Vec3 pCameraPosition, Matrix4f pFrustumMatrix, Matrix4f pProjectionMatrix) private voidremoveProgress(BlockDestructionProgress pProgress) private voidrenderBlockDestroyAnimation(PoseStack pPoseStack, Camera pCamera, MultiBufferSource.BufferSource pBufferSource) private voidrenderBlockEntities(PoseStack pPoseStack, MultiBufferSource.BufferSource pBufferSource, MultiBufferSource.BufferSource pCrumblingBufferSource, Camera pCamera, float pPartialTick) private voidrenderBlockOutline(Camera pCamera, MultiBufferSource.BufferSource pBufferSource, PoseStack pPoseStack, boolean pSort) private voidrenderEntities(PoseStack pPoseStack, MultiBufferSource.BufferSource pBufferSource, Camera pCamera, DeltaTracker pDeltaTracker, List<Entity> pEntities) private voidrenderEntity(Entity pEntity, double pCamX, double pCamY, double pCamZ, float pPartialTick, PoseStack pPoseStack, MultiBufferSource pBufferSource) private voidrenderHitOutline(PoseStack pPoseStack, VertexConsumer pBuffer, Entity pEntity, double pCamX, double pCamY, double pCamZ, BlockPos pPos, BlockState pState, int pColor) voidrenderLevel(GraphicsResourceAllocator pGraphicsResourceAllocator, DeltaTracker pDeltaTracker, boolean pRenderBlockOutline, Camera pCamera, GameRenderer pGameRenderer, Matrix4f pFrustumMatrix, Matrix4f pProjectionMatrix) private voidrenderSectionLayer(RenderType pRenderType, double pX, double pY, double pZ, Matrix4f pFrustrumMatrix, Matrix4f pProjectionMatrix) voidresize(int pWidth, int pHeight) private voidscheduleResort(SectionRenderDispatcher.RenderSection pSection, SectionRenderDispatcher.TranslucencyPointOfView pPointOfView, Vec3 pCameraPosition, boolean pForce, boolean pIgnoreAxisAlignment) private voidscheduleTranslucentSectionResort(Vec3 pCameraPosition) private voidsetBlockDirty(BlockPos pPos, boolean pReRenderOnMainThread) voidsetBlockDirty(BlockPos pPos, BlockState pOldState, BlockState pNewState) voidsetBlocksDirty(int pMinX, int pMinY, int pMinZ, int pMaxX, int pMaxY, int pMaxZ) Re-renders all blocks in the specified range.voidsetLevel(ClientLevel pLevel) voidsetSectionDirty(int pSectionX, int pSectionY, int pSectionZ) private voidsetSectionDirty(int pSectionX, int pSectionY, int pSectionZ, boolean pReRenderOnMainThread) voidsetSectionDirtyWithNeighbors(int pSectionX, int pSectionY, int pSectionZ) voidsetSectionRangeDirty(int pMinY, int pMinX, int pMinZ, int pMaxY, int pMaxX, int pMaxZ) private voidsetupRender(Camera pCamera, Frustum pFrustum, boolean pHasCapturedFrustum, boolean pIsSpectator) private booleanshouldRenderDarkDisc(float pPartialTick) booleanvoidtick()voidtickParticles(Camera pCamera) voidupdateGlobalBlockEntities(Collection<BlockEntity> pBlockEntitiesToRemove, Collection<BlockEntity> pBlockEntitiesToAdd) 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 pMinecraft, EntityRenderDispatcher pEntityRenderDispatcher, BlockEntityRenderDispatcher pBlockEntityRenderDispatcher, RenderBuffers pRenderBuffers)
-
-
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:
pLevel- the level to set, ornullto clear
-
clearVisibleSections
private void clearVisibleSections() -
allChanged
public void allChanged() -
resize
public void resize(int pWidth, int pHeight) -
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 pGraphicsResourceAllocator, DeltaTracker pDeltaTracker, boolean pRenderBlockOutline, Camera pCamera, GameRenderer pGameRenderer, Matrix4f pFrustumMatrix, Matrix4f pProjectionMatrix) -
addMainPass
private void addMainPass(FrameGraphBuilder pFrameGraphBuilder, Frustum pFrustum, Camera pCamera, Matrix4f pFrustumMatrix, Matrix4f pProjectionMatrix, FogParameters pFogParameters, boolean pRenderBlockOutline, boolean pRenderEntityOutline, DeltaTracker pDeltaTracker, ProfilerFiller pProfiler) -
addParticlesPass
@Deprecated private void addParticlesPass(FrameGraphBuilder pFrameGraphBuilder, Camera pCamera, float pPartialTick, FogParameters pFog) Deprecated. -
addParticlesPass
private void addParticlesPass(FrameGraphBuilder pFrameGraphBuilder, Camera pCamera, float pPartialTick, FogParameters pFog, Frustum frustum, Matrix4f modelViewMatrix, Matrix4f projectionMatrix) -
addCloudsPass
private void addCloudsPass(FrameGraphBuilder pFrameGraphBuilder, Matrix4f pFrustumMatrix, Matrix4f pProjectionMatrix, CloudStatus pCloudStatus, Vec3 pCameraPosition, float pAgeInTicks, int pHeight, float pTicks) -
addWeatherPass
@Deprecated private void addWeatherPass(FrameGraphBuilder pFrameGraphBuilder, Vec3 pCameraPosition, float pPartialTick, FogParameters pFog) Deprecated. -
addWeatherPass
private void addWeatherPass(FrameGraphBuilder pFrameGraphBuilder, Vec3 pCameraPosition, float pPartialTick, FogParameters pFog, Matrix4f modelViewMatrix, Matrix4f projectionMatrix, Camera camera) -
addLateDebugPass
private void addLateDebugPass(FrameGraphBuilder pFrameGraphBuilder, Vec3 pCameraPosition, FogParameters pFog) -
collectVisibleEntities
-
renderEntities
private void renderEntities(PoseStack pPoseStack, MultiBufferSource.BufferSource pBufferSource, Camera pCamera, DeltaTracker pDeltaTracker, List<Entity> pEntities) -
renderBlockEntities
private void renderBlockEntities(PoseStack pPoseStack, MultiBufferSource.BufferSource pBufferSource, MultiBufferSource.BufferSource pCrumblingBufferSource, Camera pCamera, float pPartialTick) -
renderBlockDestroyAnimation
private void renderBlockDestroyAnimation(PoseStack pPoseStack, Camera pCamera, MultiBufferSource.BufferSource pBufferSource) -
renderBlockOutline
private void renderBlockOutline(Camera pCamera, MultiBufferSource.BufferSource pBufferSource, PoseStack pPoseStack, boolean pSort) -
checkPoseStack
Asserts that the specifiedposeStackis clear.- Throws:
IllegalStateException- if the specifiedposeStackis not clear
-
renderEntity
private void renderEntity(Entity pEntity, double pCamX, double pCamY, double pCamZ, float pPartialTick, PoseStack pPoseStack, MultiBufferSource pBufferSource) -
scheduleTranslucentSectionResort
-
scheduleResort
private void scheduleResort(SectionRenderDispatcher.RenderSection pSection, SectionRenderDispatcher.TranslucencyPointOfView pPointOfView, Vec3 pCameraPosition, boolean pForce, boolean pIgnoreAxisAlignment) - Parameters:
pForce- Iftrue, will schedule a resort even if the point of view hasn't changed
-
renderSectionLayer
private void renderSectionLayer(RenderType pRenderType, double pX, double pY, double pZ, Matrix4f pFrustrumMatrix, Matrix4f pProjectionMatrix) -
captureFrustum
public void captureFrustum() -
killFrustum
public void killFrustum() -
tick
public void tick() -
removeProgress
-
addSkyPass
@Deprecated private void addSkyPass(FrameGraphBuilder pFrameGraphBuilder, Camera pCamera, float pPartialTick, FogParameters pFog) Deprecated. -
addSkyPass
private void addSkyPass(FrameGraphBuilder pFrameGraphBuilder, Camera pCamera, float pPartialTick, FogParameters pFog, Matrix4f modelViewMatrix, Matrix4f projectionMatrix) -
shouldRenderDarkDisc
private boolean shouldRenderDarkDisc(float pPartialTick) -
doesMobEffectBlockSky
-
compileSections
-
renderHitOutline
private void renderHitOutline(PoseStack pPoseStack, VertexConsumer pBuffer, Entity pEntity, double pCamX, double pCamY, double pCamZ, BlockPos pPos, BlockState pState, int pColor) -
blockChanged
public void blockChanged(BlockGetter pLevel, BlockPos pPos, BlockState pOldState, BlockState pNewState, int pFlags) -
setBlockDirty
-
setBlocksDirty
public void setBlocksDirty(int pMinX, int pMinY, int pMinZ, int pMaxX, int pMaxY, int pMaxZ) Re-renders all blocks in the specified range. -
setBlockDirty
-
setSectionDirtyWithNeighbors
public void setSectionDirtyWithNeighbors(int pSectionX, int pSectionY, int pSectionZ) -
setSectionRangeDirty
public void setSectionRangeDirty(int pMinY, int pMinX, int pMinZ, int pMaxY, int pMaxX, int pMaxZ) -
setSectionDirty
public void setSectionDirty(int pSectionX, int pSectionY, int pSectionZ) -
setSectionDirty
private void setSectionDirty(int pSectionX, int pSectionY, int pSectionZ, boolean pReRenderOnMainThread) -
onSectionBecomingNonEmpty
public void onSectionBecomingNonEmpty(long pSectionPos) -
addParticle
public void addParticle(ParticleOptions pOptions, boolean pForce, double pX, double pY, double pZ, double pXSpeed, double pYSpeed, double pZSpeed) - Parameters:
pForce- 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 pOptions, boolean pForce, boolean pDecreased, double pX, double pY, double pZ, double pXSpeed, double pYSpeed, double pZSpeed) - Parameters:
pForce- iftrue, the particle will be created regardless of its distance from the camera and thecalculateParticleLevel(boolean) calculated particle level}invalid @linkplain
{@linkplain #pDecreased- 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 pOptions, double pX, double pY, double pZ, double pXSpeed, double pYSpeed, double pZSpeed) -
addParticleInternal
@Nullable Particle addParticleInternal(ParticleOptions pOptions, boolean pForce, double pX, double pY, double pZ, double pXSpeed, double pYSpeed, double pZSpeed) - Parameters:
pForce- 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 pOptions, boolean pForce, boolean pDecreased, double pX, double pY, double pZ, double pXSpeed, double pYSpeed, double pZSpeed) - Parameters:
pForce- iftrue, the particle will be created regardless of its distance from the camera and thecalculateParticleLevel(boolean) calculated particle level}invalid @linkplain
{@linkplain #pDecreased- 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> pBlockEntitiesToRemove, Collection<BlockEntity> pBlockEntitiesToAdd) -
getLightColor
-
getLightColor
-
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
-
addParticlesPass(FrameGraphBuilder, Camera, float, FogParameters, Frustum, Matrix4f, Matrix4f)instead