Revert using internal API

This commit is contained in:
yueh
2020-06-07 17:21:20 +02:00
parent 7715f605eb
commit 23b6e195ac
148 changed files with 472 additions and 498 deletions
@@ -40,7 +40,6 @@ import appeng.api.storage.channels.IItemStorageChannel;
import appeng.api.storage.data.IAEItemStack;
import appeng.api.storage.data.IItemList;
import appeng.core.AELog;
import appeng.core.Api;
import appeng.me.GridAccessException;
import appeng.me.helpers.IGridProxyable;
import appeng.me.storage.ITickingMonitor;
@@ -219,7 +218,7 @@ class ItemHandlerAdapter implements IMEInventory<IAEItemStack>, IBaseMonitor<IAE
@Override
public IItemStorageChannel getChannel()
{
return Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class );
return AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class );
}
@Override
@@ -41,6 +41,7 @@ import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.util.LazyOptional;
import net.minecraftforge.items.IItemHandler;
import appeng.api.AEApi;
import appeng.api.config.Actionable;
import appeng.api.config.Upgrades;
import appeng.api.networking.IGridNode;
@@ -62,7 +63,6 @@ import appeng.api.storage.data.IAEItemStack;
import appeng.api.storage.data.IAEStack;
import appeng.api.util.AECableType;
import appeng.api.util.IConfigManager;
import appeng.core.Api;
import appeng.core.AppEng;
import appeng.helpers.DualityInterface;
@@ -308,7 +308,7 @@ public class PartInterface extends PartBasicState implements IGridTickable, ISto
@Override
public ItemStack getItemStackRepresentation()
{
return Api.INSTANCE.definitions().parts().iface().maybeStack( 1 ).orElse( ItemStack.EMPTY );
return AEApi.instance().definitions().parts().iface().maybeStack( 1 ).orElse( ItemStack.EMPTY );
}
@Override
@@ -41,7 +41,6 @@ import appeng.api.storage.IStorageChannel;
import appeng.api.storage.channels.IItemStorageChannel;
import appeng.api.util.AECableType;
import appeng.api.util.IConfigManager;
import appeng.core.Api;
import appeng.helpers.IPriorityHost;
import appeng.me.GridAccessException;
import appeng.parts.automation.PartUpgradeable;
@@ -93,7 +92,7 @@ public abstract class PartSharedStorageBus extends PartUpgradeable implements IG
*/
public IStorageChannel getStorageChannel()
{
return Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class );
return AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class );
}
protected abstract void resetCache();
@@ -78,7 +78,6 @@ import appeng.api.util.AECableType;
import appeng.api.util.AEPartLocation;
import appeng.api.util.IConfigManager;
import appeng.capabilities.Capabilities;
import appeng.core.Api;
import appeng.core.AppEng;
import appeng.core.settings.TickRates;
@@ -266,7 +265,7 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
{
this.getProxy()
.getStorage()
.postAlterationOfStoredItems( Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ), change,
.postAlterationOfStoredItems( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ), change,
this.mySrc );
}
}
@@ -354,7 +353,7 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
this.resetCacheLogic = 0;
final IMEInventory<IAEItemStack> in = this.getInternalHandler();
IItemList<IAEItemStack> before = Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ).createList();
IItemList<IAEItemStack> before = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
if( in != null )
{
before = in.getAvailableItems( before );
@@ -370,7 +369,7 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
if( in != out )
{
IItemList<IAEItemStack> after = Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ).createList();
IItemList<IAEItemStack> after = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
if( out != null )
{
after = out.getAvailableItems( after );
@@ -393,7 +392,7 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
IStorageMonitorable inventory = accessor.getInventory( this.mySrc );
if( inventory != null )
{
return inventory.getInventory( Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ) );
return inventory.getInventory( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) );
}
// So this could / can be a design decision. If the tile does support our custom capability,
@@ -484,13 +483,13 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
{
this.checkInterfaceVsStorageBus( target, this.getSide().getOpposite() );
this.handler = new MEInventoryHandler<IAEItemStack>( inv, Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ) );
this.handler = new MEInventoryHandler<IAEItemStack>( inv, AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) );
this.handler.setBaseAccess( (AccessRestriction) this.getConfigManager().getSetting( Settings.ACCESS ) );
this.handler.setWhitelist( this.getInstalledUpgrades( Upgrades.INVERTER ) > 0 ? IncludeExclude.BLACKLIST : IncludeExclude.WHITELIST );
this.handler.setPriority( this.priority );
final IItemList<IAEItemStack> priorityList = Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ).createList();
final IItemList<IAEItemStack> priorityList = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
final int slotsToUse = 18 + this.getInstalledUpgrades( Upgrades.CAPACITY ) * 9;
for( int x = 0; x < this.Config.getSlots() && x < slotsToUse; x++ )
@@ -583,7 +582,7 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
@Override
public List<IMEInventoryHandler> getCellArray( final IStorageChannel channel )
{
if( channel == Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ) )
if( channel == AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) )
{
final IMEInventoryHandler<IAEItemStack> out = this.getProxy().isActive() ? this.getInternalHandler() : null;
if( out != null )
@@ -648,7 +647,7 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
@Override
public ItemStack getItemStackRepresentation()
{
return Api.INSTANCE.definitions().parts().storageBus().maybeStack( 1 ).orElse( ItemStack.EMPTY );
return AEApi.instance().definitions().parts().storageBus().maybeStack( 1 ).orElse( ItemStack.EMPTY );
}
@Override
@@ -30,6 +30,7 @@ import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockReader;
import appeng.api.AEApi;
import appeng.api.exceptions.FailedConnectionException;
import appeng.api.networking.IGridConnection;
import appeng.api.networking.IGridNode;
@@ -39,7 +40,6 @@ import appeng.api.parts.IPartModel;
import appeng.api.util.AECableType;
import appeng.api.util.AEPartLocation;
import appeng.core.AELog;
import appeng.core.Api;
import appeng.core.AppEng;
import appeng.helpers.Reflected;
import appeng.items.parts.PartModels;
@@ -188,7 +188,7 @@ public class PartToggleBus extends PartBasicState
{
try
{
this.connection = Api.INSTANCE.grid().createGridConnection( this.getProxy().getNode(), this.getOuterProxy().getNode() );
this.connection = AEApi.instance().grid().createGridConnection( this.getProxy().getNode(), this.getOuterProxy().getNode() );
}
catch( final FailedConnectionException e )
{