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 BlockEntityRenderDispatcher
private Frustum
private boolean
private final CloudRenderer
private Frustum
private final it.unimi.dsi.fastutil.ints.Int2ObjectMap
<BlockDestructionProgress> private final it.unimi.dsi.fastutil.longs.Long2ObjectMap
<SortedSet<BlockDestructionProgress>> private static final ResourceLocation
private RenderTarget
private final EntityRenderDispatcher
private final Set
<BlockEntity> Global block entities; these are always rendered, even if off-screen.static final int
private int
private int
private int
private BlockPos
private int
private ClientLevel
private static final org.slf4j.Logger
private final Minecraft
private static final int
static final int
private final it.unimi.dsi.fastutil.objects.ObjectArrayList
<SectionRenderDispatcher.RenderSection> private double
private double
private double
private double
private double
private final RenderBuffers
static final int
private final SectionOcclusionGraph
private SectionRenderDispatcher
private final SkyRenderer
private final LevelTargetBundle
private int
private int
private static final ResourceLocation
private ViewArea
private int
private final it.unimi.dsi.fastutil.objects.ObjectArrayList
<SectionRenderDispatcher.RenderSection> private final WeatherEffectRenderer
private final WorldBorderRenderer
-
Constructor Summary
ConstructorsConstructorDescriptionLevelRenderer
(Minecraft pMinecraft, EntityRenderDispatcher pEntityRenderDispatcher, BlockEntityRenderDispatcher pBlockEntityRenderDispatcher, RenderBuffers pRenderBuffers) -
Method Summary
Modifier and TypeMethodDescriptionprivate void
addCloudsPass
(FrameGraphBuilder pFrameGraphBuilder, CloudStatus pCloudStatus, Vec3 pCameraPosition, float pTicks, int pCloudColor, float pCloudHeight) Deprecated.private void
addCloudsPass
(FrameGraphBuilder pFrameGraphBuilder, CloudStatus pCloudStatus, Vec3 pCameraPosition, float pTicks, int pCloudColor, float pCloudHeight, org.joml.Matrix4f modelViewMatrix, org.joml.Matrix4f projectionMatrix) private void
addLateDebugPass
(FrameGraphBuilder pFrameGraphBuilder, Vec3 pCameraPosition, FogParameters pFog) private void
addMainPass
(FrameGraphBuilder pFrameGraphBuilder, Frustum pFrustum, Camera pCamera, org.joml.Matrix4f pFrustumMatrix, org.joml.Matrix4f pProjectionMatrix, FogParameters pFogParameters, boolean pRenderBlockOutline, boolean pRenderEntityOutline, DeltaTracker pDeltaTracker, ProfilerFiller pProfiler) void
addParticle
(ParticleOptions pOptions, boolean pForce, boolean pDecreased, double pX, double pY, double pZ, double pXSpeed, double pYSpeed, double pZSpeed) void
addParticle
(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 Particle
addParticleInternal
(ParticleOptions pOptions, boolean pForce, boolean pDecreased, double pX, double pY, double pZ, double pXSpeed, double pYSpeed, double pZSpeed) (package private) Particle
addParticleInternal
(ParticleOptions pOptions, boolean pForce, double pX, double pY, double pZ, double pXSpeed, double pYSpeed, double pZSpeed) private void
addParticlesPass
(FrameGraphBuilder pFrameGraphBuilder, Camera pCamera, float pPartialTick, FogParameters pFog) Deprecated.private void
addParticlesPass
(FrameGraphBuilder pFrameGraphBuilder, Camera pCamera, float pPartialTick, FogParameters pFog, Frustum frustum, org.joml.Matrix4f modelViewMatrix, org.joml.Matrix4f projectionMatrix) void
addRecentlyCompiledSection
(SectionRenderDispatcher.RenderSection pRenderSection) private void
addSkyPass
(FrameGraphBuilder pFrameGraphBuilder, Camera pCamera, float pPartialTick, FogParameters pFog) Deprecated.private void
addSkyPass
(FrameGraphBuilder pFrameGraphBuilder, Camera pCamera, float pPartialTick, FogParameters pFog, org.joml.Matrix4f modelViewMatrix, org.joml.Matrix4f projectionMatrix) private void
addWeatherPass
(FrameGraphBuilder pFrameGraphBuilder, Vec3 pCameraPosition, float pPartialTick, FogParameters pFog) Deprecated.private void
addWeatherPass
(FrameGraphBuilder pFrameGraphBuilder, Vec3 pCameraPosition, float pPartialTick, FogParameters pFog, org.joml.Matrix4f modelViewMatrix, org.joml.Matrix4f projectionMatrix, Camera camera) void
private void
applyFrustum
(Frustum pFrustum) void
blockChanged
(BlockGetter pLevel, BlockPos pPos, BlockState pOldState, BlockState pNewState, int pFlags) private ParticleStatus
calculateParticleLevel
(boolean pDecreased) void
private void
checkPoseStack
(PoseStack pPoseStack) Asserts that the specifiedposeStack
isinvalid reference
clear
private void
void
close()
private boolean
collectVisibleEntities
(Camera pCamera, Frustum pFrustum, List<Entity> pOutput) private void
compileSections
(Camera pCamera) int
void
destroyBlockProgress
(int pBreakerId, BlockPos pPos, int pProgress) void
private boolean
doesMobEffectBlockSky
(Camera pCamera) double
static int
getLightColor
(LevelRenderer.BrightnessGetter pBrightnessGetter, BlockAndTintGetter pLevel, BlockState pState, BlockPos pPos) static int
getLightColor
(BlockAndTintGetter pLevel, BlockPos pPos) Iterable
<? extends IRenderableSection> int
getTicks()
double
private PostChain
it.unimi.dsi.fastutil.objects.ObjectArrayList
<SectionRenderDispatcher.RenderSection> boolean
void
boolean
isSectionCompiled
(BlockPos pPos) void
iterateVisibleBlockEntities
(Consumer<BlockEntity> blockEntityConsumer) void
void
static Frustum
offsetFrustum
(Frustum pFrustum) void
onChunkReadyToRender
(ChunkPos pChunkPos) void
onResourceManagerReload
(ResourceManager pResourceManager) void
onSectionBecomingNonEmpty
(long pSectionPos) void
prepareCullFrustum
(Vec3 pCameraPosition, org.joml.Matrix4f pFrustumMatrix, org.joml.Matrix4f pProjectionMatrix) private void
removeProgress
(BlockDestructionProgress pProgress) private void
renderBlockDestroyAnimation
(PoseStack pPoseStack, Camera pCamera, MultiBufferSource.BufferSource pBufferSource) private void
renderBlockEntities
(PoseStack pPoseStack, MultiBufferSource.BufferSource pBufferSource, MultiBufferSource.BufferSource pCrumblingBufferSource, Camera pCamera, float pPartialTick) private void
renderBlockOutline
(Camera pCamera, MultiBufferSource.BufferSource pBufferSource, PoseStack pPoseStack, boolean pSort) private void
renderEntities
(PoseStack pPoseStack, MultiBufferSource.BufferSource pBufferSource, Camera pCamera, DeltaTracker pDeltaTracker, List<Entity> pEntities) private void
renderEntity
(Entity pEntity, double pCamX, double pCamY, double pCamZ, float pPartialTick, PoseStack pPoseStack, MultiBufferSource pBufferSource) private void
renderHitOutline
(PoseStack pPoseStack, VertexConsumer pBuffer, Entity pEntity, double pCamX, double pCamY, double pCamZ, BlockPos pPos, BlockState pState, int pColor) void
renderLevel
(GraphicsResourceAllocator pGraphicsResourceAllocator, DeltaTracker pDeltaTracker, boolean pRenderBlockOutline, Camera pCamera, GameRenderer pGameRenderer, org.joml.Matrix4f pFrustumMatrix, org.joml.Matrix4f pProjectionMatrix) private void
renderSectionLayer
(RenderType pRenderType, double pX, double pY, double pZ, org.joml.Matrix4f pFrustrumMatrix, org.joml.Matrix4f pProjectionMatrix) void
resize
(int pWidth, int pHeight) private void
scheduleResort
(SectionRenderDispatcher.RenderSection pSection, SectionRenderDispatcher.TranslucencyPointOfView pPointOfView, Vec3 pCameraPosition, boolean pForce, boolean pIgnoreAxisAlignment) private void
scheduleTranslucentSectionResort
(Vec3 pCameraPosition) private void
setBlockDirty
(BlockPos pPos, boolean pReRenderOnMainThread) void
setBlockDirty
(BlockPos pPos, BlockState pOldState, BlockState pNewState) void
setBlocksDirty
(int pMinX, int pMinY, int pMinZ, int pMaxX, int pMaxY, int pMaxZ) Re-renders all blocks in the specified range.void
setLevel
(ClientLevel pLevel) void
setSectionDirty
(int pSectionX, int pSectionY, int pSectionZ) private void
setSectionDirty
(int pSectionX, int pSectionY, int pSectionZ, boolean pReRenderOnMainThread) void
setSectionDirtyWithNeighbors
(int pSectionX, int pSectionY, int pSectionZ) void
setSectionRangeDirty
(int pMinY, int pMinX, int pMinZ, int pMaxY, int pMaxX, int pMaxZ) private void
setupRender
(Camera pCamera, Frustum pFrustum, boolean pHasCapturedFrustum, boolean pIsSpectator) private boolean
shouldRenderDarkDisc
(float pPartialTick) boolean
void
tick()
void
tickParticles
(Camera pCamera) void
updateGlobalBlockEntities
(Collection<BlockEntity> pBlockEntitiesToRemove, Collection<BlockEntity> pBlockEntitiesToAdd) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface net.minecraft.server.packs.resources.PreparableReloadListener
getName
Methods 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:
close
in interfaceAutoCloseable
-
onResourceManagerReload
- Specified by:
onResourceManagerReload
in interfaceResourceManagerReloadListener
-
initOutline
public void initOutline() -
getTransparencyChain
-
doEntityOutline
public void doEntityOutline() -
shouldShowEntityOutlines
public boolean shouldShowEntityOutlines() -
setLevel
- Parameters:
pLevel
- the level to set, ornull
to 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
public void prepareCullFrustum(Vec3 pCameraPosition, org.joml.Matrix4f pFrustumMatrix, org.joml.Matrix4f pProjectionMatrix) -
renderLevel
public void renderLevel(GraphicsResourceAllocator pGraphicsResourceAllocator, DeltaTracker pDeltaTracker, boolean pRenderBlockOutline, Camera pCamera, GameRenderer pGameRenderer, org.joml.Matrix4f pFrustumMatrix, org.joml.Matrix4f pProjectionMatrix) -
addMainPass
private void addMainPass(FrameGraphBuilder pFrameGraphBuilder, Frustum pFrustum, Camera pCamera, org.joml.Matrix4f pFrustumMatrix, org.joml.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, org.joml.Matrix4f modelViewMatrix, org.joml.Matrix4f projectionMatrix) -
addCloudsPass
@Deprecated private void addCloudsPass(FrameGraphBuilder pFrameGraphBuilder, CloudStatus pCloudStatus, Vec3 pCameraPosition, float pTicks, int pCloudColor, float pCloudHeight) Deprecated. -
addCloudsPass
private void addCloudsPass(FrameGraphBuilder pFrameGraphBuilder, CloudStatus pCloudStatus, Vec3 pCameraPosition, float pTicks, int pCloudColor, float pCloudHeight, org.joml.Matrix4f modelViewMatrix, org.joml.Matrix4f projectionMatrix) -
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, org.joml.Matrix4f modelViewMatrix, org.joml.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 specifiedposeStack
isinvalid reference
clear
- Throws:
IllegalStateException
- if the specifiedposeStack
is 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, org.joml.Matrix4f pFrustrumMatrix, org.joml.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, org.joml.Matrix4f modelViewMatrix, org.joml.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 theinvalid @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 theinvalid @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 theinvalid @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 theinvalid @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
public static int getLightColor(LevelRenderer.BrightnessGetter pBrightnessGetter, BlockAndTintGetter pLevel, BlockState pState, BlockPos pPos) -
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