// Path: src/main/java/baubles/api/IBauble.java
// public interface IBauble {
// 
// 	/**
// 	 * This method return the type of bauble this is. 
// 	 * Type is used to determine the slots it can go into.
// 	 */
// 	public BaubleType getBaubleType(ItemStack itemstack);
// 
// 	/**
// 	 * This method is called once per tick if the bauble is being worn by a player
// 	 */
// 	public default void onWornTick(ItemStack itemstack, EntityLivingBase player) {		
// 	}
// 
// 	/**
// 	 * This method is called when the bauble is equipped by a player
// 	 */
// 	public default void onEquipped(ItemStack itemstack, EntityLivingBase player) {		
// 	}
// 
// 	/**
// 	 * This method is called when the bauble is unequipped by a player
// 	 */
// 	public default void onUnequipped(ItemStack itemstack, EntityLivingBase player) {		
// 	}
// 
// 	/**
// 	 * can this bauble be placed in a bauble slot
// 	 */
// 	public default boolean canEquip(ItemStack itemstack, EntityLivingBase player) {		
// 		return true;
// 	}
// 
// 	/**
// 	 * Can this bauble be removed from a bauble slot
// 	 */
// 	public default boolean canUnequip(ItemStack itemstack, EntityLivingBase player) {
// 		return true;
// 	}
// 
// 	/**
// 	 * Will bauble automatically sync to client if a change is detected in its NBT or damage values?
// 	 * Default is off, so override and set to true if you want to auto sync.
// 	 * This sync is not instant, but occurs every 10 ticks (.5 seconds).
// 	 */
// 	public default boolean willAutoSync(ItemStack itemstack, EntityLivingBase player) {
// 		return false;
// 	}
// }


import baubles.api.IBauble;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemStack;
import net.minecraftforge.items.ItemStackHandler;
package baubles.api.cap;


public class BaublesContainer extends ItemStackHandler implements IBaublesItemHandler {

	private final static int BAUBLE_SLOTS = 7;
	private boolean[] changed = new boolean[BAUBLE_SLOTS];
	private boolean blockEvents=false;	
	private EntityLivingBase player;

	public BaublesContainer()
	{
		super(BAUBLE_SLOTS);
	}

	@Override
	public void setSize(int size)
	{
		if (size<BAUBLE_SLOTS) size = BAUBLE_SLOTS;
		super.setSize(size);
		boolean[] old = changed;
		changed = new boolean[size];
		for(int i = 0;i<old.length && i<changed.length;i++)
		{
			changed[i] = old[i];
		}
	}

	/**
	 * Returns true if automation is allowed to insert the given stack (ignoring
	 * stack size) into the given slot.
	 */
	@Override
	public boolean isItemValidForSlot(int slot, ItemStack stack, EntityLivingBase player) {
		if (stack==null || stack.isEmpty() || !stack.hasCapability(BaublesCapabilities.CAPABILITY_ITEM_BAUBLE, null))
			return false;
// Path: src/main/java/baubles/api/IBauble.java
// public interface IBauble {
// 
// 	/**
// 	 * This method return the type of bauble this is. 
// 	 * Type is used to determine the slots it can go into.
// 	 */
// 	public BaubleType getBaubleType(ItemStack itemstack);
// 
// 	/**
// 	 * This method is called once per tick if the bauble is being worn by a player
// 	 */
// 	public default void onWornTick(ItemStack itemstack, EntityLivingBase player) {		
// 	}
// 
// 	/**
// 	 * This method is called when the bauble is equipped by a player
// 	 */
// 	public default void onEquipped(ItemStack itemstack, EntityLivingBase player) {		
// 	}
// 
// 	/**
// 	 * This method is called when the bauble is unequipped by a player
// 	 */
// 	public default void onUnequipped(ItemStack itemstack, EntityLivingBase player) {		
// 	}
// 
// 	/**
// 	 * can this bauble be placed in a bauble slot
// 	 */
// 	public default boolean canEquip(ItemStack itemstack, EntityLivingBase player) {		
// 		return true;
// 	}
// 
// 	/**
// 	 * Can this bauble be removed from a bauble slot
// 	 */
// 	public default boolean canUnequip(ItemStack itemstack, EntityLivingBase player) {
// 		return true;
// 	}
// 
// 	/**
// 	 * Will bauble automatically sync to client if a change is detected in its NBT or damage values?
// 	 * Default is off, so override and set to true if you want to auto sync.
// 	 * This sync is not instant, but occurs every 10 ticks (.5 seconds).
// 	 */
// 	public default boolean willAutoSync(ItemStack itemstack, EntityLivingBase player) {
// 		return false;
// 	}
// }


// Path: src/main/java/baubles/api/cap/BaublesContainer.java
import baubles.api.IBauble;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemStack;
import net.minecraftforge.items.ItemStackHandler;

package baubles.api.cap;


public class BaublesContainer extends ItemStackHandler implements IBaublesItemHandler {

	private final static int BAUBLE_SLOTS = 7;
	private boolean[] changed = new boolean[BAUBLE_SLOTS];
	private boolean blockEvents=false;	
	private EntityLivingBase player;

	public BaublesContainer()
	{
		super(BAUBLE_SLOTS);
	}

	@Override
	public void setSize(int size)
	{
		if (size<BAUBLE_SLOTS) size = BAUBLE_SLOTS;
		super.setSize(size);
		boolean[] old = changed;
		changed = new boolean[size];
		for(int i = 0;i<old.length && i<changed.length;i++)
		{
			changed[i] = old[i];
		}
	}

	/**
	 * Returns true if automation is allowed to insert the given stack (ignoring
	 * stack size) into the given slot.
	 */
	@Override
	public boolean isItemValidForSlot(int slot, ItemStack stack, EntityLivingBase player) {
		if (stack==null || stack.isEmpty() || !stack.hasCapability(BaublesCapabilities.CAPABILITY_ITEM_BAUBLE, null))
			return false;
		IBauble bauble = stack.getCapability(BaublesCapabilities.CAPABILITY_ITEM_BAUBLE, null);