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
+2 -2
View File
@@ -26,6 +26,7 @@ import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import appeng.api.AEApi;
import appeng.api.networking.IGrid;
import appeng.api.networking.IGridCache;
import appeng.api.networking.IGridHost;
@@ -35,7 +36,6 @@ import appeng.api.networking.IMachineSet;
import appeng.api.networking.events.MENetworkEvent;
import appeng.api.networking.events.MENetworkPostCacheConstruction;
import appeng.api.util.IReadOnlyCollection;
import appeng.core.Api;
import appeng.core.worlddata.WorldData;
import appeng.hooks.TickHandler;
import appeng.util.ReadOnlyCollection;
@@ -54,7 +54,7 @@ public class Grid implements IGrid
{
this.pivot = center;
final Map<Class<? extends IGridCache>, IGridCache> myCaches = Api.INSTANCE.registries().gridCache().createCacheInstance( this );
final Map<Class<? extends IGridCache>, IGridCache> myCaches = AEApi.instance().registries().gridCache().createCacheInstance( this );
for( final Entry<Class<? extends IGridCache>, IGridCache> c : myCaches.entrySet() )
{
final Class<? extends IGridCache> key = c.getKey();
+4 -5
View File
@@ -77,7 +77,6 @@ import appeng.api.storage.channels.IItemStorageChannel;
import appeng.api.storage.data.IAEItemStack;
import appeng.api.storage.data.IAEStack;
import appeng.api.storage.data.IItemList;
import appeng.core.Api;
import appeng.crafting.CraftingJob;
import appeng.crafting.CraftingLink;
import appeng.crafting.CraftingLinkNexus;
@@ -251,7 +250,7 @@ public class CraftingGridCache implements ICraftingGrid, ICraftingProviderHelper
this.emitableItems.clear();
// update the stuff that was in the list...
this.storageGrid.postAlterationOfStoredItems( Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ), oldItems.keySet(),
this.storageGrid.postAlterationOfStoredItems( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ), oldItems.keySet(),
new BaseActionSource() );
// re-create list..
@@ -288,7 +287,7 @@ public class CraftingGridCache implements ICraftingGrid, ICraftingProviderHelper
this.craftableItems.put( e.getKey(), ImmutableList.copyOf( e.getValue() ) );
}
this.storageGrid.postAlterationOfStoredItems( Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ), this.craftableItems.keySet(),
this.storageGrid.postAlterationOfStoredItems( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ), this.craftableItems.keySet(),
new BaseActionSource() );
}
@@ -368,7 +367,7 @@ public class CraftingGridCache implements ICraftingGrid, ICraftingProviderHelper
{
final List<IMEInventoryHandler> list = new ArrayList<>( 1 );
if( channel == Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ) )
if( channel == AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) )
{
list.add( this );
}
@@ -457,7 +456,7 @@ public class CraftingGridCache implements ICraftingGrid, ICraftingProviderHelper
@Override
public IStorageChannel<IAEItemStack> getChannel()
{
return Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class );
return AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class );
}
@Override
+1 -2
View File
@@ -50,7 +50,6 @@ import appeng.api.storage.IStorageChannel;
import appeng.api.storage.data.IAEItemStack;
import appeng.api.storage.data.IAEStack;
import appeng.api.storage.data.IItemList;
import appeng.core.Api;
import appeng.me.helpers.BaseActionSource;
import appeng.me.helpers.GenericInterestManager;
import appeng.me.helpers.MachineSource;
@@ -76,7 +75,7 @@ public class GridStorageCache implements IStorageGrid
this.storageNetworks = new IdentityHashMap<>();
this.storageMonitors = new IdentityHashMap<>();
Api.INSTANCE.storage().storageChannels().forEach( channel -> this.storageMonitors.put( channel, new NetworkMonitor<>( this, channel ) ) );
AEApi.instance().storage().storageChannels().forEach( channel -> this.storageMonitors.put( channel, new NetworkMonitor<>( this, channel ) ) );
}
@Override
+2 -2
View File
@@ -46,8 +46,8 @@ import appeng.api.networking.pathing.IPathingGrid;
import appeng.api.util.AEPartLocation;
import appeng.api.util.DimensionalCoord;
import appeng.core.AEConfig;
import appeng.core.Api;
import appeng.core.AppEng;
import appeng.api.AEApi;
import appeng.api.features.AEFeature;
import appeng.core.stats.IAdvancementTrigger;
import appeng.me.GridConnection;
@@ -351,7 +351,7 @@ public class PathGridCache implements IPathingGrid
{
for( final IGridNode n : this.requireChannels )
{
PlayerEntity player = Api.INSTANCE.registries().players().findPlayer( n.getPlayerID() );
PlayerEntity player = AEApi.instance().registries().players().findPlayer( n.getPlayerID() );
if( player instanceof ServerPlayerEntity )
{
currentBracket.trigger( (ServerPlayerEntity) player );
@@ -38,6 +38,7 @@ import net.minecraft.world.World;
import net.minecraft.world.server.ServerWorld;
import net.minecraftforge.fml.hooks.BasicEventHooks;
import appeng.api.AEApi;
import appeng.api.config.Actionable;
import appeng.api.config.FuzzyMode;
import appeng.api.config.PowerMultiplier;
@@ -65,7 +66,6 @@ import appeng.api.storage.data.IItemList;
import appeng.api.util.WorldCoord;
import appeng.container.ContainerNull;
import appeng.core.AELog;
import appeng.core.Api;
import appeng.crafting.CraftBranchFailure;
import appeng.crafting.CraftingJob;
import appeng.crafting.CraftingLink;
@@ -103,7 +103,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
private MECraftingInventory inventory = new MECraftingInventory();
private IAEItemStack finalOutput;
private boolean waiting = false;
private IItemList<IAEItemStack> waitingFor = Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ).createList();
private IItemList<IAEItemStack> waitingFor = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
private long availableStorage = 0;
private MachineSource machineSrc = null;
private int accelerator = 0;
@@ -546,7 +546,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
}
final IItemList<IAEItemStack> list;
this.getListOfItem( list = Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ).createList(), CraftingItemList.ALL );
this.getListOfItem( list = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList(), CraftingItemList.ALL );
for( final IAEItemStack is : list )
{
this.postChange( is, this.machineSrc );
@@ -837,7 +837,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
}
final IStorageGrid sg = g.getCache( IStorageGrid.class );
final IMEInventory<IAEItemStack> ii = sg.getInventory( Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ) );
final IMEInventory<IAEItemStack> ii = sg.getInventory( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) );
for( IAEItemStack is : this.inventory.getItemList() )
{
@@ -881,7 +881,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
}
final IStorageGrid sg = g.getCache( IStorageGrid.class );
final IMEInventory<IAEItemStack> storage = sg.getInventory( Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ) );
final IMEInventory<IAEItemStack> storage = sg.getInventory( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) );
final MECraftingInventory ci = new MECraftingInventory( storage, true, false, false );
try
@@ -912,7 +912,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
this.submitLink( this.myLastLink );
this.submitLink( whatLink );
final IItemList<IAEItemStack> list = Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ).createList();
final IItemList<IAEItemStack> list = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
this.getListOfItem( list, CraftingItemList.ALL );
for( final IAEItemStack ge : list )
{
@@ -1279,7 +1279,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
private IItemList<IAEItemStack> readList( final ListNBT tag )
{
final IItemList<IAEItemStack> out = Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ).createList();
final IItemList<IAEItemStack> out = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
if( tag == null )
{
@@ -1323,7 +1323,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
this.lastTime = System.nanoTime();
this.elapsedTime = 0;
final IItemList<IAEItemStack> list = Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ).createList();
final IItemList<IAEItemStack> list = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
this.getListOfItem( list, CraftingItemList.ACTIVE );
this.getListOfItem( list, CraftingItemList.PENDING );
@@ -28,7 +28,6 @@ import appeng.api.AEApi;
import appeng.api.definitions.IBlockDefinition;
import appeng.api.definitions.IBlocks;
import appeng.api.util.WorldCoord;
import appeng.core.Api;
import appeng.me.cluster.IAECluster;
import appeng.me.cluster.IAEMultiBlock;
import appeng.me.cluster.MBCalculator;
@@ -88,7 +87,7 @@ public class QuantumCalculator extends MBCalculator
}
num++;
final IBlocks blocks = Api.INSTANCE.definitions().blocks();
final IBlocks blocks = AEApi.instance().definitions().blocks();
if( num == 5 )
{
if( !this.isBlockAtLocation( w, p, blocks.quantumLink() ) )
@@ -29,6 +29,7 @@ import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.world.WorldEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import appeng.api.AEApi;
import appeng.api.events.LocatableEventAnnounce;
import appeng.api.events.LocatableEventAnnounce.LocatableEvent;
import appeng.api.exceptions.FailedConnectionException;
@@ -38,7 +39,6 @@ import appeng.api.networking.IGridNode;
import appeng.api.util.AEPartLocation;
import appeng.api.util.WorldCoord;
import appeng.core.AELog;
import appeng.core.Api;
import appeng.me.cache.helpers.ConnectionWrapper;
import appeng.me.cluster.IAECluster;
import appeng.tile.qnb.TileQuantumBridge;
@@ -113,7 +113,7 @@ public class QuantumCluster implements ILocatable, IAECluster
}
}
final ILocatable myOtherSide = this.otherSide == 0 ? null : Api.INSTANCE.registries().locatable().getLocatableBy( this.otherSide );
final ILocatable myOtherSide = this.otherSide == 0 ? null : AEApi.instance().registries().locatable().getLocatableBy( this.otherSide );
boolean shutdown = false;
@@ -156,7 +156,7 @@ public class QuantumCluster implements ILocatable, IAECluster
}
}
sideA.connection = sideB.connection = new ConnectionWrapper( Api.INSTANCE.grid().createGridConnection( sideA.getNode(), sideB.getNode() ) );
sideA.connection = sideB.connection = new ConnectionWrapper( AEApi.instance().grid().createGridConnection( sideA.getNode(), sideB.getNode() ) );
}
catch( final FailedConnectionException e )
{
@@ -187,7 +187,7 @@ public class QuantumCluster implements ILocatable, IAECluster
private boolean canUseNode( final long qe )
{
final QuantumCluster qc = (QuantumCluster) Api.INSTANCE.registries().locatable().getLocatableBy( qe );
final QuantumCluster qc = (QuantumCluster) AEApi.instance().registries().locatable().getLocatableBy( qe );
if( qc != null )
{
final World theWorld = qc.center.getWorld();
@@ -22,7 +22,6 @@ package appeng.me.helpers;
import java.util.Collections;
import java.util.EnumSet;
import appeng.core.Api;
import appeng.core.worlddata.WorldData;
import appeng.hooks.TickHandler;
import appeng.me.cache.P2PCache;
@@ -34,6 +33,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.util.Direction;
import appeng.api.AEApi;
import appeng.api.networking.GridFlags;
import appeng.api.networking.GridNotification;
import appeng.api.networking.IGrid;
@@ -147,7 +147,7 @@ public class AENetworkProxy implements IGridBlock
{
if( this.node == null && Platform.isServer() && this.isReady )
{
this.node = Api.INSTANCE.grid().createGridNode( this );
this.node = AEApi.instance().grid().createGridNode( this );
this.readFromNBT( this.data );
this.node.updateState();
}
@@ -31,7 +31,6 @@ import appeng.api.storage.IStorageChannel;
import appeng.api.storage.channels.IItemStorageChannel;
import appeng.api.storage.data.IAEItemStack;
import appeng.api.storage.data.IItemList;
import appeng.core.Api;
import appeng.items.contents.CellConfig;
import appeng.util.item.AEItemStack;
@@ -39,7 +38,7 @@ import appeng.util.item.AEItemStack;
public class CreativeCellInventory implements IMEInventoryHandler<IAEItemStack>
{
private final IItemList<IAEItemStack> itemListCache = Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ).createList();
private final IItemList<IAEItemStack> itemListCache = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
protected CreativeCellInventory( final ItemStack o )
{
@@ -57,7 +56,7 @@ public class CreativeCellInventory implements IMEInventoryHandler<IAEItemStack>
public static ICellInventoryHandler getCell( final ItemStack o )
{
return new BasicCellInventoryHandler( new CreativeCellInventory( o ), Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ) );
return new BasicCellInventoryHandler( new CreativeCellInventory( o ), AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) );
}
@Override
@@ -97,7 +96,7 @@ public class CreativeCellInventory implements IMEInventoryHandler<IAEItemStack>
@Override
public IStorageChannel getChannel()
{
return Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class );
return AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class );
}
@Override
@@ -31,6 +31,7 @@ import net.minecraftforge.fluids.FluidAttributes;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.capability.IFluidHandler;
import appeng.api.AEApi;
import appeng.api.config.AccessRestriction;
import appeng.api.config.Actionable;
import appeng.api.config.StorageFilter;
@@ -42,13 +43,12 @@ import appeng.api.storage.IStorageChannel;
import appeng.api.storage.channels.IFluidStorageChannel;
import appeng.api.storage.data.IAEFluidStack;
import appeng.api.storage.data.IItemList;
import appeng.core.Api;
public class MEMonitorIFluidHandler implements IMEMonitor<IAEFluidStack>, ITickingMonitor
{
private final IFluidHandler handler;
private final IItemList<IAEFluidStack> list = Api.INSTANCE.storage().getStorageChannel( IFluidStorageChannel.class ).createList();
private final IItemList<IAEFluidStack> list = AEApi.instance().storage().getStorageChannel( IFluidStorageChannel.class ).createList();
private final HashMap<IMEMonitorHandlerReceiver<IAEFluidStack>, Object> listeners = new HashMap<>();
private final NavigableMap<Integer, CachedFluidStack> memory;
private IActionSource mySource;
@@ -120,7 +120,7 @@ public class MEMonitorIFluidHandler implements IMEMonitor<IAEFluidStack>, ITicki
@Override
public IStorageChannel getChannel()
{
return Api.INSTANCE.storage().getStorageChannel( IFluidStorageChannel.class );
return AEApi.instance().storage().getStorageChannel( IFluidStorageChannel.class );
}
@Override
@@ -178,7 +178,7 @@ public class MEMonitorIFluidHandler implements IMEMonitor<IAEFluidStack>, ITicki
if( !newIS.isEmpty() )
{
stack = ( old == null || old.aeStack == null ? Api.INSTANCE
stack = ( old == null || old.aeStack == null ? AEApi.instance()
.storage()
.getStorageChannel( IFluidStorageChannel.class )
.createStack( newIS ) : old.aeStack.copy() );
@@ -351,7 +351,7 @@ public class MEMonitorIFluidHandler implements IMEMonitor<IAEFluidStack>, ITicki
else
{
this.fluidStack = is.copy();
this.aeStack = Api.INSTANCE.storage().getStorageChannel( IFluidStorageChannel.class ).createStack( is );
this.aeStack = AEApi.instance().storage().getStorageChannel( IFluidStorageChannel.class ).createStack( is );
}
}
}
@@ -41,7 +41,6 @@ import appeng.api.storage.IStorageChannel;
import appeng.api.storage.channels.IItemStorageChannel;
import appeng.api.storage.data.IAEItemStack;
import appeng.api.storage.data.IItemList;
import appeng.core.Api;
import appeng.util.InventoryAdaptor;
import appeng.util.Platform;
import appeng.util.inv.ItemSlot;
@@ -51,7 +50,7 @@ public class MEMonitorIInventory implements IMEMonitor<IAEItemStack>, ITickingMo
{
private final InventoryAdaptor adaptor;
private final IItemList<IAEItemStack> list = Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ).createList();
private final IItemList<IAEItemStack> list = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
private final HashMap<IMEMonitorHandlerReceiver<IAEItemStack>, Object> listeners = new HashMap<>();
private final NavigableMap<Integer, CachedItemStack> memory;
private IActionSource mySource;
@@ -139,7 +138,7 @@ public class MEMonitorIInventory implements IMEMonitor<IAEItemStack>, ITickingMo
@Override
public IStorageChannel getChannel()
{
return Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class );
return AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class );
}
@Override
@@ -183,7 +182,7 @@ public class MEMonitorIInventory implements IMEMonitor<IAEItemStack>, ITickingMo
final int newSize = ( newIS.isEmpty() ? 0 : newIS.getCount() );
final int diff = newSize - ( oldIS.isEmpty() ? 0 : oldIS.getCount() );
final IAEItemStack stack = ( old == null || old.aeStack == null ? Api.INSTANCE
final IAEItemStack stack = ( old == null || old.aeStack == null ? AEApi.instance()
.storage()
.getStorageChannel( IItemStorageChannel.class )
.createStack( newIS ) : old.aeStack.copy() );
@@ -358,7 +357,7 @@ public class MEMonitorIInventory implements IMEMonitor<IAEItemStack>, ITickingMo
else
{
this.itemStack = is.copy();
this.aeStack = Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ).createStack( is );
this.aeStack = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createStack( is );
}
}
}
@@ -28,7 +28,6 @@ import appeng.api.storage.IStorageChannel;
import appeng.api.storage.channels.IItemStorageChannel;
import appeng.api.storage.data.IAEStack;
import appeng.api.storage.data.IItemList;
import appeng.core.Api;
public class NullInventory<T extends IAEStack<T>> implements IMEInventoryHandler<T>
@@ -55,7 +54,7 @@ public class NullInventory<T extends IAEStack<T>> implements IMEInventoryHandler
@Override
public IStorageChannel getChannel()
{
return Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class );
return AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class );
}
@Override
@@ -32,7 +32,6 @@ import appeng.api.storage.IStorageChannel;
import appeng.api.storage.channels.IItemStorageChannel;
import appeng.api.storage.data.IAEItemStack;
import appeng.api.storage.data.IItemList;
import appeng.core.Api;
import appeng.me.GridAccessException;
import appeng.tile.misc.TileSecurityStation;
@@ -40,7 +39,7 @@ import appeng.tile.misc.TileSecurityStation;
public class SecurityStationInventory implements IMEInventoryHandler<IAEItemStack>
{
private final IItemList<IAEItemStack> storedItems = Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ).createList();
private final IItemList<IAEItemStack> storedItems = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
private final TileSecurityStation securityTile;
public SecurityStationInventory( final TileSecurityStation ts )
@@ -53,7 +52,7 @@ public class SecurityStationInventory implements IMEInventoryHandler<IAEItemStac
{
if( this.hasPermission( src ) )
{
if( Api.INSTANCE.definitions().items().biometricCard().isSameAs( input.createItemStack() ) )
if( AEApi.instance().definitions().items().biometricCard().isSameAs( input.createItemStack() ) )
{
if( this.canAccept( input ) )
{
@@ -124,7 +123,7 @@ public class SecurityStationInventory implements IMEInventoryHandler<IAEItemStac
@Override
public IStorageChannel getChannel()
{
return Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class );
return AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class );
}
@Override
@@ -147,7 +146,7 @@ public class SecurityStationInventory implements IMEInventoryHandler<IAEItemStac
final IBiometricCard tbc = (IBiometricCard) input.getItem();
final GameProfile newUser = tbc.getProfile( input.createItemStack() );
final int PlayerID = Api.INSTANCE.registries().players().getID( newUser );
final int PlayerID = AEApi.instance().registries().players().getID( newUser );
if( this.securityTile.getOwner() == PlayerID )
{
return false;