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:
thatsIch
2015-01-03 02:53:14 +01:00
parent 3dd81433ac
commit 9986ffc458
385 changed files with 12477 additions and 8292 deletions
+41 -23
View File
@@ -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;
}
}