Refactored StorageChannel enum into an interface (#3138)

This replaces the static enum with a more dynamic interface providing
factory methods for handling network storage.
This commit is contained in:
yueh
2017-10-08 17:59:30 +02:00
committed by GitHub
parent 8ad8ce68b5
commit 6e81f698c0
115 changed files with 1255 additions and 943 deletions
@@ -37,6 +37,7 @@ import net.minecraft.world.World;
import appeng.api.AEApi;
import appeng.api.networking.crafting.ICraftingPatternDetails;
import appeng.api.storage.channels.IItemStorageChannel;
import appeng.api.storage.data.IAEItemStack;
import appeng.container.ContainerNull;
import appeng.util.ItemSorters;
@@ -78,7 +79,7 @@ public class PatternHelper implements ICraftingPatternDetails, Comparable<Patter
this.canSubstitute = this.isCrafting && encodedValue.getBoolean( "substitute" );
this.patternItem = is;
this.pattern = AEItemStack.create( is );
this.pattern = AEItemStack.fromItemStack( is );
final List<IAEItemStack> in = new ArrayList<>();
final List<IAEItemStack> out = new ArrayList<>();
@@ -100,7 +101,7 @@ public class PatternHelper implements ICraftingPatternDetails, Comparable<Patter
this.markItemAs( x, gs, TestStatus.ACCEPT );
}
in.add( AEApi.instance().storage().createItemStack( gs ) );
in.add( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createStack( gs ) );
this.testFrame.setInventorySlotContents( x, gs );
}
@@ -111,7 +112,7 @@ public class PatternHelper implements ICraftingPatternDetails, Comparable<Patter
if( this.standardRecipe != null )
{
this.correctOutput = this.standardRecipe.getCraftingResult( this.crafting );
out.add( AEApi.instance().storage().createItemStack( this.correctOutput ) );
out.add( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createStack( this.correctOutput ) );
}
else
{
@@ -135,7 +136,7 @@ public class PatternHelper implements ICraftingPatternDetails, Comparable<Patter
if( !gs.isEmpty() )
{
out.add( AEApi.instance().storage().createItemStack( gs ) );
out.add( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createStack( gs ) );
}
}
}