pick 97420a31d The big reformat of 2020
This commit is contained in:
@@ -18,12 +18,10 @@
|
||||
|
||||
package appeng.client.gui;
|
||||
|
||||
|
||||
import java.text.NumberFormat;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import appeng.container.AEBaseContainer;
|
||||
import net.minecraft.entity.player.PlayerInventory;
|
||||
import net.minecraft.inventory.container.Container;
|
||||
import net.minecraft.inventory.container.Slot;
|
||||
@@ -33,75 +31,66 @@ import net.minecraft.util.text.TextFormatting;
|
||||
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.client.me.SlotME;
|
||||
import appeng.container.AEBaseContainer;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.localization.ButtonToolTips;
|
||||
|
||||
public abstract class AEBaseMEGui<T extends AEBaseContainer> extends AEBaseGui<T> {
|
||||
|
||||
public abstract class AEBaseMEGui<T extends AEBaseContainer> extends AEBaseGui<T>
|
||||
{
|
||||
public AEBaseMEGui(T container, PlayerInventory playerInventory, ITextComponent title) {
|
||||
super(container, playerInventory, title);
|
||||
}
|
||||
|
||||
public AEBaseMEGui(T container, PlayerInventory playerInventory, ITextComponent title) {
|
||||
super(container, playerInventory, title);
|
||||
}
|
||||
@Override
|
||||
protected void renderTooltip(final ItemStack stack, final int x, final int y) {
|
||||
final Slot s = this.getSlot(x, y);
|
||||
|
||||
@Override
|
||||
protected void renderTooltip( final ItemStack stack, final int x, final int y )
|
||||
{
|
||||
final Slot s = this.getSlot( x, y );
|
||||
if (s instanceof SlotME && !stack.isEmpty()) {
|
||||
final int bigNumber = AEConfig.instance().useTerminalUseLargeFont() ? 999 : 9999;
|
||||
|
||||
if( s instanceof SlotME && !stack.isEmpty() )
|
||||
{
|
||||
final int bigNumber = AEConfig.instance().useTerminalUseLargeFont() ? 999 : 9999;
|
||||
IAEItemStack myStack = null;
|
||||
final List<String> currentToolTip = this.getTooltipFromItem(stack);
|
||||
|
||||
IAEItemStack myStack = null;
|
||||
final List<String> currentToolTip = this.getTooltipFromItem( stack );
|
||||
try {
|
||||
final SlotME theSlotField = (SlotME) s;
|
||||
myStack = theSlotField.getAEStack();
|
||||
} catch (final Throwable ignore) {
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
final SlotME theSlotField = (SlotME) s;
|
||||
myStack = theSlotField.getAEStack();
|
||||
}
|
||||
catch( final Throwable ignore )
|
||||
{
|
||||
}
|
||||
if (myStack != null) {
|
||||
if (myStack.getStackSize() > bigNumber || (myStack.getStackSize() > 1 && stack.isDamaged())) {
|
||||
final String local = ButtonToolTips.ItemsStored.getLocal();
|
||||
final String formattedAmount = NumberFormat.getNumberInstance(Locale.US)
|
||||
.format(myStack.getStackSize());
|
||||
final String format = String.format(local, formattedAmount);
|
||||
|
||||
if( myStack != null )
|
||||
{
|
||||
if( myStack.getStackSize() > bigNumber || ( myStack.getStackSize() > 1 && stack.isDamaged() ) )
|
||||
{
|
||||
final String local = ButtonToolTips.ItemsStored.getLocal();
|
||||
final String formattedAmount = NumberFormat.getNumberInstance( Locale.US ).format( myStack.getStackSize() );
|
||||
final String format = String.format( local, formattedAmount );
|
||||
currentToolTip.add(TextFormatting.GRAY + format);
|
||||
}
|
||||
|
||||
currentToolTip.add( TextFormatting.GRAY + format );
|
||||
}
|
||||
if (myStack.getCountRequestable() > 0) {
|
||||
final String local = ButtonToolTips.ItemsRequestable.getLocal();
|
||||
final String formattedAmount = NumberFormat.getNumberInstance(Locale.US)
|
||||
.format(myStack.getCountRequestable());
|
||||
final String format = String.format(local, formattedAmount);
|
||||
|
||||
if( myStack.getCountRequestable() > 0 )
|
||||
{
|
||||
final String local = ButtonToolTips.ItemsRequestable.getLocal();
|
||||
final String formattedAmount = NumberFormat.getNumberInstance( Locale.US ).format( myStack.getCountRequestable() );
|
||||
final String format = String.format( local, formattedAmount );
|
||||
currentToolTip.add(format);
|
||||
}
|
||||
this.renderTooltip(currentToolTip, x, y, this.font);
|
||||
|
||||
currentToolTip.add( format );
|
||||
}
|
||||
this.renderTooltip( currentToolTip, x, y, this.font );
|
||||
return;
|
||||
} else if (stack.getCount() > bigNumber) {
|
||||
final String local = ButtonToolTips.ItemsStored.getLocal();
|
||||
final String formattedAmount = NumberFormat.getNumberInstance(Locale.US).format(stack.getCount());
|
||||
final String format = String.format(local, formattedAmount);
|
||||
|
||||
return;
|
||||
}
|
||||
else if( stack.getCount() > bigNumber )
|
||||
{
|
||||
final String local = ButtonToolTips.ItemsStored.getLocal();
|
||||
final String formattedAmount = NumberFormat.getNumberInstance( Locale.US ).format( stack.getCount() );
|
||||
final String format = String.format( local, formattedAmount );
|
||||
currentToolTip.add(TextFormatting.GRAY + format);
|
||||
|
||||
currentToolTip.add( TextFormatting.GRAY + format );
|
||||
this.renderTooltip(currentToolTip, x, y, this.font);
|
||||
|
||||
this.renderTooltip( currentToolTip, x, y, this.font );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
super.renderTooltip( stack, x, y );
|
||||
}
|
||||
super.renderTooltip(stack, x, y);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user