From fa1d950ff96f4c9df3b19806025518cea3305088 Mon Sep 17 00:00:00 2001 From: cola98765 Date: Fri, 17 Sep 2021 12:55:14 +0200 Subject: [PATCH] grass is actually using texture now --- .../com/seibel/lod/builders/LodBuilder.java | 21 +++++++++++-------- .../java/com/seibel/lod/util/ColorUtil.java | 4 ++++ 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/seibel/lod/builders/LodBuilder.java b/src/main/java/com/seibel/lod/builders/LodBuilder.java index 918f91d66..04a98cadb 100644 --- a/src/main/java/com/seibel/lod/builders/LodBuilder.java +++ b/src/main/java/com/seibel/lod/builders/LodBuilder.java @@ -618,9 +618,9 @@ public class LodBuilder { if (texture.isTransparent(k, i, j)) { - if (blockState.getBlock() instanceof LeavesBlock) + /*if (blockState.getBlock() instanceof LeavesBlock) color = 0; - else + else*/ continue; } else { @@ -706,21 +706,24 @@ public class LodBuilder else if (blockState.getBlock() instanceof LeavesBlock || blockState.getBlock() == Blocks.VINE) { brightness = getColorTextureForBlock(blockState, blockPos, false); - colorInt = ColorUtil.changeBrightnessValue(biome.getFoliageColor(), brightness); + //colorInt = ColorUtil.changeBrightnessValue(biome.getFoliageColor(), brightness); + colorInt = ColorUtil.multiplyRGBcolors(biome.getFoliageColor(), brightness); } else if ((blockState.getBlock() instanceof GrassBlock || blockState.getBlock() instanceof AbstractPlantBlock || blockState.getBlock() instanceof BushBlock || blockState.getBlock() instanceof IGrowable) && !(blockState.getBlock() == Blocks.BROWN_MUSHROOM || blockState.getBlock() == Blocks.RED_MUSHROOM)) { - /*brightness = getColorTextureForBlock(blockState, blockPos, true); - colorInt = ColorUtil.changeBrightnessValue(biome.getGrassColor(x, z), brightness);*/ - colorInt = ColorUtil.applySaturationAndBrightnessMultipliers(biome.getGrassColor(x, z), 1f, 0.65f); + brightness = ColorUtil.applySaturationAndBrightnessMultipliers(getColorTextureForBlock(blockState, blockPos, true),1f, 1.2f); + //colorInt = ColorUtil.changeBrightnessValue(biome.getGrassColor(x, z), brightness); + //colorInt = ColorUtil.applySaturationAndBrightnessMultipliers(biome.getGrassColor(x, z), 1f, 0.65f); + colorInt = ColorUtil.multiplyRGBcolors(biome.getGrassColor(x, z), brightness); } // water else if (blockState.getBlock() == Blocks.WATER) { - /*brightness = getColorTextureForBlock(blockState, blockPos, true); - colorInt = ColorUtil.changeBrightnessValue(biome.getWaterColor(), brightness);*/ - colorInt = ColorUtil.applySaturationAndBrightnessMultipliers(biome.getWaterColor(), 1f, 0.75f); + brightness = getColorTextureForBlock(blockState, blockPos, true); + //colorInt = ColorUtil.changeBrightnessValue(biome.getWaterColor(), brightness); + //colorInt = ColorUtil.applySaturationAndBrightnessMultipliers(biome.getWaterColor(), 1f, 0.75f); + colorInt = ColorUtil.multiplyRGBcolors(biome.getWaterColor(), brightness); } // everything else diff --git a/src/main/java/com/seibel/lod/util/ColorUtil.java b/src/main/java/com/seibel/lod/util/ColorUtil.java index 3b1806b3a..99b4ea19c 100644 --- a/src/main/java/com/seibel/lod/util/ColorUtil.java +++ b/src/main/java/com/seibel/lod/util/ColorUtil.java @@ -92,4 +92,8 @@ public class ColorUtil hsv[1], brightness).getRGB(); } + public static int multiplyRGBcolors(int color1, int color2) + { + return (((getAlpha(color1) * getAlpha(color2)) << 16) & 0xFF000000) | (((getRed(color1) * getRed(color2)) << 8) & 0xFF0000) | ((getGreen(color1) * getGreen(color2)) & 0xFF00) | (((getBlue(color1) * getBlue(color2)) >> 8) & 0xFF); + } }