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
@@ -29,7 +29,6 @@ import javax.annotation.Nullable;
import appeng.block.storage.BlockChest;
import appeng.block.storage.DriveSlotState;
import appeng.container.implementations.ContainerMEMonitorable;
import appeng.core.Api;
import appeng.fluids.container.ContainerFluidTerminal;
import net.minecraft.block.BlockState;
import net.minecraft.entity.player.PlayerEntity;
@@ -50,6 +49,7 @@ import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
import net.minecraftforge.fluids.capability.IFluidHandler;
import net.minecraftforge.items.IItemHandler;
import appeng.api.AEApi;
import appeng.api.config.AccessRestriction;
import appeng.api.config.Actionable;
import appeng.api.config.PowerMultiplier;
@@ -228,12 +228,12 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, ITerminal
if( !is.isEmpty() )
{
this.isCached = true;
ICellHandler cellHandler = Api.INSTANCE.registries().cell().getHandler( is );
ICellHandler cellHandler = AEApi.instance().registries().cell().getHandler( is );
if( cellHandler != null )
{
double power = 1.0;
for( IStorageChannel channel : Api.INSTANCE.storage().storageChannels() )
for( IStorageChannel channel : AEApi.instance().storage().storageChannels() )
{
final ICellInventoryHandler<IAEItemStack> newCell = cellHandler.getCellInventory( is, this, channel );
if( newCell != null )
@@ -248,7 +248,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, ITerminal
this.accessor = new Accessor();
if( this.cellHandler != null && this.cellHandler
.getChannel() == Api.INSTANCE.storage().getStorageChannel( IFluidStorageChannel.class ) )
.getChannel() == AEApi.instance().storage().getStorageChannel( IFluidStorageChannel.class ) )
{
this.fluidHandler = new FluidHandler();
}
@@ -284,7 +284,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, ITerminal
this.updateHandler();
final ItemStack cell = this.getCell();
final ICellHandler ch = Api.INSTANCE.registries().cell().getHandler( cell );
final ICellHandler ch = AEApi.instance().registries().cell().getHandler( cell );
if( this.cellHandler != null && ch != null )
{
@@ -541,7 +541,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, ITerminal
{
this.updateHandler();
if( this.cellHandler != null && this.cellHandler.getChannel() == Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ) )
if( this.cellHandler != null && this.cellHandler.getChannel() == AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) )
{
final IAEItemStack returns = Platform.poweredInsert( this, this.cellHandler,
AEItemStack.fromItemStack( this.inputInventory.getStackInSlot( 0 ) ), this.mySrc );
@@ -628,11 +628,11 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, ITerminal
this.updateHandler();
if( this.cellHandler != null )
{
final ICellHandler ch = Api.INSTANCE.registries().cell().getHandler( this.getCell() );
final ICellHandler ch = AEApi.instance().registries().cell().getHandler( this.getCell() );
if( ch != null )
{
final ICellGuiHandler chg = Api.INSTANCE.registries().cell().getGuiHandler( this.cellHandler.getChannel(), this.getCell() );
final ICellGuiHandler chg = AEApi.instance().registries().cell().getGuiHandler( this.cellHandler.getChannel(), this.getCell() );
if( chg != null )
{
chg.openChestGui( p, this, ch, this.cellHandler, this.getCell(), this.cellHandler.getChannel() );
@@ -831,7 +831,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, ITerminal
{
private boolean canAcceptLiquids() {
return TileChest.this.cellHandler != null && TileChest.this.cellHandler.getChannel() == Api.INSTANCE.storage().getStorageChannel(IFluidStorageChannel.class);
return TileChest.this.cellHandler != null && TileChest.this.cellHandler.getChannel() == AEApi.instance().storage().getStorageChannel(IFluidStorageChannel.class);
}
@Nonnull
@@ -921,7 +921,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, ITerminal
{
TileChest.this.updateHandler();
return TileChest.this.cellHandler != null && TileChest.this.cellHandler
.getChannel() == Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class );
.getChannel() == AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class );
}
return false;
}
@@ -939,7 +939,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, ITerminal
@Override
public boolean allowInsert( IItemHandler inv, int slot, ItemStack stack )
{
return Api.INSTANCE.registries().cell().getHandler( stack ) != null;
return AEApi.instance().registries().cell().getHandler( stack ) != null;
}
}
@@ -947,7 +947,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, ITerminal
@Override
public ItemStack getItemStackRepresentation()
{
return Api.INSTANCE.definitions().blocks().chest().maybeStack( 1 ).orElse( ItemStack.EMPTY );
return AEApi.instance().definitions().blocks().chest().maybeStack( 1 ).orElse( ItemStack.EMPTY );
}
@Override
@@ -956,11 +956,11 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, ITerminal
this.updateHandler();
if( this.cellHandler != null )
{
if( this.cellHandler.getChannel() == Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ) )
if( this.cellHandler.getChannel() == AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) )
{
return ContainerMEMonitorable.TYPE;
}
if( this.cellHandler.getChannel() == Api.INSTANCE.storage().getStorageChannel( IFluidStorageChannel.class ) )
if( this.cellHandler.getChannel() == AEApi.instance().storage().getStorageChannel( IFluidStorageChannel.class ) )
{
return ContainerFluidTerminal.TYPE;
}
@@ -30,7 +30,6 @@ import java.util.Map;
import appeng.block.AEBaseTileBlock;
import appeng.block.storage.DriveSlotsState;
import appeng.container.implementations.ContainerDrive;
import appeng.core.Api;
import net.minecraft.inventory.container.ContainerType;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
@@ -41,6 +40,7 @@ import net.minecraftforge.client.model.data.ModelDataMap;
import net.minecraftforge.client.model.data.ModelProperty;
import net.minecraftforge.items.IItemHandler;
import appeng.api.AEApi;
import appeng.api.implementations.tiles.IChestOrDrive;
import appeng.api.networking.GridFlags;
import appeng.api.networking.events.MENetworkCellArrayUpdate;
@@ -290,7 +290,7 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior
{
if( !this.isCached )
{
final Collection<IStorageChannel<? extends IAEStack<?>>> storageChannels = Api.INSTANCE.storage().storageChannels();
final Collection<IStorageChannel<? extends IAEStack<?>>> storageChannels = AEApi.instance().storage().storageChannels();
storageChannels.forEach( channel -> this.inventoryHandlers.put( channel, new ArrayList<>( 10 ) ) );
double power = 2.0;
@@ -303,7 +303,7 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior
if( !is.isEmpty() )
{
this.handlersBySlot[x] = Api.INSTANCE.registries().cell().getHandler( is );
this.handlersBySlot[x] = AEApi.instance().registries().cell().getHandler( is );
if( this.handlersBySlot[x] != null )
{
@@ -405,7 +405,7 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior
@Override
public boolean allowInsert( IItemHandler inv, int slot, ItemStack stack )
{
return !stack.isEmpty() && Api.INSTANCE.registries().cell().isCellHandled( stack );
return !stack.isEmpty() && AEApi.instance().registries().cell().isCellHandled( stack );
}
}
@@ -413,7 +413,7 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior
@Override
public ItemStack getItemStackRepresentation()
{
return Api.INSTANCE.definitions().blocks().drive().maybeStack( 1 ).orElse( ItemStack.EMPTY );
return AEApi.instance().definitions().blocks().drive().maybeStack( 1 ).orElse( ItemStack.EMPTY );
}
@Nonnull
@@ -23,7 +23,6 @@ import java.util.IdentityHashMap;
import java.util.List;
import java.util.Map;
import appeng.core.Api;
import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
@@ -107,7 +106,7 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC
this.mySrc = new MachineSource( this );
this.lastRedstoneState = YesNo.UNDECIDED;
final Block ioPortBlock = Api.INSTANCE.definitions().blocks().iOPort().maybeBlock().get();
final Block ioPortBlock = AEApi.instance().definitions().blocks().iOPort().maybeBlock().get();
this.upgrades = new BlockUpgradeInventory( ioPortBlock, this, NUMBER_OF_UPGRADE_SLOTS );
}
@@ -305,7 +304,7 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC
{
boolean shouldMove = true;
for( IStorageChannel<? extends IAEStack<?>> c : Api.INSTANCE.storage().storageChannels() )
for( IStorageChannel<? extends IAEStack<?>> c : AEApi.instance().storage().storageChannels() )
{
if( itemsToMove > 0 )
{
@@ -372,9 +371,9 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC
this.currentCell = is;
this.cachedInventories = new IdentityHashMap<>();
for( IStorageChannel<? extends IAEStack<?>> c : Api.INSTANCE.storage().storageChannels() )
for( IStorageChannel<? extends IAEStack<?>> c : AEApi.instance().storage().storageChannels() )
{
this.cachedInventories.put( c, Api.INSTANCE.registries().cell().getCellInventory( is, null, c ) );
this.cachedInventories.put( c, AEApi.instance().registries().cell().getCellInventory( is, null, c ) );
}
}