Changed to Null ItemStack instead of null.

This commit is contained in:
yueh 2016-12-21 20:27:23 +01:00
parent ed9e6dd21c
commit 1cde7bc933
36 changed files with 95 additions and 78 deletions

View File

@ -1,4 +1,4 @@
aeversion=rv4
aeversion=rv5
aechannel=alpha
aebuild=0
aegroup=appeng
@ -9,7 +9,7 @@ aebasename=appliedenergistics2
#########################################################
minecraft_version=1.11
mcp_mappings=snapshot_20161206
forge_version=13.19.1.2188
forge_version=13.19.1.2189
#########################################################
# Installable #

View File

@ -237,7 +237,7 @@ public class BlockCableBus extends AEBaseTileBlock
return sp.facade.getItemStack();
}
return null;
return ItemStack.EMPTY;
}
@Override

View File

@ -40,7 +40,7 @@ class Size1Slot extends Slot
return modifiedStack;
}
return null;
return ItemStack.EMPTY;
}
@Override

View File

@ -91,7 +91,7 @@ public class SlotDisconnected extends AppEngSlot
@Override
public ItemStack decrStackSize( final int par1 )
{
return null;
return ItemStack.EMPTY;
}
@Override

View File

@ -455,7 +455,7 @@ public abstract class AEBaseContainer extends Container
{
if( Platform.isClient() )
{
return null;
return ItemStack.EMPTY;
}
boolean hasMETiles = false;
@ -470,14 +470,14 @@ public abstract class AEBaseContainer extends Container
if( hasMETiles && Platform.isClient() )
{
return null;
return ItemStack.EMPTY;
}
final AppEngSlot clickSlot = (AppEngSlot) this.inventorySlots.get( idx ); // require AE SLots!
if( clickSlot instanceof SlotDisabled || clickSlot instanceof SlotInaccessible )
{
return null;
return ItemStack.EMPTY;
}
if( clickSlot != null && clickSlot.getHasStack() )
{
@ -485,7 +485,7 @@ public abstract class AEBaseContainer extends Container
if( tis == null )
{
return null;
return ItemStack.EMPTY;
}
final List<Slot> selectedSlots = new ArrayList<Slot>();
@ -602,7 +602,7 @@ public abstract class AEBaseContainer extends Container
this.updateSlot( clickSlot );
this.updateSlot( d );
return null;
return ItemStack.EMPTY;
}
else
{
@ -656,7 +656,7 @@ public abstract class AEBaseContainer extends Container
this.updateSlot( clickSlot );
this.updateSlot( d );
return null;
return ItemStack.EMPTY;
}
else
{
@ -692,7 +692,7 @@ public abstract class AEBaseContainer extends Container
this.updateSlot( clickSlot );
this.updateSlot( d );
return null;
return ItemStack.EMPTY;
}
else
{
@ -707,7 +707,7 @@ public abstract class AEBaseContainer extends Container
}
this.updateSlot( clickSlot );
return null;
return ItemStack.EMPTY;
}
@Override

View File

@ -128,9 +128,9 @@ public class ContainerQuartzKnife extends AEBaseContainer implements IAEAppEngIn
public ItemStack getStackInSlot( final int var1 )
{
final ItemStack input = this.inSlot.getStackInSlot( 0 );
if( input == null )
if( input == ItemStack.EMPTY )
{
return null;
return ItemStack.EMPTY;
}
if( SlotRestrictedInput.isMetalIngot( input ) )
@ -147,7 +147,7 @@ public class ContainerQuartzKnife extends AEBaseContainer implements IAEAppEngIn
}
}
return null;
return ItemStack.EMPTY;
}
@Override
@ -161,7 +161,7 @@ public class ContainerQuartzKnife extends AEBaseContainer implements IAEAppEngIn
return is;
}
}
return null;
return ItemStack.EMPTY;
}
private boolean makePlate()
@ -185,7 +185,7 @@ public class ContainerQuartzKnife extends AEBaseContainer implements IAEAppEngIn
@Override
public ItemStack removeStackFromSlot( final int var1 )
{
return null;
return ItemStack.EMPTY;
}
@Override

View File

@ -85,12 +85,12 @@ public class AppEngSlot extends Slot
{
if( !this.isEnabled() )
{
return null;
return ItemStack.EMPTY;
}
if( this.inventory.getSizeInventory() <= this.getSlotIndex() )
{
return null;
return ItemStack.EMPTY;
}
if( this.isDisplay() )

View File

@ -54,7 +54,7 @@ public class NullSlot extends Slot
@Override
public ItemStack getStack()
{
return null;
return ItemStack.EMPTY;
}
@Override
@ -78,7 +78,7 @@ public class NullSlot extends Slot
@Override
public ItemStack decrStackSize( final int par1 )
{
return null;
return ItemStack.EMPTY;
}
@Override

View File

@ -200,7 +200,7 @@ public class SlotCraftingTerm extends AppEngCraftingSlot
return request;
}
}
return null;
return ItemStack.EMPTY;
}
is = r.getCraftingResult( ic );
@ -231,7 +231,7 @@ public class SlotCraftingTerm extends AppEngCraftingSlot
return is;
}
return null;
return ItemStack.EMPTY;
}
private boolean preCraft( final EntityPlayer p, final IMEMonitor<IAEItemStack> inv, final ItemStack[] set, final ItemStack result )

View File

@ -41,7 +41,7 @@ public class SlotFake extends AppEngSlot
@Override
public ItemStack decrStackSize( final int par1 )
{
return null;
return ItemStack.EMPTY;
}
@Override

View File

@ -70,7 +70,7 @@ public final class ColoredItemDefinition implements AEColoredItemDefinition
if( is == null )
{
return null;
return ItemStack.EMPTY;
}
return is.stack( stackSize );

View File

@ -162,7 +162,7 @@ public final class P2PTunnelRegistry implements IP2PTunnelRegistry
if( item == null )
{
return null;
return ItemStack.EMPTY;
}
final ItemStack myItemStack = new ItemStack( item, 1, meta );

View File

@ -233,7 +233,7 @@ public final class GrinderRecipeManager implements IGrinderRegistry, IOreListene
{
return is.copy();
}
return null;
return ItemStack.EMPTY;
}
private int getDustToOreRatio( final String name )

View File

@ -93,7 +93,7 @@ public class TileItemGen extends AEBaseTile implements IInventory
@Override
public ItemStack removeStackFromSlot( final int i )
{
return null;
return ItemStack.EMPTY;
}
@Override

View File

@ -316,7 +316,7 @@ public class PatternHelper implements ICraftingPatternDetails, Comparable<Patter
{
if( !this.isValidItemForSlot( x, craftingInv.getStackInSlot( x ), w ) )
{
return null;
return ItemStack.EMPTY;
}
}
@ -325,7 +325,7 @@ public class PatternHelper implements ICraftingPatternDetails, Comparable<Patter
return this.outputs[0].getItemStack();
}
return null;
return ItemStack.EMPTY;
}
private TestStatus getStatus( final int slotIndex, final ItemStack i )

View File

@ -144,7 +144,7 @@ public enum MaterialType
this( metaValue, modelName, features );
this.droppedEntity = c;
EntityRegistry.registerModEntity( new ResourceLocation( this.droppedEntity.getName() ), this.droppedEntity, this.droppedEntity.getSimpleName(),
EntityRegistry.registerModEntity( new ResourceLocation( this.droppedEntity.getName() ), this.droppedEntity, "appliedenergistics2:" + this.droppedEntity.getSimpleName(),
EntityIds.get( this.droppedEntity ), AppEng.instance(), 16, 4,
true );
}
@ -154,7 +154,7 @@ public enum MaterialType
this( metaValue, modelName, features );
this.oreName = oreDictionary;
this.droppedEntity = c;
EntityRegistry.registerModEntity( new ResourceLocation( this.droppedEntity.getName() ), this.droppedEntity, this.droppedEntity.getSimpleName(),
EntityRegistry.registerModEntity( new ResourceLocation( this.droppedEntity.getName() ), this.droppedEntity, "appliedenergistics2:" + this.droppedEntity.getSimpleName(),
EntityIds.get( this.droppedEntity ), AppEng.instance(), 16, 4,
true );
}

View File

@ -64,7 +64,7 @@ public class ItemCrystalSeed extends AEBaseItem implements IGrowableCrystal
{
this.setHasSubtypes( true );
EntityRegistry.registerModEntity( new ResourceLocation( EntityGrowingCrystal.class.getName() ), EntityGrowingCrystal.class, EntityGrowingCrystal.class.getSimpleName(), EntityIds.get( EntityGrowingCrystal.class ), AppEng.instance(), 16, 4, true );
EntityRegistry.registerModEntity( new ResourceLocation( EntityGrowingCrystal.class.getName() ), EntityGrowingCrystal.class, "appliedenergistics2:" + EntityGrowingCrystal.class.getSimpleName(), EntityIds.get( EntityGrowingCrystal.class ), AppEng.instance(), 16, 4, true );
}
@Nullable
@ -139,7 +139,7 @@ public class ItemCrystalSeed extends AEBaseItem implements IGrowableCrystal
}
if( newDamage > FINAL_STAGE )
{
return null;
return ItemStack.EMPTY;
}
this.setProgress( is, newDamage );

View File

@ -175,14 +175,14 @@ public class ItemEncodedPattern extends AEBaseItem implements ICraftingPatternIt
final World w = AppEng.proxy.getWorld();
if( w == null )
{
return null;
return ItemStack.EMPTY;
}
final ICraftingPatternDetails details = this.getPatternForItem( item, w );
if( details == null )
{
return null;
return ItemStack.EMPTY;
}
SIMPLE_CACHE.put( item, out = details.getCondensedOutputs()[0].getItemStack() );

View File

@ -155,13 +155,13 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
{
if( l == null )
{
return null;
return ItemStack.EMPTY;
}
final Block b = Block.getBlockFromItem( l.getItem() );
if( b == null || l.hasTagCompound() )
{
return null;
return ItemStack.EMPTY;
}
final int metadata = l.getItem().getMetadata( l.getItemDamage() );
@ -180,7 +180,7 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
catch( Exception e )
{
AELog.debug( e, "Cannot create a facade for " + b.getRegistryName() );
return null;
return ItemStack.EMPTY;
}
final boolean defaultValue = ( b.isFullyOpaque( blockState ) && hasSimpleModel( blockState ) && !b.getTickRandomly() && !hasTile && !disableOre ) || enableGlass;
@ -198,7 +198,7 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
is.setTagCompound( data );
return is;
}
return null;
return ItemStack.EMPTY;
}
@Override
@ -220,7 +220,7 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
if( nbt == null )
{
return null;
return ItemStack.EMPTY;
}
ResourceLocation itemId;
@ -232,12 +232,12 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
int[] data = nbt.getIntArray( "x" );
if( data.length != 2 )
{
return null;
return ItemStack.EMPTY;
}
Item item = Item.REGISTRY.getObjectById( data[0] );
if ( item == null ) {
return null;
return ItemStack.EMPTY;
}
itemId = item.getRegistryName();
@ -252,7 +252,7 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
if( baseItem == null )
{
return null;
return ItemStack.EMPTY;
}
return new ItemStack( baseItem, 1, itemDamage );
@ -315,7 +315,7 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
// Convert back to a registry name...
Item item = Item.REGISTRY.getObjectById( ids[0] );
if ( item == null ) {
return null;
return ItemStack.EMPTY;
}
final NBTTagCompound facadeTag = new NBTTagCompound();

View File

@ -288,7 +288,7 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
if( list.size() <= 0 )
{
return null;
return ItemStack.EMPTY;
}
IAEItemStack where = list.getFirst();

View File

@ -66,7 +66,8 @@ public abstract class AERootPoweredItem extends AEBaseItem implements IAEItemPow
final double percent = internalCurrentPower / internalMaxPower;
lines.add( GuiText.StoredEnergy.getLocal() + ':' + MessageFormat.format( " {0,number,#} ", internalCurrentPower ) + Platform.gui_localize( PowerUnits.AE.unlocalizedName ) + " - " + MessageFormat.format( " {0,number,#.##%} ", percent ) );
lines.add( GuiText.StoredEnergy.getLocal() + ':' + MessageFormat.format( " {0,number,#} ", internalCurrentPower ) + Platform
.gui_localize( PowerUnits.AE.unlocalizedName ) + " - " + MessageFormat.format( " {0,number,#.##%} ", percent ) );
}
@Override

View File

@ -64,9 +64,7 @@ class PoweredItemCapabilities implements ICapabilityProvider, IEnergyStorage
@Override
public boolean hasCapability( Capability<?> capability, @Nullable EnumFacing facing )
{
return capability == CapabilityEnergy.ENERGY
|| capability == Capabilities.TESLA_CONSUMER
|| capability == Capabilities.TESLA_HOLDER;
return capability == CapabilityEnergy.ENERGY || capability == Capabilities.TESLA_CONSUMER || capability == Capabilities.TESLA_HOLDER;
}
@SuppressWarnings( "unchecked" )

View File

@ -281,7 +281,7 @@ public class PartP2PItems extends PartP2PTunnel<PartP2PItems> implements /* IPip
@Override
public ItemStack removeStackFromSlot( final int i )
{
return null;
return ItemStack.EMPTY;
}
@Override

View File

@ -171,7 +171,7 @@ public final class DisassembleRecipe implements IRecipe
@Override
public ItemStack getRecipeOutput() // no default output..
{
return null;
return ItemStack.EMPTY;
}
@Override

View File

@ -88,7 +88,7 @@ public final class FacadeRecipe implements IRecipe
@Override
public ItemStack getRecipeOutput() // no default output..
{
return null;
return ItemStack.EMPTY;
}
@Override

View File

@ -111,7 +111,7 @@ public abstract class AEBaseInvTile extends AEBaseTile implements ISidedInventor
@Override
public ItemStack removeStackFromSlot( final int i )
{
return null;
return ItemStack.EMPTY;
}
@Override

View File

@ -110,7 +110,7 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
final IStackSrc src = ITEM_STACKS.get( obj.getClass() );
if( src == null )
{
return null;
return ItemStack.EMPTY;
}
return src.stack( 1 );
}

View File

@ -174,13 +174,13 @@ public class AppEngInternalAEInventory implements IInventory, Iterable<ItemStack
return ns;
}
return null;
return ItemStack.EMPTY;
}
@Override
public ItemStack removeStackFromSlot( final int var1 )
{
return null;
return ItemStack.EMPTY;
}
@Override

View File

@ -99,7 +99,7 @@ public class AppEngInternalInventory implements IInventory, Iterable<ItemStack>
return ns;
}
return null;
return ItemStack.EMPTY;
}
protected boolean eventsEnabled()
@ -110,7 +110,7 @@ public class AppEngInternalInventory implements IInventory, Iterable<ItemStack>
@Override
public ItemStack removeStackFromSlot( final int var1 )
{
return null;
return ItemStack.EMPTY;
}
@Override

View File

@ -46,19 +46,19 @@ public class AppEngNullInventory implements IInventory
@Override
public ItemStack getStackInSlot( final int var1 )
{
return null;
return ItemStack.EMPTY;
}
@Override
public ItemStack decrStackSize( final int slot, final int qty )
{
return null;
return ItemStack.EMPTY;
}
@Override
public ItemStack removeStackFromSlot( final int var1 )
{
return null;
return ItemStack.EMPTY;
}
@Override

View File

@ -172,7 +172,7 @@ public class TileCondenser extends AEBaseInvTile implements IConfigManagerHost,
case TRASH:
default:
return null;
return ItemStack.EMPTY;
}
}
@ -314,7 +314,7 @@ public class TileCondenser extends AEBaseInvTile implements IConfigManagerHost,
public ItemStack getStackInSlot( int slot )
{
// The void slot never has any content
return null;
return ItemStack.EMPTY;
}
@Override
@ -328,13 +328,13 @@ public class TileCondenser extends AEBaseInvTile implements IConfigManagerHost,
{
addPower( stack.getCount() );
}
return null;
return ItemStack.EMPTY;
}
@Override
public ItemStack extractItem( int slot, int amount, boolean simulate )
{
return null;
return ItemStack.EMPTY;
}
@Override

View File

@ -672,7 +672,7 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
{
return inv.getStackInSlot( extractSlot );
}
return null;
return ItemStack.EMPTY;
}
@Override
@ -708,7 +708,7 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
if( slot != validExtractSlot || amount == 0 )
{
return null;
return ItemStack.EMPTY;
}
AdaptorIInventory adapter = new AdaptorIInventory( new WrapperInventoryRange( TileInscriber.this, extractSlot, 1, true ) );

View File

@ -1,3 +1,21 @@
/*
* 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>.
*/
package appeng.tile.powersink;

View File

@ -700,7 +700,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, ITerminal
{
return this.storageType;
}
return null;
return ItemStack.EMPTY;
}
@Override

View File

@ -1626,7 +1626,7 @@ public class Platform
{
if( providedTemplate == null )
{
return null;
return ItemStack.EMPTY;
}
final AEItemStack ae_req = AEItemStack.create( providedTemplate );
@ -1679,7 +1679,7 @@ public class Platform
}
}
}
return null;
return ItemStack.EMPTY;
}
public static ItemStack cloneItemStack( final ItemStack a )
@ -1691,7 +1691,7 @@ public class Platform
{
if( stackInSlot == null )
{
return null;
return ItemStack.EMPTY;
}
final Item i = stackInSlot.getItem();
@ -1702,13 +1702,13 @@ public class Platform
stackInSlot.setCount( stackInSlot.getCount() - 1 );
return stackInSlot;
}
return null;
return ItemStack.EMPTY;
}
ItemStack ci = i.getContainerItem( stackInSlot.copy() );
if( ci != null && ci.isItemStackDamageable() && ci.getItemDamage() == ci.getMaxDamage() )
{
ci = null;
ci = ItemStack.EMPTY;
}
return ci;

View File

@ -264,7 +264,7 @@ public class AdaptorIInventory extends InventoryAdaptor
{
if( itemsToAdd == null || itemsToAdd.getCount() == 0 )
{
return null;
return ItemStack.EMPTY;
}
final ItemStack left = itemsToAdd.copy();
@ -292,7 +292,7 @@ public class AdaptorIInventory extends InventoryAdaptor
if( left.getCount() <= 0 )
{
return null;
return ItemStack.EMPTY;
}
}
else if( Platform.itemComparisons().isSameItem( is, left ) && is.getCount() < perOperationLimit )
@ -310,7 +310,7 @@ public class AdaptorIInventory extends InventoryAdaptor
left.grow( -used );
if( left.getCount() <= 0 )
{
return null;
return ItemStack.EMPTY;
}
}
}