2014-11-14 12:02:52 +01:00
|
|
|
/*
|
|
|
|
* This file is part of Applied Energistics 2.
|
|
|
|
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
|
|
|
*
|
|
|
|
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Lesser General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
|
|
|
*/
|
|
|
|
|
2014-09-24 02:26:27 +02:00
|
|
|
package appeng.client.gui;
|
|
|
|
|
|
|
|
import java.text.NumberFormat;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.Locale;
|
|
|
|
|
|
|
|
import net.minecraft.inventory.Container;
|
|
|
|
import net.minecraft.inventory.Slot;
|
|
|
|
import net.minecraft.item.ItemStack;
|
2014-12-29 21:59:05 +01:00
|
|
|
|
2014-09-24 02:26:27 +02:00
|
|
|
import appeng.api.storage.data.IAEItemStack;
|
|
|
|
import appeng.client.me.SlotME;
|
|
|
|
import appeng.core.AEConfig;
|
|
|
|
|
|
|
|
public abstract class AEBaseMEGui extends AEBaseGui
|
|
|
|
{
|
|
|
|
|
|
|
|
public AEBaseMEGui(Container container) {
|
|
|
|
super( container );
|
|
|
|
}
|
|
|
|
|
2014-09-28 11:47:17 +02:00
|
|
|
public List<String> handleItemTooltip(ItemStack stack, int mouseX, int mouseY, List<String> currentToolTip)
|
2014-09-24 02:26:27 +02:00
|
|
|
{
|
|
|
|
if ( stack != null )
|
|
|
|
{
|
2014-12-29 15:13:47 +01:00
|
|
|
Slot s = this.getSlot( mouseX, mouseY );
|
2014-09-24 02:26:27 +02:00
|
|
|
if ( s instanceof SlotME )
|
|
|
|
{
|
|
|
|
int BigNumber = AEConfig.instance.useTerminalUseLargeFont() ? 999 : 9999;
|
|
|
|
|
|
|
|
IAEItemStack myStack = null;
|
|
|
|
|
|
|
|
try
|
|
|
|
{
|
|
|
|
SlotME theSlotField = (SlotME) s;
|
|
|
|
myStack = theSlotField.getAEStack();
|
|
|
|
}
|
|
|
|
catch (Throwable ignore)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( myStack != null )
|
|
|
|
{
|
|
|
|
if ( myStack.getStackSize() > BigNumber || (myStack.getStackSize() > 1 && stack.isItemDamaged()) )
|
2014-09-28 11:47:17 +02:00
|
|
|
currentToolTip.add( "\u00a77Items Stored: " + NumberFormat.getNumberInstance( Locale.US ).format( myStack.getStackSize() ) );
|
2014-09-24 02:26:27 +02:00
|
|
|
|
|
|
|
if ( myStack.getCountRequestable() > 0 )
|
2014-09-28 11:47:17 +02:00
|
|
|
currentToolTip.add( "\u00a77Items Requestable: " + NumberFormat.getNumberInstance( Locale.US ).format( myStack.getCountRequestable() ) );
|
2014-09-24 02:26:27 +02:00
|
|
|
}
|
|
|
|
else if ( stack.stackSize > BigNumber || (stack.stackSize > 1 && stack.isItemDamaged()) )
|
|
|
|
{
|
2014-09-28 11:47:17 +02:00
|
|
|
currentToolTip.add( "\u00a77Items Stored: " + NumberFormat.getNumberInstance( Locale.US ).format( stack.stackSize ) );
|
2014-09-24 02:26:27 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2014-09-28 11:47:17 +02:00
|
|
|
return currentToolTip;
|
2014-09-24 02:26:27 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// Vanilla version...
|
|
|
|
// protected void drawItemStackTooltip(ItemStack stack, int x, int y)
|
|
|
|
@Override
|
|
|
|
protected void renderToolTip(ItemStack stack, int x, int y)
|
|
|
|
{
|
2014-12-29 15:13:47 +01:00
|
|
|
Slot s = this.getSlot( x, y );
|
2014-09-24 02:26:27 +02:00
|
|
|
if ( s instanceof SlotME && stack != null )
|
|
|
|
{
|
|
|
|
int BigNumber = AEConfig.instance.useTerminalUseLargeFont() ? 999 : 9999;
|
|
|
|
|
|
|
|
IAEItemStack myStack = null;
|
|
|
|
|
|
|
|
try
|
|
|
|
{
|
|
|
|
SlotME theSlotField = (SlotME) s;
|
|
|
|
myStack = theSlotField.getAEStack();
|
|
|
|
}
|
|
|
|
catch (Throwable ignore)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( myStack != null )
|
|
|
|
{
|
2014-11-04 15:18:09 +01:00
|
|
|
@SuppressWarnings( "unchecked" )
|
|
|
|
List<String> currentToolTip = stack.getTooltip( this.mc.thePlayer, this.mc.gameSettings.advancedItemTooltips );
|
2014-09-24 02:26:27 +02:00
|
|
|
|
|
|
|
if ( myStack.getStackSize() > BigNumber || (myStack.getStackSize() > 1 && stack.isItemDamaged()) )
|
2014-09-28 11:47:17 +02:00
|
|
|
currentToolTip.add( "Items Stored: " + NumberFormat.getNumberInstance( Locale.US ).format( myStack.getStackSize() ) );
|
2014-09-24 02:26:27 +02:00
|
|
|
|
|
|
|
if ( myStack.getCountRequestable() > 0 )
|
2014-09-28 11:47:17 +02:00
|
|
|
currentToolTip.add( "Items Requestable: " + NumberFormat.getNumberInstance( Locale.US ).format( myStack.getCountRequestable() ) );
|
2014-09-24 02:26:27 +02:00
|
|
|
|
2014-12-29 15:13:47 +01:00
|
|
|
this.drawTooltip( x, y, 0, join( currentToolTip, "\n" ) );
|
2014-09-24 02:26:27 +02:00
|
|
|
}
|
2014-09-28 19:41:51 +02:00
|
|
|
else if ( stack.stackSize > BigNumber )
|
2014-09-24 02:26:27 +02:00
|
|
|
{
|
|
|
|
List var4 = stack.getTooltip( this.mc.thePlayer, this.mc.gameSettings.advancedItemTooltips );
|
|
|
|
var4.add( "Items Stored: " + NumberFormat.getNumberInstance( Locale.US ).format( stack.stackSize ) );
|
2014-12-29 15:13:47 +01:00
|
|
|
this.drawTooltip( x, y, 0, join( var4, "\n" ) );
|
2014-09-24 02:26:27 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
super.renderToolTip( stack, x, y );
|
|
|
|
// super.drawItemStackTooltip( stack, x, y );
|
|
|
|
}
|
|
|
|
|
2013-12-27 23:59:59 +01:00
|
|
|
}
|