<commit_before>package modtweaker.mods.thaumcraft;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

import modtweaker.helpers.ReflectionHelper;
import thaumcraft.api.ThaumcraftApi;
import thaumcraft.api.ThaumcraftApi.EntityTags;
import thaumcraft.api.aspects.Aspect;
import thaumcraft.api.aspects.AspectList;
import thaumcraft.api.research.ResearchCategories;

public class ThaumcraftHelper {
    public static ArrayList recipes = null;
    public static HashMap<Object, Integer> warpList;

    static {
        try {
            recipes = ReflectionHelper.getStaticObject(ThaumcraftApi.class, "recipes");
            warpList = ReflectionHelper.getStaticObject(ThaumcraftApi.class, "warpMap");
        } catch (Exception e) {}
    }

    private ThaumcraftHelper() {}

    public static AspectList parseAspects(String aspects) {
        return parseAspects(new AspectList(), aspects);
    }

    public static AspectList parseAspects(AspectList list, String str) {
        if (list == null) list = new AspectList();
        if (str == null || str.equals("")) return list;
        String[] aspects = str.split(",");
        for (String aspect : aspects) {
            if (aspect.startsWith(" ")) aspect = aspect.replaceFirst(" ", "");
            String[] aspct = aspect.split("\\s+");
            if (aspct.length == 2) list.add(Aspect.aspects.get(aspct[0]), Integer.parseInt(aspct[1]));
        }

        return list;
    }

    public static AspectList removeAspects(AspectList list, String str) {
        String[] aspects = str.split(",");
        for (String aspect : aspects) {
            if (aspect.startsWith(" ")) aspect = aspect.replaceFirst(" ", "");
            String[] aspct = aspect.split("\\s+");
            if (aspct.length == 2) {
                list.remove(Aspect.aspects.get(aspct[0]), Integer.parseInt(aspct[1]));
            }
        }

        return list;
    }

    public static String getResearchTab(String key) {
        for (String tab : ResearchCategories.researchCategories.keySet()) {
            for (String research : ResearchCategories.researchCategories.get(tab).research.keySet()) {
                if (research.equals(key)) return tab;
            }
        }
        return null;
    }

	public static AspectList getEntityAspects(String name) {
		for(EntityTags tag : ThaumcraftApi.scanEntities)
		{
			if(tag.entityName==name && tag.nbts.length==0)
				return tag.aspects;
		}
		return null;
	}

	public static void removeEntityAspects(String name) {
		List<EntityTags> tags = ThaumcraftApi.scanEntities;
		for(EntityTags tag : tags)
		{
			if(tag.entityName==name && tag.nbts.length==0)
				ThaumcraftApi.scanEntities.remove(tag);
		}
	}

}<commit_msg>Fixed a concurrent modifier exception.<commit_after>package modtweaker.mods.thaumcraft;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

import modtweaker.helpers.ReflectionHelper;
import thaumcraft.api.ThaumcraftApi;
import thaumcraft.api.ThaumcraftApi.EntityTags;
import thaumcraft.api.aspects.Aspect;
import thaumcraft.api.aspects.AspectList;
import thaumcraft.api.research.ResearchCategories;

public class ThaumcraftHelper {
    public static ArrayList recipes = null;
    public static HashMap<Object, Integer> warpList;

    static {
        try {
            recipes = ReflectionHelper.getStaticObject(ThaumcraftApi.class, "recipes");
            warpList = ReflectionHelper.getStaticObject(ThaumcraftApi.class, "warpMap");
        } catch (Exception e) {}
    }

    private ThaumcraftHelper() {}

    public static AspectList parseAspects(String aspects) {
        return parseAspects(new AspectList(), aspects);
    }

    public static AspectList parseAspects(AspectList list, String str) {
        if (list == null) list = new AspectList();
        if (str == null || str.equals("")) return list;
        String[] aspects = str.split(",");
        for (String aspect : aspects) {
            if (aspect.startsWith(" ")) aspect = aspect.replaceFirst(" ", "");
            String[] aspct = aspect.split("\\s+");
            if (aspct.length == 2) list.add(Aspect.aspects.get(aspct[0]), Integer.parseInt(aspct[1]));
        }

        return list;
    }

    public static AspectList removeAspects(AspectList list, String str) {
        String[] aspects = str.split(",");
        for (String aspect : aspects) {
            if (aspect.startsWith(" ")) aspect = aspect.replaceFirst(" ", "");
            String[] aspct = aspect.split("\\s+");
            if (aspct.length == 2) {
                list.remove(Aspect.aspects.get(aspct[0]), Integer.parseInt(aspct[1]));
            }
        }

        return list;
    }

    public static String getResearchTab(String key) {
        for (String tab : ResearchCategories.researchCategories.keySet()) {
            for (String research : ResearchCategories.researchCategories.get(tab).research.keySet()) {
                if (research.equals(key)) return tab;
            }
        }
        return null;
    }

	public static AspectList getEntityAspects(String name) {
		for(EntityTags tag : ThaumcraftApi.scanEntities)
		{
			if(tag.entityName==name && tag.nbts.length==0)
				return tag.aspects;
		}
		return null;
	}

	public static void removeEntityAspects(String name) {
		List<EntityTags> tags = new ArrayList(ThaumcraftApi.scanEntities);
		for(EntityTags tag : tags)
		{
			if(tag.entityName==name && tag.nbts.length==0)
				ThaumcraftApi.scanEntities.remove(tag);
		}
	}

}
{'fraction_non_alphanumeric': 0.12281659388646288, 'fraction_numerical': 0.002911208151382824, 'mean_word_length': 2.9405017921146954, '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': '7659168', 'n_tokens_mistral': 1748, 'n_tokens_neox': 1682, 'n_words': 345}