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
@@ -190,7 +190,7 @@ public class TileCraftingMonitorTile extends TileCraftingTile implements IColora
@Override
protected ItemStack getItemFromTile( final Object obj )
{
final Optional<ItemStack> is = AEApi.instance().definitions().blocks().craftingMonitor().maybeStack( 1 );
final Optional<ItemStack> is = Api.INSTANCE.definitions().blocks().craftingMonitor().maybeStack( 1 );
return is.orElseGet( () -> super.getItemFromTile( obj ) );
}
@@ -35,7 +35,7 @@ public class TileCraftingStorageTile extends TileCraftingTile
@Override
protected ItemStack getItemFromTile( final Object obj )
{
final IBlocks blocks = AEApi.instance().definitions().blocks();
final IBlocks blocks = Api.INSTANCE.definitions().blocks();
final int storage = ( (TileCraftingTile) obj ).getStorageBytes() / KILO_SCALAR;
Optional<ItemStack> is;
@@ -83,11 +83,11 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP
if( ( (TileCraftingTile) obj ).isAccelerator() )
{
is = AEApi.instance().definitions().blocks().craftingAccelerator().maybeStack( 1 );
is = Api.INSTANCE.definitions().blocks().craftingAccelerator().maybeStack( 1 );
}
else
{
is = AEApi.instance().definitions().blocks().craftingUnit().maybeStack( 1 );
is = Api.INSTANCE.definitions().blocks().craftingUnit().maybeStack( 1 );
}
return is.orElseGet( () -> super.getItemFromTile( obj ) );
@@ -319,7 +319,7 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP
throw new IllegalStateException( this.cluster + " does not contain any kind of blocks, which were destroyed." );
}
for( IAEItemStack ais : inv.getAvailableItems( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList() ) )
for( IAEItemStack ais : inv.getAvailableItems( Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ).createList() ) )
{
ais = ais.copy();
ais.setStackSize( ais.getDefinition().getMaxStackSize() );
@@ -99,7 +99,7 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
public TileMolecularAssembler()
{
final ITileDefinition assembler = AEApi.instance().definitions().blocks().molecularAssembler();
final ITileDefinition assembler = Api.INSTANCE.definitions().blocks().molecularAssembler();
this.settings = new ConfigManager( this );
this.settings.registerSetting( Settings.REDSTONE_CONTROLLED, RedstoneMode.IGNORE );
@@ -91,7 +91,7 @@ public class TileGrinder extends AEBaseInvTile implements ICrankable
continue;
}
final IGrinderRecipe r = AEApi.instance().registries().grinder().getRecipeForInput( item );
final IGrinderRecipe r = Api.INSTANCE.registries().grinder().getRecipeForInput( item );
if( r != null )
{
if( item.getCount() >= r.getInput().getCount() )
@@ -127,7 +127,7 @@ public class TileGrinder extends AEBaseInvTile implements ICrankable
this.points++;
final ItemStack processing = this.inv.getStackInSlot( 6 );
final IGrinderRecipe r = AEApi.instance().registries().grinder().getRecipeForInput( processing );
final IGrinderRecipe r = Api.INSTANCE.registries().grinder().getRecipeForInput( processing );
if( r != null )
{
if( r.getRequiredTurns() > this.points )
@@ -198,7 +198,7 @@ public class TileGrinder extends AEBaseInvTile implements ICrankable
@Override
public boolean allowInsert( IItemHandler inv, int slotIndex, ItemStack stack )
{
if( AEApi.instance().registries().grinder().getRecipeForInput( stack ) == null )
if( Api.INSTANCE.registries().grinder().getRecipeForInput( stack ) == null )
{
return false;
}
@@ -177,7 +177,7 @@ public class AppEngInternalAEInventory implements IItemHandlerModifiable, Iterab
{
if( existing.isEmpty() )
{
this.inv[slot] = AEApi.instance()
this.inv[slot] = Api.INSTANCE
.storage()
.getStorageChannel( IItemStorageChannel.class )
.createStack(
@@ -226,7 +226,7 @@ public class AppEngInternalAEInventory implements IItemHandlerModifiable, Iterab
public void setStackInSlot( final int slot, final ItemStack newItemStack )
{
ItemStack oldStack = this.getStackInSlot( slot ).copy();
this.inv[slot] = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createStack( newItemStack );
this.inv[slot] = Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ).createStack( newItemStack );
if( this.te != null && Platform.isServer() )
{
@@ -104,7 +104,7 @@ class CondenserItemInventory implements IMEMonitor<IAEItemStack>, ITickingMonito
@Override
public IStorageChannel<IAEItemStack> getChannel()
{
return AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class );
return Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class );
}
@Override
@@ -135,7 +135,7 @@ public class TileCharger extends AENetworkPowerTile implements ICrankable, IGrid
final ItemStack myItem = this.inv.getStackInSlot( 0 );
if( this.getInternalCurrentPower() > POWER_THRESHOLD )
{
final IMaterials materials = AEApi.instance().definitions().materials();
final IMaterials materials = Api.INSTANCE.definitions().materials();
if( materials.certusQuartzCrystal().isSameAs( myItem ) )
{
@@ -185,7 +185,7 @@ public class TileCharger extends AENetworkPowerTile implements ICrankable, IGrid
{
ItemStack held = player.inventory.getCurrentItem();
if( AEApi.instance().definitions().materials().certusQuartzCrystal().isSameAs( held ) || Platform.isChargeable( held ) )
if( Api.INSTANCE.definitions().materials().certusQuartzCrystal().isSameAs( held ) || Platform.isChargeable( held ) )
{
held = player.inventory.decrStackSize( player.inventory.currentItem, 1 );
this.inv.setStackInSlot( 0, held );
@@ -219,7 +219,7 @@ public class TileCharger extends AENetworkPowerTile implements ICrankable, IGrid
if( !myItem.isEmpty() )
{
final IMaterials materials = AEApi.instance().definitions().materials();
final IMaterials materials = Api.INSTANCE.definitions().materials();
if( Platform.isChargeable( myItem ) )
{
@@ -227,7 +227,7 @@ public class TileCharger extends AENetworkPowerTile implements ICrankable, IGrid
if( ps.getAEMaxPower( myItem ) > ps.getAECurrentPower( myItem ) )
{
final double chargeRate = AEApi.instance().registries().charger().getChargeRate( myItem.getItem() );
final double chargeRate = Api.INSTANCE.registries().charger().getChargeRate( myItem.getItem() );
double extractedAmount = this.extractAEPower( chargeRate, Actionable.MODULATE, PowerMultiplier.CONFIG );
@@ -298,7 +298,7 @@ public class TileCharger extends AENetworkPowerTile implements ICrankable, IGrid
@Override
public boolean allowInsert( IItemHandler inv, final int i, final ItemStack itemstack )
{
final IItemDefinition cert = AEApi.instance().definitions().materials().certusQuartzCrystal();
final IItemDefinition cert = Api.INSTANCE.definitions().materials().certusQuartzCrystal();
return Platform.isChargeable( itemstack ) || cert.isSameAs( itemstack );
}
@@ -317,7 +317,7 @@ public class TileCharger extends AENetworkPowerTile implements ICrankable, IGrid
}
}
return AEApi.instance().definitions().materials().certusQuartzCrystalCharged().isSameAs( extractedItem );
return Api.INSTANCE.definitions().materials().certusQuartzCrystalCharged().isSameAs( extractedItem );
}
}
}
@@ -161,7 +161,7 @@ public class TileCondenser extends AEBaseInvTile implements IConfigManagerHost,
private ItemStack getOutput()
{
final IMaterials materials = AEApi.instance().definitions().materials();
final IMaterials materials = Api.INSTANCE.definitions().materials();
switch( (CondenserOutput) this.cm.getSetting( Settings.CONDENSER_OUTPUT ) )
{
@@ -316,7 +316,7 @@ public class TileCondenser extends AEBaseInvTile implements IConfigManagerHost,
{
if( doFill )
{
final IStorageChannel<IAEFluidStack> chan = AEApi.instance().storage().getStorageChannel( IFluidStorageChannel.class );
final IStorageChannel<IAEFluidStack> chan = Api.INSTANCE.storage().getStorageChannel( IFluidStorageChannel.class );
TileCondenser.this.addPower( ( resource == null ? 0.0 : (double) resource.amount ) / chan.transferFactor() );
}
@@ -364,7 +364,7 @@ public class TileCondenser extends AEBaseInvTile implements IConfigManagerHost,
@Override
public <T extends IAEStack<T>> IMEMonitor<T> getInventory( IStorageChannel<T> channel )
{
if( channel == AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) )
if( channel == Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ) )
{
return (IMEMonitor<T>) this.itemInventory;
}
@@ -109,7 +109,7 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
this.getProxy().setIdlePowerUsage( 0 );
this.settings = new ConfigManager( this );
final ITileDefinition inscriberDefinition = AEApi.instance().definitions().blocks().inscriber();
final ITileDefinition inscriberDefinition = Api.INSTANCE.definitions().blocks().inscriber();
this.upgrades = new DefinitionUpgradeInventory( inscriberDefinition, this, this.getUpgradeSlots() );
this.sideItemHandler.setMaxStackSize( 1, 64 );
@@ -311,7 +311,7 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
return null;
}
final IComparableDefinition namePress = AEApi.instance().definitions().materials().namePress();
final IComparableDefinition namePress = Api.INSTANCE.definitions().materials().namePress();
final boolean isNameA = namePress.isSameAs( plateA );
final boolean isNameB = namePress.isSameAs( plateB );
@@ -324,7 +324,7 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
return this.makeNamePressRecipe( input, plateB, plateA );
}
for( final IInscriberRecipe recipe : AEApi.instance().registries().inscriber().getRecipes() )
for( final IInscriberRecipe recipe : Api.INSTANCE.registries().inscriber().getRecipes() )
{
final boolean matchA = ( plateA.isEmpty() && !recipe.getTopOptional().isPresent() ) || ( Platform.itemComparisons()
@@ -567,7 +567,7 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
final List<ItemStack> inputs = Lists.newArrayList( startingItem );
final InscriberProcessType type = InscriberProcessType.INSCRIBE;
final IInscriberRecipeBuilder builder = AEApi.instance().registries().inscriber().builder();
final IInscriberRecipeBuilder builder = Api.INSTANCE.registries().inscriber().builder();
builder.withInputs( inputs ).withOutput( renamedItem ).withProcessType( type );
if( !plateA.isEmpty() )
@@ -617,11 +617,11 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
if( inv == TileInscriber.this.topItemHandler || inv == TileInscriber.this.bottomItemHandler )
{
if( AEApi.instance().definitions().materials().namePress().isSameAs( stack ) )
if( Api.INSTANCE.definitions().materials().namePress().isSameAs( stack ) )
{
return true;
}
for( final ItemStack optionals : AEApi.instance().registries().inscriber().getOptionals() )
for( final ItemStack optionals : Api.INSTANCE.registries().inscriber().getOptionals() )
{
if( Platform.itemComparisons().isSameItem( stack, optionals ) )
{
@@ -358,7 +358,7 @@ public class TileInterface extends AENetworkInvTile implements IGridTickable, II
@Override
public ItemStack getItemStackRepresentation()
{
return AEApi.instance().definitions().blocks().iface().maybeStack( 1 ).orElse( ItemStack.EMPTY );
return Api.INSTANCE.definitions().blocks().iface().maybeStack( 1 ).orElse( ItemStack.EMPTY );
}
@Override
@@ -278,7 +278,7 @@ public class TileSecurityStation extends AENetworkTile implements ITerminalHost,
@Override
public <T extends IAEStack<T>> IMEMonitor<T> getInventory( IStorageChannel<T> channel )
{
if( channel == AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) )
if( channel == Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ) )
{
return (IMEMonitor<T>) this.securityMonitor;
}
@@ -318,7 +318,7 @@ public class TileSecurityStation extends AENetworkTile implements ITerminalHost,
@Override
public void readPermissions( final Map<Integer, EnumSet<SecurityPermissions>> playerPerms )
{
final IPlayerRegistry pr = AEApi.instance().registries().players();
final IPlayerRegistry pr = Api.INSTANCE.registries().players();
// read permissions
for( final IAEItemStack ais : this.inventory.getStoredItems() )
@@ -60,7 +60,7 @@ public class TileWireless extends AENetworkInvTile implements IWirelessAccessPoi
public TileWireless()
{
this.inv.setFilter( new AEItemDefinitionFilter( AEApi.instance().definitions().materials().wirelessBooster() ) );
this.inv.setFilter( new AEItemDefinitionFilter( Api.INSTANCE.definitions().materials().wirelessBooster() ) );
this.getProxy().setFlags( GridFlags.REQUIRE_CHANNEL );
this.getProxy().setValidSides( EnumSet.noneOf( Direction.class ) );
}
@@ -141,7 +141,7 @@ public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock
private boolean isCenter()
{
return AEApi.instance()
return Api.INSTANCE
.definitions()
.blocks()
.quantumLink()
@@ -168,7 +168,7 @@ public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock
{
super.onReady();
final IBlockDefinition quantumRing = AEApi.instance().definitions().blocks().quantumRing();
final IBlockDefinition quantumRing = Api.INSTANCE.definitions().blocks().quantumRing();
final Optional<Block> maybeLinkBlock = quantumRing.maybeBlock();
final Optional<ItemStack> maybeLinkStack = quantumRing.maybeStack( 1 );
@@ -221,12 +221,12 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, ITerminal
if( !is.isEmpty() )
{
this.isCached = true;
ICellHandler cellHandler = AEApi.instance().registries().cell().getHandler( is );
ICellHandler cellHandler = Api.INSTANCE.registries().cell().getHandler( is );
if( cellHandler != null )
{
double power = 1.0;
for( IStorageChannel channel : AEApi.instance().storage().storageChannels() )
for( IStorageChannel channel : Api.INSTANCE.storage().storageChannels() )
{
final ICellInventoryHandler<IAEItemStack> newCell = cellHandler.getCellInventory( is, this, channel );
if( newCell != null )
@@ -241,7 +241,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, ITerminal
this.accessor = new Accessor();
if( this.cellHandler != null && this.cellHandler
.getChannel() == AEApi.instance().storage().getStorageChannel( IFluidStorageChannel.class ) )
.getChannel() == Api.INSTANCE.storage().getStorageChannel( IFluidStorageChannel.class ) )
{
this.fluidHandler = new FluidHandler();
}
@@ -277,7 +277,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, ITerminal
this.updateHandler();
final ItemStack cell = this.getCell();
final ICellHandler ch = AEApi.instance().registries().cell().getHandler( cell );
final ICellHandler ch = Api.INSTANCE.registries().cell().getHandler( cell );
if( this.cellHandler != null && ch != null )
{
@@ -534,7 +534,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, ITerminal
{
this.updateHandler();
if( this.cellHandler != null && this.cellHandler.getChannel() == AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) )
if( this.cellHandler != null && this.cellHandler.getChannel() == Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ) )
{
final IAEItemStack returns = Platform.poweredInsert( this, this.cellHandler,
AEItemStack.fromItemStack( this.inputInventory.getStackInSlot( 0 ) ), this.mySrc );
@@ -621,11 +621,11 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, ITerminal
this.updateHandler();
if( this.cellHandler != null )
{
final ICellHandler ch = AEApi.instance().registries().cell().getHandler( this.getCell() );
final ICellHandler ch = Api.INSTANCE.registries().cell().getHandler( this.getCell() );
if( ch != null )
{
final ICellGuiHandler chg = AEApi.instance().registries().cell().getGuiHandler( this.cellHandler.getChannel(), this.getCell() );
final ICellGuiHandler chg = Api.INSTANCE.registries().cell().getGuiHandler( this.cellHandler.getChannel(), this.getCell() );
if( chg != null )
{
chg.openChestGui( p, this, ch, this.cellHandler, this.getCell(), this.cellHandler.getChannel() );
@@ -844,7 +844,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, ITerminal
{
TileChest.this.updateHandler();
if( TileChest.this.cellHandler != null && TileChest.this.cellHandler
.getChannel() == AEApi.instance().storage().getStorageChannel( IFluidStorageChannel.class ) )
.getChannel() == Api.INSTANCE.storage().getStorageChannel( IFluidStorageChannel.class ) )
{
final IAEFluidStack results = Platform.poweredInsert( TileChest.this, TileChest.this.cellHandler, AEFluidStack.fromFluidStack( resource ),
TileChest.this.mySrc, doFill ? Actionable.MODULATE : Actionable.SIMULATE );
@@ -876,7 +876,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, ITerminal
TileChest.this.updateHandler();
if( TileChest.this.cellHandler != null && TileChest.this.cellHandler
.getChannel() == AEApi.instance().storage().getStorageChannel( IFluidStorageChannel.class ) )
.getChannel() == Api.INSTANCE.storage().getStorageChannel( IFluidStorageChannel.class ) )
{
return this.TANK_PROPS;
}
@@ -899,7 +899,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, ITerminal
{
TileChest.this.updateHandler();
return TileChest.this.cellHandler != null && TileChest.this.cellHandler
.getChannel() == AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class );
.getChannel() == Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class );
}
return false;
}
@@ -917,7 +917,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, ITerminal
@Override
public boolean allowInsert( IItemHandler inv, int slot, ItemStack stack )
{
return AEApi.instance().registries().cell().getHandler( stack ) != null;
return Api.INSTANCE.registries().cell().getHandler( stack ) != null;
}
}
@@ -925,7 +925,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, ITerminal
@Override
public ItemStack getItemStackRepresentation()
{
return AEApi.instance().definitions().blocks().chest().maybeStack( 1 ).orElse( ItemStack.EMPTY );
return Api.INSTANCE.definitions().blocks().chest().maybeStack( 1 ).orElse( ItemStack.EMPTY );
}
@Override
@@ -934,11 +934,11 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, ITerminal
this.updateHandler();
if( this.cellHandler != null )
{
if( this.cellHandler.getChannel() == AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) )
if( this.cellHandler.getChannel() == Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ) )
{
return GuiBridge.GUI_ME;
}
if( this.cellHandler.getChannel() == AEApi.instance().storage().getStorageChannel( IFluidStorageChannel.class ) )
if( this.cellHandler.getChannel() == Api.INSTANCE.storage().getStorageChannel( IFluidStorageChannel.class ) )
{
return GuiBridge.GUI_FLUID_TERMINAL;
}
@@ -279,7 +279,7 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior
{
if( !this.isCached )
{
final Collection<IStorageChannel<? extends IAEStack<?>>> storageChannels = AEApi.instance().storage().storageChannels();
final Collection<IStorageChannel<? extends IAEStack<?>>> storageChannels = Api.INSTANCE.storage().storageChannels();
storageChannels.forEach( channel -> this.inventoryHandlers.put( channel, new ArrayList<>( 10 ) ) );
double power = 2.0;
@@ -292,7 +292,7 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior
if( !is.isEmpty() )
{
this.handlersBySlot[x] = AEApi.instance().registries().cell().getHandler( is );
this.handlersBySlot[x] = Api.INSTANCE.registries().cell().getHandler( is );
if( this.handlersBySlot[x] != null )
{
@@ -394,7 +394,7 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior
@Override
public boolean allowInsert( IItemHandler inv, int slot, ItemStack stack )
{
return !stack.isEmpty() && AEApi.instance().registries().cell().isCellHandled( stack );
return !stack.isEmpty() && Api.INSTANCE.registries().cell().isCellHandled( stack );
}
}
@@ -402,7 +402,7 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior
@Override
public ItemStack getItemStackRepresentation()
{
return AEApi.instance().definitions().blocks().drive().maybeStack( 1 ).orElse( ItemStack.EMPTY );
return Api.INSTANCE.definitions().blocks().drive().maybeStack( 1 ).orElse( ItemStack.EMPTY );
}
@Override
@@ -105,7 +105,7 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC
this.mySrc = new MachineSource( this );
this.lastRedstoneState = YesNo.UNDECIDED;
final Block ioPortBlock = AEApi.instance().definitions().blocks().iOPort().maybeBlock().get();
final Block ioPortBlock = Api.INSTANCE.definitions().blocks().iOPort().maybeBlock().get();
this.upgrades = new BlockUpgradeInventory( ioPortBlock, this, NUMBER_OF_UPGRADE_SLOTS );
}
@@ -303,7 +303,7 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC
{
boolean shouldMove = true;
for( IStorageChannel<? extends IAEStack<?>> c : AEApi.instance().storage().storageChannels() )
for( IStorageChannel<? extends IAEStack<?>> c : Api.INSTANCE.storage().storageChannels() )
{
if( itemsToMove > 0 )
{
@@ -370,9 +370,9 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC
this.currentCell = is;
this.cachedInventories = new IdentityHashMap<>();
for( IStorageChannel<? extends IAEStack<?>> c : AEApi.instance().storage().storageChannels() )
for( IStorageChannel<? extends IAEStack<?>> c : Api.INSTANCE.storage().storageChannels() )
{
this.cachedInventories.put( c, AEApi.instance().registries().cell().getCellInventory( is, null, c ) );
this.cachedInventories.put( c, Api.INSTANCE.registries().cell().getCellInventory( is, null, c ) );
}
}