<commit_before>package me.nallar.modpatcher;

import net.minecraft.launchwrapper.ITweaker;
import net.minecraft.launchwrapper.Launch;
import net.minecraft.launchwrapper.LaunchClassLoader;

import java.io.*;
import java.lang.reflect.*;
import java.util.*;

/**
 * Tries to ensure that our transformer is last
 */
public class ModPatcherTweaker implements ITweaker {
	@SuppressWarnings("unchecked")
	public static void add() {
		List<String> newTweaks = (List<String>) Launch.blackboard.get("TweakClasses");
		newTweaks.add(ModPatcherTweaker.class.getName());
	}

	private static void inject() {
		LaunchClassLoaderUtil.addTransformer(ModPatcherTransformer.getInstance());
		try {
			Class<?> mixinEnvironmentClass = Class.forName("org.spongepowered.asm.mixin.MixinEnvironment", false, ModPatcherTweaker.class.getClassLoader());
			Field f = mixinEnvironmentClass.getDeclaredField("excludeTransformers");
			f.setAccessible(true);
			Set<String> vals = (Set<String>) f.get(null);
			vals.add(ModPatcherTransformer.class.getName());
		} catch (ClassNotFoundException ignored) {
			// TODO Silence this once confirmed working?
			PatcherLog.trace("Failed to find mixin environment, normal for non-spongepowered", ignored);
		} catch (NoSuchFieldException | IllegalAccessException e) {
			PatcherLog.warn("Failed to add mixin transformer exclusion for our transformer", e);
		}
	}

	@Override
	public void acceptOptions(List<String> list, File file, File file1, String s) {
		inject();
	}

	@Override
	public void injectIntoClassLoader(LaunchClassLoader launchClassLoader) {
		inject();
	}

	@Override
	public String getLaunchTarget() {
		inject();
		LaunchClassLoaderUtil.dumpTransformersIfEnabled();
		return null;
	}

	@Override
	public String[] getLaunchArguments() {
		inject();
		return new String[0];
	}
}
<commit_msg>Dump transformers in ModPatcherTweaker correctly<commit_after>package me.nallar.modpatcher;

import net.minecraft.launchwrapper.ITweaker;
import net.minecraft.launchwrapper.Launch;
import net.minecraft.launchwrapper.LaunchClassLoader;

import java.io.*;
import java.lang.reflect.*;
import java.util.*;

/**
 * Tries to ensure that our transformer is last
 */
public class ModPatcherTweaker implements ITweaker {
	@SuppressWarnings("unchecked")
	public static void add() {
		List<String> newTweaks = (List<String>) Launch.blackboard.get("TweakClasses");
		newTweaks.add(ModPatcherTweaker.class.getName());
	}

	private static void inject() {
		LaunchClassLoaderUtil.addTransformer(ModPatcherTransformer.getInstance());
		try {
			Class<?> mixinEnvironmentClass = Class.forName("org.spongepowered.asm.mixin.MixinEnvironment", false, ModPatcherTweaker.class.getClassLoader());
			Field f = mixinEnvironmentClass.getDeclaredField("excludeTransformers");
			f.setAccessible(true);
			Set<String> vals = (Set<String>) f.get(null);
			vals.add(ModPatcherTransformer.class.getName());
		} catch (ClassNotFoundException ignored) {
			// TODO Silence this once confirmed working?
			PatcherLog.trace("Failed to find mixin environment, normal for non-spongepowered", ignored);
		} catch (NoSuchFieldException | IllegalAccessException e) {
			PatcherLog.warn("Failed to add mixin transformer exclusion for our transformer", e);
		}
	}

	@Override
	public void acceptOptions(List<String> list, File file, File file1, String s) {
	}

	@Override
	public void injectIntoClassLoader(LaunchClassLoader launchClassLoader) {
		inject();
	}

	@Override
	public String getLaunchTarget() {
		throw new UnsupportedOperationException("ModPatcherTweaker is not a primary tweaker.");
	}

	@Override
	public String[] getLaunchArguments() {
		inject();
		LaunchClassLoaderUtil.dumpTransformersIfEnabled();
		return new String[0];
	}
}

{'fraction_non_alphanumeric': 0.11137949543746645, 'fraction_numerical': 0.0010735373054213634, 'mean_word_length': 5.6553571428571425, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, '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': '5626041', 'n_tokens_mistral': 1185, 'n_tokens_neox': 1106, 'n_words': 254}