Class CloudRenderer
java.lang.Object
net.neoforged.neoforge.resource.ContextAwareReloadListener
net.minecraft.server.packs.resources.SimplePreparableReloadListener<Optional<CloudRenderer.TextureData>>
net.minecraft.client.renderer.CloudRenderer
- All Implemented Interfaces:
AutoCloseable, PreparableReloadListener
public class CloudRenderer
extends SimplePreparableReloadListener<Optional<CloudRenderer.TextureData>>
implements AutoCloseable
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static enumstatic final recordNested classes/interfaces inherited from interface PreparableReloadListener
PreparableReloadListener.PreparationBarrier, PreparableReloadListener.SharedState, PreparableReloadListener.StateKey<T> -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final floatprivate static final floatprivate static final intprivate static final intprivate static final longprivate static final intprivate static final intprivate static final org.slf4j.Loggerprivate booleanprivate static final intprivate intprivate intprivate CloudRenderer.RelativeCameraPosprivate @Nullable CloudStatusprivate intprivate static final intprivate @Nullable CloudRenderer.TextureDataprivate static final Identifierprivate static final intprivate final MappableRingBufferprivate static final intprivate @Nullable MappableRingBufferprivate static final int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidapply(Optional<CloudRenderer.TextureData> preparations, ResourceManager manager, ProfilerFiller profiler) private voidbuildExtrudedCell(CloudRenderer.RelativeCameraPos relativePos, ByteBuffer faceBuffer, int x, int z, long cellData) private voidbuildFlatCell(ByteBuffer faceBuffer, int x, int z) private voidbuildMesh(CloudRenderer.RelativeCameraPos relativePos, ByteBuffer faceBuffer, int centerCellX, int centerCellZ, boolean extrude, int radiusCells) voidclose()private voidencodeFace(ByteBuffer faceBuffer, int x, int z, Direction direction, int flags) voidendFrame()private static intgetSizeForCloudDistance(int radiusCells) private static booleanisCellEmpty(int color) private static booleanisEastEmpty(long cellData) private static booleanisNorthEmpty(long cellData) private static booleanisSouthEmpty(long cellData) private static booleanisWestEmpty(long cellData) voidprivate static longpackCellData(int color, boolean north, boolean east, boolean south, boolean west) protected Optional<CloudRenderer.TextureData> prepare(ResourceManager manager, ProfilerFiller profiler) Performs any reloading that can be done off-thread, such as file IOvoidrender(int color, CloudStatus type, float bottomY, Vec3 cameraPosition, long gameTime, float partialTicks) private voidtryBuildCell(CloudRenderer.RelativeCameraPos relativePos, ByteBuffer faceBuffer, int cellX, int cellZ, boolean extrude, int relativeCellX, int textureWidth, int relativeCellZ, int textureHeight, long[] cells) Methods inherited from class SimplePreparableReloadListener
reloadMethods inherited from class ContextAwareReloadListener
getContext, getRegistryLookup, injectContext, makeConditionalOps, makeConditionalOpsMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface PreparableReloadListener
getName, prepareSharedState
-
Field Details
-
FLAG_INSIDE_FACE
private static final int FLAG_INSIDE_FACE- See Also:
-
FLAG_USE_TOP_COLOR
private static final int FLAG_USE_TOP_COLOR- See Also:
-
CELL_SIZE_IN_BLOCKS
private static final float CELL_SIZE_IN_BLOCKS- See Also:
-
TICKS_PER_CELL
private static final int TICKS_PER_CELL- See Also:
-
BLOCKS_PER_SECOND
private static final float BLOCKS_PER_SECOND- See Also:
-
UBO_SIZE
private static final int UBO_SIZE -
LOGGER
private static final org.slf4j.Logger LOGGER -
TEXTURE_LOCATION
-
EMPTY_CELL
private static final long EMPTY_CELL- See Also:
-
COLOR_OFFSET
private static final int COLOR_OFFSET- See Also:
-
NORTH_OFFSET
private static final int NORTH_OFFSET- See Also:
-
EAST_OFFSET
private static final int EAST_OFFSET- See Also:
-
SOUTH_OFFSET
private static final int SOUTH_OFFSET- See Also:
-
WEST_OFFSET
private static final int WEST_OFFSET- See Also:
-
needsRebuild
private boolean needsRebuild -
prevCellX
private int prevCellX -
prevCellZ
private int prevCellZ -
prevRelativeCameraPos
-
prevType
-
texture
-
quadCount
private int quadCount -
ubo
-
utb
-
-
Constructor Details
-
CloudRenderer
public CloudRenderer()
-
-
Method Details
-
prepare
protected Optional<CloudRenderer.TextureData> prepare(ResourceManager manager, ProfilerFiller profiler) Description copied from class:SimplePreparableReloadListenerPerforms any reloading that can be done off-thread, such as file IO- Specified by:
preparein classSimplePreparableReloadListener<Optional<CloudRenderer.TextureData>>
-
getSizeForCloudDistance
private static int getSizeForCloudDistance(int radiusCells) -
apply
protected void apply(Optional<CloudRenderer.TextureData> preparations, ResourceManager manager, ProfilerFiller profiler) - Specified by:
applyin classSimplePreparableReloadListener<Optional<CloudRenderer.TextureData>>
-
isCellEmpty
private static boolean isCellEmpty(int color) -
packCellData
private static long packCellData(int color, boolean north, boolean east, boolean south, boolean west) -
isNorthEmpty
private static boolean isNorthEmpty(long cellData) -
isEastEmpty
private static boolean isEastEmpty(long cellData) -
isSouthEmpty
private static boolean isSouthEmpty(long cellData) -
isWestEmpty
private static boolean isWestEmpty(long cellData) -
render
public void render(int color, CloudStatus type, float bottomY, Vec3 cameraPosition, long gameTime, float partialTicks) -
buildMesh
private void buildMesh(CloudRenderer.RelativeCameraPos relativePos, ByteBuffer faceBuffer, int centerCellX, int centerCellZ, boolean extrude, int radiusCells) -
tryBuildCell
private void tryBuildCell(CloudRenderer.RelativeCameraPos relativePos, ByteBuffer faceBuffer, int cellX, int cellZ, boolean extrude, int relativeCellX, int textureWidth, int relativeCellZ, int textureHeight, long[] cells) -
buildFlatCell
-
encodeFace
-
buildExtrudedCell
private void buildExtrudedCell(CloudRenderer.RelativeCameraPos relativePos, ByteBuffer faceBuffer, int x, int z, long cellData) -
markForRebuild
public void markForRebuild() -
endFrame
public void endFrame() -
close
public void close()- Specified by:
closein interfaceAutoCloseable
-