diff --git a/items/materials/ItemMultiMaterial.java b/items/materials/ItemMultiMaterial.java index 941dff773..6da8ddfe4 100644 --- a/items/materials/ItemMultiMaterial.java +++ b/items/materials/ItemMultiMaterial.java @@ -107,7 +107,7 @@ public class ItemMultiMaterial extends AEBaseItem implements IStorageComponent, if ( j.getKey().getItem() instanceof IItemGroup ) { IItemGroup ig = (IItemGroup) j.getKey().getItem(); - String str = ig.getUnlocalizedGroupName( j.getKey() ); + String str = ig.getUnlocalizedGroupName( u.getSupported().keySet(), j.getKey() ); if ( str != null ) name = Platform.gui_localize( str ) + (limit > 1 ? " (" + limit + ")" : ""); } diff --git a/items/parts/ItemMultiPart.java b/items/parts/ItemMultiPart.java index bae0975ae..90c6b99b0 100644 --- a/items/parts/ItemMultiPart.java +++ b/items/parts/ItemMultiPart.java @@ -7,6 +7,7 @@ import java.util.EnumSet; import java.util.HashMap; import java.util.List; import java.util.Map.Entry; +import java.util.Set; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; @@ -226,15 +227,37 @@ public class ItemMultiPart extends AEBaseItem implements IPartItem, IItemGroup } @Override - public String getUnlocalizedGroupName(ItemStack is) + public String getUnlocalizedGroupName(Set others, ItemStack is) { - switch (getTypeByStack( is )) + boolean importBus = false, exportBus = false, group = false; + + PartType u = getTypeByStack( is ); + + for (ItemStack stack : others) { - case ImportBus: - case ExportBus: - return GuiText.IOBuses.getUnlocalized(); - default: + if ( stack.getItem() == this ) + { + PartType pt = getTypeByStack( stack ); + switch (pt) + { + case ImportBus: + importBus = true; + if ( u == pt ) + group = true; + break; + case ExportBus: + exportBus = true; + if ( u == pt ) + group = true; + break; + default: + } + } } + + if ( group && importBus && exportBus ) + return GuiText.IOBuses.getUnlocalized(); + return null; } diff --git a/items/storage/ItemBasicStorageCell.java b/items/storage/ItemBasicStorageCell.java index 2268fbc7a..36f62b197 100644 --- a/items/storage/ItemBasicStorageCell.java +++ b/items/storage/ItemBasicStorageCell.java @@ -2,6 +2,7 @@ package appeng.items.storage; import java.util.EnumSet; import java.util.List; +import java.util.Set; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; @@ -167,7 +168,7 @@ public class ItemBasicStorageCell extends AEBaseItem implements IStorageCell, II } @Override - public String getUnlocalizedGroupName(ItemStack is) + public String getUnlocalizedGroupName(Set others, ItemStack is) { return GuiText.StorageCells.getUnlocalized(); } diff --git a/items/tools/powered/ToolColorApplicator.java b/items/tools/powered/ToolColorApplicator.java index 5be9bc4ec..4082b1ad5 100644 --- a/items/tools/powered/ToolColorApplicator.java +++ b/items/tools/powered/ToolColorApplicator.java @@ -4,6 +4,7 @@ import java.util.Collections; import java.util.EnumSet; import java.util.LinkedList; import java.util.List; +import java.util.Set; import net.minecraft.block.Block; import net.minecraft.block.BlockDispenser; @@ -316,7 +317,7 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe } @Override - public String getUnlocalizedGroupName(ItemStack is) + public String getUnlocalizedGroupName(Set others, ItemStack is) { return GuiText.StorageCells.getUnlocalized(); } diff --git a/items/tools/powered/ToolPortableCell.java b/items/tools/powered/ToolPortableCell.java index 659ddeee3..920bd61a9 100644 --- a/items/tools/powered/ToolPortableCell.java +++ b/items/tools/powered/ToolPortableCell.java @@ -2,6 +2,7 @@ package appeng.items.tools.powered; import java.util.EnumSet; import java.util.List; +import java.util.Set; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; @@ -133,7 +134,7 @@ public class ToolPortableCell extends AEBasePoweredItem implements IStorageCell, } @Override - public String getUnlocalizedGroupName(ItemStack is) + public String getUnlocalizedGroupName(Set others, ItemStack is) { return GuiText.StorageCells.getUnlocalized(); }