Fix facade recipes. Hopefully the last null check fix.
This commit is contained in:
@@ -34,6 +34,7 @@ import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.EnumDyeColor;
|
||||
@@ -272,7 +273,7 @@ public abstract class AEBaseTileBlock extends AEBaseBlock implements ITileEntity
|
||||
public boolean onBlockActivated( World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ )
|
||||
{
|
||||
ItemStack heldItem;
|
||||
if( player != null && player.getHeldItemMainhand() != null )
|
||||
if( player != null && !player.getHeldItemMainhand().isEmpty() )
|
||||
{
|
||||
heldItem = player.getHeldItemMainhand();
|
||||
|
||||
|
||||
@@ -257,7 +257,7 @@ public class BlockCableBus extends AEBaseTileBlock
|
||||
// Our built-in model has the actual baked sprites we need
|
||||
IBakedModel model = Minecraft.getMinecraft().getBlockRendererDispatcher().getModelForState( getDefaultState() );
|
||||
|
||||
// We cannot add the effect if we dont have the model
|
||||
// We cannot add the effect if we don't have the model
|
||||
if( !( model instanceof CableBusBakedModel ) )
|
||||
{
|
||||
return true;
|
||||
|
||||
@@ -338,11 +338,11 @@ public class ClientHelper extends ServerHelper
|
||||
if( player.isSneaking() )
|
||||
{
|
||||
final EnumHand hand;
|
||||
if( player.getHeldItem( EnumHand.MAIN_HAND ) != null && player.getHeldItem( EnumHand.MAIN_HAND ).getItem() instanceof IMouseWheelItem )
|
||||
if( !player.getHeldItem( EnumHand.MAIN_HAND ).isEmpty() && player.getHeldItem( EnumHand.MAIN_HAND ).getItem() instanceof IMouseWheelItem )
|
||||
{
|
||||
hand = EnumHand.MAIN_HAND;
|
||||
}
|
||||
else if( player.getHeldItem( EnumHand.OFF_HAND ) != null && player.getHeldItem( EnumHand.OFF_HAND ).getItem() instanceof IMouseWheelItem )
|
||||
else if( !player.getHeldItem( EnumHand.OFF_HAND ).isEmpty() && player.getHeldItem( EnumHand.OFF_HAND ).getItem() instanceof IMouseWheelItem )
|
||||
{
|
||||
hand = EnumHand.OFF_HAND;
|
||||
}
|
||||
|
||||
@@ -99,7 +99,7 @@ public class TesrRenderHelper
|
||||
*/
|
||||
public static void renderItem2d( ItemStack itemStack, float scale )
|
||||
{
|
||||
if( itemStack != null )
|
||||
if( !itemStack.isEmpty() )
|
||||
{
|
||||
OpenGlHelper.setLightmapTextureCoords( OpenGlHelper.lightmapTexUnit, 240.f, 240.0f );
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package appeng.client.render.tesr;
|
||||
|
||||
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
@@ -200,7 +202,7 @@ public class InscriberTESR extends TileEntitySpecialRenderer<TileInscriber>
|
||||
|
||||
// heuristic to scale items down much further than blocks
|
||||
final Block blk = Block.getBlockFromItem( sis.getItem() );
|
||||
if( blk == null )
|
||||
if( blk == Blocks.AIR )
|
||||
{
|
||||
GlStateManager.scale( 0.5, 0.5, 0.5 );
|
||||
}
|
||||
|
||||
@@ -430,7 +430,7 @@ public final class ContainerInterfaceTerminal extends AEBaseContainer
|
||||
@Override
|
||||
public boolean isItemValid( final ItemStack itemstack )
|
||||
{
|
||||
return itemstack != null && itemstack.getItem() instanceof ItemEncodedPattern;
|
||||
return !itemstack.isEmpty() && itemstack.getItem() instanceof ItemEncodedPattern;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ import java.io.IOException;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
@@ -118,7 +119,7 @@ public class ContainerNetworkStatus extends AEBaseContainer
|
||||
{
|
||||
final IGridBlock blk = machine.getGridBlock();
|
||||
final ItemStack is = blk.getMachineRepresentation();
|
||||
if( !is.isEmpty() && is.getItem() != null )
|
||||
if( !is.isEmpty() && is.getItem() != Items.AIR )
|
||||
{
|
||||
final IAEItemStack ais = AEItemStack.create( is );
|
||||
ais.setStackSize( 1 );
|
||||
|
||||
@@ -77,7 +77,7 @@ public class ContainerQuartzKnife extends AEBaseContainer implements IAEAppEngIn
|
||||
|
||||
if( currentItem != this.toolInv.getItemStack() )
|
||||
{
|
||||
if( currentItem != null )
|
||||
if( !currentItem.isEmpty() )
|
||||
{
|
||||
if( Platform.itemComparisons().isEqualItem( this.toolInv.getItemStack(), currentItem ) )
|
||||
{
|
||||
@@ -173,7 +173,7 @@ public class ContainerQuartzKnife extends AEBaseContainer implements IAEAppEngIn
|
||||
|
||||
if( item.getCount() == 0 )
|
||||
{
|
||||
this.getPlayerInv().mainInventory.add( this.getPlayerInv().currentItem, null );
|
||||
this.getPlayerInv().mainInventory.add( this.getPlayerInv().currentItem, ItemStack.EMPTY );
|
||||
MinecraftForge.EVENT_BUS.post( new PlayerDestroyItemEvent( this.getPlayerInv().player, item, null ) );
|
||||
}
|
||||
|
||||
@@ -191,7 +191,7 @@ public class ContainerQuartzKnife extends AEBaseContainer implements IAEAppEngIn
|
||||
@Override
|
||||
public void setInventorySlotContents( final int var1, final ItemStack var2 )
|
||||
{
|
||||
if( var2 == null && Platform.isServer() )
|
||||
if( var2.isEmpty() && Platform.isServer() )
|
||||
{
|
||||
this.makePlate();
|
||||
}
|
||||
|
||||
@@ -105,7 +105,7 @@ public class SlotRestrictedInput extends AppEngSlot
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if( i.getItem() == null )
|
||||
if( i.getItem() == Items.AIR )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.common.config.Configuration;
|
||||
|
||||
@@ -20,6 +20,7 @@ package appeng.core.api.imc;
|
||||
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fml.common.event.FMLInterModComms.IMCMessage;
|
||||
|
||||
@@ -39,7 +40,7 @@ public class IMCBlackListSpatial implements IIMCProcessor
|
||||
if( !is.isEmpty() )
|
||||
{
|
||||
final Block blk = Block.getBlockFromItem( is.getItem() );
|
||||
if( blk != null )
|
||||
if( blk != Blocks.AIR )
|
||||
{
|
||||
AEApi.instance().registries().movable().blacklistBlock( blk );
|
||||
return;
|
||||
|
||||
@@ -75,12 +75,12 @@ public class IMCGrinder implements IIMCProcessor
|
||||
|
||||
final int turns = msg.getInteger( "turns" );
|
||||
|
||||
if( in == null )
|
||||
if( in.isEmpty() )
|
||||
{
|
||||
throw new IllegalStateException( "invalid input" );
|
||||
}
|
||||
|
||||
if( out == null )
|
||||
if( out.isEmpty() )
|
||||
{
|
||||
throw new IllegalStateException( "invalid output" );
|
||||
}
|
||||
@@ -90,7 +90,7 @@ public class IMCGrinder implements IIMCProcessor
|
||||
final NBTTagCompound optionalTag = (NBTTagCompound) msg.getTag( "optional" );
|
||||
final ItemStack optional = new ItemStack( optionalTag );
|
||||
|
||||
if( optional == null )
|
||||
if( optional.isEmpty() )
|
||||
{
|
||||
throw new IllegalStateException( "invalid optional" );
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ public class IMCMatterCannon implements IIMCProcessor
|
||||
final ItemStack ammo = new ItemStack( item );
|
||||
final double weight = msg.getDouble( "weight" );
|
||||
|
||||
if( ammo == null )
|
||||
if( ammo.isEmpty() )
|
||||
{
|
||||
throw new IllegalStateException( "invalid item in message " + m );
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ public class AchievementCraftingHandler
|
||||
@SubscribeEvent
|
||||
public void onPlayerCraftingEvent( final PlayerEvent.ItemCraftedEvent event )
|
||||
{
|
||||
if( this.differentiator.isNoPlayer( event.player ) || event.crafting == null )
|
||||
if( this.differentiator.isNoPlayer( event.player ) || event.crafting.isEmpty() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ public class AchievementPickupHandler
|
||||
@SubscribeEvent
|
||||
public void onItemPickUp( final PlayerEvent.ItemPickupEvent event )
|
||||
{
|
||||
if( this.differentiator.isNoPlayer( event.player ) || event.pickedUp == null || event.pickedUp.getEntityItem() == null )
|
||||
if( this.differentiator.isNoPlayer( event.player ) || event.pickedUp == null || event.pickedUp.getEntityItem().isEmpty() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -116,7 +116,7 @@ public enum Achievements
|
||||
|
||||
Achievements( final int x, final int y, final AEColoredItemDefinition which, final AchievementType type )
|
||||
{
|
||||
this.stack = ( which != null ) ? which.stack( AEColor.TRANSPARENT, 1 ) : null;
|
||||
this.stack = ( which != null ) ? which.stack( AEColor.TRANSPARENT, 1 ) : ItemStack.EMPTY;
|
||||
this.type = type;
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
@@ -145,7 +145,7 @@ public enum Achievements
|
||||
|
||||
public Achievement getAchievement()
|
||||
{
|
||||
if( this.stat == null && this.getStack() != null )
|
||||
if( this.stat == null && !this.getStack().isEmpty() )
|
||||
{
|
||||
this.stat = new Achievement( "achievement.ae2." + this.name(), "ae2." + this.name(), this.x, this.y, this.getStack(), this.parent );
|
||||
this.stat.registerStat();
|
||||
|
||||
@@ -98,14 +98,14 @@ public class PacketValueConfig extends AppEngPacket
|
||||
{
|
||||
final Container c = player.openContainer;
|
||||
|
||||
if( this.Name.equals( "Item" ) && ( ( player.getHeldItem( EnumHand.MAIN_HAND ) != null && player.getHeldItem(EnumHand.MAIN_HAND).getItem() instanceof IMouseWheelItem ) || ( player.getHeldItem( EnumHand.OFF_HAND ) != null && player.getHeldItem(EnumHand.OFF_HAND).getItem() instanceof IMouseWheelItem ) ) )
|
||||
if( this.Name.equals( "Item" ) && ( ( !player.getHeldItem( EnumHand.MAIN_HAND ).isEmpty() && player.getHeldItem(EnumHand.MAIN_HAND).getItem() instanceof IMouseWheelItem ) || ( !player.getHeldItem( EnumHand.OFF_HAND ).isEmpty() && player.getHeldItem(EnumHand.OFF_HAND).getItem() instanceof IMouseWheelItem ) ) )
|
||||
{
|
||||
final EnumHand hand;
|
||||
if( player.getHeldItem( EnumHand.MAIN_HAND ) != null && player.getHeldItem( EnumHand.MAIN_HAND ).getItem() instanceof IMouseWheelItem )
|
||||
if( !player.getHeldItem( EnumHand.MAIN_HAND ).isEmpty() && player.getHeldItem( EnumHand.MAIN_HAND ).getItem() instanceof IMouseWheelItem )
|
||||
{
|
||||
hand = EnumHand.MAIN_HAND;
|
||||
}
|
||||
else if( player.getHeldItem( EnumHand.OFF_HAND ) != null && player.getHeldItem( EnumHand.OFF_HAND ).getItem() instanceof IMouseWheelItem )
|
||||
else if( !player.getHeldItem( EnumHand.OFF_HAND ).isEmpty() && player.getHeldItem( EnumHand.OFF_HAND ).getItem() instanceof IMouseWheelItem )
|
||||
{
|
||||
hand = EnumHand.OFF_HAND;
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ package appeng.decorative.solid;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.inventory.EntityEquipmentSlot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
@@ -64,7 +65,7 @@ public class BlockSkyStone extends AEBaseBlock
|
||||
final ItemStack is = event.getEntityPlayer().getItemStackFromSlot( EntityEquipmentSlot.MAINHAND );
|
||||
int level = -1;
|
||||
|
||||
if( !is.isEmpty() && is.getItem() != null )
|
||||
if( !is.isEmpty() && is.getItem() != Items.AIR )
|
||||
{
|
||||
level = is.getItem().getHarvestLevel( is, "pickaxe", event.getEntityPlayer(), event.getState() );
|
||||
}
|
||||
|
||||
@@ -119,7 +119,7 @@ public final class EntityChargedQuartz extends AEBaseEntityItem
|
||||
if( e instanceof EntityItem && !e.isDead )
|
||||
{
|
||||
final ItemStack other = ( (EntityItem) e ).getEntityItem();
|
||||
if( other != null && other.getCount() > 0 )
|
||||
if( !other.isEmpty() && other.getCount() > 0 )
|
||||
{
|
||||
if( Platform.itemComparisons().isEqualItem( other, new ItemStack( Items.REDSTONE ) ) )
|
||||
{
|
||||
|
||||
@@ -93,7 +93,7 @@ public final class EntitySingularity extends AEBaseEntityItem
|
||||
if( e instanceof EntityItem )
|
||||
{
|
||||
final ItemStack other = ( (EntityItem) e ).getEntityItem();
|
||||
if( other != null )
|
||||
if( !other.isEmpty() )
|
||||
{
|
||||
boolean matches = false;
|
||||
for( final ItemStack is : OreDictionary.getOres( "dustEnder" ) )
|
||||
|
||||
@@ -29,6 +29,7 @@ import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.MoverType;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.item.EntityTNTPrimed;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.SoundEvents;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.EnumParticleTypes;
|
||||
|
||||
@@ -25,6 +25,7 @@ import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
@@ -90,7 +91,7 @@ public class FacadePart implements IFacadePart, IBoxProvider
|
||||
final ItemStack is = this.getTextureItem();
|
||||
if( is.isEmpty() )
|
||||
{
|
||||
return null;
|
||||
return Items.AIR;
|
||||
}
|
||||
return is.getItem();
|
||||
}
|
||||
@@ -123,7 +124,6 @@ public class FacadePart implements IFacadePart, IBoxProvider
|
||||
return this.getBlockState().isOpaqueCube();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public ItemStack getTextureItem()
|
||||
{
|
||||
@@ -137,7 +137,7 @@ public class FacadePart implements IFacadePart, IBoxProvider
|
||||
return facade.getTextureItem( this.facade );
|
||||
}
|
||||
|
||||
return null;
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -32,6 +32,7 @@ import com.google.common.collect.ImmutableSet;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.inventory.InventoryCrafting;
|
||||
@@ -1225,13 +1226,13 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
BAD_BLOCKS.add( directedBlock ); // nope!
|
||||
}
|
||||
|
||||
if( what.getItem() != null )
|
||||
if( what.getItem() != Items.AIR )
|
||||
{
|
||||
return what.getUnlocalizedName();
|
||||
}
|
||||
|
||||
final Item item = Item.getItemFromBlock( directedBlock );
|
||||
if( item == null )
|
||||
if( item == Items.AIR )
|
||||
{
|
||||
return directedBlock.getUnlocalizedName();
|
||||
}
|
||||
|
||||
@@ -89,7 +89,7 @@ public class PatternHelper implements ICraftingPatternDetails, Comparable<Patter
|
||||
|
||||
this.crafting.setInventorySlotContents( x, gs );
|
||||
|
||||
if( gs != null && ( !this.isCrafting || !gs.hasTagCompound() ) )
|
||||
if( !gs.isEmpty() && ( !this.isCrafting || !gs.hasTagCompound() ) )
|
||||
{
|
||||
this.markItemAs( x, gs, TestStatus.ACCEPT );
|
||||
}
|
||||
@@ -121,7 +121,7 @@ public class PatternHelper implements ICraftingPatternDetails, Comparable<Patter
|
||||
{
|
||||
final ItemStack gs = new ItemStack( outTag.getCompoundTagAt( x ) );
|
||||
|
||||
if( gs != null )
|
||||
if( !gs.isEmpty() )
|
||||
{
|
||||
out.add( AEApi.instance().storage().createItemStack( gs ) );
|
||||
}
|
||||
@@ -330,7 +330,7 @@ public class PatternHelper implements ICraftingPatternDetails, Comparable<Patter
|
||||
|
||||
private TestStatus getStatus( final int slotIndex, final ItemStack i )
|
||||
{
|
||||
if( this.crafting.getStackInSlot( slotIndex ) == null )
|
||||
if( this.crafting.getStackInSlot( slotIndex ).isEmpty() )
|
||||
{
|
||||
return i == null ? TestStatus.ACCEPT : TestStatus.DECLINE;
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ class FacadeRegistryPlugin implements IRecipeRegistryPlugin
|
||||
// Looking up if a certain block can be used to make a facade
|
||||
ItemStack itemStack = (ItemStack) focus.getValue();
|
||||
|
||||
if( itemFacade.createFacadeForItem( itemStack, true ) != null )
|
||||
if( !itemFacade.createFacadeForItem( itemStack, true ).isEmpty() )
|
||||
{
|
||||
return Collections.singletonList( VanillaRecipeCategoryUid.CRAFTING );
|
||||
}
|
||||
@@ -102,7 +102,7 @@ class FacadeRegistryPlugin implements IRecipeRegistryPlugin
|
||||
ItemStack itemStack = (ItemStack) focus.getValue();
|
||||
ItemStack facade = itemFacade.createFacadeForItem( itemStack, false );
|
||||
|
||||
if( facade != null )
|
||||
if( !facade.isEmpty() )
|
||||
{
|
||||
return Collections.singletonList( (T) new FacadeRecipeWrapper( itemStack, cableAnchor, facade ) );
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ public class ChargerInfoProvider implements ITileProbInfoProvider
|
||||
final IInventory chargerInventory = charger.getInternalInventory();
|
||||
final ItemStack chargingItem = chargerInventory.getStackInSlot( 0 );
|
||||
|
||||
if( chargingItem != null )
|
||||
if( !chargingItem.isEmpty() )
|
||||
{
|
||||
final String currentInventory = chargingItem.getDisplayName();
|
||||
final IProbeInfo centerAlignedHorizontalLayout = probeInfo
|
||||
|
||||
@@ -37,6 +37,7 @@ import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -220,7 +221,7 @@ public final class ItemMaterial extends AEBaseItem implements IStorageComponent,
|
||||
{
|
||||
for( final ItemStack is : options )
|
||||
{
|
||||
if( !is.isEmpty() && is.getItem() != null )
|
||||
if( !is.isEmpty() && is.getItem() != Items.AIR )
|
||||
{
|
||||
replacement = is.copy();
|
||||
break;
|
||||
|
||||
@@ -81,7 +81,7 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
|
||||
try
|
||||
{
|
||||
final ItemStack in = this.getTextureItem( is );
|
||||
if( in != null )
|
||||
if( !in.isEmpty() )
|
||||
{
|
||||
return super.getItemStackDisplayName( is ) + " - " + in.getDisplayName();
|
||||
}
|
||||
@@ -112,7 +112,7 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
|
||||
try
|
||||
{
|
||||
final Item item = Item.getItemFromBlock( b );
|
||||
if( item == null )
|
||||
if( item == Items.AIR )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -122,7 +122,7 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
|
||||
for( final ItemStack l : tmpList )
|
||||
{
|
||||
final ItemStack facade = this.createFacadeForItem( l, false );
|
||||
if( facade != null )
|
||||
if( !facade.isEmpty() )
|
||||
{
|
||||
this.subTypes.add( facade );
|
||||
}
|
||||
@@ -153,13 +153,13 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
|
||||
|
||||
public ItemStack createFacadeForItem( final ItemStack l, final boolean returnItem )
|
||||
{
|
||||
if( l == null )
|
||||
if( l.isEmpty() )
|
||||
{
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
final Block b = Block.getBlockFromItem( l.getItem() );
|
||||
if( b == null || l.hasTagCompound() )
|
||||
if( b == Blocks.AIR || l.hasTagCompound() )
|
||||
{
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
@@ -205,7 +205,7 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
|
||||
public FacadePart createPartFromItemStack( final ItemStack is, final AEPartLocation side )
|
||||
{
|
||||
final ItemStack in = this.getTextureItem( is );
|
||||
if( in != null )
|
||||
if( !in.isEmpty() )
|
||||
{
|
||||
return new FacadePart( is, side );
|
||||
}
|
||||
@@ -265,14 +265,14 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
|
||||
|
||||
ItemStack baseItemStack = getTextureItem( is );
|
||||
|
||||
if( baseItemStack == null )
|
||||
if( baseItemStack.isEmpty() )
|
||||
{
|
||||
return Blocks.GLASS.getDefaultState();
|
||||
}
|
||||
|
||||
Block block = Block.getBlockFromItem( baseItemStack.getItem() );
|
||||
|
||||
if( block == null )
|
||||
if( block == Blocks.AIR )
|
||||
{
|
||||
return Blocks.GLASS.getDefaultState();
|
||||
}
|
||||
|
||||
@@ -243,7 +243,7 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
|
||||
{
|
||||
final NBTTagCompound color = c.getCompoundTag( "color" );
|
||||
final ItemStack oldColor = new ItemStack( color );
|
||||
if( oldColor != null )
|
||||
if( !oldColor.isEmpty() )
|
||||
{
|
||||
return oldColor;
|
||||
}
|
||||
|
||||
@@ -289,7 +289,7 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
|
||||
{
|
||||
final ItemStack result = FurnaceRecipes.instance().getSmeltingResult( i );
|
||||
|
||||
if( result != null )
|
||||
if( !result.isEmpty() )
|
||||
{
|
||||
if( result.getItem() instanceof ItemBlock )
|
||||
{
|
||||
|
||||
@@ -462,7 +462,7 @@ public class CellInventory implements ICellInventory
|
||||
try
|
||||
{
|
||||
t = new ItemStack( compoundTag );
|
||||
if( t == null )
|
||||
if( t.isEmpty() )
|
||||
{
|
||||
AELog.warn( "Removing item " + compoundTag + " from storage cell because the associated item type couldn't be found." );
|
||||
return;
|
||||
|
||||
@@ -426,7 +426,7 @@ public abstract class AEBasePart implements IPart, IGridProxyable, IActionHost,
|
||||
{
|
||||
final ItemStack memCardIS = player.inventory.getCurrentItem();
|
||||
|
||||
if( memCardIS != null && this.useStandardMemoryCard() && memCardIS.getItem() instanceof IMemoryCard )
|
||||
if( !memCardIS.isEmpty() && this.useStandardMemoryCard() && memCardIS.getItem() instanceof IMemoryCard )
|
||||
{
|
||||
final IMemoryCard memoryCard = (IMemoryCard) memCardIS.getItem();
|
||||
|
||||
|
||||
@@ -436,7 +436,7 @@ public class PartPlacement
|
||||
boolean supportedItem = items.memoryCard().isSameAs( held );
|
||||
supportedItem |= items.colorApplicator().isSameAs( held );
|
||||
|
||||
if( event.getEntityPlayer().isSneaking() && held != null && supportedItem )
|
||||
if( event.getEntityPlayer().isSneaking() && !held.isEmpty() && supportedItem )
|
||||
{
|
||||
NetworkHandler.instance().sendToServer( new PacketClick( event.getPos(), event.getFace(), 0, 0, 0, event.getHand() ) );
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
@@ -86,7 +87,7 @@ public class PartIdentityAnnihilationPlane extends PartAnnihilationPlane
|
||||
final List<ItemStack> out = new ArrayList<ItemStack>( 1 );
|
||||
final Item item = Item.getItemFromBlock( state.getBlock() );
|
||||
|
||||
if( item != null )
|
||||
if( item != Items.AIR )
|
||||
{
|
||||
int meta = 0;
|
||||
if( item.getHasSubtypes() )
|
||||
|
||||
@@ -20,6 +20,7 @@ package appeng.parts.automation;
|
||||
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
@@ -88,7 +89,7 @@ public class PartImportBus extends PartSharedItemBus implements IInventoryDestin
|
||||
@Override
|
||||
public boolean canInsert( final ItemStack stack )
|
||||
{
|
||||
if( stack.isEmpty() || stack.getItem() == null )
|
||||
if( stack.isEmpty() || stack.getItem() == Items.AIR )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
package appeng.parts.automation;
|
||||
|
||||
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -117,7 +118,7 @@ public abstract class UpgradeInventory extends AppEngInternalInventory implement
|
||||
|
||||
for( final ItemStack is : this )
|
||||
{
|
||||
if( is == null || is.getItem() == null || !( is.getItem() instanceof IUpgradeModule ) )
|
||||
if( is == null || is.getItem() == Items.AIR || !( is.getItem() instanceof IUpgradeModule ) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -91,13 +91,13 @@ public class PartConversionMonitor extends AbstractPartMonitor
|
||||
boolean ModeB = false;
|
||||
|
||||
ItemStack item = player.getHeldItem( hand );
|
||||
if( item == null && this.getDisplayed() != null )
|
||||
if( item.isEmpty() && this.getDisplayed() != null )
|
||||
{
|
||||
ModeB = true;
|
||||
item = ( (IAEItemStack) this.getDisplayed() ).getItemStack();
|
||||
}
|
||||
|
||||
if( item != null )
|
||||
if( !item.isEmpty() )
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
@@ -24,6 +24,7 @@ import java.util.List;
|
||||
import com.google.common.base.Preconditions;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
@@ -167,7 +168,7 @@ public class Ingredient implements IIngredient
|
||||
if( blk != null )
|
||||
{
|
||||
final Item it = Item.getItemFromBlock( blk );
|
||||
if( it != null )
|
||||
if( it != Items.AIR )
|
||||
{
|
||||
return this.makeItemStack( it, this.qty, this.meta, this.nbt );
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ public final class DisassembleRecipe implements IRecipe
|
||||
@Override
|
||||
public boolean matches( final InventoryCrafting inv, final World w )
|
||||
{
|
||||
return this.getOutput( inv ) != null;
|
||||
return !this.getOutput( inv ).isEmpty();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -111,7 +111,7 @@ public final class DisassembleRecipe implements IRecipe
|
||||
final IItemList<IAEItemStack> list = cellInv.getAvailableItems( StorageChannel.ITEMS.createList() );
|
||||
if( !list.isEmpty() )
|
||||
{
|
||||
return null;
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ public final class FacadeRecipe implements IRecipe
|
||||
@Override
|
||||
public boolean matches( final InventoryCrafting inv, final World w )
|
||||
{
|
||||
return this.getOutput( inv, false ) != null;
|
||||
return !this.getOutput( inv, false ).isEmpty();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -62,7 +62,7 @@ public final class FacadeRecipe implements IRecipe
|
||||
if( this.anchor.isSameAs( inv.getStackInSlot( 1 ) ) && this.anchor.isSameAs( inv.getStackInSlot( 3 ) ) && this.anchor.isSameAs( inv.getStackInSlot( 5 ) ) && this.anchor.isSameAs( inv.getStackInSlot( 7 ) ) )
|
||||
{
|
||||
final ItemStack facades = facade.createFacadeForItem( inv.getStackInSlot( 4 ), !createFacade );
|
||||
if( facades != null && createFacade )
|
||||
if( !facades.isEmpty() && createFacade )
|
||||
{
|
||||
facades.setCount( 4 );
|
||||
}
|
||||
@@ -70,7 +70,7 @@ public final class FacadeRecipe implements IRecipe
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -21,6 +21,7 @@ package appeng.recipes.handlers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
|
||||
@@ -59,12 +60,12 @@ public class Smelt implements ICraftHandler, IWebsiteSerializer
|
||||
@Override
|
||||
public void register() throws RegistrationError, MissingIngredientError
|
||||
{
|
||||
if( this.in.getItemStack().getItem() == null )
|
||||
if( this.in.getItemStack().getItem() == Items.AIR )
|
||||
{
|
||||
throw new RegistrationError( this.in.toString() + ": Smelting Input is not a valid item." );
|
||||
}
|
||||
|
||||
if( this.out.getItemStack().getItem() == null )
|
||||
if( this.out.getItemStack().getItem() == Items.AIR )
|
||||
{
|
||||
throw new RegistrationError( this.out.toString() + ": Smelting Output is not a valid item." );
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ public class OreDictionaryHandler
|
||||
@SubscribeEvent
|
||||
public void onOreDictionaryRegister( final OreDictionary.OreRegisterEvent event )
|
||||
{
|
||||
if( event.getName() == null || event.getOre() == null )
|
||||
if( event.getName() == null || event.getOre().isEmpty() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -111,7 +111,7 @@ public class OreDictionaryHandler
|
||||
{
|
||||
for( final ItemStack item : OreDictionary.getOres( name ) )
|
||||
{
|
||||
if( item != null )
|
||||
if( !item.isEmpty() )
|
||||
{
|
||||
n.oreRegistered( name, item );
|
||||
}
|
||||
|
||||
@@ -172,7 +172,7 @@ final class MinecraftItemCSVExporter implements Exporter
|
||||
final Item item = input.getItem();
|
||||
final String unlocalizedItem = input.getUnlocalizedName();
|
||||
final Block block = Block.getBlockFromItem( item );
|
||||
final boolean isBlock = block != null && !block.equals( Blocks.AIR );
|
||||
final boolean isBlock = block != Blocks.AIR && !block.equals( Blocks.AIR );
|
||||
final Class<? extends ItemStack> stackClass = input.getClass();
|
||||
final String stackClassName = stackClass.getName();
|
||||
|
||||
@@ -275,7 +275,7 @@ final class MinecraftItemCSVExporter implements Exporter
|
||||
if( this.mode == ExportMode.VERBOSE )
|
||||
{
|
||||
final Block block = Block.getBlockFromItem( input );
|
||||
final boolean isBlock = block != null && !block.equals( Blocks.AIR );
|
||||
final boolean isBlock = block != Blocks.AIR && !block.equals( Blocks.AIR );
|
||||
final Class<? extends Item> itemClass = input.getClass();
|
||||
final String itemClassName = itemClass.getName();
|
||||
|
||||
|
||||
@@ -254,9 +254,9 @@ public class TileVibrationChamber extends AENetworkInvTile implements IGridTicka
|
||||
is.grow( -1 );
|
||||
if( is.getCount() <= 0 )
|
||||
{
|
||||
ItemStack container = null;
|
||||
ItemStack container = ItemStack.EMPTY;
|
||||
|
||||
if( is.getItem() != null && is.getItem().hasContainerItem( is ) )
|
||||
if( is.getItem() != Items.AIR && is.getItem().hasContainerItem( is ) )
|
||||
{
|
||||
container = is.getItem().getContainerItem( is );
|
||||
}
|
||||
|
||||
@@ -265,7 +265,7 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior
|
||||
@Override
|
||||
public boolean isItemValidForSlot( final int i, final ItemStack itemstack )
|
||||
{
|
||||
return itemstack != null && AEApi.instance().registries().cell().isCellHandled( itemstack );
|
||||
return !itemstack.isEmpty() && AEApi.instance().registries().cell().isCellHandled( itemstack );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -58,7 +58,7 @@ public class InWorldToolOperationResult
|
||||
|
||||
for( final ItemStack l : items )
|
||||
{
|
||||
if( b == null )
|
||||
if( b.isEmpty() )
|
||||
{
|
||||
final Block bl = Block.getBlockFromItem( l.getItem() );
|
||||
|
||||
|
||||
@@ -681,7 +681,7 @@ public class Platform
|
||||
return new ArrayList();
|
||||
}
|
||||
|
||||
ItemStack itemStack = null;
|
||||
ItemStack itemStack = ItemStack.EMPTY;
|
||||
if( o instanceof AEItemStack )
|
||||
{
|
||||
final AEItemStack ais = (AEItemStack) o;
|
||||
@@ -724,7 +724,7 @@ public class Platform
|
||||
return "** Null";
|
||||
}
|
||||
|
||||
ItemStack itemStack = null;
|
||||
ItemStack itemStack = ItemStack.EMPTY;
|
||||
if( o instanceof AEItemStack )
|
||||
{
|
||||
final String n = ( (AEItemStack) o ).getDisplayName();
|
||||
|
||||
@@ -26,6 +26,7 @@ import java.util.Set;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTBase;
|
||||
@@ -140,7 +141,7 @@ public class ItemComparisonHelper
|
||||
*/
|
||||
|
||||
// test damageable items..
|
||||
if( a.getItem() != null && b.getItem() != null && a.getItem().isDamageable() && a.getItem() == b.getItem() )
|
||||
if( a.getItem() != Items.AIR && b.getItem() != Items.AIR && a.getItem().isDamageable() && a.getItem() == b.getItem() )
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -379,11 +380,11 @@ public class ItemComparisonHelper
|
||||
*/
|
||||
private boolean hasSameNbtTag( final ItemStack a, final ItemStack b )
|
||||
{
|
||||
if( a == null && b == null )
|
||||
if( a.isEmpty() && b.isEmpty() )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if( a == null || b == null )
|
||||
if( a.isEmpty() || b.isEmpty() )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -31,6 +31,7 @@ import javax.annotation.Nullable;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompressedStreamTools;
|
||||
@@ -68,14 +69,14 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
|
||||
}
|
||||
|
||||
final Item item = is.getItem();
|
||||
if( item == null )
|
||||
if( item == Items.AIR )
|
||||
{
|
||||
throw new InvalidParameterException( "Contained item is null, thus not a valid ItemStack for AEItemStack." );
|
||||
}
|
||||
|
||||
this.setDefinition( new AEItemDef( item ) );
|
||||
|
||||
if( this.getDefinition().getItem() == null )
|
||||
if( this.getDefinition().getItem() == Items.AIR )
|
||||
{
|
||||
throw new InvalidParameterException( "This ItemStack is bad, it has a null item." );
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ package appeng.util.item;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.WeakHashMap;
|
||||
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
@@ -81,7 +82,7 @@ public class AESharedNBT extends NBTTagCompound implements IAETagCompound
|
||||
|
||||
final Item item = s.getItem();
|
||||
int meta = -1;
|
||||
if( s.getItem() != null && s.isItemStackDamageable() && s.getHasSubtypes() )
|
||||
if( s.getItem() != Items.AIR && s.isItemStackDamageable() && s.getHasSubtypes() )
|
||||
{
|
||||
meta = s.getItemDamage();
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
@@ -54,7 +55,7 @@ public class OreReference
|
||||
{
|
||||
for( final ItemStack is : OreHelper.INSTANCE.getCachedOres( oreName ) )
|
||||
{
|
||||
if( is.getItem() != null )
|
||||
if( is.getItem() != Items.AIR )
|
||||
{
|
||||
this.aeOtherOptions.add( AEItemStack.create( is ) );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user