// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java
// public final class Refs {
// 	private Refs(){}
// 	public static final String MODID = "runesofwizardry_classics";
// 	public static final String VERSION = "@VERSION@";
// 	public static final String NAME="Runes of Wizardry - Classic Dusts Pack";
// 	public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory";
// 	public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy",
// 							   SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy";
// 	public static final String PATTERN_PATH=MODID+":patterns/";
// 	public static final String TEXTURE_PATH=MODID+":";
// 	public static final int TICKS_PER_DAY=24000;
// 	public static final int TPS=20;
// 	public static final class Lang{
// 		private Lang(){}
// 		public static final String RUNE=MODID+".rune";
// 		public static final String CONFIG=MODID+".configuration";
// 		public static final String DEC=RUNE+".decorative";
// 		
// 		public static final class Jei{
// 			private Jei(){}
// 			public static final String JEI=MODID+".jei";
// 			public static final String SPIRIT_SWORD=JEI+".spirit_sword";
// 			public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe";
// 		}
// 	}
// }
// 
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/RunesofWizardry_Classics.java
// @Mod(modid = Refs.MODID, version = Refs.VERSION, name=Refs.NAME, guiFactory=Refs.GUI_FACTORY, dependencies = "required-after:runesofwizardry;after:guideapi")
// public class RunesofWizardry_Classics
// {
// 	@SidedProxy(clientSide=Refs.CLIENT_PROXY,serverSide=Refs.SERVER_PROXY)
// 	public static IProxy proxy;
// 	
// 	private static Logger logger;
// 	/**Returns the logger for the mod**/
// 	public static Logger log(){return logger;}
// 	
// 	@EventHandler
// 	public void preInit(FMLPreInitializationEvent event){
// 		logger = event.getModLog();
// 		RunesofWizardry_Classics.log().info("Registering Classic dusts");
// 		ClassicDusts.instance = new ClassicDusts();
// 		DustRegistry.registerDust(ClassicDusts.instance);
// 		DustVariable.instance=new DustVariable();
// 		DustRegistry.registerDust(DustVariable.instance);
// 		//init the runes
// 		ModRunes.initRunes();
// 		ModInscriptions.initInscriptions();
// 		//register the config
// 		Config.init(event.getSuggestedConfigurationFile());
// 		MinecraftForge.EVENT_BUS.register(new Config());
// 	}
//     @EventHandler
//     public void init(FMLInitializationEvent event)
//     {
//     	//register the runes
//     	ModRunes.registerRunes();
//     	ModInscriptions.registerInscriptions();
//     }
//     @EventHandler
//     public void postInit(FMLPostInitializationEvent event){
//     	if(Loader.isModLoaded("guideapi")){
//     		GuideBookAdditions.handlePost();
//     	}
//     }
// }


import java.util.Collection;
import java.util.LinkedList;
import java.util.List;
import java.util.concurrent.Callable;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTBase;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.capabilities.Capability.IStorage;
import net.minecraftforge.common.capabilities.CapabilityInject;
import net.minecraftforge.common.capabilities.CapabilityManager;
import net.minecraftforge.common.capabilities.ICapabilityProvider;
import net.minecraftforge.common.capabilities.ICapabilitySerializable;
import net.minecraftforge.event.AttachCapabilitiesEvent;
import net.minecraftforge.event.entity.player.PlayerEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import xilef11.mc.runesofwizardry_classics.Refs;
import xilef11.mc.runesofwizardry_classics.RunesofWizardry_Classics;
	public void onAttachCapability(AttachCapabilitiesEvent<Entity> event){
		if(event.getObject() instanceof EntityPlayer){
			event.addCapability(capabilityKey, new Provider());
		}
	}
	@SubscribeEvent
	public void onPlayerClone(PlayerEvent.Clone event){
		if(event.isWasDeath()){
			IVoidStorageCapability oldCap = event.getOriginal().getCapability(VOID_STORAGE_CAPABILITY, null);
			IVoidStorageCapability newCap = event.getEntityPlayer().getCapability(VOID_STORAGE_CAPABILITY, null);
			for(ItemStack i:oldCap.getVoidInventory()){
				newCap.addStackToVoid(i);
			}
		}
	}
	public static void register(){
		CapabilityManager.INSTANCE.register(IVoidStorageCapability.class, new Storage(), new Factory());
		MinecraftForge.EVENT_BUS.register(new VoidStorageCapability());
	}
	private static class Storage implements IStorage<IVoidStorageCapability> {
		@Override
		public NBTBase writeNBT(Capability<IVoidStorageCapability> capability,IVoidStorageCapability instance, EnumFacing side) {
			NBTTagList stacks = new NBTTagList();
			for(ItemStack i:instance.getVoidInventory()){
				if(!i.isEmpty()){
					NBTTagCompound comp = new NBTTagCompound();
					i.writeToNBT(comp);
					stacks.appendTag(comp);
				}
			}
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java
// public final class Refs {
// 	private Refs(){}
// 	public static final String MODID = "runesofwizardry_classics";
// 	public static final String VERSION = "@VERSION@";
// 	public static final String NAME="Runes of Wizardry - Classic Dusts Pack";
// 	public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory";
// 	public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy",
// 							   SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy";
// 	public static final String PATTERN_PATH=MODID+":patterns/";
// 	public static final String TEXTURE_PATH=MODID+":";
// 	public static final int TICKS_PER_DAY=24000;
// 	public static final int TPS=20;
// 	public static final class Lang{
// 		private Lang(){}
// 		public static final String RUNE=MODID+".rune";
// 		public static final String CONFIG=MODID+".configuration";
// 		public static final String DEC=RUNE+".decorative";
// 		
// 		public static final class Jei{
// 			private Jei(){}
// 			public static final String JEI=MODID+".jei";
// 			public static final String SPIRIT_SWORD=JEI+".spirit_sword";
// 			public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe";
// 		}
// 	}
// }
// 
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/RunesofWizardry_Classics.java
// @Mod(modid = Refs.MODID, version = Refs.VERSION, name=Refs.NAME, guiFactory=Refs.GUI_FACTORY, dependencies = "required-after:runesofwizardry;after:guideapi")
// public class RunesofWizardry_Classics
// {
// 	@SidedProxy(clientSide=Refs.CLIENT_PROXY,serverSide=Refs.SERVER_PROXY)
// 	public static IProxy proxy;
// 	
// 	private static Logger logger;
// 	/**Returns the logger for the mod**/
// 	public static Logger log(){return logger;}
// 	
// 	@EventHandler
// 	public void preInit(FMLPreInitializationEvent event){
// 		logger = event.getModLog();
// 		RunesofWizardry_Classics.log().info("Registering Classic dusts");
// 		ClassicDusts.instance = new ClassicDusts();
// 		DustRegistry.registerDust(ClassicDusts.instance);
// 		DustVariable.instance=new DustVariable();
// 		DustRegistry.registerDust(DustVariable.instance);
// 		//init the runes
// 		ModRunes.initRunes();
// 		ModInscriptions.initInscriptions();
// 		//register the config
// 		Config.init(event.getSuggestedConfigurationFile());
// 		MinecraftForge.EVENT_BUS.register(new Config());
// 	}
//     @EventHandler
//     public void init(FMLInitializationEvent event)
//     {
//     	//register the runes
//     	ModRunes.registerRunes();
//     	ModInscriptions.registerInscriptions();
//     }
//     @EventHandler
//     public void postInit(FMLPostInitializationEvent event){
//     	if(Loader.isModLoaded("guideapi")){
//     		GuideBookAdditions.handlePost();
//     	}
//     }
// }


// Path: src/main/java/xilef11/mc/runesofwizardry_classics/managers/VoidStorageCapability.java
import java.util.Collection;
import java.util.LinkedList;
import java.util.List;
import java.util.concurrent.Callable;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTBase;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.capabilities.Capability.IStorage;
import net.minecraftforge.common.capabilities.CapabilityInject;
import net.minecraftforge.common.capabilities.CapabilityManager;
import net.minecraftforge.common.capabilities.ICapabilityProvider;
import net.minecraftforge.common.capabilities.ICapabilitySerializable;
import net.minecraftforge.event.AttachCapabilitiesEvent;
import net.minecraftforge.event.entity.player.PlayerEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import xilef11.mc.runesofwizardry_classics.Refs;
import xilef11.mc.runesofwizardry_classics.RunesofWizardry_Classics;

	public void onAttachCapability(AttachCapabilitiesEvent<Entity> event){
		if(event.getObject() instanceof EntityPlayer){
			event.addCapability(capabilityKey, new Provider());
		}
	}
	@SubscribeEvent
	public void onPlayerClone(PlayerEvent.Clone event){
		if(event.isWasDeath()){
			IVoidStorageCapability oldCap = event.getOriginal().getCapability(VOID_STORAGE_CAPABILITY, null);
			IVoidStorageCapability newCap = event.getEntityPlayer().getCapability(VOID_STORAGE_CAPABILITY, null);
			for(ItemStack i:oldCap.getVoidInventory()){
				newCap.addStackToVoid(i);
			}
		}
	}
	public static void register(){
		CapabilityManager.INSTANCE.register(IVoidStorageCapability.class, new Storage(), new Factory());
		MinecraftForge.EVENT_BUS.register(new VoidStorageCapability());
	}
	private static class Storage implements IStorage<IVoidStorageCapability> {
		@Override
		public NBTBase writeNBT(Capability<IVoidStorageCapability> capability,IVoidStorageCapability instance, EnumFacing side) {
			NBTTagList stacks = new NBTTagList();
			for(ItemStack i:instance.getVoidInventory()){
				if(!i.isEmpty()){
					NBTTagCompound comp = new NBTTagCompound();
					i.writeToNBT(comp);
					stacks.appendTag(comp);
				}
			}
			return stacks;