Fixes #1339: Was not able to retrieve the name of an unregistered part

Added an additional map to store all parts and be able to access them if needed.
Added public preconditions
Added private asserts
Excluded public overridden methods, since behaviour can be unexpected
This commit is contained in:
thatsIch
2015-04-27 09:51:40 +02:00
parent bbde2443e1
commit e85acf2bee
2 changed files with 134 additions and 139 deletions
@@ -3,8 +3,6 @@ package appeng.core.api.definitions;
import net.minecraft.item.Item;
import com.google.common.base.Optional;
import appeng.api.definitions.IBlockDefinition;
import appeng.api.definitions.IItemDefinition;
import appeng.api.definitions.ITileDefinition;
@@ -91,13 +89,9 @@ public class DefinitionConstructor
for( AEColor color : AEColor.values() )
{
ItemStackSrc multiPartSource = target.createPart( type, color );
final Optional<ItemStackSrc> maybeSource = Optional.fromNullable( multiPartSource );
final ItemStackSrc multiPartSource = target.createPart( type, color );
if( maybeSource.isPresent() )
{
definition.add( color, multiPartSource );
}
definition.add( color, multiPartSource );
}
return definition;