Package com.hbm_m.client.render
Class RenderDistanceHelper
java.lang.Object
com.hbm_m.client.render.RenderDistanceHelper
Shared utility for distance-based LOD and fade-out calculations used by
all BER renderers. Centralizes the distance check and fade factor math
so every renderer behaves identically.
The fade zone spans the last 16 blocks (1 chunk) before the cutoff
distance. Within this zone, computeFade(net.minecraft.core.BlockPos, double) returns a value in
(0, 1] that renderers multiply into their alpha / color to
smoothly dissolve the part instead of popping it out abruptly.
-
Method Summary
Modifier and TypeMethodDescriptionstatic floatcomputeAnimatedFade(net.minecraft.core.BlockPos blockPos) Computes a fade factor for animated parts at the given position.static floatcomputeFade(net.minecraft.core.BlockPos blockPos, double maxBlocks) Core fade calculation.static floatcomputeStaticFade(net.minecraft.core.BlockPos blockPos) Computes a fade factor for static parts at the given position.static doubledistanceSqToCamera(net.minecraft.core.BlockPos blockPos) Computes the squared distance from the camera to the block center.static doubleReturns the maximum render distance for animated/dynamic parts in blocks.static doubleSquared camera distance threshold for full 8-cornerLightSampleCachesampling.static doubleReturns the maximum render distance for static parts in blocks.static intConverts a BER view distance config (in chunks) to blocks, matchingBlockEntityRenderer.getViewDistance().static booleanshouldSkipAnimation(net.minecraft.core.BlockPos blockPos) Whether the animated parts should be completely skipped (beyond cutoff).
-
Method Details
-
distanceSqToCamera
public static double distanceSqToCamera(net.minecraft.core.BlockPos blockPos) Computes the squared distance from the camera to the block center. -
getAnimatedDistanceBlocks
public static double getAnimatedDistanceBlocks()Returns the maximum render distance for animated/dynamic parts in blocks. -
getStaticDistanceBlocks
public static double getStaticDistanceBlocks()Returns the maximum render distance for static parts in blocks. -
shouldSkipAnimation
public static boolean shouldSkipAnimation(net.minecraft.core.BlockPos blockPos) Whether the animated parts should be completely skipped (beyond cutoff). -
computeAnimatedFade
public static float computeAnimatedFade(net.minecraft.core.BlockPos blockPos) Computes a fade factor for animated parts at the given position.- Returns:
- 1.0 when fully visible, 0.0 when at/beyond cutoff, smooth
transition in the last
FADE_ZONE_BLOCKSbefore cutoff. Returns -1 if beyond cutoff (caller should skip rendering entirely).
-
computeStaticFade
public static float computeStaticFade(net.minecraft.core.BlockPos blockPos) Computes a fade factor for static parts at the given position.- Returns:
- 1.0 when fully visible, 0.0 when at/beyond cutoff, smooth
transition in the last
FADE_ZONE_BLOCKSbefore cutoff. Returns -1 if beyond cutoff (caller should skip rendering entirely).
-
computeFade
public static float computeFade(net.minecraft.core.BlockPos blockPos, double maxBlocks) Core fade calculation.- Parameters:
blockPos- block to measure distance tomaxBlocks- cutoff distance in blocks- Returns:
- fade factor in [0, 1], or -1 if fully beyond cutoff
-
getStaticViewDistanceBlocks
public static int getStaticViewDistanceBlocks()Converts a BER view distance config (in chunks) to blocks, matchingBlockEntityRenderer.getViewDistance(). -
getLightCornerDetailDistanceSq
public static double getLightCornerDetailDistanceSq()Squared camera distance threshold for full 8-cornerLightSampleCachesampling. Beyond this, callers should use uniform corner UV from vanilla packed light.
-