Skip to content

Commit

Permalink
Switch to ClampUtil
Browse files Browse the repository at this point in the history
  • Loading branch information
Desoroxxx committed Nov 17, 2023
1 parent 931abde commit 634de3c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import dev.redstudio.alfheim.api.IChunkLightingData;
import dev.redstudio.alfheim.utils.PooledLongQueue;
import io.redstudioragnarok.redcore.utils.MathUtil;
import dev.redstudio.redcore.math.ClampUtil;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.profiler.Profiler;
Expand Down Expand Up @@ -518,11 +518,11 @@ private byte getCursorLuminosity(final IBlockState state, final EnumSkyBlock lig
return 0;
}

return (byte) MathUtil.clampMaxFirst(LightUtil.getLightValueForState(state, world, currentPos), 0, MAX_LIGHT_LEVEL);
return (byte) ClampUtil.clampMaxFirst(LightUtil.getLightValueForState(state, world, currentPos), 0, MAX_LIGHT_LEVEL);
}

private byte getPosOpacity(final BlockPos blockPos, final IBlockState blockState) {
return (byte) MathUtil.clampMaxFirst(blockState.getLightOpacity(world, blockPos), 1, MAX_LIGHT_LEVEL);
return (byte) ClampUtil.clampMaxFirst(blockState.getLightOpacity(world, blockPos), 1, MAX_LIGHT_LEVEL);
}

private Chunk getChunk(final BlockPos blockPos) {
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/dev/redstudio/alfheim/mixin/BlockMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import dev.redstudio.alfheim.api.ILightInfoProvider;
import dev.redstudio.alfheim.api.ILightLevelProvider;
import dev.redstudio.alfheim.api.ILitBlock;
import io.redstudioragnarok.redcore.utils.MathUtil;
import dev.redstudio.redcore.math.ClampUtil;
import net.minecraft.block.Block;
import net.minecraft.block.BlockLiquid;
import net.minecraft.block.state.IBlockState;
Expand Down Expand Up @@ -60,7 +60,7 @@ private static void checkForLiquid(final CallbackInfo callbackInfo, @Local(ordin
@Overwrite
@SideOnly(Side.CLIENT)
public float getAmbientOcclusionLightValue(final IBlockState blockState) {
final byte lightValue = (byte) MathUtil.clampMinFirst(blockState.getLightValue() -1, 0, 15);
final byte lightValue = (byte) ClampUtil.clampMinFirst(blockState.getLightValue() -1, 0, 15);

if (lightValue == 0)
return blockState.isBlockNormalCube() ? 0.2F : 1;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package dev.redstudio.alfheim.mixin.client;

import io.redstudioragnarok.redcore.utils.MathUtil;
import dev.redstudio.redcore.math.ClampUtil;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.BlockModelRenderer;
import net.minecraft.util.math.BlockPos;
Expand Down Expand Up @@ -30,7 +30,7 @@ public abstract class BlockModelRendererMixin {
require = 0
)
private int adjustGetLightValue(final IBlockState blockState, final IBlockAccess blockAccess, final BlockPos blockPos) {
return MathUtil.clampMinFirst(blockState.getLightValue(blockAccess, blockPos) -1, 0, 15);
return ClampUtil.clampMinFirst(blockState.getLightValue(blockAccess, blockPos) -1, 0, 15);
}

/**
Expand All @@ -44,6 +44,6 @@ private int adjustGetLightValue(final IBlockState blockState, final IBlockAccess
require = 0
)
private int adjustGetLightValueOptiFine(final IBlockState blockState, final IBlockAccess blockAccess, final BlockPos blockPos) {
return MathUtil.clampMinFirst(blockState.getLightValue(blockAccess, blockPos) -1, 0, 15);
return ClampUtil.clampMinFirst(blockState.getLightValue(blockAccess, blockPos) -1, 0, 15);
}
}

0 comments on commit 634de3c

Please sign in to comment.