Fix facade recipes. Hopefully the last null check fix.

This commit is contained in:
Gunther De Wachter
2017-06-27 20:39:06 +02:00
parent b819fe4adb
commit 61b81fc802
52 changed files with 101 additions and 83 deletions
+2 -1
View File
@@ -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 );
}