<commit_before>package gigaherz.elementsofpower.client.renderers;

import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Maps;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.VertexBuffer;
import net.minecraft.client.renderer.block.model.BakedQuad;
import net.minecraft.client.renderer.block.model.IBakedModel;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.client.renderer.vertex.VertexFormat;
import net.minecraft.client.resources.IReloadableResourceManager;
import net.minecraft.client.resources.IResourceManager;
import net.minecraft.client.resources.IResourceManagerReloadListener;
import net.minecraft.crash.CrashReport;
import net.minecraft.util.ReportedException;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.model.*;
import net.minecraftforge.client.model.pipeline.LightUtil;
import org.lwjgl.opengl.GL11;

import javax.annotation.Nonnull;
import java.util.Map;

public class ModelHandle
{
    static Map<String, IBakedModel> loadedModels = Maps.newHashMap();

    private String model;
    private String key;
    private final Map<String, String> textureReplacements = Maps.newHashMap();
    private VertexFormat vertexFormat = Attributes.DEFAULT_BAKED_FORMAT;

    private ModelHandle(String model)
    {
        this.model = model;
        this.key = model;
    }

    public ModelHandle replace(String texChannel, String resloc)
    {
        key += "//" + texChannel + "/" + resloc;
        textureReplacements.put(texChannel, resloc);
        return this;
    }

    public ModelHandle vertexFormat(VertexFormat fmt)
    {
        key += "//VF:" + fmt.hashCode();
        vertexFormat = fmt;
        return this;
    }

    public String getModel()
    {
        return model;
    }

    public String getKey()
    {
        return key;
    }

    public Map<String, String> getTextureReplacements()
    {
        return textureReplacements;
    }

    public VertexFormat getVertexFormat()
    {
        return vertexFormat;
    }

    public void setVertexFormat(VertexFormat vertexFormat)
    {
        this.vertexFormat = vertexFormat;
    }

    public IBakedModel get()
    {
        return loadModel(this);
    }

    // ========================================================= STATIC METHODS

    public static void init()
    {
        IResourceManager rm = Minecraft.getMinecraft().getResourceManager();
        if (rm instanceof IReloadableResourceManager)
        {
            ((IReloadableResourceManager) rm).registerReloadListener(new IResourceManagerReloadListener()
            {
                @Override
                public void onResourceManagerReload(IResourceManager __)
                {
                    loadedModels.clear();
                }
            });
        }
    }

    @Nonnull<commit_msg>Remove derp from using the IDE to autogenerate accessors.<commit_after>package gigaherz.elementsofpower.client.renderers;

import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Maps;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.VertexBuffer;
import net.minecraft.client.renderer.block.model.BakedQuad;
import net.minecraft.client.renderer.block.model.IBakedModel;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.client.renderer.vertex.VertexFormat;
import net.minecraft.client.resources.IReloadableResourceManager;
import net.minecraft.client.resources.IResourceManager;
import net.minecraft.client.resources.IResourceManagerReloadListener;
import net.minecraft.crash.CrashReport;
import net.minecraft.util.ReportedException;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.model.*;
import net.minecraftforge.client.model.pipeline.LightUtil;
import org.lwjgl.opengl.GL11;

import javax.annotation.Nonnull;
import java.util.Map;

public class ModelHandle
{
    static Map<String, IBakedModel> loadedModels = Maps.newHashMap();

    private String model;
    private String key;
    private final Map<String, String> textureReplacements = Maps.newHashMap();
    private VertexFormat vertexFormat = Attributes.DEFAULT_BAKED_FORMAT;

    private ModelHandle(String model)
    {
        this.model = model;
        this.key = model;
    }

    public ModelHandle replace(String texChannel, String resloc)
    {
        key += "//" + texChannel + "/" + resloc;
        textureReplacements.put(texChannel, resloc);
        return this;
    }

    public ModelHandle vertexFormat(VertexFormat fmt)
    {
        key += "//VF:" + fmt.hashCode();
        vertexFormat = fmt;
        return this;
    }

    public String getModel()
    {
        return model;
    }

    public String getKey()
    {
        return key;
    }

    public Map<String, String> getTextureReplacements()
    {
        return textureReplacements;
    }

    public VertexFormat getVertexFormat()
    {
        return vertexFormat;
    }

    public IBakedModel get()
    {
        return loadModel(this);
    }

    // ========================================================= STATIC METHODS

    public static void init()
    {
        IResourceManager rm = Minecraft.getMinecraft().getResourceManager();
        if (rm instanceof IReloadableResourceManager)
        {
            ((IReloadableResourceManager) rm).registerReloadListener(new IResourceManagerReloadListener()
            {
                @Override
                public void onResourceManagerReload(IResourceManager __)
                {
                    loadedModels.clear();
                }
            });
        }
    }

    @Nonnull
{'fraction_non_alphanumeric': 0.10795847750865052, 'fraction_numerical': 0.0006920415224913495, 'mean_word_length': 3.051156271899089, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '2498921', 'n_tokens_mistral': 1613, 'n_tokens_neox': 1599, 'n_words': 303}