From 7398af0e1c9c8efde2cd2f9f0049e71829e2abdc Mon Sep 17 00:00:00 2001 From: Gunther De Wachter Date: Sun, 2 Jul 2017 05:26:37 +0200 Subject: [PATCH] Add an ease of use tooltip to the creative cell. Displays the items provided/formatted by the cell. --- .../storage/ItemCreativeStorageCell.java | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/main/java/appeng/items/storage/ItemCreativeStorageCell.java b/src/main/java/appeng/items/storage/ItemCreativeStorageCell.java index 65094a0e..455c073a 100644 --- a/src/main/java/appeng/items/storage/ItemCreativeStorageCell.java +++ b/src/main/java/appeng/items/storage/ItemCreativeStorageCell.java @@ -19,6 +19,11 @@ package appeng.items.storage; +import appeng.api.AEApi; +import appeng.api.storage.ICellInventoryHandler; +import appeng.api.storage.IMEInventoryHandler; +import appeng.api.storage.StorageChannel; +import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; @@ -27,6 +32,7 @@ import appeng.api.storage.ICellWorkbenchItem; import appeng.items.AEBaseItem; import appeng.items.contents.CellConfig; +import java.util.List; public class ItemCreativeStorageCell extends AEBaseItem implements ICellWorkbenchItem { @@ -65,4 +71,23 @@ public class ItemCreativeStorageCell extends AEBaseItem implements ICellWorkbenc { } + + @Override + public void addCheckedInformation(final ItemStack stack, final EntityPlayer player, final List lines, final boolean displayMoreInfo ) + { + final IMEInventoryHandler inventory = AEApi.instance().registries().cell().getCellInventory( stack, null, StorageChannel.ITEMS ); + + if( inventory instanceof ICellInventoryHandler) + { + final CellConfig cc = new CellConfig( stack ); + + for( final ItemStack is : cc ) + { + if( !is.isEmpty() ) + { + lines.add( is.getDisplayName() ); + } + } + } + } }