<commit_before>package com.wraithavens.conquest.SinglePlayer.Blocks.BlockMesher;

import java.nio.FloatBuffer;
import java.nio.ShortBuffer;
import java.util.ArrayList;
import org.lwjgl.BufferUtils;
import com.wraithavens.conquest.SinglePlayer.BlockPopulators.BlockTextures;

public class MeshFormatter{
	private static boolean[] quadReferences = new boolean[10];
	private static final ArrayList<Integer> used = new ArrayList();
	private final BlockTypeList typeList;
	private final byte[][] quads;
	private final int[][] storage;
	private final int[][] temp;
	private final VertexStorage vertexStorage;
	private final IndexStorage indexStorage;
	private final VertexStorage waterVertexStorage;
	private final IndexStorage waterIndexStorage;
	private boolean basicState;
	private int currentTextureId;
	public MeshFormatter(){
		typeList = new BlockTypeList();
		quads = new byte[64][64];
		storage = new int[64][64];
		temp = new int[64][64];
		vertexStorage = new VertexStorage();
		indexStorage = new IndexStorage();
		waterVertexStorage = new VertexStorage();
		waterIndexStorage = new IndexStorage();
	}
	private void addQuad(int x, int y, int w, int h, int j, int o){
		float shade = j==2?1:j==3?130/255f:j==0||j==1?200/255f:180/255f;
		VertexStorage vertexStorage;
		IndexStorage indexStorage;
		if(BlockTextures.values()[currentTextureId].isWater()){
			vertexStorage = waterVertexStorage;
			indexStorage = waterIndexStorage;
			shade = 1;
		}else{
			vertexStorage = this.vertexStorage;
			indexStorage = this.indexStorage;
		}
		if(j==0){
			float sx = o;
			float sy = x;
			float sz = y;
			float bx = sx+1;
			float by = sy+w;
			float bz = sz+h;
			short v1 = (short)vertexStorage.place(bx, by, bz, shade, 0, 0, currentTextureId);
			short v2 = (short)vertexStorage.place(bx, sy, bz, shade, 0, w, currentTextureId);
			short v3 = (short)vertexStorage.place(bx, sy, sz, shade, h, w, currentTextureId);
			short v4 = (short)vertexStorage.place(bx, by, sz, shade, h, 0, currentTextureId);
			indexStorage.place(v1);
			indexStorage.place(v2);
			indexStorage.place(v3);
			indexStorage.place(v1);
			indexStorage.place(v3);
			indexStorage.place(v4);
		}else if(j==1){
			float sx = o;
			float sy = x;
			float sz = y;
			float by = sy+w;
			float bz = sz+h;
			short v1 = (short)vertexStorage.place(sx, sy, sz, shade, h, w, currentTextureId);
			short v2 = (short)vertexStorage.place(sx, sy, bz, shade, 0, w, currentTextureId);
			short v3 = (short)vertexStorage.place(sx, by, bz, shade, 0, 0, currentTextureId);
			short v4 = (short)vertexStorage.place(sx, by, sz, shade, h, 0, currentTextureId);
			indexStorage.place(v1);
			indexStorage.place(v2);
			indexStorage.place(v3);
			indexStorage.place(v1);
			indexStorage.place(v3);
			indexStorage.place(v4);
		}else if(j==2){
			float sx = x;
			float sy = o;
			float sz = y;
			float bx = sx+w;
			float by = sy+1;
			float bz = sz+h;
			short v1 = (short)vertexStorage.place(sx, by, sz, shade, 0, 0, currentTextureId);
			short v2 = (short)vertexStorage.place(sx, by, bz, shade, 0, h, currentTextureId);
			short v3 = (short)vertexStorage.place(bx, by, bz, shade, w, h, currentTextureId);
			short v4 = (short)vertexStorage.place(bx, by, sz, shade, w, 0, currentTextureId);
			indexStorage.place(v1);
			indexStorage.place(v2);
			indexStorage.place(v3);
			indexStorage.place(v1);
			indexStorage.place(v3);
			indexStorage.place(v4);
		}else if(j==3){
			float sx = x;
			float sy = o;
			float sz = y;
			float bx = sx+w;
			float bz = sz+h;
			short v1 = (short)vertexStorage.place(bx, sy, bz, shade, w, h, currentTextureId);
			short v2 = (short)vertexStorage.place(sx, sy, bz, shade, 0, h, currentTextureId);
			short v3 = (short)vertexStorage.place(sx, sy, sz, shade, 0, 0, currentTextureId);
			short v4 = (short)vertexStorage.place(bx, sy, sz, shade, w, 0, currentTextureId);
			indexStorage.place(v1);
			indexStorage.place(v2);
			indexStorage.place(v3);
			indexStorage.place(v1);
			indexStorage.place(v3);
			indexStorage.place(v4);
		}else if(j==4){
			float sx = x;
			float sy = y;
			float sz = o;
			float bx = sx+w;
			float by = sy+h;
			float bz = sz+1;
			short v1 = (short)vertexStorage.place(bx, by, bz, shade, 0, 0, currentTextureId);
			short v2 = (short)vertexStorage.place(sx, by, bz, shade, 0, w, currentTextureId);
			short v3 = (short)vertexStorage.place(sx, sy, bz, shade, h, w, currentTextureId);
			short v4 = (short)vertexStorage.place(bx, sy, bz, shade, h, 0, currentTextureId);
			indexStorage.place(v1);
			indexStorage.place(v2);
			indexStorage.place(v3);
			indexStorage.place(v1);
			indexStorage.place(v3);
			indexStorage.place(v4);
		}else if(j==5){
			float sx = x;
			float sy = y;
			float sz = o;
			float bx = sx+w;
			float by = sy+h;
			short v1 = (short)vertexStorage.place(sx, sy, sz, shade, 0, 0, currentTextureId);
			short v2 = (short)vertexStorage.place(sx, by, sz, shade, 0, h, currentTextureId);
			short v3 = (short)vertexStorage.place(bx, by, sz, shade, w, h, currentTextureId);
			short v4 = (short)vertexStorage.place(bx, sy, sz, shade, w, 0, currentTextureId);
			indexStorage.place(v1);
			indexStorage.place(v2);
			indexStorage.place(v3);
			indexStorage.place(v1);
			indexStorage.place(v3);
			indexStorage.place(v4);
		}else
			throw new RuntimeException();
	}
	private void countQuads(int quadCount, int j, int offset){
		int x, y, w, h, o;
		if(quadCount>quadReferences.length)
			quadReferences = new boolean[quadCount];
		else
			for(o = 0; o<quadReferences.length; o++)<commit_msg>Lowered global water levels by 0.1f units. (2.5 cm)<commit_after>package com.wraithavens.conquest.SinglePlayer.Blocks.BlockMesher;

import java.nio.FloatBuffer;
import java.nio.ShortBuffer;
import java.util.ArrayList;
import org.lwjgl.BufferUtils;
import com.wraithavens.conquest.SinglePlayer.BlockPopulators.BlockTextures;

public class MeshFormatter{
	private static boolean[] quadReferences = new boolean[10];
	private static final ArrayList<Integer> used = new ArrayList();
	private final BlockTypeList typeList;
	private final byte[][] quads;
	private final int[][] storage;
	private final int[][] temp;
	private final VertexStorage vertexStorage;
	private final IndexStorage indexStorage;
	private final VertexStorage waterVertexStorage;
	private final IndexStorage waterIndexStorage;
	private boolean basicState;
	private int currentTextureId;
	public MeshFormatter(){
		typeList = new BlockTypeList();
		quads = new byte[64][64];
		storage = new int[64][64];
		temp = new int[64][64];
		vertexStorage = new VertexStorage();
		indexStorage = new IndexStorage();
		waterVertexStorage = new VertexStorage();
		waterIndexStorage = new IndexStorage();
	}
	private void addQuad(int x, int y, int w, int h, int j, int o){
		float shade = j==2?1:j==3?130/255f:j==0||j==1?200/255f:180/255f;
		VertexStorage vertexStorage;
		IndexStorage indexStorage;
		boolean water;
		final float waterOffset = -0.1f;
		if(BlockTextures.values()[currentTextureId].isWater()){
			vertexStorage = waterVertexStorage;
			indexStorage = waterIndexStorage;
			shade = 1;
			water = true;
		}else{
			vertexStorage = this.vertexStorage;
			indexStorage = this.indexStorage;
			water = false;
		}
		if(j==0){
			float sx = o;
			float sy = x+(water?waterOffset:0);
			float sz = y;
			float bx = sx+1;
			float by = sy+w;
			float bz = sz+h;
			short v1 = (short)vertexStorage.place(bx, by, bz, shade, 0, 0, currentTextureId);
			short v2 = (short)vertexStorage.place(bx, sy, bz, shade, 0, w, currentTextureId);
			short v3 = (short)vertexStorage.place(bx, sy, sz, shade, h, w, currentTextureId);
			short v4 = (short)vertexStorage.place(bx, by, sz, shade, h, 0, currentTextureId);
			indexStorage.place(v1);
			indexStorage.place(v2);
			indexStorage.place(v3);
			indexStorage.place(v1);
			indexStorage.place(v3);
			indexStorage.place(v4);
		}else if(j==1){
			float sx = o;
			float sy = x+(water?waterOffset:0);
			float sz = y;
			float by = sy+w;
			float bz = sz+h;
			short v1 = (short)vertexStorage.place(sx, sy, sz, shade, h, w, currentTextureId);
			short v2 = (short)vertexStorage.place(sx, sy, bz, shade, 0, w, currentTextureId);
			short v3 = (short)vertexStorage.place(sx, by, bz, shade, 0, 0, currentTextureId);
			short v4 = (short)vertexStorage.place(sx, by, sz, shade, h, 0, currentTextureId);
			indexStorage.place(v1);
			indexStorage.place(v2);
			indexStorage.place(v3);
			indexStorage.place(v1);
			indexStorage.place(v3);
			indexStorage.place(v4);
		}else if(j==2){
			float sx = x;
			float sy = o+(water?waterOffset:0);
			float sz = y;
			float bx = sx+w;
			float by = sy+1;
			float bz = sz+h;
			short v1 = (short)vertexStorage.place(sx, by, sz, shade, 0, 0, currentTextureId);
			short v2 = (short)vertexStorage.place(sx, by, bz, shade, 0, h, currentTextureId);
			short v3 = (short)vertexStorage.place(bx, by, bz, shade, w, h, currentTextureId);
			short v4 = (short)vertexStorage.place(bx, by, sz, shade, w, 0, currentTextureId);
			indexStorage.place(v1);
			indexStorage.place(v2);
			indexStorage.place(v3);
			indexStorage.place(v1);
			indexStorage.place(v3);
			indexStorage.place(v4);
		}else if(j==3){
			float sx = x;
			float sy = o+(water?waterOffset:0);
			float sz = y;
			float bx = sx+w;
			float bz = sz+h;
			short v1 = (short)vertexStorage.place(bx, sy, bz, shade, w, h, currentTextureId);
			short v2 = (short)vertexStorage.place(sx, sy, bz, shade, 0, h, currentTextureId);
			short v3 = (short)vertexStorage.place(sx, sy, sz, shade, 0, 0, currentTextureId);
			short v4 = (short)vertexStorage.place(bx, sy, sz, shade, w, 0, currentTextureId);
			indexStorage.place(v1);
			indexStorage.place(v2);
			indexStorage.place(v3);
			indexStorage.place(v1);
			indexStorage.place(v3);
			indexStorage.place(v4);
		}else if(j==4){
			float sx = x;
			float sy = y+(water?waterOffset:0);
			float sz = o;
			float bx = sx+w;
			float by = sy+h;
			float bz = sz+1;
			short v1 = (short)vertexStorage.place(bx, by, bz, shade, 0, 0, currentTextureId);
			short v2 = (short)vertexStorage.place(sx, by, bz, shade, 0, w, currentTextureId);
			short v3 = (short)vertexStorage.place(sx, sy, bz, shade, h, w, currentTextureId);
			short v4 = (short)vertexStorage.place(bx, sy, bz, shade, h, 0, currentTextureId);
			indexStorage.place(v1);
			indexStorage.place(v2);
			indexStorage.place(v3);
			indexStorage.place(v1);
			indexStorage.place(v3);
			indexStorage.place(v4);
		}else if(j==5){
			float sx = x;
			float sy = y+(water?waterOffset:0);
			float sz = o;
			float bx = sx+w;
			float by = sy+h;
			short v1 = (short)vertexStorage.place(sx, sy, sz, shade, 0, 0, currentTextureId);
			short v2 = (short)vertexStorage.place(sx, by, sz, shade, 0, h, currentTextureId);
			short v3 = (short)vertexStorage.place(bx, by, sz, shade, w, h, currentTextureId);
			short v4 = (short)vertexStorage.place(bx, sy, sz, shade, w, 0, currentTextureId);
			indexStorage.place(v1);
			indexStorage.place(v2);
			indexStorage.place(v3);
			indexStorage.place(v1);
			indexStorage.place(v3);
			indexStorage.place(v4);
		}else
			throw new RuntimeException();
	}
	private void countQuads(int quadCount, int j, int offset){
		int x, y, w, h, o;
		if(quadCount>quadReferences.length)
			quadReferences = new boolean[quadCount];
		else
			for(o = 0; o<quadReferences.length; o++)
{'fraction_non_alphanumeric': 0.13918118312848174, 'fraction_numerical': 0.024405340878945973, 'mean_word_length': 4.3023909985935305, 'pattern_counts': {'":': 0, '<': 7, '<?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': '3114670', 'n_tokens_mistral': 4667, 'n_tokens_neox': 4058, 'n_words': 1045}