<commit_before>package invtweaks.integration;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

import net.minecraftforge.fml.common.Loader;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

/**
 * Checks if the NEI or JEI item lists are visible on the screen.
 * Used to make sure InvTweaks buttons do not overlap with the item list.
 */
public class ItemListChecker {
	@Nullable
    private Method neiHidden;
	@Nullable
    private Method jeiShown;

	private boolean visible = false;
	private boolean wasVisible = false;

	public ItemListChecker() {
		this.neiHidden = getNeiHidden();
		this.jeiShown = getJeiShown();
	}

	public boolean isVisible() {
		wasVisible = visible;
		visible = isNeiVisible() || isJeiVisible();
		return visible;
	}

	public boolean wasVisible() {
		return wasVisible;
	}

	private static Method getNeiHidden() {
		if (Loader.isModLoaded("NotEnoughItems")) {
			try {
				Class<?> clientConfig = Class.forName("codechicken.nei.NEIClientConfig");
				if (clientConfig != null) {
					return clientConfig.getMethod("isHidden");
				}
			} catch (@NotNull ClassNotFoundException | NoSuchMethodException | SecurityException ignored) {
				return null;
			}
		}
		return null;
	}

	private static Method getJeiShown() {
		if (Loader.isModLoaded("JEI")) {
			try {
				Class<?> clientConfig = Class.forName("mezz.jei.config.Config");
				if (clientConfig != null) {
					return clientConfig.getMethod("isOverlayEnabled");
				}
			} catch (@NotNull ClassNotFoundException | NoSuchMethodException | SecurityException ignored) {
				return null;
			}
		}
		return null;
	}

	private boolean isNeiVisible() {
		if (neiHidden != null) {<commit_msg>Fix NEI/JEI modids for 1.11.<commit_after>package invtweaks.integration;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

import net.minecraftforge.fml.common.Loader;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

/**
 * Checks if the NEI or JEI item lists are visible on the screen.
 * Used to make sure InvTweaks buttons do not overlap with the item list.
 */
public class ItemListChecker {
	@Nullable
    private Method neiHidden;
	@Nullable
    private Method jeiShown;

	private boolean visible = false;
	private boolean wasVisible = false;

	public ItemListChecker() {
		this.neiHidden = getNeiHidden();
		this.jeiShown = getJeiShown();
	}

	public boolean isVisible() {
		wasVisible = visible;
		visible = isNeiVisible() || isJeiVisible();
		return visible;
	}

	public boolean wasVisible() {
		return wasVisible;
	}

	private static Method getNeiHidden() {
		if (Loader.isModLoaded("nei")) {
			try {
				Class<?> clientConfig = Class.forName("codechicken.nei.NEIClientConfig");
				if (clientConfig != null) {
					return clientConfig.getMethod("isHidden");
				}
			} catch (@NotNull ClassNotFoundException | NoSuchMethodException | SecurityException ignored) {
				return null;
			}
		}
		return null;
	}

	private static Method getJeiShown() {
		if (Loader.isModLoaded("jei")) {
			try {
				Class<?> clientConfig = Class.forName("mezz.jei.config.Config");
				if (clientConfig != null) {
					return clientConfig.getMethod("isOverlayEnabled");
				}
			} catch (@NotNull ClassNotFoundException | NoSuchMethodException | SecurityException ignored) {
				return null;
			}
		}
		return null;
	}

	private boolean isNeiVisible() {
		if (neiHidden != null) {
{'fraction_non_alphanumeric': 0.10591274397244546, 'fraction_numerical': 0.0008610792192881745, 'mean_word_length': 4.095029239766082, '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': '3746829', 'n_tokens_mistral': 1190, 'n_tokens_neox': 1063, 'n_words': 272}