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
@@ -27,7 +27,6 @@ import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.world.World;
import appeng.api.AEApi;
import appeng.api.config.Actionable;
import appeng.api.networking.IGrid;
import appeng.api.networking.IGridHost;
@@ -44,6 +43,7 @@ import appeng.api.storage.data.IAEItemStack;
import appeng.api.storage.data.IItemList;
import appeng.api.util.DimensionalCoord;
import appeng.core.AELog;
import appeng.core.Api;
import appeng.hooks.TickHandler;
public class CraftingJob implements Runnable, ICraftingJob {
@@ -52,9 +52,9 @@ public class CraftingJob implements Runnable, ICraftingJob {
private final MECraftingInventory original;
private final World world;
private final IItemList<IAEItemStack> crafting = AEApi.instance().storage()
private final IItemList<IAEItemStack> crafting = Api.instance().storage()
.getStorageChannel(IItemStorageChannel.class).createList();
private final IItemList<IAEItemStack> missing = AEApi.instance().storage()
private final IItemList<IAEItemStack> missing = Api.instance().storage()
.getStorageChannel(IItemStorageChannel.class).createList();
private final HashMap<String, TwoIntegers> opsAndMultiplier = new HashMap<>();
private final Object monitor = new Object();
@@ -85,7 +85,7 @@ public class CraftingJob implements Runnable, ICraftingJob {
final ICraftingGrid cc = grid.getCache(ICraftingGrid.class);
final IStorageGrid sg = grid.getCache(IStorageGrid.class);
this.original = new MECraftingInventory(
sg.getInventory(AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class)), actionSrc,
sg.getInventory(Api.instance().storage().getStorageChannel(IItemStorageChannel.class)), actionSrc,
false, false, false);
this.setTree(this.getCraftingTree(cc, what));
@@ -26,7 +26,6 @@ import com.google.common.collect.Lists;
import net.minecraft.world.World;
import appeng.api.AEApi;
import appeng.api.config.Actionable;
import appeng.api.config.FuzzyMode;
import appeng.api.networking.crafting.ICraftingGrid;
@@ -35,6 +34,7 @@ import appeng.api.networking.security.IActionSource;
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.cluster.implementations.CraftingCPUCluster;
public class CraftingTreeNode {
@@ -42,7 +42,7 @@ public class CraftingTreeNode {
// what slot!
private final int slot;
private final CraftingJob job;
private final IItemList<IAEItemStack> used = AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class)
private final IItemList<IAEItemStack> used = Api.instance().storage().getStorageChannel(IItemStorageChannel.class)
.createList();
// parent node.
private final CraftingTreeProcess parent;
@@ -28,7 +28,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.networking.crafting.ICraftingGrid;
import appeng.api.networking.crafting.ICraftingPatternDetails;
@@ -37,6 +36,7 @@ import appeng.api.storage.channels.IItemStorageChannel;
import appeng.api.storage.data.IAEItemStack;
import appeng.api.storage.data.IItemList;
import appeng.container.ContainerNull;
import appeng.core.Api;
import appeng.me.cluster.implementations.CraftingCPUCluster;
import appeng.util.Platform;
@@ -180,7 +180,7 @@ public class CraftingTreeProcess {
ItemStack is = ic.getStackInSlot(x);
is = Platform.getContainerItem(is);
final IAEItemStack o = AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class)
final IAEItemStack o = Api.instance().storage().getStorageChannel(IItemStorageChannel.class)
.createStack(is);
if (o != null) {
this.bytes++;
@@ -195,7 +195,7 @@ public class CraftingTreeProcess {
if (this.containerItems) {
final ItemStack is = Platform.getContainerItem(stack.createItemStack());
final IAEItemStack o = AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class)
final IAEItemStack o = Api.instance().storage().getStorageChannel(IItemStorageChannel.class)
.createStack(is);
if (o != null) {
this.bytes++;
@@ -18,7 +18,6 @@
package appeng.crafting;
import appeng.api.AEApi;
import appeng.api.config.Actionable;
import appeng.api.networking.security.IActionSource;
import appeng.api.storage.IMEInventory;
@@ -27,6 +26,7 @@ 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.inv.ItemListIgnoreCrafting;
public class MECraftingInventory implements IMEInventory<IAEItemStack> {
@@ -47,7 +47,7 @@ public class MECraftingInventory implements IMEInventory<IAEItemStack> {
public MECraftingInventory() {
this.localCache = new ItemListIgnoreCrafting<>(
AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class).createList());
Api.instance().storage().getStorageChannel(IItemStorageChannel.class).createList());
this.extractedCache = null;
this.injectedCache = null;
this.missingCache = null;
@@ -65,25 +65,25 @@ public class MECraftingInventory implements IMEInventory<IAEItemStack> {
this.logMissing = parent.logMissing;
if (this.logMissing) {
this.missingCache = AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class).createList();
this.missingCache = Api.instance().storage().getStorageChannel(IItemStorageChannel.class).createList();
} else {
this.missingCache = null;
}
if (this.logExtracted) {
this.extractedCache = AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class).createList();
this.extractedCache = Api.instance().storage().getStorageChannel(IItemStorageChannel.class).createList();
} else {
this.extractedCache = null;
}
if (this.logInjections) {
this.injectedCache = AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class).createList();
this.injectedCache = Api.instance().storage().getStorageChannel(IItemStorageChannel.class).createList();
} else {
this.injectedCache = null;
}
this.localCache = this.target.getAvailableItems(new ItemListIgnoreCrafting<>(
AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class).createList()));
Api.instance().storage().getStorageChannel(IItemStorageChannel.class).createList()));
this.par = parent;
}
@@ -96,25 +96,25 @@ public class MECraftingInventory implements IMEInventory<IAEItemStack> {
this.logMissing = logMissing;
if (logMissing) {
this.missingCache = AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class).createList();
this.missingCache = Api.instance().storage().getStorageChannel(IItemStorageChannel.class).createList();
} else {
this.missingCache = null;
}
if (logExtracted) {
this.extractedCache = AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class).createList();
this.extractedCache = Api.instance().storage().getStorageChannel(IItemStorageChannel.class).createList();
} else {
this.extractedCache = null;
}
if (logInjections) {
this.injectedCache = AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class).createList();
this.injectedCache = Api.instance().storage().getStorageChannel(IItemStorageChannel.class).createList();
} else {
this.injectedCache = null;
}
this.localCache = new ItemListIgnoreCrafting<>(
AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class).createList());
Api.instance().storage().getStorageChannel(IItemStorageChannel.class).createList());
for (final IAEItemStack is : target.getStorageList()) {
this.localCache.add(target.extractItems(is, Actionable.SIMULATE, src));
}
@@ -130,25 +130,25 @@ public class MECraftingInventory implements IMEInventory<IAEItemStack> {
this.logMissing = logMissing;
if (logMissing) {
this.missingCache = AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class).createList();
this.missingCache = Api.instance().storage().getStorageChannel(IItemStorageChannel.class).createList();
} else {
this.missingCache = null;
}
if (logExtracted) {
this.extractedCache = AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class).createList();
this.extractedCache = Api.instance().storage().getStorageChannel(IItemStorageChannel.class).createList();
} else {
this.extractedCache = null;
}
if (logInjections) {
this.injectedCache = AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class).createList();
this.injectedCache = Api.instance().storage().getStorageChannel(IItemStorageChannel.class).createList();
} else {
this.injectedCache = null;
}
this.localCache = target.getAvailableItems(
AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class).createList());
this.localCache = target
.getAvailableItems(Api.instance().storage().getStorageChannel(IItemStorageChannel.class).createList());
this.par = null;
}
@@ -214,7 +214,7 @@ public class MECraftingInventory implements IMEInventory<IAEItemStack> {
@Override
public IStorageChannel getChannel() {
return AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class);
return Api.instance().storage().getStorageChannel(IItemStorageChannel.class);
}
public IItemList<IAEItemStack> getItemList() {
@@ -222,9 +222,9 @@ public class MECraftingInventory implements IMEInventory<IAEItemStack> {
}
public boolean commit(final IActionSource src) {
final IItemList<IAEItemStack> added = AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class)
final IItemList<IAEItemStack> added = Api.instance().storage().getStorageChannel(IItemStorageChannel.class)
.createList();
final IItemList<IAEItemStack> pulled = AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class)
final IItemList<IAEItemStack> pulled = Api.instance().storage().getStorageChannel(IItemStorageChannel.class)
.createList();
boolean failed = false;