<commit_before>package wraith.library.WorldManagement.TileGrid;

import java.awt.image.BufferedImage;
import wraith.library.MiscUtil.ImageUtil;

public class Chipset{
	private TileMaterial[] materials;
	private final int rows, cols;
	private final BufferedImage[] tiles;
	public Chipset(BufferedImage img, int rows, int cols){
		if(img==null)throw new IllegalArgumentException("Image cannot be null!");
		if(rows<1||cols<1)throw new IllegalArgumentException("Rows and cols must be at least 1!");
		tiles=ImageUtil.splitImage(img, rows, cols);
		this.cols=cols;
		this.rows=rows;
	}
	public Chipset(BufferedImage img, int size){
		if(img==null)throw new IllegalArgumentException("Image cannot be null!");
		if(size<1)throw new IllegalArgumentException("Size cannot be less then 1!");
		this.cols=img.getWidth()/size;
		this.rows=img.getHeight()/size;
		tiles=ImageUtil.splitImage(img, rows, cols);
	}
	public void generateTileMaterials(){
		materials=new TileMaterial[tiles.length];
		for(int i = 0; i<tiles.length; i++)materials[i]=new StaticTileMaterial(tiles[i]);
	}
	public BufferedImage getTile(int x, int y){ return tiles[y*cols+x]; }
	public TileMaterial getTileMaterial(int x, int y){ return materials[y*cols+x]; }
	public int getRows(){ return rows; }
	public int getCols(){ return cols; }
}<commit_msg>Chipsets can now have different scale levels prepared, for quicker rendering.<commit_after>package wraith.library.WorldManagement.TileGrid;

import java.awt.image.BufferedImage;
import wraith.library.MiscUtil.ImageUtil;

public class Chipset{
	private int scaleLevel;
	private TileMaterial[][] materials;
	private final int rows, cols;
	private final BufferedImage[][] tiles;
	public Chipset(BufferedImage img, int rows, int cols, int scales){
		if(img==null)throw new IllegalArgumentException("Image cannot be null!");
		if(rows<1||cols<1)throw new IllegalArgumentException("Rows and cols must be at least 1!");
		if(scales<1)throw new IllegalArgumentException("Scales must be at least equal to 1!");
		tiles=ImageUtil.splitImageAndScale(img, rows, cols, scales);
		this.cols=cols;
		this.rows=rows;
	}
	public Chipset(BufferedImage img, int size, int scales){
		if(img==null)throw new IllegalArgumentException("Image cannot be null!");
		if(size<1)throw new IllegalArgumentException("Size cannot be less then 1!");
		if(scales<1)throw new IllegalArgumentException("Scales must be at least equal to 1!");
		this.cols=img.getWidth()/size;
		this.rows=img.getHeight()/size;
		tiles=ImageUtil.splitImageAndScale(img, rows, cols, scales);
	}
	public void generateTileMaterials(){
		materials=new TileMaterial[tiles.length][tiles[0].length];
		int i, j;
		for(i=0; i<tiles.length; i++)for(j=0; j<tiles[0].length; j++)materials[i][j]=new StaticTileMaterial(tiles[i][j]);
	}
	public BufferedImage getTile(int x, int y){ return tiles[scaleLevel][y*cols+x]; }
	public TileMaterial getTileMaterial(int x, int y){ return materials[scaleLevel][y*cols+x]; }
	public int getRows(){ return rows; }
	public int getCols(){ return cols; }
	public void setScaleLevel(int scaleLevel){ this.scaleLevel=scaleLevel; }
	public int getScaleLevel(){ return scaleLevel; }
	public int getScaleDepth(){ return tiles.length; }
}
{'fraction_non_alphanumeric': 0.12679127725856698, 'fraction_numerical': 0.005919003115264798, 'mean_word_length': 6.450116009280743, 'pattern_counts': {'":': 0, '<': 14, '<?xml version=': 0, '>': 3, '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': '4741257', 'n_tokens_mistral': 1062, 'n_tokens_neox': 1004, 'n_words': 283}