Custom Model Loader

This commit is contained in:
Sebastian Hartte
2020-06-01 04:02:37 +02:00
parent 077ff17078
commit 5cdeff01be
202 changed files with 942 additions and 1017 deletions
+1 -1
View File
@@ -434,7 +434,7 @@ public abstract class AEBasePart implements IPart, IGridProxyable, IActionHost,
ItemStack is = this.getItemStack( PartItemStack.NETWORK );
// Blocks and parts share the same soul!
final IDefinitions definitions = AEApi.instance().definitions();
final IDefinitions definitions = Api.INSTANCE.definitions();
if( definitions.parts().iface().isSameAs( is ) )
{
Optional<ItemStack> iface = definitions.blocks().iface().maybeStack( 1 );
@@ -427,7 +427,7 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
}
}
if( AEApi.instance().partHelper().getCableRenderMode().opaqueFacades )
if( Api.INSTANCE.partHelper().getCableRenderMode().opaqueFacades )
{
final IFacadeContainer fc = this.getFacadeContainer();
for( final AEPartLocation side : AEPartLocation.SIDE_LOCATIONS )
@@ -632,7 +632,7 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
{
try
{
AEApi.instance().grid().createGridConnection( cn, sn );
Api.INSTANCE.grid().createGridConnection( cn, sn );
}
catch( final FailedConnectionException e )
{
@@ -755,7 +755,7 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
}
}
if( AEApi.instance().partHelper().getCableRenderMode().opaqueFacades || !visual )
if( Api.INSTANCE.partHelper().getCableRenderMode().opaqueFacades || !visual )
{
if( includeFacades && s != null && s != AEPartLocation.INTERNAL )
{
@@ -230,7 +230,7 @@ public class PartPlacement
BlockPos te_pos = pos;
final IBlockDefinition multiPart = AEApi.instance().definitions().blocks().multiPart();
final IBlockDefinition multiPart = Api.INSTANCE.definitions().blocks().multiPart();
if( host == null && pass == PlaceType.PLACE_ITEM )
{
Direction offset = null;
@@ -431,7 +431,7 @@ public class PartPlacement
else
{
final ItemStack held = event.getPlayer().getHeldItem( event.getHand() );
final IItems items = AEApi.instance().definitions().items();
final IItems items = Api.INSTANCE.definitions().items();
boolean supportedItem = items.memoryCard().isSameAs( held );
supportedItem |= items.colorApplicator().isSameAs( held );
@@ -337,7 +337,7 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
final IStorageGrid storage = this.getProxy().getStorage();
final IEnergyGrid energy = this.getProxy().getEnergy();
final IAEItemStack overflow = Platform.poweredInsert( energy,
storage.getInventory( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) ), itemToStore, this.mySrc );
storage.getInventory( Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ) ), itemToStore, this.mySrc );
this.isAccepting = overflow == null;
@@ -530,7 +530,7 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
for( final ItemStack itemStack : itemStacks )
{
final IAEItemStack itemToTest = AEItemStack.fromItemStack( itemStack );
final IAEItemStack overflow = storage.getInventory( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) )
final IAEItemStack overflow = storage.getInventory( Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ) )
.injectItems( itemToTest, Actionable.SIMULATE, this.mySrc );
if( overflow == null || itemToTest.getStackSize() > overflow.getStackSize() )
{
@@ -133,7 +133,7 @@ public class PartExportBus extends PartSharedItemBus implements ICraftingRequest
final IMEMonitor<IAEItemStack> inv = this.getProxy()
.getStorage()
.getInventory(
AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) );
Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ) );
final IEnergyGrid energy = this.getProxy().getEnergy();
final ICraftingGrid cg = this.getProxy().getCrafting();
final FuzzyMode fzMode = (FuzzyMode) this.getConfigManager().getSetting( Settings.FUZZY_MODE );
@@ -90,7 +90,7 @@ public class PartFormationPlane extends PartAbstractFormationPlane<IAEItemStack>
return MODELS.getModels();
}
private final MEInventoryHandler<IAEItemStack> myHandler = new MEInventoryHandler<>( this, AEApi.instance()
private final MEInventoryHandler<IAEItemStack> myHandler = new MEInventoryHandler<>( this, Api.INSTANCE
.storage()
.getStorageChannel( IItemStorageChannel.class ) );
private final AppEngInternalAEInventory Config = new AppEngInternalAEInventory( this, 63 );
@@ -111,7 +111,7 @@ public class PartFormationPlane extends PartAbstractFormationPlane<IAEItemStack>
this.myHandler.setWhitelist( this.getInstalledUpgrades( Upgrades.INVERTER ) > 0 ? IncludeExclude.BLACKLIST : IncludeExclude.WHITELIST );
this.myHandler.setPriority( this.getPriority() );
final IItemList<IAEItemStack> priorityList = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
final IItemList<IAEItemStack> priorityList = Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ).createList();
final int slotsToUse = 18 + this.getInstalledUpgrades( Upgrades.CAPACITY ) * 9;
for( int x = 0; x < this.Config.getSlots() && x < slotsToUse; x++ )
@@ -206,7 +206,7 @@ public class PartFormationPlane extends PartAbstractFormationPlane<IAEItemStack>
@Override
public List<IMEInventoryHandler> getCellArray( final IStorageChannel channel )
{
if( this.getProxy().isActive() && channel == AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) )
if( this.getProxy().isActive() && channel == Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ) )
{
final List<IMEInventoryHandler> handler = new ArrayList<>( 1 );
handler.add( this.myHandler );
@@ -363,7 +363,7 @@ public class PartFormationPlane extends PartAbstractFormationPlane<IAEItemStack>
@Override
public IStorageChannel<IAEItemStack> getChannel()
{
return AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class );
return Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class );
}
@Override
@@ -375,7 +375,7 @@ public class PartFormationPlane extends PartAbstractFormationPlane<IAEItemStack>
@Override
public ItemStack getItemStackRepresentation()
{
return AEApi.instance().definitions().parts().formationPlane().maybeStack( 1 ).orElse( ItemStack.EMPTY );
return Api.INSTANCE.definitions().parts().formationPlane().maybeStack( 1 ).orElse( ItemStack.EMPTY );
}
@Override
@@ -96,9 +96,9 @@ public class PartImportBus extends PartSharedItemBus implements IInventoryDestin
final IMEMonitor<IAEItemStack> inv = this.getProxy()
.getStorage()
.getInventory(
AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) );
Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ) );
final IAEItemStack out = inv.injectItems( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createStack( stack ),
final IAEItemStack out = inv.injectItems( Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ).createStack( stack ),
Actionable.SIMULATE,
this.source );
if( out == null )
@@ -171,7 +171,7 @@ public class PartImportBus extends PartSharedItemBus implements IInventoryDestin
final IMEMonitor<IAEItemStack> inv = this.getProxy()
.getStorage()
.getInventory(
AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) );
Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ) );
final IEnergyGrid energy = this.getProxy().getEnergy();
boolean Configured = false;
@@ -231,7 +231,7 @@ public class PartImportBus extends PartSharedItemBus implements IInventoryDestin
if( !newItems.isEmpty() )
{
final IAEItemStack aeStack = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createStack( newItems );
final IAEItemStack aeStack = Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ).createStack( newItems );
final IAEItemStack failed = Platform.poweredInsert( energy, inv, aeStack, this.source );
if( failed != null )
@@ -276,7 +276,7 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH
this.updateState();
// no more item stuff..
this.getProxy().getStorage().getInventory( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) ).removeListener( this );
this.getProxy().getStorage().getInventory( Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ) ).removeListener( this );
}
catch( final GridAccessException e )
{
@@ -292,13 +292,13 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH
{
this.getProxy()
.getStorage()
.getInventory( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) )
.getInventory( Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ) )
.addListener( this,
this.getProxy().getGrid() );
}
else
{
this.getProxy().getStorage().getInventory( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) ).removeListener( this );
this.getProxy().getStorage().getInventory( Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ) ).removeListener( this );
if( this.myWatcher != null )
{
@@ -306,7 +306,7 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH
}
}
this.updateReportingValue( this.getProxy().getStorage().getInventory( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) ) );
this.updateReportingValue( this.getProxy().getStorage().getInventory( Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ) ) );
}
catch( final GridAccessException e )
{
@@ -362,7 +362,7 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH
@Override
public void onStackChange( final IItemList o, final IAEStack fullStack, final IAEStack diffStack, final IActionSource src, final IStorageChannel chan )
{
if( chan == AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) && fullStack.equals( this.config.getAEStackInSlot( 0 ) ) && this
if( chan == Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ) && fullStack.equals( this.config.getAEStackInSlot( 0 ) ) && this
.getInstalledUpgrades( Upgrades.FUZZY ) == 0 )
{
this.lastReportedValue = fullStack.getStackSize();
@@ -408,7 +408,7 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH
{
try
{
this.updateReportingValue( this.getProxy().getStorage().getInventory( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) ) );
this.updateReportingValue( this.getProxy().getStorage().getInventory( Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ) ) );
}
catch( final GridAccessException e )
{
@@ -117,6 +117,6 @@ public class PlaneBakedModel implements IBakedModel
@Override
public ItemOverrideList getOverrides()
{
return ItemOverrideList.NONE;
return ItemOverrideList.EMPTY;
}
}
@@ -218,7 +218,7 @@ class ItemHandlerAdapter implements IMEInventory<IAEItemStack>, IBaseMonitor<IAE
@Override
public IItemStorageChannel getChannel()
{
return AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class );
return Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class );
}
@Override
@@ -309,7 +309,7 @@ public class PartInterface extends PartBasicState implements IGridTickable, ISto
@Override
public ItemStack getItemStackRepresentation()
{
return AEApi.instance().definitions().parts().iface().maybeStack( 1 ).orElse( ItemStack.EMPTY );
return Api.INSTANCE.definitions().parts().iface().maybeStack( 1 ).orElse( ItemStack.EMPTY );
}
@Override
@@ -92,7 +92,7 @@ public abstract class PartSharedStorageBus extends PartUpgradeable implements IG
*/
public IStorageChannel getStorageChannel()
{
return AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class );
return Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class );
}
protected abstract void resetCache();
@@ -259,7 +259,7 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
{
this.getProxy()
.getStorage()
.postAlterationOfStoredItems( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ), change,
.postAlterationOfStoredItems( Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ), change,
this.mySrc );
}
}
@@ -347,7 +347,7 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
this.resetCacheLogic = 0;
final IMEInventory<IAEItemStack> in = this.getInternalHandler();
IItemList<IAEItemStack> before = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
IItemList<IAEItemStack> before = Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ).createList();
if( in != null )
{
before = in.getAvailableItems( before );
@@ -363,7 +363,7 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
if( in != out )
{
IItemList<IAEItemStack> after = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
IItemList<IAEItemStack> after = Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ).createList();
if( out != null )
{
after = out.getAvailableItems( after );
@@ -385,7 +385,7 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
IStorageMonitorable inventory = accessor.getInventory( this.mySrc );
if( inventory != null )
{
return inventory.getInventory( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) );
return inventory.getInventory( Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ) );
}
// So this could / can be a design decision. If the tile does support our custom capability,
@@ -472,13 +472,13 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
{
this.checkInterfaceVsStorageBus( target, this.getSide().getOpposite() );
this.handler = new MEInventoryHandler<IAEItemStack>( inv, AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) );
this.handler = new MEInventoryHandler<IAEItemStack>( inv, Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ) );
this.handler.setBaseAccess( (AccessRestriction) this.getConfigManager().getSetting( Settings.ACCESS ) );
this.handler.setWhitelist( this.getInstalledUpgrades( Upgrades.INVERTER ) > 0 ? IncludeExclude.BLACKLIST : IncludeExclude.WHITELIST );
this.handler.setPriority( this.priority );
final IItemList<IAEItemStack> priorityList = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
final IItemList<IAEItemStack> priorityList = Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ).createList();
final int slotsToUse = 18 + this.getInstalledUpgrades( Upgrades.CAPACITY ) * 9;
for( int x = 0; x < this.Config.getSlots() && x < slotsToUse; x++ )
@@ -571,7 +571,7 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
@Override
public List<IMEInventoryHandler> getCellArray( final IStorageChannel channel )
{
if( channel == AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) )
if( channel == Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ) )
{
final IMEInventoryHandler<IAEItemStack> out = this.getProxy().isActive() ? this.getInternalHandler() : null;
if( out != null )
@@ -636,7 +636,7 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
@Override
public ItemStack getItemStackRepresentation()
{
return AEApi.instance().definitions().parts().storageBus().maybeStack( 1 ).orElse( ItemStack.EMPTY );
return Api.INSTANCE.definitions().parts().storageBus().maybeStack( 1 ).orElse( ItemStack.EMPTY );
}
@Override
@@ -188,7 +188,7 @@ public class PartToggleBus extends PartBasicState
{
try
{
this.connection = AEApi.instance().grid().createGridConnection( this.getProxy().getNode(), this.getOuterProxy().getNode() );
this.connection = Api.INSTANCE.grid().createGridConnection( this.getProxy().getNode(), this.getOuterProxy().getNode() );
}
catch( final FailedConnectionException e )
{
@@ -114,7 +114,7 @@ public class PartCable extends AEBasePart implements IPartCable
{
ItemStack newPart = null;
final IParts parts = AEApi.instance().definitions().parts();
final IParts parts = Api.INSTANCE.definitions().parts();
if( this.getCableConnectionType() == AECableType.GLASS )
{
@@ -124,7 +124,7 @@ public abstract class PartP2PTunnel<T extends PartP2PTunnel> extends PartBasicSt
return super.getItemStack( type );
}
final Optional<ItemStack> maybeMEStack = AEApi.instance().definitions().parts().p2PTunnelME().maybeStack( 1 );
final Optional<ItemStack> maybeMEStack = Api.INSTANCE.definitions().parts().p2PTunnelME().maybeStack( 1 );
if( maybeMEStack.isPresent() )
{
return maybeMEStack.get();
@@ -195,7 +195,7 @@ public abstract class PartP2PTunnel<T extends PartP2PTunnel> extends PartBasicSt
// UniqueIdentifier id = GameRegistry.findUniqueIdentifierFor( is.getItem() );
// AELog.info( "ID:" + id.toString() + " : " + is.getItemDamage() );
final TunnelType tt = AEApi.instance().registries().p2pTunnel().getTunnelTypeByItem( is );
final TunnelType tt = Api.INSTANCE.registries().p2pTunnel().getTunnelTypeByItem( is );
if( !is.isEmpty() && is.getItem() instanceof IMemoryCard )
{
final IMemoryCard mc = (IMemoryCard) is.getItem();
@@ -244,7 +244,7 @@ public abstract class PartP2PTunnel<T extends PartP2PTunnel> extends PartBasicSt
{
final ItemStack newType;
final IParts parts = AEApi.instance().definitions().parts();
final IParts parts = Api.INSTANCE.definitions().parts();
switch( tt )
{
@@ -241,7 +241,7 @@ public class PartP2PTunnelME extends PartP2PTunnel<PartP2PTunnelME> implements I
{
connections.getConnections()
.put( me.getGridNode(),
new TunnelConnection( me, AEApi.instance()
new TunnelConnection( me, Api.INSTANCE
.grid()
.createGridConnection( this.outerProxy.getNode(),
me.outerProxy.getNode() ) ) );
@@ -225,7 +225,7 @@ public abstract class AbstractPartMonitor extends AbstractPartDisplay implements
}
this.updateReportingValue(
this.getProxy().getStorage().getInventory( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) ) );
this.getProxy().getStorage().getInventory( Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ) ) );
}
}
catch( final GridAccessException e )
@@ -179,7 +179,7 @@ public class PartConversionMonitor extends AbstractPartMonitor
final IEnergySource energy = this.getProxy().getEnergy();
final IMEMonitor<IAEItemStack> cell = this.getProxy()
.getStorage()
.getInventory( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) );
.getInventory( Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ) );
if( allItems )
{
@@ -235,7 +235,7 @@ public class PartConversionMonitor extends AbstractPartMonitor
final IMEMonitor<IAEItemStack> cell = this.getProxy()
.getStorage()
.getInventory(
AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) );
Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ) );
input.setStackSize( count );