<commit_before>package codechicken.lib.colour;

import codechicken.lib.math.MathHelper;
import codechicken.lib.render.TextureUtils;
import net.minecraft.util.ResourceLocation;

import java.awt.image.BufferedImage;

public class CustomGradient
{
    public int[] gradient;
    
    public CustomGradient(ResourceLocation textureFile)
    {
        BufferedImage img = TextureUtils.loadBufferedImage(textureFile);
        int[] data = new int[img.getWidth()];
        img.getRGB(0, 0, img.getWidth(), 1, data, 0, img.getWidth());
        gradient = new int[img.getWidth()];
        for(int i = 0; i < data.length; i++)
            gradient[i] = (data[i]<<8)|(((data[i])>>24)&0xFF);
    }
    
    public ColourRGBA getColour(double position)<commit_msg>Add meaningful exception text to CustomGradient when resource not found<commit_after>package codechicken.lib.colour;

import codechicken.lib.math.MathHelper;
import codechicken.lib.render.TextureUtils;
import net.minecraft.util.ResourceLocation;

import java.awt.image.BufferedImage;

public class CustomGradient
{
    public int[] gradient;
    
    public CustomGradient(ResourceLocation textureFile)
    {
        BufferedImage img = TextureUtils.loadBufferedImage(textureFile);
        if(img == null)
            throw new RuntimeException("File not found: "+textureFile.toString());

        int[] data = new int[img.getWidth()];
        img.getRGB(0, 0, img.getWidth(), 1, data, 0, img.getWidth());
        gradient = new int[img.getWidth()];
        for(int i = 0; i < data.length; i++)
            gradient[i] = (data[i]<<8)|(((data[i])>>24)&0xFF);
    }
    
    public ColourRGBA getColour(double position)
{'fraction_non_alphanumeric': 0.12829736211031176, 'fraction_numerical': 0.01079136690647482, 'mean_word_length': 3.5726027397260274, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '520644', 'n_tokens_mistral': 524, 'n_tokens_neox': 506, 'n_words': 112}