Use ordinal of parts/items as the default meta, allows for holes in the setup but lets default configs be consistent regardless of other mods.

This commit is contained in:
AlgorithmX2
2014-04-06 01:51:44 -05:00
parent 028555bc8a
commit 97c06db6ef
3 changed files with 31 additions and 11 deletions
+29 -9
View File
@@ -236,20 +236,40 @@ public class AEConfig extends Configuration implements IConfigureableObject, ICo
super.save(); super.save();
} }
public int getFreeMaterial() public int getFreeIDSLot(int varID, String Category)
{ {
boolean alreadyUsed = false;
int min = 0; int min = 0;
for (Property p : getCategory( "materials" ).getValues().values())
min = Math.max( min, p.getInt() + 1 ); for (Property p : getCategory( Category ).getValues().values())
return min; {
int thisInt = p.getInt();
if ( varID == thisInt )
alreadyUsed = true;
min = Math.max( min, thisInt + 1 );
}
if ( alreadyUsed )
{
if ( min < 1000 )
min = 1000;
return min;
}
return varID;
} }
public int getFreePart() public int getFreeMaterial(int varID)
{ {
int min = 0; return getFreeIDSLot( varID, "materials" );
for (Property p : getCategory( "parts" ).getValues().values()) }
min = Math.max( min, p.getInt() + 1 );
return min; public int getFreePart(int varID)
{
return getFreeIDSLot( varID, "parts" );
} }
@Override @Override
+1 -1
View File
@@ -136,7 +136,7 @@ public class ItemMaterial extends AEBaseItem implements IStorageComponent, IUpgr
if ( enabled ) if ( enabled )
{ {
int newMaterialNum = AEConfig.instance.get( "materials", name, AEConfig.instance.getFreeMaterial() ).getInt(); int newMaterialNum = AEConfig.instance.get( "materials", name, AEConfig.instance.getFreeMaterial( mat.ordinal() ) ).getInt();
mat.damageValue = newMaterialNum; mat.damageValue = newMaterialNum;
ItemStackSrc output = new ItemStackSrc( this, newMaterialNum ); ItemStackSrc output = new ItemStackSrc( this, newMaterialNum );
+1 -1
View File
@@ -80,7 +80,7 @@ public class ItemPart extends AEBaseItem implements IPartItem, IItemGroup
if ( enabled ) if ( enabled )
{ {
int newPartNum = AEConfig.instance.get( "parts", name, AEConfig.instance.getFreePart() ).getInt(); int newPartNum = AEConfig.instance.get( "parts", name, AEConfig.instance.getFreePart( varID ) ).getInt();
ItemStackSrc output = new ItemStackSrc( this, newPartNum ); ItemStackSrc output = new ItemStackSrc( this, newPartNum );
PartTypeIst pti = new PartTypeIst(); PartTypeIst pti = new PartTypeIst();