Replaced all instances of Guava's Optional type with Java 8's Optional type, as discussed in #81. (#90)

This commit is contained in:
shartte
2016-08-24 19:06:10 +02:00
committed by Sebastian Hartte
parent c2a239a12f
commit e276aa682f
65 changed files with 306 additions and 468 deletions
@@ -34,7 +34,7 @@ import java.util.zip.ZipOutputStream;
import javax.annotation.Nonnull;
import com.google.common.base.Optional;
import java.util.Optional;
import com.google.common.base.Preconditions;
import com.google.common.collect.HashMultimap;
@@ -21,12 +21,10 @@ package appeng.recipes.game;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import com.google.common.base.Optional;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.item.ItemStack;
@@ -100,8 +98,10 @@ public final class DisassembleRecipe implements IRecipe
}
// handle storage cells
for( final ItemStack storageCellStack : this.getCellOutput( stackInSlot ).asSet() )
Optional<ItemStack> maybeCellOutput = this.getCellOutput( stackInSlot );
if( maybeCellOutput.isPresent() )
{
ItemStack storageCellStack = maybeCellOutput.get();
// make sure the storage cell stackInSlot empty...
final IMEInventory<IAEItemStack> cellInv = AEApi.instance().registries().cell().getCellInventory( stackInSlot, null, StorageChannel.ITEMS );
if( cellInv != null )
@@ -117,10 +117,7 @@ public final class DisassembleRecipe implements IRecipe
}
// handle crafting storage blocks
for( final ItemStack craftingStorageStack : this.getNonCellOutput( stackInSlot ).asSet() )
{
output = craftingStorageStack;
}
output = getNonCellOutput( stackInSlot ).orElse( output );
}
}
@@ -138,7 +135,7 @@ public final class DisassembleRecipe implements IRecipe
}
}
return Optional.absent();
return Optional.empty();
}
@Nonnull
@@ -152,7 +149,7 @@ public final class DisassembleRecipe implements IRecipe
}
}
return Optional.absent();
return Optional.empty();
}
@Nullable
@@ -19,10 +19,9 @@
package appeng.recipes.game;
import java.util.Optional;
import javax.annotation.Nullable;
import com.google.common.base.Optional;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.item.Item;
@@ -63,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 ) ) )
{
for( final Item facadeItemDefinition : this.maybeFacade.asSet() )
return this.maybeFacade.map( facadeItemDefinition ->
{
final ItemFacade facade = (ItemFacade) facadeItemDefinition;
@@ -73,7 +72,7 @@ public final class FacadeRecipe implements IRecipe
facades.stackSize = 4;
}
return facades;
}
} ).orElse( null );
}
}