package com.jaquadro.minecraft.storagedrawers.item;

import com.jaquadro.minecraft.storagedrawers.block.BlockDrawers;
import com.jaquadro.minecraft.storagedrawers.block.tile.TileEntityDrawers;
import com.jaquadro.minecraft.storagedrawers.core.ModBlocks;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.BlockWood;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemMultiTexture;
import net.minecraft.item.ItemStack;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;

import java.util.List;

public class ItemDrawers extends ItemMultiTexture
{
    public ItemDrawers (Block block) {
        super(block, block, BlockWood.field_150096_a);
    }

    @Override
    public boolean placeBlockAt (ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ, int metadata) {
        if (!super.placeBlockAt(stack, player, world, x, y, z, side, hitX, hitY, hitZ, metadata))
            return false;

        TileEntityDrawers tile = (TileEntityDrawers) world.getTileEntity(x, y, z);
        if (tile != null) {
            if (side > 1)
                tile.setDirection(side);

            BlockDrawers block = (BlockDrawers) field_150939_a;
            tile.setDrawerCount(block.drawerCount);

            if (block.drawerCount == 2)
                tile.setDrawerCapacity(block.halfDepth ? 4 : 8);
            else if (block.drawerCount == 4)
                tile.setDrawerCapacity(block.halfDepth ? 2 : 4);
        }

        return true;
    }

    @Override
    @SideOnly(Side.CLIENT)
    public void addInformation (ItemStack itemStack, EntityPlayer player, List list, boolean par4) {
        Block block = Block.getBlockFromItem(itemStack.getItem());

        int count = 0;
        if (block == ModBlocks.fullDrawers2)
            count = 8;
        else if (block == ModBlocks.fullDrawers4 || block == ModBlocks.halfDrawers2)
            count = 4;
        else if (block == ModBlocks.halfDrawers4)
            count = 2;

        list.add(StatCollector.translateToLocalFormatted("storageDrawers.drawers.description", count));
    }
}

@@ -46,16 +46,77 @@
 .item;%0A%0A
+import com.jaquadro.minecraft.storagedrawers.StorageDrawers;%0A
 import c
@@ -239,32 +239,99 @@
 eEntityDrawers;%0A
+import com.jaquadro.minecraft.storagedrawers.config.ConfigManager;%0A
 import com.jaqua
@@ -2058,16 +2058,70 @@
 Item());
+%0A        ConfigManager config = StorageDrawers.config;
 %0A%0A      
@@ -2202,17 +2202,58 @@
 count = 
-8
+config.getBlockBaseStorage(%22fulldrawers2%22)
 ;%0A      
@@ -2298,12 +2298,91 @@
 ers4
- %7C%7C 
+)%0A            count = config.getBlockBaseStorage(%22fulldrawers4%22);%0A        else if (
 bloc
@@ -2430,17 +2430,58 @@
 count = 
-4
+config.getBlockBaseStorage(%22halfdrawers2%22)
 ;%0A      
@@ -2544,17 +2544,58 @@
 count = 
-2
+config.getBlockBaseStorage(%22halfdrawers4%22)
 ;%0A%0A     

Make blocks pay attention to config base capacities