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
@@ -29,9 +29,11 @@ import net.minecraft.util.EnumHand;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.Vec3d;
import appeng.api.AEApi;
import appeng.api.networking.energy.IEnergySource;
import appeng.api.parts.IPartModel;
import appeng.api.storage.IMEMonitor;
import appeng.api.storage.channels.IItemStorageChannel;
import appeng.api.storage.data.IAEItemStack;
import appeng.core.AppEng;
import appeng.helpers.Reflected;
@@ -106,8 +108,9 @@ public class PartConversionMonitor extends AbstractPartMonitor
}
final IEnergySource energy = this.getProxy().getEnergy();
final IMEMonitor<IAEItemStack> cell = this.getProxy().getStorage().getItemInventory();
final IAEItemStack input = AEItemStack.create( item );
final IMEMonitor<IAEItemStack> cell = this.getProxy().getStorage().getInventory(
AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) );
final IAEItemStack input = AEItemStack.fromItemStack( item );
if( ModeB )
{
@@ -152,7 +155,8 @@ public class PartConversionMonitor extends AbstractPartMonitor
}
final IEnergySource energy = this.getProxy().getEnergy();
final IMEMonitor<IAEItemStack> cell = this.getProxy().getStorage().getItemInventory();
final IMEMonitor<IAEItemStack> cell = this.getProxy().getStorage().getInventory(
AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) );
final ItemStack is = input.createItemStack();
input.setStackSize( is.getMaxStackSize() );