package net.mcft.copy.betterstorage.inventory;

import net.mcft.copy.betterstorage.api.IKey;
import net.mcft.copy.betterstorage.misc.Constants;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;

public class InventoryKeyring extends InventoryItem {
	
	public InventoryKeyring(EntityPlayer player, String title) {
		super(player, 9, (title.isEmpty() ? Constants.containerKeyring : title), !title.isEmpty());
	}
	
	@Override
	public boolean isItemValidForSlot(int slot, ItemStack stack) {
		return ((stack != null) && (stack.getItem() instanceof IKey) &&
		        ((IKey)stack.getItem()).isNormalKey());
	}
	
	@Override
	public void onInventoryChanged() {
		updateStack();
	}
	
	@Override
	protected void updateStack() {
		int count = 0;
		for (ItemStack stack : allContents[0])
			if (stack != null) count++;
		stack.setItemDamage(count);
		super.updateStack();
	}
	
}

@@ -533,25 +533,25 @@
 ((stack 
-!
+=
 = null) 
 && (stac
@@ -546,11 +546,12 @@
 ll) 
-&& 
+%7C%7C (
 (sta
@@ -593,16 +593,36 @@
         
+                    
 ((IKey)s
@@ -647,24 +647,25 @@
 NormalKey())
+)
 ;%0A%09%7D%0A%09%0A%09@Ove

Fix keys being stuck in keyring container