<commit_before>package codechicken.lib.render;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.util.ResourceLocation;
import codechicken.lib.lighting.CCRBModel;
import codechicken.lib.lighting.LightModel;
import codechicken.lib.vec.Cuboid6;
import codechicken.lib.vec.RedundantTransformation;
import codechicken.lib.vec.Transformation;
import codechicken.lib.vec.TransformationList;
import codechicken.lib.vec.Translation;
import codechicken.lib.vec.Vector3;

import static codechicken.lib.vec.Rotation.*;

public class CCModel
{
    private static class PositionNormalEntry
    {        
        public Vector3 pos;
        public LinkedList<Vector3> normals = new LinkedList<Vector3>();
        
        public PositionNormalEntry(Vector3 position)
        {
            pos = position;
        }
        
        public boolean positionEqual(Vector3 v)
        {
            return pos.x == v.x && pos.y == v.y && pos.z == v.z;
        }
        
        public PositionNormalEntry addNormal(Vector3 normal)
        {
            normals.add(normal);
            return this;
        }
    }
    
    public final int vertexMode;
    public final int vp;
    public Vertex5[] verts;
    public Vector3[] normals;
    public int[] colours;
    
    protected CCModel(int vertexMode)
    {
        if(vertexMode != 7 && vertexMode != 4)
            throw new IllegalArgumentException("Models must be GL_QUADS or GL_TRIANGLES");
        
        this.vertexMode = vertexMode;
        vp = vertexMode == 7 ? 4 : 3;
    }
    
    /**
     * Each pixel corresponds to one unit of position when generating the model
     * @param i Vertex index to start generating at
     * @param x1 The minX bound of the box
     * @param y1 The minY bound of the box
     * @param z1 The minZ bound of the box
     * @param w The width of the box
     * @param h The height of the box
     * @param d The depth of the box
     * @param tx The distance of the top left corner of the texture map from the left in pixels
     * @param ty The distance of the top left corner of the texture map from the top in pixels
     * @param tw The width of the texture in pixels
     * @param th The height of the texture in pixels
     * @param f The scale of the model, pixels per block, normally 16
     * @return The generated model
     */
    public CCModel generateBox(int i, double x1, double y1, double z1, double w, double h, double d, double tx, double ty, double tw, double th, double f)
    {
        double u1, v1, u2, v2;
        double x2 = x1+w;
        double y2 = y1+h;
        double z2 = z1+d;
        x1 /= f; x2 /= f; y1 /= f; y2 /= f; z1 /= f; z2 /= f;
    
        //bottom face
        u1 = (tx + d + w) / tw; v1 = (ty + d) / th;
        u2 = (tx + d*2 + w) / tw; v2 = ty / th;
        verts[i++] = new Vertex5(x1, y1, z2, u1, v2);
        verts[i++] = new Vertex5(x1, y1, z1, u1, v1);
        verts[i++] = new Vertex5(x2, y1, z1, u2, v1);
        verts[i++] = new Vertex5(x2, y1, z2, u2, v2);
    
        //top face
        u1 = (tx + d) / tw; v1 = (ty + d) / th;
        u2 = (tx + d + w) / tw; v2 = ty / th;
        verts[i++] = new Vertex5(x2, y2, z2, u2, v2);
        verts[i++] = new Vertex5(x2, y2, z1, u2, v1);
        verts[i++] = new Vertex5(x1, y2, z1, u1, v1);
        verts[i++] = new Vertex5(x1, y2, z2, u1, v2);
    
        //front face
        u1 = (tx + d + w) / tw; v1 = (ty + d) / th;
        u2 = (tx + d) / tw; v2 = (ty + d + h) / th;
        verts[i++] = new Vertex5(x1, y2, z1, u2, v1);
        verts[i++] = new Vertex5(x2, y2, z1, u1, v1);
        verts[i++] = new Vertex5(x2, y1, z1, u1, v2);
        verts[i++] = new Vertex5(x1, y1, z1, u2, v2);
    
        //back face
        u1 = (tx + d*2 + w*2) / tw; v1 = (ty + d) / th;
        u2 = (tx + d*2 + w) / tw; v2 = (ty + d + h) / th;
        verts[i++] = new Vertex5(x1, y2, z2, u1, v1);
        verts[i++] = new Vertex5(x1, y1, z2, u1, v2);
        verts[i++] = new Vertex5(x2, y1, z2, u2, v2);
        verts[i++] = new Vertex5(x2, y2, z2, u2, v1);
    
        //left face
        u1 = (tx + d) / tw; v1 = (ty + d) / th;
        u2 = (tx) / tw; v2 = (ty + d + h) / th;
        verts[i++] = new Vertex5(x1, y2, z2, u2, v1);
        verts[i++] = new Vertex5(x1, y2, z1, u1, v1);
        verts[i++] = new Vertex5(x1, y1, z1, u1, v2);
        verts[i++] = new Vertex5(x1, y1, z2, u2, v2);
    
        //right face
        u1 = (tx + d*2 + w) / tw; v1 = (ty + d) / th;
        u2 = (tx + d + w) / tw; v2 = (ty + d + h) / th;
        verts[i++] = new Vertex5(x2, y1, z2, u1, v2);
        verts[i++] = new Vertex5(x2, y1, z1, u2, v2);
        verts[i++] = new Vertex5(x2, y2, z1, u2, v1);
        verts[i++] = new Vertex5(x2, y2, z2, u1, v1);
        
        return this;
    }

    /**
     * Generates a box, uv mapped to be the same as a minecraft block with the same bounds
     * @param i The vertex index to start generating at
     * @param bounds The bounds of the block, 0 to 1
     * @return The generated model. When rendering an icon will need to be supplied for the UV transformation.
     */
    public CCModel generateBlock(int i, Cuboid6 bounds)
    {
        return generateBlock(i, bounds.min.x, bounds.min.y, bounds.min.z, bounds.max.x, bounds.max.y, bounds.max.z);
    }
<commit_msg>Added missing overload for CCModel.generateBlock<commit_after>package codechicken.lib.render;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.util.ResourceLocation;
import codechicken.lib.lighting.CCRBModel;
import codechicken.lib.lighting.LightModel;
import codechicken.lib.vec.Cuboid6;
import codechicken.lib.vec.RedundantTransformation;
import codechicken.lib.vec.Transformation;
import codechicken.lib.vec.TransformationList;
import codechicken.lib.vec.Translation;
import codechicken.lib.vec.Vector3;

import static codechicken.lib.vec.Rotation.*;

public class CCModel
{
    private static class PositionNormalEntry
    {        
        public Vector3 pos;
        public LinkedList<Vector3> normals = new LinkedList<Vector3>();
        
        public PositionNormalEntry(Vector3 position)
        {
            pos = position;
        }
        
        public boolean positionEqual(Vector3 v)
        {
            return pos.x == v.x && pos.y == v.y && pos.z == v.z;
        }
        
        public PositionNormalEntry addNormal(Vector3 normal)
        {
            normals.add(normal);
            return this;
        }
    }
    
    public final int vertexMode;
    public final int vp;
    public Vertex5[] verts;
    public Vector3[] normals;
    public int[] colours;
    
    protected CCModel(int vertexMode)
    {
        if(vertexMode != 7 && vertexMode != 4)
            throw new IllegalArgumentException("Models must be GL_QUADS or GL_TRIANGLES");
        
        this.vertexMode = vertexMode;
        vp = vertexMode == 7 ? 4 : 3;
    }
    
    /**
     * Each pixel corresponds to one unit of position when generating the model
     * @param i Vertex index to start generating at
     * @param x1 The minX bound of the box
     * @param y1 The minY bound of the box
     * @param z1 The minZ bound of the box
     * @param w The width of the box
     * @param h The height of the box
     * @param d The depth of the box
     * @param tx The distance of the top left corner of the texture map from the left in pixels
     * @param ty The distance of the top left corner of the texture map from the top in pixels
     * @param tw The width of the texture in pixels
     * @param th The height of the texture in pixels
     * @param f The scale of the model, pixels per block, normally 16
     * @return The generated model
     */
    public CCModel generateBox(int i, double x1, double y1, double z1, double w, double h, double d, double tx, double ty, double tw, double th, double f)
    {
        double u1, v1, u2, v2;
        double x2 = x1+w;
        double y2 = y1+h;
        double z2 = z1+d;
        x1 /= f; x2 /= f; y1 /= f; y2 /= f; z1 /= f; z2 /= f;
    
        //bottom face
        u1 = (tx + d + w) / tw; v1 = (ty + d) / th;
        u2 = (tx + d*2 + w) / tw; v2 = ty / th;
        verts[i++] = new Vertex5(x1, y1, z2, u1, v2);
        verts[i++] = new Vertex5(x1, y1, z1, u1, v1);
        verts[i++] = new Vertex5(x2, y1, z1, u2, v1);
        verts[i++] = new Vertex5(x2, y1, z2, u2, v2);
    
        //top face
        u1 = (tx + d) / tw; v1 = (ty + d) / th;
        u2 = (tx + d + w) / tw; v2 = ty / th;
        verts[i++] = new Vertex5(x2, y2, z2, u2, v2);
        verts[i++] = new Vertex5(x2, y2, z1, u2, v1);
        verts[i++] = new Vertex5(x1, y2, z1, u1, v1);
        verts[i++] = new Vertex5(x1, y2, z2, u1, v2);
    
        //front face
        u1 = (tx + d + w) / tw; v1 = (ty + d) / th;
        u2 = (tx + d) / tw; v2 = (ty + d + h) / th;
        verts[i++] = new Vertex5(x1, y2, z1, u2, v1);
        verts[i++] = new Vertex5(x2, y2, z1, u1, v1);
        verts[i++] = new Vertex5(x2, y1, z1, u1, v2);
        verts[i++] = new Vertex5(x1, y1, z1, u2, v2);
    
        //back face
        u1 = (tx + d*2 + w*2) / tw; v1 = (ty + d) / th;
        u2 = (tx + d*2 + w) / tw; v2 = (ty + d + h) / th;
        verts[i++] = new Vertex5(x1, y2, z2, u1, v1);
        verts[i++] = new Vertex5(x1, y1, z2, u1, v2);
        verts[i++] = new Vertex5(x2, y1, z2, u2, v2);
        verts[i++] = new Vertex5(x2, y2, z2, u2, v1);
    
        //left face
        u1 = (tx + d) / tw; v1 = (ty + d) / th;
        u2 = (tx) / tw; v2 = (ty + d + h) / th;
        verts[i++] = new Vertex5(x1, y2, z2, u2, v1);
        verts[i++] = new Vertex5(x1, y2, z1, u1, v1);
        verts[i++] = new Vertex5(x1, y1, z1, u1, v2);
        verts[i++] = new Vertex5(x1, y1, z2, u2, v2);
    
        //right face
        u1 = (tx + d*2 + w) / tw; v1 = (ty + d) / th;
        u2 = (tx + d + w) / tw; v2 = (ty + d + h) / th;
        verts[i++] = new Vertex5(x2, y1, z2, u1, v2);
        verts[i++] = new Vertex5(x2, y1, z1, u2, v2);
        verts[i++] = new Vertex5(x2, y2, z1, u2, v1);
        verts[i++] = new Vertex5(x2, y2, z2, u1, v1);
        
        return this;
    }

    /**
     * Generates a box, uv mapped to be the same as a minecraft block with the same bounds
     * @param i The vertex index to start generating at
     * @param bounds The bounds of the block, 0 to 1
     * @return The generated model. When rendering an icon will need to be supplied for the UV transformation.
     */
    public CCModel generateBlock(int i, Cuboid6 bounds)
    {
        return generateBlock(i, bounds, 0);
    }
    
    public CCModel generateBlock(int i, Cuboid6 bounds, int mask)
    {
        return generateBlock(i, bounds.min.x, bounds.min.y, bounds.min.z, bounds.max.x, bounds.max.y, bounds.max.z, mask);
    }

{'fraction_non_alphanumeric': 0.13238341968911918, 'fraction_numerical': 0.03730569948186528, 'mean_word_length': 2.1487221315932574, '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': '4133556', 'n_tokens_mistral': 4276, 'n_tokens_neox': 4213, 'n_words': 1359}