diff --git a/resources/assets/storagedrawers/lang/de_DE.lang b/resources/assets/storagedrawers/lang/de_DE.lang index 5a57431..b8ff282 100644 --- a/resources/assets/storagedrawers/lang/de_DE.lang +++ b/resources/assets/storagedrawers/lang/de_DE.lang @@ -28,6 +28,12 @@ item.storagedrawers.upgradeCreative.store.name=Kreativspeicherupgrade item.storagedrawers.upgradeCreative.store.description=Fast unendlicher Speicher item.storagedrawers.upgradeCreative.vend.name=Kreativautomatenupgrade item.storagedrawers.upgradeCreative.vend.description=Uneingeschränkte Itementnahme +item.storagedrawers.upgradeRedstone.combined.name=Redstone Upgrade +item.storagedrawers.upgradeRedstone.combined.description=Emits signal for total storage. +item.storagedrawers.upgradeRedstone.max.name=Redstone Max Upgrade +item.storagedrawers.upgradeRedstone.max.description=Emits signal for most full slot. +item.storagedrawers.upgradeRedstone.min.name=Redstone Min Upgrade +item.storagedrawers.upgradeRedstone.min.description=Emits signal for least full slot. item.storagedrawers.upgradeSorting.name=Sortierungsupgrade item.storagedrawers.upgradeSorting.description=Für Refined Relocation item.storagedrawers.shroudKey.name=Verbergungsschlüssel @@ -132,6 +138,7 @@ storageDrawers.config.prop.enableLockUpgrades=Erlaube Schubfachverschließung storageDrawers.config.prop.enableShroudUpgrades=Erlaube Verbergen storageDrawers.config.prop.enableVoidUpgrades=Erlaube Voidupgrade storageDrawers.config.prop.enableCreativeUpgrades=Erlaube Kreativupgrade +storageDrawers.config.prop.enableRedstoneUpgrades=Enable Redstone Upgrade storageDrawers.config.prop.enableSortingUpgrades=Erlaube Sortierungsupgrade storageDrawers.config.prop.enableSortingUpgrades.tooltip=Refined Relocation muss geladen seien. storageDrawers.config.prop.renderStorageUpgrades=Zeige Speicherupgrades diff --git a/resources/assets/storagedrawers/lang/en_US.lang b/resources/assets/storagedrawers/lang/en_US.lang index 77aa669..837ba38 100644 --- a/resources/assets/storagedrawers/lang/en_US.lang +++ b/resources/assets/storagedrawers/lang/en_US.lang @@ -29,6 +29,12 @@ item.storagedrawers.upgradeCreative.store.name=Creative Storage Upgrade item.storagedrawers.upgradeCreative.store.description=Near-infinite storage item.storagedrawers.upgradeCreative.vend.name=Creative Vending Upgrade item.storagedrawers.upgradeCreative.vend.description=Unlimited item withdrawal +item.storagedrawers.upgradeRedstone.combined.name=Redstone Upgrade +item.storagedrawers.upgradeRedstone.combined.description=Emits signal for total storage. +item.storagedrawers.upgradeRedstone.max.name=Redstone Max Upgrade +item.storagedrawers.upgradeRedstone.max.description=Emits signal for most full slot. +item.storagedrawers.upgradeRedstone.min.name=Redstone Min Upgrade +item.storagedrawers.upgradeRedstone.min.description=Emits signal for least full slot. item.storagedrawers.upgradeSorting.name=Sorting Upgrade item.storagedrawers.upgradeSorting.description=For Refined Relocation item.storagedrawers.shroudKey.name=Concealment Key @@ -148,6 +154,7 @@ storageDrawers.config.prop.enableShroudUpgrades=Enable Item Concealing storageDrawers.config.prop.enablePersonalUpgrades=Enable Access Protection storageDrawers.config.prop.enableVoidUpgrades=Enable Void Upgrade storageDrawers.config.prop.enableCreativeUpgrades=Enable Creative Upgrade +storageDrawers.config.prop.enableRedstoneUpgrades=Enable Redstone Upgrade storageDrawers.config.prop.enableSortingUpgrades=Enable Sorting Upgrade storageDrawers.config.prop.enableSortingUpgrades.tooltip=Refined Relocation must be loaded. storageDrawers.config.prop.renderStorageUpgrades=Render Storage Upgrades diff --git a/resources/assets/storagedrawers/lang/zh_CN.lang b/resources/assets/storagedrawers/lang/zh_CN.lang index 0f8868d..a237104 100644 --- a/resources/assets/storagedrawers/lang/zh_CN.lang +++ b/resources/assets/storagedrawers/lang/zh_CN.lang @@ -29,6 +29,12 @@ item.storagedrawers.upgradeCreative.store.name=创造模式容量升级 item.storagedrawers.upgradeCreative.store.description=接近无限的存储容量。 item.storagedrawers.upgradeCreative.vend.name=Creative Vending Upgrade item.storagedrawers.upgradeCreative.vend.description=能无限的取出被存入的物品。 +item.storagedrawers.upgradeRedstone.combined.name=Redstone Upgrade +item.storagedrawers.upgradeRedstone.combined.description=Emits signal for total storage. +item.storagedrawers.upgradeRedstone.max.name=Redstone Max Upgrade +item.storagedrawers.upgradeRedstone.max.description=Emits signal for most full slot. +item.storagedrawers.upgradeRedstone.min.name=Redstone Min Upgrade +item.storagedrawers.upgradeRedstone.min.description=Emits signal for least full slot. item.storagedrawers.upgradeSorting.name=分拣升级 item.storagedrawers.upgradeSorting.description=将抽屉升级为分拣抽屉。 item.storagedrawers.shroudKey.name=屏蔽钥匙 @@ -148,6 +154,7 @@ storageDrawers.config.prop.enableShroudUpgrades=允许屏蔽钥匙 storageDrawers.config.prop.enablePersonalUpgrades=允许访问保护 storageDrawers.config.prop.enableVoidUpgrades=允许清空升级 storageDrawers.config.prop.enableCreativeUpgrades=允许创造模式专用升级 +storageDrawers.config.prop.enableRedstoneUpgrades=Enable Redstone Upgrade storageDrawers.config.prop.enableSortingUpgrades=允许分拣升级 storageDrawers.config.prop.enableSortingUpgrades.tooltip=需安装精准重定位。 storageDrawers.config.prop.renderStorageUpgrades=渲染容量升级显示 diff --git a/resources/assets/storagedrawers/lang/zh_TW.lang b/resources/assets/storagedrawers/lang/zh_TW.lang index 45a95c2..47ecf6a 100644 --- a/resources/assets/storagedrawers/lang/zh_TW.lang +++ b/resources/assets/storagedrawers/lang/zh_TW.lang @@ -28,6 +28,12 @@ item.storagedrawers.upgradeCreative.store.name=創造模式容量升級 item.storagedrawers.upgradeCreative.store.description=接近無限的存儲容量。 item.storagedrawers.upgradeCreative.vend.name=Creative Vending Upgrade item.storagedrawers.upgradeCreative.vend.description=Unlimited item withdrawal +item.storagedrawers.upgradeRedstone.combined.name=Redstone Upgrade +item.storagedrawers.upgradeRedstone.combined.description=Emits signal for total storage. +item.storagedrawers.upgradeRedstone.max.name=Redstone Max Upgrade +item.storagedrawers.upgradeRedstone.max.description=Emits signal for most full slot. +item.storagedrawers.upgradeRedstone.min.name=Redstone Min Upgrade +item.storagedrawers.upgradeRedstone.min.description=Emits signal for least full slot. item.storagedrawers.upgradeSorting.name=分揀升級 item.storagedrawers.upgradeSorting.description=將抽屜升級為分揀抽屜。 item.storagedrawers.shroudKey.name=屏蔽鑰匙 @@ -134,6 +140,7 @@ storageDrawers.config.prop.enableLockUpgrades=允許抽屜鑰匙 storageDrawers.config.prop.enableShroudUpgrades=允許屏蔽鑰匙 storageDrawers.config.prop.enableVoidUpgrades=允許清空升級 storageDrawers.config.prop.enableCreativeUpgrades=允許創造模式專用升級 +storageDrawers.config.prop.enableRedstoneUpgrades=Enable Redstone Upgrade storageDrawers.config.prop.enableSortingUpgrades=允許分揀升級 storageDrawers.config.prop.enableSortingUpgrades.tooltip=需安裝精準重定位。 storageDrawers.config.prop.renderStorageUpgrades=渲染容量升級顯示 diff --git a/resources/assets/storagedrawers/textures/items/upgrade_redstone_combined.png b/resources/assets/storagedrawers/textures/items/upgrade_redstone_combined.png new file mode 100644 index 0000000..6aa86b8 Binary files /dev/null and b/resources/assets/storagedrawers/textures/items/upgrade_redstone_combined.png differ diff --git a/resources/assets/storagedrawers/textures/items/upgrade_redstone_max.png b/resources/assets/storagedrawers/textures/items/upgrade_redstone_max.png new file mode 100644 index 0000000..d2d4333 Binary files /dev/null and b/resources/assets/storagedrawers/textures/items/upgrade_redstone_max.png differ diff --git a/resources/assets/storagedrawers/textures/items/upgrade_redstone_min.png b/resources/assets/storagedrawers/textures/items/upgrade_redstone_min.png new file mode 100644 index 0000000..cd33f7b Binary files /dev/null and b/resources/assets/storagedrawers/textures/items/upgrade_redstone_min.png differ diff --git a/src/com/jaquadro/minecraft/storagedrawers/block/BlockDrawers.java b/src/com/jaquadro/minecraft/storagedrawers/block/BlockDrawers.java index 4fe5c36..abfff33 100644 --- a/src/com/jaquadro/minecraft/storagedrawers/block/BlockDrawers.java +++ b/src/com/jaquadro/minecraft/storagedrawers/block/BlockDrawers.java @@ -325,7 +325,8 @@ public class BlockDrawers extends BlockContainer implements IExtendedBlockClickH return true; } - else if (item.getItem() == ModItems.upgrade || item.getItem() == ModItems.upgradeStatus || item.getItem() == ModItems.upgradeVoid || item.getItem() == ModItems.upgradeCreative) { + else if (item.getItem() == ModItems.upgrade || item.getItem() == ModItems.upgradeStatus || item.getItem() == ModItems.upgradeVoid || + item.getItem() == ModItems.upgradeCreative || item.getItem() == ModItems.upgradeRedstone) { if (!tileDrawers.addUpgrade(item)) { player.addChatMessage(new ChatComponentTranslation("storagedrawers.msg.maxUpgrades")); return false; @@ -718,6 +719,28 @@ public class BlockDrawers extends BlockContainer implements IExtendedBlockClickH } } + @Override + public boolean canProvidePower () { + return true; + } + + @Override + public int isProvidingWeakPower (IBlockAccess blockAccess, int x, int y, int z, int dir) { + if (!canProvidePower()) + return 0; + + TileEntityDrawers tile = getTileEntity(blockAccess, x, y, z); + if (tile == null || !tile.isRedstone()) + return 0; + + return tile.getRedstoneLevel(); + } + + @Override + public int isProvidingStrongPower (IBlockAccess blockAccess, int x, int y, int z, int dir) { + return (dir == 1) ? isProvidingWeakPower(blockAccess, x, y, z, dir) : 0; + } + @SideOnly(Side.CLIENT) public IIcon getIconTrim (int meta) { meta = (meta < 0 || meta >= iconTrim.length) ? 0 : meta; diff --git a/src/com/jaquadro/minecraft/storagedrawers/block/tile/TileEntityDrawers.java b/src/com/jaquadro/minecraft/storagedrawers/block/tile/TileEntityDrawers.java index 6199a97..72a130b 100644 --- a/src/com/jaquadro/minecraft/storagedrawers/block/tile/TileEntityDrawers.java +++ b/src/com/jaquadro/minecraft/storagedrawers/block/tile/TileEntityDrawers.java @@ -165,9 +165,12 @@ public abstract class TileEntityDrawers extends BaseTileEntity implements IDrawe upgrades[slot] = upgrade; - if (worldObj != null && !worldObj.isRemote) { - markDirty(); - worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); + if (worldObj != null) { + if (!worldObj.isRemote) { + markDirty(); + worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); + } + worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord, zCoord, getBlockType()); } } @@ -368,6 +371,101 @@ public abstract class TileEntityDrawers extends BaseTileEntity implements IDrawe return false; } + public boolean isRedstone () { + if (!StorageDrawers.config.cache.enableRedstoneUpgrades) + return false; + + for (ItemStack stack : upgrades) { + if (stack != null && stack.getItem() == ModItems.upgradeRedstone) + return true; + } + + return false; + } + + public int getRedstoneLevel () { + int redstoneType = -1; + for (ItemStack stack : upgrades) { + if (stack != null && stack.getItem() == ModItems.upgradeRedstone) { + redstoneType = stack.getItemDamage(); + break; + } + } + + switch (redstoneType) { + case 0: + return getCombinedRedstoneLevel(); + case 1: + return getMaxRedstoneLevel(); + case 2: + return getMinRedstoneLevel(); + default: + return 0; + } + } + + protected int getCombinedRedstoneLevel () { + int active = 0; + float fillRatio = 0; + + for (int i = 0; i < getDrawerCount(); i++) { + if (!isDrawerEnabled(i)) + continue; + + IDrawer drawer = getDrawer(i); + if (drawer.getMaxCapacity() > 0) + fillRatio += ((float)drawer.getStoredItemCount() / drawer.getMaxCapacity()); + + active++; + } + + if (active == 0) + return 0; + + if (fillRatio == active) + return 15; + + return (int)Math.ceil((fillRatio / active) * 14); + } + + protected int getMinRedstoneLevel () { + float minRatio = 2; + + for (int i = 0; i < getDrawerCount(); i++) { + if (!isDrawerEnabled(i)) + continue; + + IDrawer drawer = getDrawer(i); + if (drawer.getMaxCapacity() > 0) + minRatio = Math.min(minRatio, (float)drawer.getStoredItemCount() / drawer.getMaxCapacity()); + } + + if (minRatio > 1) + return 0; + if (minRatio == 1) + return 15; + + return (int)Math.ceil(minRatio * 14); + } + + protected int getMaxRedstoneLevel () { + float maxRatio = 0; + + for (int i = 0; i < getDrawerCount(); i++) { + if (!isDrawerEnabled(i)) + continue; + + IDrawer drawer = getDrawer(i); + if (drawer.getMaxCapacity() > 0) + maxRatio = Math.max(maxRatio, (float)drawer.getStoredItemCount() / drawer.getMaxCapacity()); + } + + if (maxRatio == 1) + return 15; + + return (int)Math.ceil(maxRatio * 14); + } + public boolean isSorting () { return false; } @@ -419,6 +517,9 @@ public abstract class TileEntityDrawers extends BaseTileEntity implements IDrawe IDrawer drawer = drawers[slot]; drawer.setStoredItemCount(drawer.getStoredItemCount() - stack.stackSize); + if (isRedstone() && worldObj != null) + worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord, zCoord, getBlockType()); + // TODO: Reset empty drawer in subclasses return stack; @@ -457,12 +558,13 @@ public abstract class TileEntityDrawers extends BaseTileEntity implements IDrawe } public int interactPutCurrentItemIntoSlot (int slot, EntityPlayer player) { + int count = 0; ItemStack currentStack = player.inventory.getCurrentItem(); if (currentStack != null) - return putItemsIntoSlot(slot, currentStack, currentStack.stackSize); + count = putItemsIntoSlot(slot, currentStack, currentStack.stackSize); markDirty(); - return 0; + return count; } public int interactPutCurrentInventoryIntoSlot (int slot, EntityPlayer player) { @@ -673,6 +775,9 @@ public abstract class TileEntityDrawers extends BaseTileEntity implements IDrawe @Override public void markDirty () { inventory.markDirty(); + if (isRedstone() && worldObj != null) + worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord, zCoord, getBlockType()); + super.markDirty(); } diff --git a/src/com/jaquadro/minecraft/storagedrawers/config/ConfigManager.java b/src/com/jaquadro/minecraft/storagedrawers/config/ConfigManager.java index bdb565f..adbd688 100644 --- a/src/com/jaquadro/minecraft/storagedrawers/config/ConfigManager.java +++ b/src/com/jaquadro/minecraft/storagedrawers/config/ConfigManager.java @@ -62,6 +62,7 @@ public class ConfigManager public boolean enableShroudUpgrades; public boolean enablePersonalUpgrades; public boolean enableSortingUpgrades; + public boolean enableRedstoneUpgrades; public boolean renderStorageUpgrades; public boolean enableDrawerUI; public String itemRenderType; @@ -234,6 +235,7 @@ public class ConfigManager cache.enableShroudUpgrades = config.get(Configuration.CATEGORY_GENERAL, "enableShroudUpgrades", true).setLanguageKey(LANG_PREFIX + "prop.enableShroudUpgrades").setRequiresMcRestart(true).getBoolean(); cache.enablePersonalUpgrades = config.get(Configuration.CATEGORY_GENERAL, "enablePersonalUpgrades", true).setLanguageKey(LANG_PREFIX + "prop.enablePersonalUpgrades").setRequiresMcRestart(true).getBoolean(); cache.enableSortingUpgrades = config.get(Configuration.CATEGORY_GENERAL, "enableSortingUpgrades", true).setLanguageKey(LANG_PREFIX + "prop.enableSortingUpgrades").setRequiresMcRestart(true).getBoolean(); + cache.enableRedstoneUpgrades = config.get(Configuration.CATEGORY_GENERAL, "enableRedstoneUpgrades", true).setLanguageKey(LANG_PREFIX + "prop.enableRedstoneUpgrades").setRequiresMcRestart(true).getBoolean(); cache.enableTape = config.get(Configuration.CATEGORY_GENERAL, "enableTape", true).setLanguageKey(LANG_PREFIX + "prop.enableTape").setRequiresMcRestart(true).getBoolean(); cache.itemRenderType = config.get(Configuration.CATEGORY_GENERAL, "itemRenderType", "fast", null, new String[]{"fancy", "fast"}).setLanguageKey(LANG_PREFIX + "prop.itemRenderType").getString(); cache.renderStorageUpgrades = config.get(Configuration.CATEGORY_GENERAL, "renderStorageUpgrades", true).setLanguageKey(LANG_PREFIX + "prop.renderStorageUpgrades").getBoolean(); diff --git a/src/com/jaquadro/minecraft/storagedrawers/core/ModItems.java b/src/com/jaquadro/minecraft/storagedrawers/core/ModItems.java index d989b92..0674060 100644 --- a/src/com/jaquadro/minecraft/storagedrawers/core/ModItems.java +++ b/src/com/jaquadro/minecraft/storagedrawers/core/ModItems.java @@ -13,6 +13,7 @@ public class ModItems public static ItemUpgradeLock upgradeLock; public static ItemUpgradeVoid upgradeVoid; public static ItemUpgradeCreative upgradeCreative; + public static ItemUpgradeRedstone upgradeRedstone; public static ItemShroudKey shroudKey; public static ItemPersonalKey personalKey; public static ItemTape tape; @@ -24,6 +25,7 @@ public class ModItems upgradeLock = new ItemUpgradeLock(makeName("upgradeLock")); upgradeVoid = new ItemUpgradeVoid(makeName("upgradeVoid")); upgradeCreative = new ItemUpgradeCreative(makeName("upgradeCreative")); + upgradeRedstone = new ItemUpgradeRedstone(makeName("upgradeRedstone")); shroudKey = new ItemShroudKey(makeName("shroudKey")); personalKey = new ItemPersonalKey(makeName("personalKey")); tape = new ItemTape(makeName("tape")); @@ -38,6 +40,8 @@ public class ModItems GameRegistry.registerItem(upgradeVoid, "upgradeVoid"); if (StorageDrawers.config.cache.enableCreativeUpgrades) GameRegistry.registerItem(upgradeCreative, "upgradeCreative"); + if (StorageDrawers.config.cache.enableRedstoneUpgrades) + GameRegistry.registerItem(upgradeRedstone, "upgradeRedstone"); if (StorageDrawers.config.cache.enableLockUpgrades) GameRegistry.registerItem(upgradeLock, "upgradeLock"); if (StorageDrawers.config.cache.enableShroudUpgrades) diff --git a/src/com/jaquadro/minecraft/storagedrawers/core/ModRecipes.java b/src/com/jaquadro/minecraft/storagedrawers/core/ModRecipes.java index 5d50ac1..644349c 100644 --- a/src/com/jaquadro/minecraft/storagedrawers/core/ModRecipes.java +++ b/src/com/jaquadro/minecraft/storagedrawers/core/ModRecipes.java @@ -112,6 +112,15 @@ public class ModRecipes 'x', Blocks.obsidian, 'y', "stickWood", 'z', ModItems.upgradeTemplate)); } + if (config.cache.enableRedstoneUpgrades) { + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.upgradeRedstone, 1, 0), "xyx", "yzy", "xyx", + 'x', "dustRedstone", 'y', "stickWood", 'z', ModItems.upgradeTemplate)); + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.upgradeRedstone, 1, 1), "xxx", "yzy", "yyy", + 'x', "dustRedstone", 'y', "stickWood", 'z', ModItems.upgradeTemplate)); + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.upgradeRedstone, 1, 2), "yyy", "yzy", "xxx", + 'x', "dustRedstone", 'y', "stickWood", 'z', ModItems.upgradeTemplate)); + } + if (config.cache.enableShroudUpgrades) { GameRegistry.addShapelessRecipe(new ItemStack(ModItems.shroudKey), ModItems.upgradeLock, Items.ender_eye); } diff --git a/src/com/jaquadro/minecraft/storagedrawers/integration/RefinedRelocation.java b/src/com/jaquadro/minecraft/storagedrawers/integration/RefinedRelocation.java index eb698d4..33c3bbf 100644 --- a/src/com/jaquadro/minecraft/storagedrawers/integration/RefinedRelocation.java +++ b/src/com/jaquadro/minecraft/storagedrawers/integration/RefinedRelocation.java @@ -56,7 +56,7 @@ public class RefinedRelocation extends IntegrationModule compDrawers = new BlockSortingCompDrawers("compDrawers"); trim = new BlockSortingTrim("trim"); - upgradeSorting = new ItemUpgradeSorting("upgradeSorting"); + upgradeSorting = new ItemUpgradeSorting(ModItems.makeName("upgradeSorting")); SortingBlockRegistry.register(ModBlocks.fullDrawers1, fullDrawers1); SortingBlockRegistry.register(ModBlocks.fullDrawers2, fullDrawers2); diff --git a/src/com/jaquadro/minecraft/storagedrawers/item/ItemUpgradeRedstone.java b/src/com/jaquadro/minecraft/storagedrawers/item/ItemUpgradeRedstone.java new file mode 100644 index 0000000..871b47b --- /dev/null +++ b/src/com/jaquadro/minecraft/storagedrawers/item/ItemUpgradeRedstone.java @@ -0,0 +1,73 @@ +package com.jaquadro.minecraft.storagedrawers.item; + +import com.jaquadro.minecraft.storagedrawers.StorageDrawers; +import com.jaquadro.minecraft.storagedrawers.core.ModCreativeTabs; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.IIcon; +import net.minecraft.util.MathHelper; +import net.minecraft.util.StatCollector; + +import java.util.List; + +public class ItemUpgradeRedstone extends Item +{ + public static final String[] iconNames = new String[] { "combined", "max", "min" }; + + @SideOnly(Side.CLIENT) + private IIcon[] icons; + + public ItemUpgradeRedstone (String name) { + setUnlocalizedName(name); + setHasSubtypes(true); + setCreativeTab(ModCreativeTabs.tabStorageDrawers); + setMaxDamage(0); + } + + @Override + @SideOnly(Side.CLIENT) + public IIcon getIconFromDamage (int meta) { + return icons[MathHelper.clamp_int(meta, 0, iconNames.length - 1)]; + } + + @Override + public String getUnlocalizedName (ItemStack itemStack) { + int meta = MathHelper.clamp_int(itemStack.getItemDamage(), 0, iconNames.length - 1); + if (iconNames[meta] == null) + return super.getUnlocalizedName(); + + return super.getUnlocalizedName() + "." + iconNames[meta]; + } + + @Override + @SideOnly(Side.CLIENT) + public void addInformation (ItemStack itemStack, EntityPlayer player, List list, boolean par4) { + String name = getUnlocalizedName(itemStack); + list.add(StatCollector.translateToLocalFormatted(name + ".description")); + } + + @Override + @SideOnly(Side.CLIENT) + public void getSubItems (Item item, CreativeTabs creativeTabs, List list) { + for (int i = 0, n = iconNames.length; i < n; i++) { + if (iconNames[i] != null) + list.add(new ItemStack(item, 1, i)); + } + } + + @Override + @SideOnly(Side.CLIENT) + public void registerIcons (IIconRegister register) { + icons = new IIcon[iconNames.length]; + + for (int i = 0, n = iconNames.length; i < n; i++) { + if (iconNames[i] != null) + icons[i] = register.registerIcon(StorageDrawers.MOD_ID + ":upgrade_redstone_" + iconNames[i]); + } + } +}