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 Comparator
<Entity> private static final ResourceLocation
private RenderTarget
private final EntityRenderDispatcher
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) private void
addLateDebugPass
(FrameGraphBuilder pFrameGraphBuilder, Vec3 pCameraPosition, GpuBufferSlice pShaderFog) private void
addMainPass
(FrameGraphBuilder p_361593_, Frustum p_366590_, Camera p_363453_, org.joml.Matrix4f p_362420_, GpuBufferSlice p_418185_, boolean p_363964_, boolean p_362137_, DeltaTracker p_360931_, ProfilerFiller p_362234_) 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, GpuBufferSlice pShaderFog) Deprecated.private void
addParticlesPass
(FrameGraphBuilder pFrameGraphBuilder, Camera pCamera, float pPartialTick, GpuBufferSlice pShaderFog, Frustum frustum, org.joml.Matrix4f modelViewMatrix) void
addRecentlyCompiledSection
(SectionRenderDispatcher.RenderSection pRenderSection) private void
addSkyPass
(FrameGraphBuilder pFrameGraphBuilder, Camera pCamera, float pPartialTick, GpuBufferSlice pShaderFog) Deprecated.private void
addSkyPass
(FrameGraphBuilder pFrameGraphBuilder, Camera pCamera, float pPartialTick, GpuBufferSlice pShaderFog, org.joml.Matrix4f modelViewMatrix) private void
addWeatherPass
(FrameGraphBuilder pFrameGraphBuilder, Vec3 pCameraPosition, float pPartialTick, GpuBufferSlice pShaderFog) Deprecated.private void
addWeatherPass
(FrameGraphBuilder pFrameGraphBuilder, Vec3 pCameraPosition, float pPartialTick, GpuBufferSlice pShaderFog, org.joml.Matrix4f modelViewMatrix, 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) void
endFrame()
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) private ChunkSectionsToRender
prepareChunkRenders
(org.joml.Matrix4fc p_428537_, double p_428258_, double p_428243_, double p_428448_) void
prepareCullFrustum
(Vec3 p_253766_, org.joml.Matrix4f p_254341_, org.joml.Matrix4f p_323487_) 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 p_361796_, DeltaTracker p_348530_, boolean p_109603_, Camera p_109604_, org.joml.Matrix4f p_254120_, org.joml.Matrix4f p_323920_, GpuBufferSlice p_425977_, org.joml.Vector4f p_425544_, boolean p_426302_) void
resize
(int pWidth, int pHeight) private void
scheduleResort
(SectionRenderDispatcher.RenderSection pSection, 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) 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:
-
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 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 p_253766_, org.joml.Matrix4f p_254341_, org.joml.Matrix4f p_323487_) -
renderLevel
public void renderLevel(GraphicsResourceAllocator p_361796_, DeltaTracker p_348530_, boolean p_109603_, Camera p_109604_, org.joml.Matrix4f p_254120_, org.joml.Matrix4f p_323920_, GpuBufferSlice p_425977_, org.joml.Vector4f p_425544_, boolean p_426302_) -
addMainPass
private void addMainPass(FrameGraphBuilder p_361593_, Frustum p_366590_, Camera p_363453_, org.joml.Matrix4f p_362420_, GpuBufferSlice p_418185_, boolean p_363964_, boolean p_362137_, DeltaTracker p_360931_, ProfilerFiller p_362234_) -
addParticlesPass
@Deprecated private void addParticlesPass(FrameGraphBuilder pFrameGraphBuilder, Camera pCamera, float pPartialTick, GpuBufferSlice pShaderFog) Deprecated. -
addParticlesPass
private void addParticlesPass(FrameGraphBuilder pFrameGraphBuilder, Camera pCamera, float pPartialTick, GpuBufferSlice pShaderFog, Frustum frustum, org.joml.Matrix4f modelViewMatrix) -
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) -
addWeatherPass
@Deprecated private void addWeatherPass(FrameGraphBuilder pFrameGraphBuilder, Vec3 pCameraPosition, float pPartialTick, GpuBufferSlice pShaderFog) Deprecated. -
addWeatherPass
private void addWeatherPass(FrameGraphBuilder pFrameGraphBuilder, Vec3 pCameraPosition, float pPartialTick, GpuBufferSlice pShaderFog, org.joml.Matrix4f modelViewMatrix, Camera camera) -
addLateDebugPass
private void addLateDebugPass(FrameGraphBuilder pFrameGraphBuilder, Vec3 pCameraPosition, GpuBufferSlice pShaderFog) -
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, TranslucencyPointOfView pPointOfView, Vec3 pCameraPosition, boolean pForce, boolean pIgnoreAxisAlignment) -
prepareChunkRenders
private ChunkSectionsToRender prepareChunkRenders(org.joml.Matrix4fc p_428537_, double p_428258_, double p_428243_, double p_428448_) -
endFrame
public void endFrame() -
captureFrustum
public void captureFrustum() -
killFrustum
public void killFrustum() -
tick
public void tick() -
removeProgress
-
addSkyPass
@Deprecated private void addSkyPass(FrameGraphBuilder pFrameGraphBuilder, Camera pCamera, float pPartialTick, GpuBufferSlice pShaderFog) Deprecated. -
addSkyPass
private void addSkyPass(FrameGraphBuilder pFrameGraphBuilder, Camera pCamera, float pPartialTick, GpuBufferSlice pShaderFog, org.joml.Matrix4f modelViewMatrix) -
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() -
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)
instead