<commit_before>package com.ezardlabs.dethsquare;

import com.ezardlabs.dethsquare.util.RenderUtils;
import com.ezardlabs.dethsquare.util.Utils;

import java.io.BufferedReader;
import java.io.IOException;
import java.util.HashMap;

public final class TextureAtlas {
	final String imagePath;
	final String mapPath;
	private final HashMap<String, Sprite> atlas = new HashMap<>();
	public int textureName = -1;
	public int width;
	public int height;

	private TextureAtlas(String imagePath, String mapPath, int tileWidth, int tileHeight) {
		this.imagePath = imagePath;
		this.mapPath = mapPath;

		int[] data;
		if (Renderer.textures.containsKey(imagePath)) {
			data = Renderer.textures.get(imagePath);
		} else {
			data = RenderUtils.loadImage(imagePath);
			Renderer.textures.put(imagePath, data);
		}

		textureName = data[0];
		width = data[1];
		height = data[2];

		if(mapPath != null) {
			try {
				String temp;
				BufferedReader reader = Utils.getReader(mapPath);
				while ((temp = reader.readLine()) != null) {
					String[] split = temp.split(" = ");
					String[] split2 = split[1].split(" ");
					atlas.put(split[0], new Sprite(Float.parseFloat(split2[0]) / width,
							Float.parseFloat(split2[1]) / height, Float.parseFloat(split2[2]) / width,
							Float.parseFloat(split2[3]) / height));
				}
			} catch (IOException ignored) {
			}
		} else {
			int count = 0;
			for(int y = 0; y < height; y += tileHeight) {
				for(int x = 0; x < width; x += tileWidth) {
					atlas.put(String.valueOf(count++),
						new Sprite(
							(float) x / width,
							(float) y / height,
							(float) tileWidth / width,
							(float) tileHeight / height
						)
					);<commit_msg>Update to work with new IOUtils class<commit_after>package com.ezardlabs.dethsquare;

import com.ezardlabs.dethsquare.util.IOUtils;
import com.ezardlabs.dethsquare.util.RenderUtils;

import java.io.BufferedReader;
import java.io.IOException;
import java.util.HashMap;

public final class TextureAtlas {
	final String imagePath;
	final String mapPath;
	private final HashMap<String, Sprite> atlas = new HashMap<>();
	public int textureName = -1;
	public int width;
	public int height;

	private TextureAtlas(String imagePath, String mapPath, int tileWidth, int tileHeight) {
		this.imagePath = imagePath;
		this.mapPath = mapPath;

		int[] data;
		if (Renderer.textures.containsKey(imagePath)) {
			data = Renderer.textures.get(imagePath);
		} else {
			data = RenderUtils.loadImage(imagePath);
			Renderer.textures.put(imagePath, data);
		}

		textureName = data[0];
		width = data[1];
		height = data[2];

		if(mapPath != null) {
			try {
				String temp;
				BufferedReader reader = IOUtils.getReader(mapPath);
				while ((temp = reader.readLine()) != null) {
					String[] split = temp.split(" = ");
					String[] split2 = split[1].split(" ");
					atlas.put(split[0], new Sprite(Float.parseFloat(split2[0]) / width,
							Float.parseFloat(split2[1]) / height, Float.parseFloat(split2[2]) / width,
							Float.parseFloat(split2[3]) / height));
				}
			} catch (IOException ignored) {
			}
		} else {
			int count = 0;
			for(int y = 0; y < height; y += tileHeight) {
				for(int x = 0; x < width; x += tileWidth) {
					atlas.put(String.valueOf(count++),
						new Sprite(
							(float) x / width,
							(float) y / height,
							(float) tileWidth / width,
							(float) tileHeight / height
						)
					);
{'fraction_non_alphanumeric': 0.13572267920094008, 'fraction_numerical': 0.010575793184488837, 'mean_word_length': 3.3486590038314175, 'pattern_counts': {'":': 0, '<': 11, '<?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': '2139045', 'n_tokens_mistral': 1365, 'n_tokens_neox': 1144, 'n_words': 272}