Fix incorrect redstone tint colors (#38)
This commit is contained in:
+10
-1
@@ -13,6 +13,7 @@ import net.minecraft.registry.Registry;
|
|||||||
import net.minecraft.registry.RegistryKeys;
|
import net.minecraft.registry.RegistryKeys;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.math.ColorHelper;
|
||||||
import net.minecraft.world.biome.Biome;
|
import net.minecraft.world.biome.Biome;
|
||||||
import net.minecraft.world.biome.FoliageColors;
|
import net.minecraft.world.biome.FoliageColors;
|
||||||
|
|
||||||
@@ -38,12 +39,20 @@ public class TintsDataGenerator implements IDataGenerator {
|
|||||||
Map<Integer, Integer> resultColors = new LinkedHashMap<>();
|
Map<Integer, Integer> resultColors = new LinkedHashMap<>();
|
||||||
|
|
||||||
for (int redstoneLevel : RedstoneWireBlock.POWER.getValues()) {
|
for (int redstoneLevel : RedstoneWireBlock.POWER.getValues()) {
|
||||||
int color = RedstoneWireBlock.getWireColor(redstoneLevel);
|
// Remove the unintended alpha channel from the redstone tint color
|
||||||
|
int color = removeAlphaChannel(RedstoneWireBlock.getWireColor(redstoneLevel));
|
||||||
resultColors.put(redstoneLevel, color);
|
resultColors.put(redstoneLevel, color);
|
||||||
}
|
}
|
||||||
return resultColors;
|
return resultColors;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static int removeAlphaChannel(int color) {
|
||||||
|
float r = (float) (color >> 16 & 0xFF) / 255;
|
||||||
|
float g = (float) (color >> 8 & 0xFF) / 255;
|
||||||
|
float b = (float) (color & 0xFF) / 255;
|
||||||
|
return ColorHelper.fromFloats(0, r, g, b);
|
||||||
|
}
|
||||||
|
|
||||||
private static int getBlockColor(Block block) {
|
private static int getBlockColor(Block block) {
|
||||||
return BlockColors.create().getColor(block.getDefaultState(), EmptyRenderBlockView.INSTANCE, BlockPos.ORIGIN, 0xFFFFFF);
|
return BlockColors.create().getColor(block.getDefaultState(), EmptyRenderBlockView.INSTANCE, BlockPos.ORIGIN, 0xFFFFFF);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user