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
@@ -19,7 +19,6 @@
package appeng.items.storage;
import java.util.List;
import java.util.Set;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.entity.player.PlayerEntity;
@@ -35,7 +34,6 @@ import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.items.IItemHandler;
import appeng.api.AEApi;
import appeng.api.config.FuzzyMode;
import appeng.api.exceptions.MissingDefinitionException;
import appeng.api.features.AEFeature;
@@ -46,7 +44,7 @@ import appeng.api.storage.data.IAEItemStack;
import appeng.api.storage.data.IAEStack;
import appeng.api.storage.data.IItemList;
import appeng.core.AEConfig;
import appeng.core.localization.GuiText;
import appeng.core.Api;
import appeng.items.AEBaseItem;
import appeng.items.contents.CellConfig;
import appeng.items.contents.CellUpgrades;
@@ -73,8 +71,8 @@ public abstract class AbstractStorageCell<T extends IAEStack<T>> extends AEBaseI
@Override
public void addInformation(final ItemStack stack, final World world, final List<ITextComponent> lines,
final ITooltipFlag advancedTooltips) {
AEApi.instance().client().addCellInformation(
AEApi.instance().registries().cell().getCellInventory(stack, null, this.getChannel()), lines);
Api.instance().client().addCellInformation(
Api.instance().registries().cell().getCellInventory(stack, null, this.getChannel()), lines);
}
@Override
@@ -145,7 +143,7 @@ public abstract class AbstractStorageCell<T extends IAEStack<T>> extends AEBaseI
}
final PlayerInventory playerInventory = player.inventory;
final IMEInventoryHandler inv = AEApi.instance().registries().cell().getCellInventory(stack, null,
final IMEInventoryHandler inv = Api.instance().registries().cell().getCellInventory(stack, null,
this.getChannel());
if (inv != null && playerInventory.getCurrentItem() == stack) {
final InventoryAdaptor ia = InventoryAdaptor.getAdaptor(player);
@@ -193,7 +191,7 @@ public abstract class AbstractStorageCell<T extends IAEStack<T>> extends AEBaseI
@Override
public ItemStack getContainerItem(final ItemStack itemStack) {
return AEApi.instance().definitions().materials().emptyStorageCell().maybeStack(1)
return Api.instance().definitions().materials().emptyStorageCell().maybeStack(1)
.orElseThrow(() -> new MissingDefinitionException(
"Tried to use empty storage cells while basic storage cells are defined."));
}
@@ -21,10 +21,10 @@ package appeng.items.storage;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import appeng.api.AEApi;
import appeng.api.storage.IStorageChannel;
import appeng.api.storage.channels.IItemStorageChannel;
import appeng.api.storage.data.IAEItemStack;
import appeng.core.Api;
import appeng.items.materials.MaterialType;
import appeng.util.InventoryAdaptor;
@@ -71,12 +71,12 @@ public final class BasicStorageCellItem extends AbstractStorageCell<IAEItemStack
@Override
public IStorageChannel<IAEItemStack> getChannel() {
return AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class);
return Api.instance().storage().getStorageChannel(IItemStorageChannel.class);
}
@Override
protected void dropEmptyStorageCellCase(final InventoryAdaptor ia, final PlayerEntity player) {
AEApi.instance().definitions().materials().emptyStorageCell().maybeStack(1).ifPresent(is -> {
Api.instance().definitions().materials().emptyStorageCell().maybeStack(1).ifPresent(is -> {
final ItemStack extraA = ia.addItems(is);
if (!extraA.isEmpty()) {
player.dropItem(extraA, false);
@@ -28,12 +28,12 @@ import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.items.IItemHandler;
import appeng.api.AEApi;
import appeng.api.config.FuzzyMode;
import appeng.api.storage.IMEInventoryHandler;
import appeng.api.storage.cells.ICellInventoryHandler;
import appeng.api.storage.cells.ICellWorkbenchItem;
import appeng.api.storage.channels.IItemStorageChannel;
import appeng.core.Api;
import appeng.items.AEBaseItem;
import appeng.items.contents.CellConfig;
@@ -72,8 +72,8 @@ public class CreativeStorageCellItem extends AEBaseItem implements ICellWorkbenc
@Override
public void addInformation(final ItemStack stack, final World world, final List<ITextComponent> lines,
final ITooltipFlag advancedTooltips) {
final IMEInventoryHandler<?> inventory = AEApi.instance().registries().cell().getCellInventory(stack, null,
AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class));
final IMEInventoryHandler<?> inventory = Api.instance().registries().cell().getCellInventory(stack, null,
Api.instance().storage().getStorageChannel(IItemStorageChannel.class));
if (inventory instanceof ICellInventoryHandler) {
final CellConfig cc = new CellConfig(stack);
@@ -21,7 +21,6 @@ package appeng.items.storage;
import net.minecraft.item.ItemStack;
import net.minecraftforge.items.IItemHandler;
import appeng.api.AEApi;
import appeng.api.config.FuzzyMode;
import appeng.api.config.Upgrades;
import appeng.api.implementations.items.IUpgradeModule;
@@ -29,6 +28,7 @@ import appeng.api.storage.cells.ICellWorkbenchItem;
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.AEBaseItem;
import appeng.items.contents.CellConfig;
import appeng.items.contents.CellUpgrades;
@@ -55,7 +55,7 @@ public class ViewCellItem extends AEBaseItem implements ICellWorkbenchItem {
}
if ((currentViewCell.getItem() instanceof ViewCellItem)) {
final IItemList<IAEItemStack> priorityList = AEApi.instance().storage()
final IItemList<IAEItemStack> priorityList = Api.instance().storage()
.getStorageChannel(IItemStorageChannel.class).createList();
final ICellWorkbenchItem vc = (ICellWorkbenchItem) currentViewCell.getItem();