<commit_before>package net.acomputerdog.BlazeLoader.proxy;

import net.acomputerdog.BlazeLoader.api.base.ApiBase;
import net.acomputerdog.BlazeLoader.fix.FixManager;
import net.acomputerdog.BlazeLoader.main.BlazeLoader;
import net.acomputerdog.BlazeLoader.mod.ModList;
import net.minecraft.src.*;

import java.io.File;
import java.lang.reflect.Field;
import java.net.Proxy;

/**
 * Acts as a proxy to intercept method calls to Minecraft.class.  Loaded in place of normal Minecraft.class
 */
public class MinecraftProxy extends Minecraft {
    protected IntegratedServerProxy theServer = null;

    public MinecraftProxy(Session par1Session, int par2, int par3, boolean par4, boolean par5, File par6File, File par7File, File par8File, Proxy par9Proxy, String par10Str) {
        super(par1Session, par2, par3, par4, par5, par6File, par7File, par8File, par9Proxy, par10Str);
        ApiBase.theMinecraft = this;
        injectProfilerProxy();
        ApiBase.globalLogger = getLogAgent();
        BlazeLoader.init(new File(System.getProperty("user.dir")));
    }

    private void injectProfilerProxy(){
        try{
            Field[] fields = getClass().getDeclaredFields();
            for(Field f : fields){
                if(Profiler.class.isAssignableFrom(f.getType())){
                    f.setAccessible(true);
                    f.set(this, new ProfilerProxy());
                }
            }
        }catch(ReflectiveOperationException e){
            BlazeLoader.log("[ERROR] Unable to inject ProfilerProxy!  Some components may not function!");
            e.printStackTrace();
        }
    }

    @Override
    public void setDimensionAndSpawnPlayer(int par1) {
        super.setDimensionAndSpawnPlayer(par1);
        ApiBase.localPlayer = this.thePlayer;
    }

    @Override
    public void loadWorld(WorldClient par1WorldClient, String par2Str) {
        super.loadWorld(par1WorldClient, par2Str);
        theServer = null;
        ApiBase.localPlayer = this.thePlayer;
    }

    @Override
    public void launchIntegratedServer(String par1Str, String par2Str, WorldSettings par3WorldSettings) {
        super.launchIntegratedServer(par1Str, par2Str, par3WorldSettings);<commit_msg>Fixed potential bug in MinecraftProxy<commit_after>package net.acomputerdog.BlazeLoader.proxy;

import net.acomputerdog.BlazeLoader.api.base.ApiBase;
import net.acomputerdog.BlazeLoader.fix.FixManager;
import net.acomputerdog.BlazeLoader.main.BlazeLoader;
import net.acomputerdog.BlazeLoader.mod.ModList;
import net.minecraft.src.*;

import java.io.File;
import java.lang.reflect.Field;
import java.net.Proxy;

/**
 * Acts as a proxy to intercept method calls to Minecraft.class.  Loaded in place of normal Minecraft.class
 */
public class MinecraftProxy extends Minecraft {
    protected IntegratedServerProxy theServer = null;

    public MinecraftProxy(Session par1Session, int par2, int par3, boolean par4, boolean par5, File par6File, File par7File, File par8File, Proxy par9Proxy, String par10Str) {
        super(par1Session, par2, par3, par4, par5, par6File, par7File, par8File, par9Proxy, par10Str);
        ApiBase.theMinecraft = this;
        injectProfilerProxy();
        ApiBase.globalLogger = getLogAgent();
        BlazeLoader.init(new File(System.getProperty("user.dir")));
    }

    private void injectProfilerProxy(){
        try{
            Field[] fields = getClass().getDeclaredFields();
            for(Field f : fields){
                if(Profiler.class.isAssignableFrom(f.getType())){
                    f.setAccessible(true);
                    f.set(this, new ProfilerProxy());
                }
            }
        }catch(ReflectiveOperationException e){
            BlazeLoader.log("[ERROR] Unable to inject ProfilerProxy!  Some components may not function!");
            e.printStackTrace();
        }
    }

    @Override
    public void setDimensionAndSpawnPlayer(int par1) {
        super.setDimensionAndSpawnPlayer(par1);
        ApiBase.localPlayer = this.thePlayer;
    }

    @Override
    public void loadWorld(WorldClient par1WorldClient, String par2Str) {
        super.loadWorld(par1WorldClient, par2Str);
        theServer = (IntegratedServerProxy)getIntegratedServer();
        ApiBase.localPlayer = this.thePlayer;
    }

    @Override
    public void launchIntegratedServer(String par1Str, String par2Str, WorldSettings par3WorldSettings) {
        super.launchIntegratedServer(par1Str, par2Str, par3WorldSettings);
{'fraction_non_alphanumeric': 0.09257602862254025, 'fraction_numerical': 0.01520572450805009, 'mean_word_length': 3.223796033994334, 'pattern_counts': {'":': 0, '<': 3, '<?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': '5827255', 'n_tokens_mistral': 1312, 'n_tokens_neox': 1315, 'n_words': 287}