Add an ease of use tooltip to the creative cell. Displays the items provided/formatted by the cell.

This commit is contained in:
Gunther De Wachter 2017-07-02 05:26:37 +02:00
parent eb0b304fd9
commit 7398af0e1c

View file

@ -19,6 +19,11 @@
package appeng.items.storage; 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.inventory.IInventory;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@ -27,6 +32,7 @@ import appeng.api.storage.ICellWorkbenchItem;
import appeng.items.AEBaseItem; import appeng.items.AEBaseItem;
import appeng.items.contents.CellConfig; import appeng.items.contents.CellConfig;
import java.util.List;
public class ItemCreativeStorageCell extends AEBaseItem implements ICellWorkbenchItem 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<String> 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() );
}
}
}
}
} }