This commit is contained in:
AlgorithmX2 2014-06-04 00:07:57 -05:00
commit faad4a6ba2
6 changed files with 55 additions and 33 deletions

View file

@ -218,12 +218,17 @@ public class Registration
{
try
{
Field f = materialClass.getField( "material" + mat.name() );
ItemStackSrc is = ((ItemMultiMaterial) materialItem.item()).createMaterial( mat );
if ( is != null )
f.set( materials, new DamagedItemDefinition( is ) );
if ( mat == MaterialType.InvalidType )
((ItemMultiMaterial) materialItem.item()).createMaterial( mat );
else
f.set( materials, new NullItemDefinition() );
{
Field f = materialClass.getField( "material" + mat.name() );
ItemStackSrc is = ((ItemMultiMaterial) materialItem.item()).createMaterial( mat );
if ( is != null )
f.set( materials, new DamagedItemDefinition( is ) );
else
f.set( materials, new NullItemDefinition() );
}
}
catch (Throwable err)
{
@ -239,30 +244,35 @@ public class Registration
{
try
{
Field f = partClass.getField( "part" + type.name() );
Enum varients[] = type.getVarients();
if ( varients == null )
{
ItemStackSrc is = ((ItemMultiPart) partItem.item()).createPart( type, null );
if ( is != null )
f.set( parts, new DamagedItemDefinition( is ) );
else
f.set( parts, new NullItemDefinition() );
}
if ( type == PartType.InvalidType )
((ItemMultiPart) partItem.item()).createPart( type, null );
else
{
if ( varients[0] instanceof AEColor )
Field f = partClass.getField( "part" + type.name() );
Enum varients[] = type.getVarients();
if ( varients == null )
{
ColoredItemDefinition def = new ColoredItemDefinition();
for (Enum v : varients)
ItemStackSrc is = ((ItemMultiPart) partItem.item()).createPart( type, null );
if ( is != null )
f.set( parts, new DamagedItemDefinition( is ) );
else
f.set( parts, new NullItemDefinition() );
}
else
{
if ( varients[0] instanceof AEColor )
{
ItemStackSrc is = ((ItemMultiPart) partItem.item()).createPart( type, v );
if ( is != null )
def.add( (AEColor) v, is );
}
ColoredItemDefinition def = new ColoredItemDefinition();
f.set( parts, def );
for (Enum v : varients)
{
ItemStackSrc is = ((ItemMultiPart) partItem.item()).createPart( type, v );
if ( is != null )
def.add( (AEColor) v, is );
}
f.set( parts, def );
}
}
}
}

View file

@ -97,13 +97,20 @@ public class ApiPart implements IPartHelper
public ClassNode getReader(String name) throws IOException
{
ClassReader cr;
String path = "/" + name.replace( ".", "/" ) + ".class";
InputStream is = getClass().getResourceAsStream( path );
cr = new ClassReader( is );
ClassNode cn = new ClassNode();
cr.accept( cn, ClassReader.EXPAND_FRAMES );
return cn;
try
{
ClassReader cr;
String path = "/" + name.replace( ".", "/" ) + ".class";
InputStream is = getClass().getResourceAsStream( path );
cr = new ClassReader( is );
ClassNode cn = new ClassNode();
cr.accept( cn, ClassReader.EXPAND_FRAMES );
return cn;
}
catch (Throwable t)
{
throw new RuntimeException( "Error loading " + name, t );
}
}
public Class getCombinedInstance(String base)
@ -167,6 +174,7 @@ public class ApiPart implements IPartHelper
}
catch (Throwable t)
{
AELog.warning( "Error loading " + name );
AELog.error( t );
// throw new RuntimeException( t );
}

View file

@ -205,7 +205,7 @@ public class BC extends BaseModule implements IBC
@Override
public void Init()
{
AEApi.instance().partHelper().registerNewLayer( "appeng.api.parts.layers.LayerIPipeConnection", "buildcraft.api.transport.IPipeConnection" );
AEApi.instance().partHelper().registerNewLayer( "appeng.parts.layers.LayerIPipeConnection", "buildcraft.api.transport.IPipeConnection" );
AEApi.instance().registries().externalStorage().addExternalStorageInterface( new BCPipeHandler() );
Blocks b = AEApi.instance().blocks();

View file

@ -166,7 +166,7 @@ public class ItemMultiMaterial extends AEBaseItem implements IStorageComponent,
{
if ( dmgToMaterial.containsKey( is.getItemDamage() ) )
return dmgToMaterial.get( is.getItemDamage() );
return null;
return MaterialType.InvalidType;
}
@Override

View file

@ -17,6 +17,8 @@ import cpw.mods.fml.relauncher.SideOnly;
public enum MaterialType
{
InvalidType(-1, AEFeature.Core),
CertusQuartzCrystal(0, AEFeature.Core, "crystalCertusQuartz"), CertusQuartzCrystalCharged(1, AEFeature.Core, EntityChargedQuartz.class),
CertusQuartzDust(2, AEFeature.Core, "dustCertusQuartz"), NetherQuartzDust(3, AEFeature.Core, "dustNetherQuartz"), Flour(4, AEFeature.Flour, "dustWheat"), GoldDust(

View file

@ -43,6 +43,8 @@ import appeng.parts.reporting.PartTerminal;
public enum PartType
{
InvalidType(-1, AEFeature.Core, null),
CableGlass(0, AEFeature.Core, PartCableGlass.class),
CableCovered(20, AEFeature.Core, PartCableCovered.class),