Removed AEApi

Moved all internal access to the internal `Api` class using a new static
getter.
This commit is contained in:
yueh
2020-07-11 19:40:34 +02:00
parent d18eabe1fc
commit 0d43ca15be
168 changed files with 757 additions and 677 deletions
@@ -37,7 +37,6 @@ 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,6 +64,7 @@ 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;
@@ -100,7 +100,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU {
private MECraftingInventory inventory = new MECraftingInventory();
private IAEItemStack finalOutput;
private boolean waiting = false;
private IItemList<IAEItemStack> waitingFor = AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class)
private IItemList<IAEItemStack> waitingFor = Api.instance().storage().getStorageChannel(IItemStorageChannel.class)
.createList();
private long availableStorage = 0;
private MachineSource machineSrc = null;
@@ -466,7 +466,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU {
}
final IItemList<IAEItemStack> list;
this.getListOfItem(list = AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class).createList(),
this.getListOfItem(list = Api.instance().storage().getStorageChannel(IItemStorageChannel.class).createList(),
CraftingItemList.ALL);
for (final IAEItemStack is : list) {
this.postChange(is, this.machineSrc);
@@ -716,7 +716,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU {
final IStorageGrid sg = g.getCache(IStorageGrid.class);
final IMEInventory<IAEItemStack> ii = sg
.getInventory(AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class));
.getInventory(Api.instance().storage().getStorageChannel(IItemStorageChannel.class));
for (IAEItemStack is : this.inventory.getItemList()) {
is = this.inventory.extractItems(is.copy(), Actionable.MODULATE, this.machineSrc);
@@ -754,7 +754,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU {
final IStorageGrid sg = g.getCache(IStorageGrid.class);
final IMEInventory<IAEItemStack> storage = sg
.getInventory(AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class));
.getInventory(Api.instance().storage().getStorageChannel(IItemStorageChannel.class));
final MECraftingInventory ci = new MECraftingInventory(storage, true, false, false);
try {
@@ -784,7 +784,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU {
this.submitLink(this.myLastLink);
this.submitLink(whatLink);
final IItemList<IAEItemStack> list = AEApi.instance().storage()
final IItemList<IAEItemStack> list = Api.instance().storage()
.getStorageChannel(IItemStorageChannel.class).createList();
this.getListOfItem(list, CraftingItemList.ALL);
for (final IAEItemStack ge : list) {
@@ -1094,7 +1094,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU {
}
private IItemList<IAEItemStack> readList(final ListNBT tag) {
final IItemList<IAEItemStack> out = AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class)
final IItemList<IAEItemStack> out = Api.instance().storage().getStorageChannel(IItemStorageChannel.class)
.createList();
if (tag == null) {
@@ -1131,7 +1131,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU {
this.lastTime = System.nanoTime();
this.elapsedTime = 0;
final IItemList<IAEItemStack> list = AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class)
final IItemList<IAEItemStack> list = Api.instance().storage().getStorageChannel(IItemStorageChannel.class)
.createList();
this.getListOfItem(list, CraftingItemList.ACTIVE);
@@ -23,10 +23,10 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.World;
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;
@@ -77,7 +77,7 @@ public class QuantumCalculator extends MBCalculator {
}
num++;
final IBlocks blocks = AEApi.instance().definitions().blocks();
final IBlocks blocks = Api.instance().definitions().blocks();
if (num == 5) {
if (!this.isBlockAtLocation(w, p, blocks.quantumLink())) {
return false;
@@ -28,7 +28,6 @@ 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,6 +37,7 @@ 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.QuantumBridgeTileEntity;
@@ -99,7 +99,7 @@ public class QuantumCluster implements ILocatable, IAECluster {
}
final ILocatable myOtherSide = this.otherSide == 0 ? null
: AEApi.instance().registries().locatable().getLocatableBy(this.otherSide);
: Api.instance().registries().locatable().getLocatableBy(this.otherSide);
boolean shutdown = false;
@@ -134,7 +134,7 @@ public class QuantumCluster implements ILocatable, IAECluster {
}
sideA.connection = sideB.connection = new ConnectionWrapper(
AEApi.instance().grid().createGridConnection(sideA.getNode(), sideB.getNode()));
Api.instance().grid().createGridConnection(sideA.getNode(), sideB.getNode()));
} catch (final FailedConnectionException e) {
// :(
AELog.debug(e);
@@ -156,7 +156,7 @@ public class QuantumCluster implements ILocatable, IAECluster {
}
private boolean canUseNode(final long qe) {
final QuantumCluster qc = (QuantumCluster) AEApi.instance().registries().locatable().getLocatableBy(qe);
final QuantumCluster qc = (QuantumCluster) Api.instance().registries().locatable().getLocatableBy(qe);
if (qc != null) {
final World theWorld = qc.center.getWorld();
if (!qc.isDestroyed) {