Fixes #675 No disabled feature should log spam or crash anymore.
Deprecates the old usage of the AEItemDefinitions via the direct method access of * blocks() * parts() * items() * materials() and thus use the new re-direct via definitions(). All definitions are now initialized, no matter what. But SubItems, Items and Blocks are not registered, if by chance are disabled.
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
|
||||
package appeng.core;
|
||||
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import appeng.api.IAppEngApi;
|
||||
@@ -41,28 +42,47 @@ import appeng.util.Platform;
|
||||
|
||||
public final class Api implements IAppEngApi
|
||||
{
|
||||
|
||||
public static final Api INSTANCE = new Api();
|
||||
|
||||
private Api() {
|
||||
|
||||
}
|
||||
private final ApiPart partHelper;
|
||||
|
||||
// private MovableTileRegistry MovableRegistry = new MovableTileRegistry();
|
||||
private final RegistryContainer rc = new RegistryContainer();
|
||||
private final ApiStorage storageHelper = new ApiStorage();
|
||||
private final IRegistryContainer registryContainer;
|
||||
private final IStorageHelper storageHelper;
|
||||
private final Materials materials;
|
||||
private final Items items;
|
||||
private final Blocks blocks;
|
||||
private final Parts parts;
|
||||
private final ApiDefinitions definitions;
|
||||
|
||||
public final ApiPart partHelper = new ApiPart();
|
||||
|
||||
private final Materials materials = new Materials();
|
||||
private final Items items = new Items();
|
||||
private final Blocks blocks = new Blocks();
|
||||
private final Parts parts = new Parts();
|
||||
private Api()
|
||||
{
|
||||
this.parts = new Parts();
|
||||
this.blocks = new Blocks();
|
||||
this.items = new Items();
|
||||
this.materials = new Materials();
|
||||
this.storageHelper = new ApiStorage();
|
||||
this.registryContainer = new RegistryContainer();
|
||||
this.partHelper = new ApiPart();
|
||||
this.definitions = new ApiDefinitions( this.partHelper );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IRegistryContainer registries()
|
||||
{
|
||||
return this.rc;
|
||||
return this.registryContainer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IStorageHelper storage()
|
||||
{
|
||||
return this.storageHelper;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPartHelper partHelper()
|
||||
{
|
||||
return this.partHelper;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -90,19 +110,13 @@ public final class Api implements IAppEngApi
|
||||
}
|
||||
|
||||
@Override
|
||||
public IStorageHelper storage()
|
||||
public ApiDefinitions definitions()
|
||||
{
|
||||
return this.storageHelper;
|
||||
return this.definitions;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPartHelper partHelper()
|
||||
{
|
||||
return this.partHelper;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IGridNode createGridNode(IGridBlock blk)
|
||||
public IGridNode createGridNode( IGridBlock blk )
|
||||
{
|
||||
if ( Platform.isClient() )
|
||||
throw new RuntimeException( "Grid Features are Server Side Only." );
|
||||
@@ -110,9 +124,13 @@ public final class Api implements IAppEngApi
|
||||
}
|
||||
|
||||
@Override
|
||||
public IGridConnection createGridConnection(IGridNode a, IGridNode b) throws FailedConnection
|
||||
public IGridConnection createGridConnection( IGridNode a, IGridNode b ) throws FailedConnection
|
||||
{
|
||||
return new GridConnection( a, b, ForgeDirection.UNKNOWN );
|
||||
}
|
||||
|
||||
public ApiPart getPartHelper()
|
||||
{
|
||||
return this.partHelper;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user