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
@@ -19,10 +19,10 @@
package appeng.items.contents;
import appeng.core.Api;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
import appeng.api.AEApi;
import appeng.api.config.Actionable;
import appeng.api.config.PowerMultiplier;
import appeng.api.config.Settings;
@@ -51,7 +51,7 @@ public class PortableCellViewer extends MEMonitorHandler<IAEItemStack> implement
public PortableCellViewer( final ItemStack is, final int slot )
{
super( Api.INSTANCE.registries().cell().getCellInventory( is, null, Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ) ) );
super( AEApi.instance().registries().cell().getCellInventory( is, null, AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) ) );
this.ips = (IAEItemPowerStorage) is.getItem();
this.target = is;
this.inventorySlot = slot;
@@ -85,7 +85,7 @@ public class PortableCellViewer extends MEMonitorHandler<IAEItemStack> implement
@Override
public <T extends IAEStack<T>> IMEMonitor<T> getInventory( IStorageChannel<T> channel )
{
if( channel == Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ) )
if( channel == AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) )
{
return (IMEMonitor<T>) this;
}
@@ -19,10 +19,10 @@
package appeng.items.misc;
import appeng.api.AEApi;
import appeng.api.implementations.ICraftingPatternItem;
import appeng.api.networking.crafting.ICraftingPatternDetails;
import appeng.api.storage.data.IAEItemStack;
import appeng.core.Api;
import appeng.core.AppEng;
import appeng.core.localization.GuiText;
import appeng.helpers.InvalidPatternHelper;
@@ -85,7 +85,7 @@ public class ItemEncodedPattern extends AEBaseItem implements ICraftingPatternIt
final PlayerInventory inv = player.inventory;
ItemStack is = Api.INSTANCE.definitions().materials().blankPattern().maybeStack( stack.getCount() ).orElse( ItemStack.EMPTY );
ItemStack is = AEApi.instance().definitions().materials().blankPattern().maybeStack( stack.getCount() ).orElse( ItemStack.EMPTY );
if( !is.isEmpty() )
{
for( int s = 0; s < player.inventory.getSizeInventory(); s++ )
@@ -37,11 +37,11 @@ import net.minecraft.util.registry.Registry;
import net.minecraft.util.text.ITextComponent;
import net.minecraftforge.registries.ForgeRegistries;
import appeng.api.AEApi;
import appeng.api.exceptions.MissingDefinitionException;
import appeng.api.parts.IAlphaPassItem;
import appeng.api.util.AEPartLocation;
import appeng.core.AELog;
import appeng.core.Api;
import appeng.core.FacadeConfig;
import appeng.facade.FacadePart;
import appeng.facade.IFacadeItem;
@@ -63,7 +63,7 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
@Override
public ActionResultType onItemUseFirst( ItemStack stack, ItemUseContext context )
{
return Api.INSTANCE.partHelper().placeBus( stack, context.getPos(), context.getFace(), context.getPlayer(), context.getHand(), context.getWorld() );
return AEApi.instance().partHelper().placeBus( stack, context.getPos(), context.getFace(), context.getPlayer(), context.getHand(), context.getWorld() );
}
@Override
@@ -286,7 +286,7 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
public ItemStack createFromID( final int id )
{
ItemStack facadeStack = Api.INSTANCE
ItemStack facadeStack = AEApi.instance()
.definitions()
.items()
.facade()
@@ -19,11 +19,11 @@
package appeng.items.parts;
import appeng.api.AEApi;
import appeng.api.implementations.items.IItemGroup;
import appeng.api.parts.IPart;
import appeng.api.parts.IPartItem;
import appeng.api.util.AEColor;
import appeng.core.Api;
import appeng.core.features.ActivityState;
import appeng.core.features.ItemStackSrc;
import appeng.core.localization.GuiText;
@@ -151,7 +151,7 @@ public final class ItemPart extends AEBaseItem implements IPartItem, IItemGroup
return ActionResultType.FAIL;
}
return Api.INSTANCE.partHelper().placeBus( held, context.getPos(), context.getFace(), player, context.getHand(), context.getWorld() );
return AEApi.instance().partHelper().placeBus( held, context.getPos(), context.getFace(), player, context.getHand(), context.getWorld() );
}
@Override
@@ -50,7 +50,6 @@ 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.Api;
import appeng.api.features.AEFeature;
import appeng.core.localization.GuiText;
import appeng.items.AEBaseItem;
@@ -82,9 +81,9 @@ 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 )
{
Api.INSTANCE
AEApi.instance()
.client()
.addCellInformation( Api.INSTANCE.registries().cell().getCellInventory( stack, null, this.getChannel() ), lines );
.addCellInformation( AEApi.instance().registries().cell().getCellInventory( stack, null, this.getChannel() ), lines );
}
@Override
@@ -178,7 +177,7 @@ public abstract class AbstractStorageCell<T extends IAEStack<T>> extends AEBaseI
}
final PlayerInventory playerInventory = player.inventory;
final IMEInventoryHandler inv = Api.INSTANCE.registries().cell().getCellInventory( stack, null, this.getChannel() );
final IMEInventoryHandler inv = AEApi.instance().registries().cell().getCellInventory( stack, null, this.getChannel() );
if( inv != null && playerInventory.getCurrentItem() == stack )
{
final InventoryAdaptor ia = InventoryAdaptor.getAdaptor( player );
@@ -232,7 +231,7 @@ public abstract class AbstractStorageCell<T extends IAEStack<T>> extends AEBaseI
@Override
public ItemStack getContainerItem( final ItemStack itemStack )
{
return Api.INSTANCE
return AEApi.instance()
.definitions()
.materials()
.emptyStorageCell()
@@ -26,7 +26,6 @@ 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;
@@ -80,13 +79,13 @@ public final class BasicItemStorageCell extends AbstractStorageCell<IAEItemStack
@Override
public IStorageChannel<IAEItemStack> getChannel()
{
return Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class );
return AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class );
}
@Override
protected void dropEmptyStorageCellCase( final InventoryAdaptor ia, final PlayerEntity player )
{
Api.INSTANCE.definitions().materials().emptyStorageCell().maybeStack( 1 ).ifPresent( is ->
AEApi.instance().definitions().materials().emptyStorageCell().maybeStack( 1 ).ifPresent( is ->
{
final ItemStack extraA = ia.addItems( is );
if( !extraA.isEmpty() )
@@ -35,7 +35,6 @@ import appeng.api.storage.ICellInventoryHandler;
import appeng.api.storage.ICellWorkbenchItem;
import appeng.api.storage.IMEInventoryHandler;
import appeng.api.storage.channels.IItemStorageChannel;
import appeng.core.Api;
import appeng.items.AEBaseItem;
import appeng.items.contents.CellConfig;
@@ -82,11 +81,11 @@ public class ItemCreativeStorageCell extends AEBaseItem implements ICellWorkbenc
@Override
public void addInformation(final ItemStack stack, final World world, final List<ITextComponent> lines, final ITooltipFlag advancedTooltips )
{
final IMEInventoryHandler<?> inventory = Api.INSTANCE
final IMEInventoryHandler<?> inventory = AEApi.instance()
.registries()
.cell()
.getCellInventory( stack, null,
Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ) );
AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) );
if( inventory instanceof ICellInventoryHandler )
{
@@ -19,11 +19,11 @@
package appeng.items.storage;
import appeng.core.Api;
import net.minecraft.item.Item;
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;
@@ -63,7 +63,7 @@ public class ItemViewCell extends AEBaseItem implements ICellWorkbenchItem
if( ( currentViewCell.getItem() instanceof ItemViewCell ) )
{
final IItemList<IAEItemStack> priorityList = Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ).createList();
final IItemList<IAEItemStack> priorityList = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
final ICellWorkbenchItem vc = (ICellWorkbenchItem) currentViewCell.getItem();
final IItemHandler upgrades = vc.getUpgradesInventory( currentViewCell );
@@ -19,6 +19,7 @@
package appeng.items.tools.powered;
import appeng.api.AEApi;
import appeng.api.config.Actionable;
import appeng.api.config.FuzzyMode;
import appeng.api.implementations.items.IItemGroup;
@@ -35,7 +36,6 @@ import appeng.api.util.DimensionalCoord;
import appeng.block.networking.BlockCableBus;
import appeng.block.paint.BlockPaint;
import appeng.core.AEConfig;
import appeng.core.Api;
import appeng.core.AppEng;
import appeng.core.localization.GuiText;
import appeng.helpers.IMouseWheelItem;
@@ -120,11 +120,11 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
ItemStack paintBall = this.getColor( is );
final IMEInventory<IAEItemStack> inv = Api.INSTANCE
final IMEInventory<IAEItemStack> inv = AEApi.instance()
.registries()
.cell()
.getCellInventory( is, null,
Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ) );
AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) );
if( inv != null )
{
final IAEItemStack option = inv.extractItems( AEItemStack.fromItemStack( paintBall ), Actionable.SIMULATE, new BaseActionSource() );
@@ -270,15 +270,15 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
{
ItemStack newColor = ItemStack.EMPTY;
final IMEInventory<IAEItemStack> inv = Api.INSTANCE
final IMEInventory<IAEItemStack> inv = AEApi.instance()
.registries()
.cell()
.getCellInventory( is, null,
Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ) );
AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) );
if( inv != null )
{
final IItemList<IAEItemStack> itemList = inv
.getAvailableItems( Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ).createList() );
.getAvailableItems( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList() );
if( anchor.isEmpty() )
{
final IAEItemStack firstItem = itemList.getFirstItem();
@@ -431,13 +431,13 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
{
super.addInformation( stack, world, lines, advancedTooltips );
final ICellInventoryHandler<IAEItemStack> cdi = Api.INSTANCE
final ICellInventoryHandler<IAEItemStack> cdi = AEApi.instance()
.registries()
.cell()
.getCellInventory( stack, null,
Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ) );
AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) );
Api.INSTANCE.client().addCellInformation( cdi, lines );
AEApi.instance().client().addCellInformation( cdi, lines );
}
@Override
@@ -504,7 +504,7 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
@Override
public IStorageChannel<IAEItemStack> getChannel()
{
return Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class );
return AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class );
}
@Override
@@ -40,6 +40,7 @@ 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.Actionable;
import appeng.api.config.FuzzyMode;
import appeng.api.config.Upgrades;
@@ -53,7 +54,6 @@ import appeng.api.util.AEColor;
import appeng.api.util.DimensionalCoord;
import appeng.core.AEConfig;
import appeng.core.AELog;
import appeng.core.Api;
import appeng.core.AppEng;
import appeng.api.features.AEFeature;
import appeng.core.localization.PlayerMessages;
@@ -85,9 +85,9 @@ public class ToolMatterCannon extends AEBasePoweredItem implements IStorageCell<
{
super.addInformation( stack, world, lines, advancedTooltips );
final ICellInventoryHandler<IAEItemStack> cdi = Api.INSTANCE.registries().cell().getCellInventory( stack, null, Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ) );
final ICellInventoryHandler<IAEItemStack> cdi = AEApi.instance().registries().cell().getCellInventory( stack, null, AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) );
Api.INSTANCE.client().addCellInformation( cdi, lines );
AEApi.instance().client().addCellInformation( cdi, lines );
}
@Override
@@ -103,10 +103,10 @@ public class ToolMatterCannon extends AEBasePoweredItem implements IStorageCell<
shots += cu.getInstalledUpgrades( Upgrades.SPEED );
}
final ICellInventoryHandler<IAEItemStack> inv = Api.INSTANCE.registries().cell().getCellInventory( p.getHeldItem( hand ), null, Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ) );
final ICellInventoryHandler<IAEItemStack> inv = AEApi.instance().registries().cell().getCellInventory( p.getHeldItem( hand ), null, AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) );
if( inv != null )
{
final IItemList<IAEItemStack> itemList = inv.getAvailableItems( Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ).createList() );
final IItemList<IAEItemStack> itemList = inv.getAvailableItems( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList() );
IAEItemStack req = itemList.getFirstItem();
if( req instanceof IAEItemStack )
{
@@ -145,7 +145,7 @@ public class ToolMatterCannon extends AEBasePoweredItem implements IStorageCell<
final double d1 = Vec3d.y;
final double d2 = Vec3d.z;
final float penetration = Api.INSTANCE.registries().matterCannon().getPenetration( ammo ); // 196.96655f;
final float penetration = AEApi.instance().registries().matterCannon().getPenetration( ammo ); // 196.96655f;
if( penetration <= 0 )
{
final ItemStack type = aeAmmo.asItemStackRepresentation();
@@ -278,7 +278,7 @@ public class ToolMatterCannon extends AEBasePoweredItem implements IStorageCell<
final BlockState whatsThere = w.getBlockState( hitPos );
if( whatsThere.getMaterial().isReplaceable() && w.isAirBlock( hitPos ) )
{
Api.INSTANCE.definitions().blocks().paint().maybeBlock().ifPresent( paintBlock -> {
AEApi.instance().definitions().blocks().paint().maybeBlock().ifPresent( paintBlock -> {
w.setBlockState( hitPos, paintBlock.getDefaultState(), 3 );
} );
}
@@ -484,7 +484,7 @@ public class ToolMatterCannon extends AEBasePoweredItem implements IStorageCell<
@Override
public boolean isBlackListed( final ItemStack cellItem, final IAEItemStack requestedAddition )
{
final float pen = Api.INSTANCE.registries().matterCannon().getPenetration( requestedAddition.createItemStack() );
final float pen = AEApi.instance().registries().matterCannon().getPenetration( requestedAddition.createItemStack() );
if( pen > 0 )
{
return false;
@@ -519,6 +519,6 @@ public class ToolMatterCannon extends AEBasePoweredItem implements IStorageCell<
@Override
public IStorageChannel<IAEItemStack> getChannel()
{
return Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class );
return AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class );
}
}
@@ -52,7 +52,6 @@ import appeng.api.storage.channels.IItemStorageChannel;
import appeng.api.storage.data.IAEItemStack;
import appeng.api.util.AEPartLocation;
import appeng.core.AEConfig;
import appeng.core.Api;
import appeng.core.localization.GuiText;
import appeng.items.contents.CellConfig;
@@ -82,13 +81,13 @@ public class ToolPortableCell extends AEBasePoweredItem implements IStorageCell<
{
super.addInformation( stack, world, lines, advancedTooltips );
final ICellInventoryHandler<IAEItemStack> cdi = Api.INSTANCE
final ICellInventoryHandler<IAEItemStack> cdi = AEApi.instance()
.registries()
.cell()
.getCellInventory( stack, null,
Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ) );
AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) );
Api.INSTANCE.client().addCellInformation( cdi, lines );
AEApi.instance().client().addCellInformation( cdi, lines );
}
@Override
@@ -136,7 +135,7 @@ public class ToolPortableCell extends AEBasePoweredItem implements IStorageCell<
@Override
public IStorageChannel<IAEItemStack> getChannel()
{
return Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class );
return AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class );
}
@Override
@@ -36,6 +36,7 @@ import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import appeng.api.AEApi;
import appeng.api.config.Actionable;
import appeng.api.config.Settings;
import appeng.api.config.SortDir;
@@ -44,7 +45,6 @@ import appeng.api.config.ViewItems;
import appeng.api.features.IWirelessTermHandler;
import appeng.api.util.IConfigManager;
import appeng.core.AEConfig;
import appeng.core.Api;
import appeng.core.localization.GuiText;
import appeng.items.tools.powered.powersink.AEBasePoweredItem;
import appeng.util.ConfigManager;
@@ -61,7 +61,7 @@ public class ToolWirelessTerminal extends AEBasePoweredItem implements IWireless
@Override
public ActionResult<ItemStack> onItemRightClick( final World w, final PlayerEntity player, final Hand hand )
{
Api.INSTANCE.registries().wireless().openWirelessTerminalGui( player.getHeldItem( hand ), w, player, hand );
AEApi.instance().registries().wireless().openWirelessTerminalGui( player.getHeldItem( hand ), w, player, hand );
return new ActionResult<>( ActionResultType.SUCCESS, player.getHeldItem( hand ) );
}
@@ -97,7 +97,7 @@ public class ToolWirelessTerminal extends AEBasePoweredItem implements IWireless
@Override
public boolean canHandle( final ItemStack is )
{
return Api.INSTANCE.definitions().items().wirelessTerminal().isSameAs( is );
return AEApi.instance().definitions().items().wirelessTerminal().isSameAs( is );
}
@Override