@Environment(value=CLIENT) public class WorldRenderer extends Object implements SynchronousResourceReloadListener, AutoCloseable
Modifier and Type | Class and Description |
---|---|
(package private) class |
WorldRenderer.ChunkInfo |
static class |
WorldRenderer.ShaderException |
ResourceReloadListener.Synchronizer
Constructor and Description |
---|
WorldRenderer(MinecraftClient client,
BufferBuilderStorage bufferBuilders) |
Modifier and Type | Method and Description |
---|---|
void |
addParticle(ParticleEffect parameters,
boolean shouldAlwaysSpawn,
boolean important,
double x,
double y,
double z,
double velocityX,
double velocityY,
double velocityZ) |
void |
addParticle(ParticleEffect parameters,
boolean shouldAlwaysSpawn,
double x,
double y,
double z,
double velocityX,
double velocityY,
double velocityZ) |
private <T extends ParticleEffect> |
addParticle(T parameters,
double x,
double y,
double z,
double velocityX,
double velocityY,
double velocityZ) |
void |
apply(ResourceManager manager) |
protected boolean |
canDrawEntityOutlines() |
private void |
captureFrustum(Matrix4f modelMatrix,
Matrix4f matrix4f,
double x,
double y,
double z,
Frustum frustum) |
private void |
checkEmpty(MatrixStack matrices) |
protected void |
clearChunkRenderers() |
void |
close() |
private void |
drawBlockOutline(MatrixStack matrixStack,
VertexConsumer vertexConsumer,
Entity entity,
double double2,
double double3,
double double4,
BlockPos blockPos,
BlockState blockState) |
static void |
drawBox(BufferBuilder buffer,
double x1,
double y1,
double z1,
double x2,
double y2,
double z2,
float red,
float green,
float blue,
float alpha) |
static void |
drawBox(MatrixStack matrices,
VertexConsumer vertexConsumer,
Box box,
float red,
float green,
float blue,
float alpha)
Draws a box.
|
static void |
drawBox(MatrixStack matrices,
VertexConsumer vertexConsumer,
double x1,
double y1,
double z1,
double x2,
double y2,
double z2,
float red,
float green,
float blue,
float alpha)
Draws a box spanning from [x1,y1,z1] to [x2,y2,z2].
|
static void |
drawBox(MatrixStack matrices,
VertexConsumer vertexConsumer,
double x1,
double y1,
double z1,
double x2,
double y2,
double z2,
float red,
float green,
float blue,
float alpha,
float xAxisRed,
float yAxisGreen,
float zAxisBlue)
Draws a box spanning from [x1,y1,z1] to [x2,y2,z2].
|
void |
drawEntityOutlinesFramebuffer() |
private static void |
drawShapeOutline(MatrixStack matrixStack,
VertexConsumer vertexConsumer,
VoxelShape voxelShape,
double double2,
double double3,
double double4,
float float2,
float float3,
float float4,
float float5) |
private ChunkBuilder.BuiltChunk |
getAdjacentChunk(BlockPos pos,
ChunkBuilder.BuiltChunk chunk,
Direction direction) |
String |
getChunksDebugString() |
Framebuffer |
getCloudsFramebuffer() |
protected int |
getCompletedChunkCount() |
String |
getEntitiesDebugString() |
Framebuffer |
getEntityFramebuffer() |
Framebuffer |
getEntityOutlinesFramebuffer() |
static int |
getLightmapCoordinates(BlockRenderView world,
BlockPos pos) |
static int |
getLightmapCoordinates(BlockRenderView world,
BlockState state,
BlockPos pos) |
Framebuffer |
getParticlesFramebuffer() |
private ParticlesMode |
getRandomParticleSpawnChance(boolean canSpawnOnMinimal) |
Framebuffer |
getTranslucentFramebuffer() |
Framebuffer |
getWeatherFramebuffer() |
boolean |
isTerrainRenderComplete() |
void |
loadEntityOutlineShader() |
private void |
loadTransparencyShader() |
private void |
method_22978(BufferBuilder bufferBuilder,
double double2,
double double3,
double double4,
double double5,
int int2,
double double6,
float float2,
float float3) |
static void |
method_22983(MatrixStack matrixStack,
VertexConsumer vertexConsumer,
VoxelShape voxelShape,
double double2,
double double3,
double double4,
float float2,
float float3,
float float4,
float float5) |
private void |
method_22984(VertexConsumer vertexConsumer,
int int2) |
private void |
method_22985(VertexConsumer vertexConsumer,
int int2,
int int3,
int int4,
int int5,
int int6,
int int7,
int int8) |
void |
method_3267() |
void |
onResized(int int2,
int int3) |
void |
playSong(SoundEvent song,
BlockPos songPosition) |
void |
processGlobalEvent(int eventId,
BlockPos pos,
int int2) |
void |
processWorldEvent(PlayerEntity source,
int eventId,
BlockPos pos,
int data) |
void |
reload() |
private void |
removeBlockBreakingInfo(BlockBreakingInfo blockBreakingInfo) |
void |
render(MatrixStack matrices,
float tickDelta,
long limitTime,
boolean renderBlockOutline,
Camera camera,
GameRenderer gameRenderer,
LightmapTextureManager lightmapTextureManager,
Matrix4f matrix4f) |
private void |
renderChunkDebugInfo(Camera camera) |
private void |
renderClouds(BufferBuilder builder,
double x,
double y,
double z,
Vec3d color) |
void |
renderClouds(MatrixStack matrices,
float tickDelta,
double cameraX,
double cameraY,
double cameraZ) |
private void |
renderDarkSky() |
private void |
renderEndSky(MatrixStack matrices) |
private void |
renderEntity(Entity entity,
double cameraX,
double cameraY,
double cameraZ,
float tickDelta,
MatrixStack matrices,
VertexConsumerProvider vertexConsumers) |
private void |
renderLayer(RenderLayer renderLayer,
MatrixStack matrixStack,
double double2,
double double3,
double double4) |
private void |
renderLightSky() |
void |
renderSky(MatrixStack matrices,
float tickDelta) |
private void |
renderSkyHalf(BufferBuilder buffer,
float y,
boolean bottom) |
private void |
renderStars() |
private void |
renderStars(BufferBuilder buffer) |
private void |
renderWeather(LightmapTextureManager manager,
float float2,
double double2,
double double3,
double double4) |
private void |
renderWorldBorder(Camera camera) |
private void |
resetTransparencyShader() |
void |
scheduleBlockRender(int x,
int y,
int z) |
void |
scheduleBlockRenders(int x,
int y,
int z) |
void |
scheduleBlockRenders(int minX,
int minY,
int minZ,
int maxX,
int maxY,
int maxZ) |
void |
scheduleBlockRerenderIfNeeded(BlockPos pos,
BlockState old,
BlockState updated) |
private void |
scheduleChunkRender(int x,
int y,
int z,
boolean important) |
private void |
scheduleSectionRender(BlockPos pos,
boolean important) |
void |
scheduleTerrainUpdate() |
void |
setBlockBreakingInfo(int entityId,
BlockPos pos,
int stage) |
private void |
setupTerrain(Camera camera,
Frustum frustum,
boolean hasForcedFrustum,
int frame,
boolean spectator) |
void |
setWorld(ClientWorld clientWorld) |
private Particle |
spawnParticle(ParticleEffect parameters,
boolean alwaysSpawn,
boolean canSpawnOnMinimal,
double x,
double y,
double z,
double velocityX,
double velocityY,
double velocityZ) |
private Particle |
spawnParticle(ParticleEffect parameters,
boolean alwaysSpawn,
double x,
double y,
double z,
double velocityX,
double velocityY,
double velocityZ) |
void |
tick() |
void |
tickRainSplashing(Camera camera) |
void |
updateBlock(BlockView world,
BlockPos pos,
BlockState oldState,
BlockState newState,
int flags) |
private void |
updateChunks(long limitTime) |
private void |
updateEntitiesForSong(World world,
BlockPos pos,
boolean playing) |
void |
updateNoCullingBlockEntities(Collection<BlockEntity> removed,
Collection<BlockEntity> added) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
reload
getName
private static final Logger LOGGER
private static final Identifier MOON_PHASES
private static final Identifier SUN
private static final Identifier CLOUDS
private static final Identifier END_SKY
private static final Identifier FORCEFIELD
private static final Identifier RAIN
private static final Identifier SNOW
public static final Direction[] DIRECTIONS
private final MinecraftClient client
private final TextureManager textureManager
private final EntityRenderDispatcher entityRenderDispatcher
private final BufferBuilderStorage bufferBuilders
private ClientWorld world
private Set<ChunkBuilder.BuiltChunk> chunksToRebuild
private final it.unimi.dsi.fastutil.objects.ObjectList<WorldRenderer.ChunkInfo> visibleChunks
private final Set<BlockEntity> noCullingBlockEntities
private BuiltChunkStorage chunks
private final VertexFormat skyVertexFormat
@Nullable private VertexBuffer starsBuffer
@Nullable private VertexBuffer lightSkyBuffer
@Nullable private VertexBuffer darkSkyBuffer
private boolean cloudsDirty
@Nullable private VertexBuffer cloudsBuffer
private final FpsSmoother chunkUpdateSmoother
private int ticks
private final it.unimi.dsi.fastutil.ints.Int2ObjectMap<BlockBreakingInfo> blockBreakingInfos
private final it.unimi.dsi.fastutil.longs.Long2ObjectMap<SortedSet<BlockBreakingInfo>> blockBreakingProgressions
private final Map<BlockPos,SoundInstance> playingSongs
@Nullable private Framebuffer entityOutlinesFramebuffer
@Nullable private ShaderEffect entityOutlineShader
@Nullable private Framebuffer translucentFramebuffer
@Nullable private Framebuffer entityFramebuffer
@Nullable private Framebuffer particlesFramebuffer
@Nullable private Framebuffer weatherFramebuffer
@Nullable private Framebuffer cloudsFramebuffer
@Nullable private ShaderEffect transparencyShader
private double lastCameraChunkUpdateX
private double lastCameraChunkUpdateY
private double lastCameraChunkUpdateZ
private int cameraChunkX
private int cameraChunkY
private int cameraChunkZ
private double lastCameraX
private double lastCameraY
private double lastCameraZ
private double lastCameraPitch
private double lastCameraYaw
private int lastCloudsBlockX
private int lastCloudsBlockY
private int lastCloudsBlockZ
private Vec3d lastCloudsColor
private CloudRenderMode lastCloudsRenderMode
private ChunkBuilder chunkBuilder
private final VertexFormat vertexFormat
private int renderDistance
private int regularEntityCount
private int blockEntityCount
private boolean shouldCaptureFrustum
private final Vector4f[] capturedFrustumOrientation
private final Vector3d capturedFrustumPosition
private double lastTranslucentSortX
private double lastTranslucentSortY
private double lastTranslucentSortZ
private boolean needsTerrainUpdate
private int frame
private int field_20793
private final float[] field_20794
private final float[] field_20795
public WorldRenderer(MinecraftClient client, BufferBuilderStorage bufferBuilders)
private void renderWeather(LightmapTextureManager manager, float float2, double double2, double double3, double double4)
public void tickRainSplashing(Camera camera)
public void close()
close
in interface AutoCloseable
public void apply(ResourceManager manager)
apply
in interface SynchronousResourceReloadListener
public void loadEntityOutlineShader()
private void loadTransparencyShader()
private void resetTransparencyShader()
public void drawEntityOutlinesFramebuffer()
protected boolean canDrawEntityOutlines()
private void renderDarkSky()
private void renderLightSky()
private void renderSkyHalf(BufferBuilder buffer, float y, boolean bottom)
private void renderStars()
private void renderStars(BufferBuilder buffer)
public void setWorld(@Nullable ClientWorld clientWorld)
public void reload()
protected void clearChunkRenderers()
public void onResized(int int2, int int3)
public String getChunksDebugString()
protected int getCompletedChunkCount()
public String getEntitiesDebugString()
private void setupTerrain(Camera camera, Frustum frustum, boolean hasForcedFrustum, int frame, boolean spectator)
@Nullable private ChunkBuilder.BuiltChunk getAdjacentChunk(BlockPos pos, ChunkBuilder.BuiltChunk chunk, Direction direction)
private void captureFrustum(Matrix4f modelMatrix, Matrix4f matrix4f, double x, double y, double z, Frustum frustum)
public void render(MatrixStack matrices, float tickDelta, long limitTime, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightmapTextureManager lightmapTextureManager, Matrix4f matrix4f)
private void checkEmpty(MatrixStack matrices)
private void renderEntity(Entity entity, double cameraX, double cameraY, double cameraZ, float tickDelta, MatrixStack matrices, VertexConsumerProvider vertexConsumers)
private void renderLayer(RenderLayer renderLayer, MatrixStack matrixStack, double double2, double double3, double double4)
private void renderChunkDebugInfo(Camera camera)
private void method_22984(VertexConsumer vertexConsumer, int int2)
private void method_22985(VertexConsumer vertexConsumer, int int2, int int3, int int4, int int5, int int6, int int7, int int8)
public void tick()
private void removeBlockBreakingInfo(BlockBreakingInfo blockBreakingInfo)
private void renderEndSky(MatrixStack matrices)
public void renderSky(MatrixStack matrices, float tickDelta)
public void renderClouds(MatrixStack matrices, float tickDelta, double cameraX, double cameraY, double cameraZ)
private void renderClouds(BufferBuilder builder, double x, double y, double z, Vec3d color)
private void updateChunks(long limitTime)
private void renderWorldBorder(Camera camera)
private void method_22978(BufferBuilder bufferBuilder, double double2, double double3, double double4, double double5, int int2, double double6, float float2, float float3)
private void drawBlockOutline(MatrixStack matrixStack, VertexConsumer vertexConsumer, Entity entity, double double2, double double3, double double4, BlockPos blockPos, BlockState blockState)
public static void method_22983(MatrixStack matrixStack, VertexConsumer vertexConsumer, VoxelShape voxelShape, double double2, double double3, double double4, float float2, float float3, float float4, float float5)
private static void drawShapeOutline(MatrixStack matrixStack, VertexConsumer vertexConsumer, VoxelShape voxelShape, double double2, double double3, double double4, float float2, float float3, float float4, float float5)
public static void drawBox(MatrixStack matrices, VertexConsumer vertexConsumer, Box box, float red, float green, float blue, float alpha)
Note the coordinates the box spans are relative to current translation of the matrices.
public static void drawBox(MatrixStack matrices, VertexConsumer vertexConsumer, double x1, double y1, double z1, double x2, double y2, double z2, float red, float green, float blue, float alpha)
Note the coordinates the box spans are relative to current translation of the matrices.
public static void drawBox(MatrixStack matrices, VertexConsumer vertexConsumer, double x1, double y1, double z1, double x2, double y2, double z2, float red, float green, float blue, float alpha, float xAxisRed, float yAxisGreen, float zAxisBlue)
Note the coordinates the box spans are relative to current translation of the matrices.
public static void drawBox(BufferBuilder buffer, double x1, double y1, double z1, double x2, double y2, double z2, float red, float green, float blue, float alpha)
public void updateBlock(BlockView world, BlockPos pos, BlockState oldState, BlockState newState, int flags)
private void scheduleSectionRender(BlockPos pos, boolean important)
public void scheduleBlockRenders(int minX, int minY, int minZ, int maxX, int maxY, int maxZ)
public void scheduleBlockRerenderIfNeeded(BlockPos pos, BlockState old, BlockState updated)
public void scheduleBlockRenders(int x, int y, int z)
public void scheduleBlockRender(int x, int y, int z)
private void scheduleChunkRender(int x, int y, int z, boolean important)
public void playSong(@Nullable SoundEvent song, BlockPos songPosition)
private void updateEntitiesForSong(World world, BlockPos pos, boolean playing)
public void addParticle(ParticleEffect parameters, boolean shouldAlwaysSpawn, double x, double y, double z, double velocityX, double velocityY, double velocityZ)
public void addParticle(ParticleEffect parameters, boolean shouldAlwaysSpawn, boolean important, double x, double y, double z, double velocityX, double velocityY, double velocityZ)
private <T extends ParticleEffect> void addParticle(T parameters, double x, double y, double z, double velocityX, double velocityY, double velocityZ)
@Nullable private Particle spawnParticle(ParticleEffect parameters, boolean alwaysSpawn, double x, double y, double z, double velocityX, double velocityY, double velocityZ)
@Nullable private Particle spawnParticle(ParticleEffect parameters, boolean alwaysSpawn, boolean canSpawnOnMinimal, double x, double y, double z, double velocityX, double velocityY, double velocityZ)
private ParticlesMode getRandomParticleSpawnChance(boolean canSpawnOnMinimal)
public void method_3267()
public void processGlobalEvent(int eventId, BlockPos pos, int int2)
public void processWorldEvent(PlayerEntity source, int eventId, BlockPos pos, int data)
public void setBlockBreakingInfo(int entityId, BlockPos pos, int stage)
public boolean isTerrainRenderComplete()
public void scheduleTerrainUpdate()
public void updateNoCullingBlockEntities(Collection<BlockEntity> removed, Collection<BlockEntity> added)
public static int getLightmapCoordinates(BlockRenderView world, BlockPos pos)
public static int getLightmapCoordinates(BlockRenderView world, BlockState state, BlockPos pos)
@Nullable public Framebuffer getEntityOutlinesFramebuffer()
@Nullable public Framebuffer getTranslucentFramebuffer()
@Nullable public Framebuffer getEntityFramebuffer()
@Nullable public Framebuffer getParticlesFramebuffer()
@Nullable public Framebuffer getWeatherFramebuffer()
@Nullable public Framebuffer getCloudsFramebuffer()