First batch of null -> isEmpty() checks.
I most likely still missed a ton of checks...
This commit is contained in:
@@ -92,7 +92,7 @@ public abstract class AEBaseGui extends GuiContainer
|
||||
private GuiScrollbar myScrollBar = null;
|
||||
private boolean disableShiftClick = false;
|
||||
private Stopwatch dbl_clickTimer = Stopwatch.createStarted();
|
||||
private ItemStack dbl_whichItem;
|
||||
private ItemStack dbl_whichItem = ItemStack.EMPTY;
|
||||
private Slot bl_clicked;
|
||||
private boolean subGui;
|
||||
|
||||
@@ -304,7 +304,7 @@ public abstract class AEBaseGui extends GuiContainer
|
||||
this.getScrollBar().click( this, x - this.guiLeft, y - this.guiTop );
|
||||
}
|
||||
|
||||
if( slot instanceof SlotFake && itemstack != null )
|
||||
if( slot instanceof SlotFake && !itemstack.isEmpty() )
|
||||
{
|
||||
this.drag_click.add( slot );
|
||||
if( this.drag_click.size() > 1 )
|
||||
@@ -453,7 +453,7 @@ public abstract class AEBaseGui extends GuiContainer
|
||||
action = ( mouseButton == 1 ) ? InventoryAction.SPLIT_OR_PLACE_SINGLE : InventoryAction.PICKUP_OR_SET_DOWN;
|
||||
stack = ( (SlotME) slot ).getAEStack();
|
||||
|
||||
if( stack != null && action == InventoryAction.PICKUP_OR_SET_DOWN && stack.getShowCraftingLabel())
|
||||
if( stack != null && action == InventoryAction.PICKUP_OR_SET_DOWN && stack.getShowCraftingLabel() )
|
||||
{
|
||||
action = InventoryAction.AUTO_CRAFT;
|
||||
}
|
||||
@@ -499,21 +499,21 @@ public abstract class AEBaseGui extends GuiContainer
|
||||
{
|
||||
this.disableShiftClick = true;
|
||||
|
||||
if( this.dbl_whichItem == null || this.bl_clicked != slot || this.dbl_clickTimer.elapsed( TimeUnit.MILLISECONDS ) > 150 )
|
||||
if( this.dbl_whichItem.isEmpty() || this.bl_clicked != slot || this.dbl_clickTimer.elapsed( TimeUnit.MILLISECONDS ) > 150 )
|
||||
{
|
||||
// some simple double click logic.
|
||||
this.bl_clicked = slot;
|
||||
this.dbl_clickTimer = Stopwatch.createStarted();
|
||||
if( slot != null )
|
||||
{
|
||||
this.dbl_whichItem = slot.getHasStack() ? slot.getStack().copy() : null;
|
||||
this.dbl_whichItem = slot.getHasStack() ? slot.getStack().copy() : ItemStack.EMPTY;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.dbl_whichItem = null;
|
||||
this.dbl_whichItem = ItemStack.EMPTY;
|
||||
}
|
||||
}
|
||||
else if( this.dbl_whichItem != null )
|
||||
else if( !this.dbl_whichItem.isEmpty() )
|
||||
{
|
||||
// a replica of the weird broken vanilla feature.
|
||||
|
||||
@@ -540,7 +540,7 @@ public abstract class AEBaseGui extends GuiContainer
|
||||
{
|
||||
final Slot theSlot = this.getSlotUnderMouse();
|
||||
|
||||
if( this.mc.player.inventory.getItemStack() == null && theSlot != null )
|
||||
if( this.mc.player.inventory.getItemStack().isEmpty() && theSlot != null )
|
||||
{
|
||||
for( int j = 0; j < 9; ++j )
|
||||
{
|
||||
@@ -728,7 +728,7 @@ public abstract class AEBaseGui extends GuiContainer
|
||||
try
|
||||
{
|
||||
final ItemStack is = s.getStack();
|
||||
if( s instanceof AppEngSlot && ( ( (AppEngSlot) s ).renderIconWithItem() || is == null ) && ( ( (AppEngSlot) s ).shouldDisplay() ) )
|
||||
if( s instanceof AppEngSlot && ( ( (AppEngSlot) s ).renderIconWithItem() || is.isEmpty() ) && ( ( (AppEngSlot) s ).shouldDisplay() ) )
|
||||
{
|
||||
final AppEngSlot aes = (AppEngSlot) s;
|
||||
if( aes.getIcon() >= 0 )
|
||||
@@ -776,7 +776,7 @@ public abstract class AEBaseGui extends GuiContainer
|
||||
}
|
||||
}
|
||||
|
||||
if( is != null && s instanceof AppEngSlot )
|
||||
if( !is.isEmpty() && s instanceof AppEngSlot )
|
||||
{
|
||||
if( ( (AppEngSlot) s ).getIsValid() == hasCalculatedValidness.NotAvailable )
|
||||
{
|
||||
|
||||
@@ -44,7 +44,7 @@ public abstract class AEBaseMEGui extends AEBaseGui
|
||||
|
||||
public List<String> handleItemTooltip( final ItemStack stack, final int mouseX, final int mouseY, final List<String> currentToolTip )
|
||||
{
|
||||
if( stack != null )
|
||||
if( !stack.isEmpty() )
|
||||
{
|
||||
final Slot s = this.getSlot( mouseX, mouseY );
|
||||
if( s instanceof SlotME )
|
||||
@@ -101,7 +101,7 @@ public abstract class AEBaseMEGui extends AEBaseGui
|
||||
protected void renderToolTip( final ItemStack stack, final int x, final int y )
|
||||
{
|
||||
final Slot s = this.getSlot( x, y );
|
||||
if( s instanceof SlotME && stack != null )
|
||||
if( s instanceof SlotME && !stack.isEmpty() )
|
||||
{
|
||||
final int BigNumber = AEConfig.instance().useTerminalUseLargeFont() ? 999 : 9999;
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ class Size1Slot extends Slot
|
||||
public ItemStack getStack()
|
||||
{
|
||||
ItemStack orgStack = delegate.getStack();
|
||||
if( orgStack != null )
|
||||
if( !orgStack.isEmpty() )
|
||||
{
|
||||
ItemStack modifiedStack = orgStack.copy();
|
||||
modifiedStack.setCount( 1 );
|
||||
|
||||
@@ -140,7 +140,7 @@ public class GuiCellWorkbench extends GuiUpgradeable
|
||||
for( int x = 0; x < inv.getSizeInventory(); x++ )
|
||||
{
|
||||
final ItemStack is = inv.getStackInSlot( x );
|
||||
if( is != null && is.getItem() instanceof IUpgradeModule )
|
||||
if( !is.isEmpty() && is.getItem() instanceof IUpgradeModule )
|
||||
{
|
||||
if( ( (IUpgradeModule) is.getItem() ).getType( is ) == Upgrades.FUZZY )
|
||||
{
|
||||
|
||||
@@ -107,23 +107,23 @@ public class GuiCraftAmount extends AEBaseGui
|
||||
|
||||
if( target instanceof PartTerminal )
|
||||
{
|
||||
myIcon = parts.terminal().maybeStack( 1 ).orElse( null );
|
||||
myIcon = parts.terminal().maybeStack( 1 ).orElse( ItemStack.EMPTY );
|
||||
this.originalGui = GuiBridge.GUI_ME;
|
||||
}
|
||||
|
||||
if( target instanceof PartCraftingTerminal )
|
||||
{
|
||||
myIcon = parts.craftingTerminal().maybeStack( 1 ).orElse( null );
|
||||
myIcon = parts.craftingTerminal().maybeStack( 1 ).orElse( ItemStack.EMPTY );
|
||||
this.originalGui = GuiBridge.GUI_CRAFTING_TERMINAL;
|
||||
}
|
||||
|
||||
if( target instanceof PartPatternTerminal )
|
||||
{
|
||||
myIcon = parts.patternTerminal().maybeStack( 1 ).orElse( null );
|
||||
myIcon = parts.patternTerminal().maybeStack( 1 ).orElse( ItemStack.EMPTY );
|
||||
this.originalGui = GuiBridge.GUI_PATTERN_TERMINAL;
|
||||
}
|
||||
|
||||
if( this.originalGui != null && myIcon != null )
|
||||
if( this.originalGui != null && !myIcon.isEmpty() )
|
||||
{
|
||||
this.buttonList.add( this.originalGuiBtn = new GuiTabButton( this.guiLeft + 154, this.guiTop, myIcon, myIcon.getDisplayName(), this.itemRender ) );
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ public class GuiCraftingStatus extends GuiCraftingCPU
|
||||
|
||||
private GuiTabButton originalGuiBtn;
|
||||
private GuiBridge originalGui;
|
||||
private ItemStack myIcon = null;
|
||||
private ItemStack myIcon = ItemStack.EMPTY;
|
||||
|
||||
public GuiCraftingStatus( final InventoryPlayer inventoryPlayer, final ITerminalHost te )
|
||||
{
|
||||
@@ -70,28 +70,28 @@ public class GuiCraftingStatus extends GuiCraftingCPU
|
||||
|
||||
if( target instanceof WirelessTerminalGuiObject )
|
||||
{
|
||||
myIcon = definitions.items().wirelessTerminal().maybeStack( 1 ).orElse( null );
|
||||
myIcon = definitions.items().wirelessTerminal().maybeStack( 1 ).orElse( ItemStack.EMPTY );
|
||||
|
||||
this.originalGui = GuiBridge.GUI_WIRELESS_TERM;
|
||||
}
|
||||
|
||||
if( target instanceof PartTerminal )
|
||||
{
|
||||
myIcon = parts.terminal().maybeStack( 1 ).orElse( null );
|
||||
myIcon = parts.terminal().maybeStack( 1 ).orElse( ItemStack.EMPTY );
|
||||
|
||||
this.originalGui = GuiBridge.GUI_ME;
|
||||
}
|
||||
|
||||
if( target instanceof PartCraftingTerminal )
|
||||
{
|
||||
myIcon = parts.craftingTerminal().maybeStack( 1 ).orElse( null );
|
||||
myIcon = parts.craftingTerminal().maybeStack( 1 ).orElse( ItemStack.EMPTY );
|
||||
|
||||
this.originalGui = GuiBridge.GUI_CRAFTING_TERMINAL;
|
||||
}
|
||||
|
||||
if( target instanceof PartPatternTerminal )
|
||||
{
|
||||
myIcon = parts.patternTerminal().maybeStack( 1 ).orElse( null );
|
||||
myIcon = parts.patternTerminal().maybeStack( 1 ).orElse( ItemStack.EMPTY );
|
||||
|
||||
this.originalGui = GuiBridge.GUI_PATTERN_TERMINAL;
|
||||
}
|
||||
@@ -131,7 +131,7 @@ public class GuiCraftingStatus extends GuiCraftingCPU
|
||||
// selectCPU.enabled = false;
|
||||
this.buttonList.add( this.selectCPU );
|
||||
|
||||
if( this.myIcon != null )
|
||||
if( !this.myIcon.isEmpty() )
|
||||
{
|
||||
this.buttonList.add( this.originalGuiBtn = new GuiTabButton( this.guiLeft + 213, this.guiTop - 4, this.myIcon, this.myIcon.getDisplayName(), this.itemRender ) );
|
||||
this.originalGuiBtn.setHideEdge( 13 );
|
||||
|
||||
@@ -84,7 +84,7 @@ public class ItemRepo
|
||||
|
||||
if( idx >= this.dsp.size() )
|
||||
{
|
||||
return null;
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
return this.dsp.get( idx );
|
||||
}
|
||||
|
||||
@@ -63,11 +63,11 @@ public class SlotDisconnected extends AppEngSlot
|
||||
if( Platform.isClient() )
|
||||
{
|
||||
final ItemStack is = super.getStack();
|
||||
if( is != null && is.getItem() instanceof ItemEncodedPattern )
|
||||
if( !is.isEmpty() && is.getItem() instanceof ItemEncodedPattern )
|
||||
{
|
||||
final ItemEncodedPattern iep = (ItemEncodedPattern) is.getItem();
|
||||
final ItemStack out = iep.getOutput( is );
|
||||
if( out != null )
|
||||
if( !out.isEmpty() )
|
||||
{
|
||||
return out;
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ public class SlotME extends Slot
|
||||
{
|
||||
return this.mySlot.getStack();
|
||||
}
|
||||
return null;
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -68,7 +68,7 @@ public class SlotME extends Slot
|
||||
{
|
||||
if( this.mySlot.hasPower() )
|
||||
{
|
||||
return this.getStack() != null;
|
||||
return !this.getStack().isEmpty();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -88,7 +88,7 @@ public class SlotME extends Slot
|
||||
@Override
|
||||
public ItemStack decrStackSize( final int par1 )
|
||||
{
|
||||
return null;
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -44,7 +44,7 @@ public class StackSizeRenderer
|
||||
|
||||
public void renderStackSize( FontRenderer fontRenderer, IAEItemStack aeStack, ItemStack is, int xPos, int yPos )
|
||||
{
|
||||
if( is != null )
|
||||
if( !is.isEmpty() )
|
||||
{
|
||||
final float scaleFactor = AEConfig.instance().useTerminalUseLargeFont() ? 0.85f : 0.5f;
|
||||
final float inverseScaleFactor = 1.0f / scaleFactor;
|
||||
|
||||
@@ -132,15 +132,15 @@ public class InscriberTESR extends TileEntitySpecialRenderer<TileInscriber>
|
||||
GlStateManager.color( 1.0F, 1.0F, 1.0F, 1.0F );
|
||||
|
||||
int items = 0;
|
||||
if( tile.getStackInSlot( 0 ) != null )
|
||||
if( !tile.getStackInSlot( 0 ).isEmpty() )
|
||||
{
|
||||
items++;
|
||||
}
|
||||
if( tile.getStackInSlot( 1 ) != null )
|
||||
if( !tile.getStackInSlot( 1 ).isEmpty() )
|
||||
{
|
||||
items++;
|
||||
}
|
||||
if( tile.getStackInSlot( 2 ) != null )
|
||||
if( !tile.getStackInSlot( 2 ).isEmpty() )
|
||||
{
|
||||
items++;
|
||||
}
|
||||
@@ -151,7 +151,7 @@ public class InscriberTESR extends TileEntitySpecialRenderer<TileInscriber>
|
||||
{
|
||||
ItemStack is = tile.getStackInSlot( 3 );
|
||||
|
||||
if( is == null )
|
||||
if( is.isEmpty() )
|
||||
{
|
||||
final IInscriberRecipe ir = tile.getTask();
|
||||
if( ir != null )
|
||||
@@ -177,7 +177,7 @@ public class InscriberTESR extends TileEntitySpecialRenderer<TileInscriber>
|
||||
|
||||
private void renderItem( ItemStack sis, final float o, final AEBaseTile tile, final VertexBuffer tess, final double x, final double y, final double z )
|
||||
{
|
||||
if( sis != null )
|
||||
if( !sis.isEmpty() )
|
||||
{
|
||||
sis = sis.copy();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user