// Path: src/main/java/net/mcft/copy/backpacks/WearableBackpacks.java
// @Mod(modid = WearableBackpacks.MOD_ID, name = WearableBackpacks.MOD_NAME,
//      version = WearableBackpacks.VERSION, dependencies = "required-after:forge@[14.21.0.2375,)",
//      guiFactory = "net.mcft.copy.backpacks.client.BackpacksGuiFactory")
// public class WearableBackpacks {
// 	
// 	public static final String MOD_ID   = "wearablebackpacks";
// 	public static final String MOD_NAME = "Wearable Backpacks";
// 	public static final String VERSION  = "@VERSION@";
// 	
// 	@Instance
// 	public static WearableBackpacks INSTANCE;
// 	
// 	@SidedProxy(serverSide = "net.mcft.copy.backpacks.ProxyCommon",
// 	            clientSide = "net.mcft.copy.backpacks.ProxyClient")
// 	public static ProxyCommon PROXY;
// 	
// 	public static Logger LOG;
// 	public static BackpacksChannel CHANNEL;
// 	public static BackpacksConfig CONFIG;
// 	public static BackpacksContent CONTENT;
// 	
// 	@EventHandler
// 	public void preInit(FMLPreInitializationEvent event) {
// 		LOG = event.getModLog();
// 		CHANNEL = new BackpacksChannel();
// 		
// 		CONFIG = new BackpacksConfig(event.getSuggestedConfigurationFile());
// 		CONFIG.load();
// 		CONFIG.save();
// 		
// 		CONTENT = new BackpacksContent();
// 		CONTENT.registerRecipes();
// 		
// 		PROXY.preInit();
// 	}
// 	
// 	@EventHandler
// 	public void init(FMLInitializationEvent event) {
// 		CONFIG.init();
// 		PROXY.init();
// 	}
// 	
// }


import java.lang.reflect.Method;
import java.util.Arrays;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.common.Loader;
import net.mcft.copy.backpacks.WearableBackpacks;
package net.mcft.copy.backpacks.misc.util;




public final class IntermodUtils {
	
	private IntermodUtils() {  }
	
	private static final int DEFAULT_ENCHANTMENT_COLOR = 0xFF8040CC;
	private static boolean getRuneColorCached  = false;
	private static Method setTargetStackMethod = null;
	private static Method getColorMethod       = null;
	/** Returns the Quark rune color for this item or the default enchant glint
	 *  color if Quark isn't present or the item doesn't have a custom rune color. */
	public static int getRuneColor(ItemStack stack) {
		if (!getRuneColorCached) {
			if (Loader.isModLoaded("quark")) {
				try {
					Class<?> clazz = Class.forName("vazkii.quark.misc.feature.ColorRunes");
					setTargetStackMethod = clazz.getMethod("setTargetStack", ItemStack.class);
					getColorMethod = Arrays.stream(clazz.getMethods())
						.filter(m -> "getColor".equals(m.getName()))
						.findAny().orElse(null);
				} catch (ClassNotFoundException |
				         NoSuchMethodException ex) {
// Path: src/main/java/net/mcft/copy/backpacks/WearableBackpacks.java
// @Mod(modid = WearableBackpacks.MOD_ID, name = WearableBackpacks.MOD_NAME,
//      version = WearableBackpacks.VERSION, dependencies = "required-after:forge@[14.21.0.2375,)",
//      guiFactory = "net.mcft.copy.backpacks.client.BackpacksGuiFactory")
// public class WearableBackpacks {
// 	
// 	public static final String MOD_ID   = "wearablebackpacks";
// 	public static final String MOD_NAME = "Wearable Backpacks";
// 	public static final String VERSION  = "@VERSION@";
// 	
// 	@Instance
// 	public static WearableBackpacks INSTANCE;
// 	
// 	@SidedProxy(serverSide = "net.mcft.copy.backpacks.ProxyCommon",
// 	            clientSide = "net.mcft.copy.backpacks.ProxyClient")
// 	public static ProxyCommon PROXY;
// 	
// 	public static Logger LOG;
// 	public static BackpacksChannel CHANNEL;
// 	public static BackpacksConfig CONFIG;
// 	public static BackpacksContent CONTENT;
// 	
// 	@EventHandler
// 	public void preInit(FMLPreInitializationEvent event) {
// 		LOG = event.getModLog();
// 		CHANNEL = new BackpacksChannel();
// 		
// 		CONFIG = new BackpacksConfig(event.getSuggestedConfigurationFile());
// 		CONFIG.load();
// 		CONFIG.save();
// 		
// 		CONTENT = new BackpacksContent();
// 		CONTENT.registerRecipes();
// 		
// 		PROXY.preInit();
// 	}
// 	
// 	@EventHandler
// 	public void init(FMLInitializationEvent event) {
// 		CONFIG.init();
// 		PROXY.init();
// 	}
// 	
// }


// Path: src/main/java/net/mcft/copy/backpacks/misc/util/IntermodUtils.java
import java.lang.reflect.Method;
import java.util.Arrays;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.common.Loader;
import net.mcft.copy.backpacks.WearableBackpacks;

package net.mcft.copy.backpacks.misc.util;




public final class IntermodUtils {
	
	private IntermodUtils() {  }
	
	private static final int DEFAULT_ENCHANTMENT_COLOR = 0xFF8040CC;
	private static boolean getRuneColorCached  = false;
	private static Method setTargetStackMethod = null;
	private static Method getColorMethod       = null;
	/** Returns the Quark rune color for this item or the default enchant glint
	 *  color if Quark isn't present or the item doesn't have a custom rune color. */
	public static int getRuneColor(ItemStack stack) {
		if (!getRuneColorCached) {
			if (Loader.isModLoaded("quark")) {
				try {
					Class<?> clazz = Class.forName("vazkii.quark.misc.feature.ColorRunes");
					setTargetStackMethod = clazz.getMethod("setTargetStack", ItemStack.class);
					getColorMethod = Arrays.stream(clazz.getMethods())
						.filter(m -> "getColor".equals(m.getName()))
						.findAny().orElse(null);
				} catch (ClassNotFoundException |
				         NoSuchMethodException ex) {
					WearableBackpacks.LOG.error("Error while fetching Quark ColorRunes methods", ex);