// Path: src/main/java/net/mcft/copy/betterstorage/BetterStorage.java
// @Mod(modid = Constants.modId,
//      name = Constants.modName,
//      dependencies = "required-after:Forge; after:Thaumcraft; after:NotEnoughItems;",
//      guiFactory = "net.mcft.copy.betterstorage.client.gui.BetterStorageGuiFactory")
// public class BetterStorage {
// 	
// 	@Instance(Constants.modId)
// 	public static BetterStorage instance;
// 	
// 	@SidedProxy(serverSide = Constants.commonProxy,
// 	            clientSide = Constants.clientProxy)
// 	public static CommonProxy proxy;
// 	
// 	public static ChannelHandler networkChannel;
// 	
// 	public static Logger log;
// 	
// 	public static CreativeTabs creativeTab;
// 	
// 	public static Config globalConfig;
// 	
// 	@EventHandler
// 	public void preInit(FMLPreInitializationEvent event) {
// 		
// 		networkChannel = new ChannelHandler();
// 		log = event.getModLog();
// 		creativeTab = new CreativeTabBetterStorage();
// 		
// 		Addon.initialize();
// 		
// 		globalConfig = new GlobalConfig(event.getSuggestedConfigurationFile());
// 		Addon.setupConfigsAll();
// 		globalConfig.load();
// 		globalConfig.save();
// 		
// 		BetterStorageTiles.initialize();
// 		BetterStorageItems.initialize();
// 		
// 		EnchantmentBetterStorage.initialize();
// 		
// 		BetterStorageTileEntities.register();
// 		BetterStorageEntities.register();
// 		DungeonLoot.add();
// 		
// 	}
// 	
// 	@EventHandler
// 	public void load(FMLInitializationEvent event) {
// 		
// 		Recipes.add();
// 		proxy.initialize();
// 		
// 	}
// 	
// 	@EventHandler
// 	public void postInit(FMLPostInitializationEvent event) {
// 		Addon.postInitializeAll();
// 	}
// 	
// }
// 
// Path: src/main/java/net/mcft/copy/betterstorage/misc/SetBlockFlag.java
// public final class SetBlockFlag {
// 	
// 	/** When set, causes a block update to the surrounding blocks. */
// 	public static final int BLOCK_UPDATE   = 0x1;
// 	/** When set on server, sends the block change to the client. */
// 	public static final int SEND_TO_CLIENT = 0x2;
// 	/** When set on client, will not render the chunk again. */
// 	public static final int DONT_RERENDER  = 0x4;
// 	
// 	/** The default setting, will cause a block
// 	 *  update and send the change to the client. */
// 	public static final int DEFAULT = BLOCK_UPDATE | SEND_TO_CLIENT;
// 	
// 	private SetBlockFlag() {  }
// 	
// }


import net.mcft.copy.betterstorage.BetterStorage;
import net.mcft.copy.betterstorage.content.BetterStorageTiles;
import net.mcft.copy.betterstorage.item.tile.ItemCardboardBox;
import net.mcft.copy.betterstorage.misc.SetBlockFlag;
import net.mcft.copy.betterstorage.network.packet.PacketPresentOpen;
import net.mcft.copy.betterstorage.utils.StackUtils;
import net.mcft.copy.betterstorage.utils.WorldUtils;
import net.minecraft.block.Block;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.NetworkManager;
import net.minecraft.network.Packet;
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.EnumChatFormatting;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
	@Override
	protected void onItemDropped(ItemStack stack) {
		super.onItemDropped(stack);
		NBTTagCompound compound = stack.getTagCompound();
		compound.setByte(TAG_COLOR_INNER, (byte)colorInner);
		compound.setByte(TAG_COLOR_OUTER, (byte)colorOuter);
		compound.setBoolean(TAG_SKOJANZA_MODE, skojanzaMode);
		if (nameTag != null)
			compound.setString(TAG_NAMETAG, nameTag);
		StackUtils.remove(stack, "display", "color");
		compound.setInteger("color", color);
	}
	
	@Override
	public void updateEntity() {
		breakPause = Math.max(0, breakPause - 1);
		if (breakPause <= 0)
			breakProgress = Math.max(0, breakProgress - 1);
	}
	
	// TileEntityContainer stuff
	
	@Override
	public void onBlockPlaced(EntityLivingBase player, ItemStack stack) {
		super.onBlockPlaced(player, stack);
		colorInner = StackUtils.get(stack, (byte)14, TAG_COLOR_INNER);
		colorOuter = StackUtils.get(stack, (byte)0, TAG_COLOR_OUTER);
		skojanzaMode = (StackUtils.get(stack, (byte)0, TAG_SKOJANZA_MODE) > 0);
		nameTag = StackUtils.get(stack, (String)null, TAG_NAMETAG);
		color = StackUtils.get(stack, -1, "color");
// Path: src/main/java/net/mcft/copy/betterstorage/BetterStorage.java
// @Mod(modid = Constants.modId,
//      name = Constants.modName,
//      dependencies = "required-after:Forge; after:Thaumcraft; after:NotEnoughItems;",
//      guiFactory = "net.mcft.copy.betterstorage.client.gui.BetterStorageGuiFactory")
// public class BetterStorage {
// 	
// 	@Instance(Constants.modId)
// 	public static BetterStorage instance;
// 	
// 	@SidedProxy(serverSide = Constants.commonProxy,
// 	            clientSide = Constants.clientProxy)
// 	public static CommonProxy proxy;
// 	
// 	public static ChannelHandler networkChannel;
// 	
// 	public static Logger log;
// 	
// 	public static CreativeTabs creativeTab;
// 	
// 	public static Config globalConfig;
// 	
// 	@EventHandler
// 	public void preInit(FMLPreInitializationEvent event) {
// 		
// 		networkChannel = new ChannelHandler();
// 		log = event.getModLog();
// 		creativeTab = new CreativeTabBetterStorage();
// 		
// 		Addon.initialize();
// 		
// 		globalConfig = new GlobalConfig(event.getSuggestedConfigurationFile());
// 		Addon.setupConfigsAll();
// 		globalConfig.load();
// 		globalConfig.save();
// 		
// 		BetterStorageTiles.initialize();
// 		BetterStorageItems.initialize();
// 		
// 		EnchantmentBetterStorage.initialize();
// 		
// 		BetterStorageTileEntities.register();
// 		BetterStorageEntities.register();
// 		DungeonLoot.add();
// 		
// 	}
// 	
// 	@EventHandler
// 	public void load(FMLInitializationEvent event) {
// 		
// 		Recipes.add();
// 		proxy.initialize();
// 		
// 	}
// 	
// 	@EventHandler
// 	public void postInit(FMLPostInitializationEvent event) {
// 		Addon.postInitializeAll();
// 	}
// 	
// }
// 
// Path: src/main/java/net/mcft/copy/betterstorage/misc/SetBlockFlag.java
// public final class SetBlockFlag {
// 	
// 	/** When set, causes a block update to the surrounding blocks. */
// 	public static final int BLOCK_UPDATE   = 0x1;
// 	/** When set on server, sends the block change to the client. */
// 	public static final int SEND_TO_CLIENT = 0x2;
// 	/** When set on client, will not render the chunk again. */
// 	public static final int DONT_RERENDER  = 0x4;
// 	
// 	/** The default setting, will cause a block
// 	 *  update and send the change to the client. */
// 	public static final int DEFAULT = BLOCK_UPDATE | SEND_TO_CLIENT;
// 	
// 	private SetBlockFlag() {  }
// 	
// }


// Path: src/main/java/net/mcft/copy/betterstorage/tile/entity/TileEntityPresent.java
import net.mcft.copy.betterstorage.BetterStorage;
import net.mcft.copy.betterstorage.content.BetterStorageTiles;
import net.mcft.copy.betterstorage.item.tile.ItemCardboardBox;
import net.mcft.copy.betterstorage.misc.SetBlockFlag;
import net.mcft.copy.betterstorage.network.packet.PacketPresentOpen;
import net.mcft.copy.betterstorage.utils.StackUtils;
import net.mcft.copy.betterstorage.utils.WorldUtils;
import net.minecraft.block.Block;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.NetworkManager;
import net.minecraft.network.Packet;
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.EnumChatFormatting;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;

	@Override
	protected void onItemDropped(ItemStack stack) {
		super.onItemDropped(stack);
		NBTTagCompound compound = stack.getTagCompound();
		compound.setByte(TAG_COLOR_INNER, (byte)colorInner);
		compound.setByte(TAG_COLOR_OUTER, (byte)colorOuter);
		compound.setBoolean(TAG_SKOJANZA_MODE, skojanzaMode);
		if (nameTag != null)
			compound.setString(TAG_NAMETAG, nameTag);
		StackUtils.remove(stack, "display", "color");
		compound.setInteger("color", color);
	}
	
	@Override
	public void updateEntity() {
		breakPause = Math.max(0, breakPause - 1);
		if (breakPause <= 0)
			breakProgress = Math.max(0, breakProgress - 1);
	}
	
	// TileEntityContainer stuff
	
	@Override
	public void onBlockPlaced(EntityLivingBase player, ItemStack stack) {
		super.onBlockPlaced(player, stack);
		colorInner = StackUtils.get(stack, (byte)14, TAG_COLOR_INNER);
		colorOuter = StackUtils.get(stack, (byte)0, TAG_COLOR_OUTER);
		skojanzaMode = (StackUtils.get(stack, (byte)0, TAG_SKOJANZA_MODE) > 0);
		nameTag = StackUtils.get(stack, (String)null, TAG_NAMETAG);
		color = StackUtils.get(stack, -1, "color");
		worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, colorInner, SetBlockFlag.SEND_TO_CLIENT);