update BlockColorWrapper, and fix "wraning"

This commit is contained in:
cola98765
2022-02-15 12:14:55 +01:00
parent f9292b80c3
commit dae3d49d62
2 changed files with 13 additions and 19 deletions
@@ -15,13 +15,7 @@ import com.seibel.lod.core.wrapperInterfaces.block.IBlockColorWrapper;
import net.minecraft.client.renderer.block.model.BakedQuad;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.core.Direction;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.BushBlock;
import net.minecraft.world.level.block.FlowerBlock;
import net.minecraft.world.level.block.GrassBlock;
import net.minecraft.world.level.block.LeavesBlock;
import net.minecraft.world.level.block.TallGrassBlock;
import net.minecraft.world.level.block.*;
import net.minecraft.world.level.block.state.BlockState;
@@ -127,7 +121,7 @@ public class BlockColorWrapper implements IBlockColorWrapper
for (Direction direction : directions)
{
quads = mc.getModelManager().getBlockModelShaper().getBlockModel(block.defaultBlockState()).getQuads(blockState, direction, random);
if (!quads.isEmpty())
if (!quads.isEmpty() && !(block instanceof RotatedPillarBlock && direction == Direction.UP))
break;
}
@@ -192,10 +186,10 @@ public class BlockColorWrapper implements IBlockColorWrapper
// add to the running averages
count += colorMultiplier;
alpha += ColorUtil.getAlpha(tempColor) * colorMultiplier;
red += ColorUtil.getBlue(tempColor) * colorMultiplier;
green += ColorUtil.getGreen(tempColor) * colorMultiplier;
blue += ColorUtil.getRed(tempColor) * colorMultiplier;
alpha += ColorUtil.getAlpha(tempColor) * ColorUtil.getAlpha(tempColor) * colorMultiplier;
red += ColorUtil.getBlue(tempColor) * ColorUtil.getBlue(tempColor) * colorMultiplier;
green += ColorUtil.getGreen(tempColor) * ColorUtil.getGreen(tempColor) * colorMultiplier;
blue += ColorUtil.getRed(tempColor) * ColorUtil.getRed(tempColor) * colorMultiplier;
}
}
}
@@ -207,11 +201,11 @@ public class BlockColorWrapper implements IBlockColorWrapper
else
{
// determine the average color
alpha /= count;
red /= count;
green /= count;
blue /= count;
tempColor = ColorUtil.rgbToInt(alpha, red, green, blue);
tempColor = ColorUtil.rgbToInt(
(int) Math.sqrt(alpha / count),
(int) Math.sqrt(red / count),
(int) Math.sqrt(green / count),
(int) Math.sqrt(blue / count));
}
// determine if this block should use the biome color tint
@@ -223,7 +217,7 @@ public class BlockColorWrapper implements IBlockColorWrapper
this.foliageTint = leavesInstance() && toTint;
this.waterTint = waterIstance() && toTint;
this.waterTint = waterIstance();
//hardcoded leaves
if (block == Blocks.SPRUCE_LEAVES)
@@ -177,7 +177,7 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper
} catch (LinkageError e) {
try {
MinecraftWrapper.INSTANCE.sendChatMessage(
"\u00A7e\u00A7l\u00A7uWRANING: Distant Horizons: getVanillaRenderedChunks method failed."
"\u00A7e\u00A7l\u00A7uWARNING: Distant Horizons: getVanillaRenderedChunks method failed."
+ " Using Backup Method.");
MinecraftWrapper.INSTANCE.sendChatMessage(
"\u00A7eOverdraw prevention will be worse than normal.");