// 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/utils/Utils.java
// public class Utils {
// 	private Utils(){}
// 	public static void spawnItemCentered(World world, BlockPos pos, ItemStack stack){
// 		EntityItem item = new EntityItem(world, pos.getX()+0.5, pos.getY()+0.5, pos.getZ()+0.5, stack);
// 		item.setDefaultPickupDelay();
// 		world.spawnEntity(item);
// 	}
// 	/**
// 	 * Attempts to remove experience levels from the player.
// 	 * @param player the player from which to take XP
// 	 * @param levels the number of XP levels to take
// 	 * @return true if the levels have been removed, false if the player didn't have enough
// 	 */
// 	public static boolean takeXP(EntityPlayer player, int levels){
// 		if(player.capabilities.isCreativeMode)return true;
// 		boolean enough =player.experienceLevel>=levels;
// 		if(enough){
// 			player.addExperienceLevel(-levels);
// 		}
// 		return enough;
// 	}
// 	/** stores coordinates for an array or whatever**/
// 	public static class Coords{
// 		public final int row,col;
// 		public Coords(int r, int c) {
// 			this.row = r;
// 			this.col = c;
// 		}
// 		/* (non-Javadoc)
// 		 * @see java.lang.Object#hashCode()
// 		 */
// 		@Override
// 		public int hashCode() {
// 			return row+col;//not the best, but should be sufficient
// 		}
// 		/* (non-Javadoc)
// 		 * @see java.lang.Object#equals(java.lang.Object)
// 		 */
// 		@Override
// 		public boolean equals(Object obj) {
// 			if(obj==this)return true;
// 			if(!(obj instanceof Coords))return false;
// 			Coords o = (Coords)obj;
// 			return this.row==o.row && this.col==o.col;
// 		}
// 	}
// }


import java.util.Set;
import com.zpig333.runesofwizardry.api.IRune;
import com.zpig333.runesofwizardry.api.RuneEntity;
import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityList;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityArmorStand;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumFacing.AxisDirection;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.text.TextComponentTranslation;
import net.minecraft.world.World;
import xilef11.mc.runesofwizardry_classics.Refs;
import xilef11.mc.runesofwizardry_classics.utils.Utils;
/**
 *
 */
package xilef11.mc.runesofwizardry_classics.runes.entity;


/**
 * @author Xilef11
 *
 */
public class RuneEntityRebirth extends RuneEntity {
	private static final String NO_SPAWN_EGG = Refs.Lang.RUNE+".rebirth.noegg";
	/**
	 * @param actualPattern
	 * @param facing
	 * @param dusts
	 * @param entity
	 */
	public RuneEntityRebirth(ItemStack[][] actualPattern, EnumFacing facing,
			Set<BlockPos> dusts, TileEntityDustActive entity,IRune creator) {
		super(actualPattern, facing, dusts, entity,creator);
	}
	/* (non-Javadoc)
	 * @see com.zpig333.runesofwizardry.api.RuneEntity#onRuneActivatedbyPlayer(net.minecraft.entity.player.EntityPlayer, net.minecraft.item.ItemStack[], boolean)
	 */
	@Override
	public void onRuneActivatedbyPlayer(EntityPlayer player,ItemStack[] sacrifice, boolean negated) {
		World world = player.world;
		if(!world.isRemote){
			//take xp if not negated
			if(!negated){
				if(player.experienceLevel>=10){
					player.addExperienceLevel(-10);
				}else{
					//kill the rune
					this.onPatternBrokenByPlayer(player);
					return;
				}
			}
			double x,y,z,offset=0.25;
			x=y=z=0;
			int dir = face.getAxisDirection()==AxisDirection.NEGATIVE? -1:1;
			switch(face.getAxis()){
			case X:x=offset*dir;
				break;
			case Y:y=offset*dir;
				break;
			case Z:z=offset*dir;
// 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/utils/Utils.java
// public class Utils {
// 	private Utils(){}
// 	public static void spawnItemCentered(World world, BlockPos pos, ItemStack stack){
// 		EntityItem item = new EntityItem(world, pos.getX()+0.5, pos.getY()+0.5, pos.getZ()+0.5, stack);
// 		item.setDefaultPickupDelay();
// 		world.spawnEntity(item);
// 	}
// 	/**
// 	 * Attempts to remove experience levels from the player.
// 	 * @param player the player from which to take XP
// 	 * @param levels the number of XP levels to take
// 	 * @return true if the levels have been removed, false if the player didn't have enough
// 	 */
// 	public static boolean takeXP(EntityPlayer player, int levels){
// 		if(player.capabilities.isCreativeMode)return true;
// 		boolean enough =player.experienceLevel>=levels;
// 		if(enough){
// 			player.addExperienceLevel(-levels);
// 		}
// 		return enough;
// 	}
// 	/** stores coordinates for an array or whatever**/
// 	public static class Coords{
// 		public final int row,col;
// 		public Coords(int r, int c) {
// 			this.row = r;
// 			this.col = c;
// 		}
// 		/* (non-Javadoc)
// 		 * @see java.lang.Object#hashCode()
// 		 */
// 		@Override
// 		public int hashCode() {
// 			return row+col;//not the best, but should be sufficient
// 		}
// 		/* (non-Javadoc)
// 		 * @see java.lang.Object#equals(java.lang.Object)
// 		 */
// 		@Override
// 		public boolean equals(Object obj) {
// 			if(obj==this)return true;
// 			if(!(obj instanceof Coords))return false;
// 			Coords o = (Coords)obj;
// 			return this.row==o.row && this.col==o.col;
// 		}
// 	}
// }


// Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/entity/RuneEntityRebirth.java
import java.util.Set;
import com.zpig333.runesofwizardry.api.IRune;
import com.zpig333.runesofwizardry.api.RuneEntity;
import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityList;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityArmorStand;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumFacing.AxisDirection;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.text.TextComponentTranslation;
import net.minecraft.world.World;
import xilef11.mc.runesofwizardry_classics.Refs;
import xilef11.mc.runesofwizardry_classics.utils.Utils;

/**
 *
 */
package xilef11.mc.runesofwizardry_classics.runes.entity;


/**
 * @author Xilef11
 *
 */
public class RuneEntityRebirth extends RuneEntity {
	private static final String NO_SPAWN_EGG = Refs.Lang.RUNE+".rebirth.noegg";
	/**
	 * @param actualPattern
	 * @param facing
	 * @param dusts
	 * @param entity
	 */
	public RuneEntityRebirth(ItemStack[][] actualPattern, EnumFacing facing,
			Set<BlockPos> dusts, TileEntityDustActive entity,IRune creator) {
		super(actualPattern, facing, dusts, entity,creator);
	}
	/* (non-Javadoc)
	 * @see com.zpig333.runesofwizardry.api.RuneEntity#onRuneActivatedbyPlayer(net.minecraft.entity.player.EntityPlayer, net.minecraft.item.ItemStack[], boolean)
	 */
	@Override
	public void onRuneActivatedbyPlayer(EntityPlayer player,ItemStack[] sacrifice, boolean negated) {
		World world = player.world;
		if(!world.isRemote){
			//take xp if not negated
			if(!negated){
				if(player.experienceLevel>=10){
					player.addExperienceLevel(-10);
				}else{
					//kill the rune
					this.onPatternBrokenByPlayer(player);
					return;
				}
			}
			double x,y,z,offset=0.25;
			x=y=z=0;
			int dir = face.getAxisDirection()==AxisDirection.NEGATIVE? -1:1;
			switch(face.getAxis()){
			case X:x=offset*dir;
				break;
			case Y:y=offset*dir;
				break;
			case Z:z=offset*dir;
				break;