// 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.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
import com.zpig333.runesofwizardry.api.IRune;
import com.zpig333.runesofwizardry.api.RuneEntity;
import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive;
import com.zpig333.runesofwizardry.tileentity.TileEntityDustPlaced;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagIntArray;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import xilef11.mc.runesofwizardry_classics.Refs;
import xilef11.mc.runesofwizardry_classics.RunesofWizardry_Classics;
	/**Adds a rune to be powered by this**/
	public void register(FueledRuneEntity toPower){
		poweredRunes.add(toPower);
		if(toPower.entity.stardata!=null)toPower.entity.stardata.scale*=1.04F;
		stableFuel = TICKRATE*poweredRunes.size()*STABLE_FUEL_CYCLES;
		entity.setDrawStar(true);
		IBlockState state = entity.getWorld().getBlockState(getPos());
		entity.getWorld().notifyBlockUpdate(getPos(), state, state, 3);
	}
	/**removes a rune to be powered by this**/
	public void unregister(FueledRuneEntity toPower){
		poweredRunes.remove(toPower);
		if(toPower.entity.stardata!=null)toPower.entity.stardata.scale/=1.04F;
		stableFuel = TICKRATE*poweredRunes.size()*STABLE_FUEL_CYCLES;
		if(poweredRunes.isEmpty())entity.setDrawStar(false);
		IBlockState state = entity.getWorld().getBlockState(getPos());
		entity.getWorld().notifyBlockUpdate(getPos(), state, state, 3);
	}
	private Set<BlockPos> toInit=null;
	private boolean initialised=false;
	private void init(){
		if(initialised || toInit==null ||entity==null ||entity.getWorld()==null)return;
		for(BlockPos p:toInit){
			TileEntity t = entity.getWorld().getTileEntity(p);
			if(t instanceof TileEntityDustPlaced){
				TileEntityDustPlaced te = (TileEntityDustPlaced)t;
				RuneEntity rune = te.getRune();
				if((rune instanceof FueledRuneEntity) && !(rune instanceof RuneEntityPowerDistribution)){
					((FueledRuneEntity)rune).registerTo(this);;
				}else{
// 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/runes/entity/RuneEntityPowerDistribution.java
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
import com.zpig333.runesofwizardry.api.IRune;
import com.zpig333.runesofwizardry.api.RuneEntity;
import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive;
import com.zpig333.runesofwizardry.tileentity.TileEntityDustPlaced;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagIntArray;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import xilef11.mc.runesofwizardry_classics.Refs;
import xilef11.mc.runesofwizardry_classics.RunesofWizardry_Classics;

	/**Adds a rune to be powered by this**/
	public void register(FueledRuneEntity toPower){
		poweredRunes.add(toPower);
		if(toPower.entity.stardata!=null)toPower.entity.stardata.scale*=1.04F;
		stableFuel = TICKRATE*poweredRunes.size()*STABLE_FUEL_CYCLES;
		entity.setDrawStar(true);
		IBlockState state = entity.getWorld().getBlockState(getPos());
		entity.getWorld().notifyBlockUpdate(getPos(), state, state, 3);
	}
	/**removes a rune to be powered by this**/
	public void unregister(FueledRuneEntity toPower){
		poweredRunes.remove(toPower);
		if(toPower.entity.stardata!=null)toPower.entity.stardata.scale/=1.04F;
		stableFuel = TICKRATE*poweredRunes.size()*STABLE_FUEL_CYCLES;
		if(poweredRunes.isEmpty())entity.setDrawStar(false);
		IBlockState state = entity.getWorld().getBlockState(getPos());
		entity.getWorld().notifyBlockUpdate(getPos(), state, state, 3);
	}
	private Set<BlockPos> toInit=null;
	private boolean initialised=false;
	private void init(){
		if(initialised || toInit==null ||entity==null ||entity.getWorld()==null)return;
		for(BlockPos p:toInit){
			TileEntity t = entity.getWorld().getTileEntity(p);
			if(t instanceof TileEntityDustPlaced){
				TileEntityDustPlaced te = (TileEntityDustPlaced)t;
				RuneEntity rune = te.getRune();
				if((rune instanceof FueledRuneEntity) && !(rune instanceof RuneEntityPowerDistribution)){
					((FueledRuneEntity)rune).registerTo(this);;
				}else{
					RunesofWizardry_Classics.log().error("rune at "+p+" was not appropriate for power distribution");