Puts everywhere brackets

This commit is contained in:
thatsIch
2015-04-29 02:30:53 +02:00
parent 23aa8fd72d
commit 64ed05a1b4
465 changed files with 6726 additions and 14 deletions
@@ -104,11 +104,17 @@ public class AEItemResolver implements ISubItemResolver
if( itemName.startsWith( "ItemCrystalSeed." ) )
{
if( itemName.equalsIgnoreCase( "ItemCrystalSeed.Certus" ) )
{
return ItemCrystalSeed.getResolver( ItemCrystalSeed.Certus );
}
if( itemName.equalsIgnoreCase( "ItemCrystalSeed.Nether" ) )
{
return new ResolverResult( "ItemCrystalSeed", ItemCrystalSeed.Nether );
}
if( itemName.equalsIgnoreCase( "ItemCrystalSeed.Fluix" ) )
{
return new ResolverResult( "ItemCrystalSeed", ItemCrystalSeed.Fluix );
}
return null;
}
@@ -119,7 +125,9 @@ public class AEItemResolver implements ISubItemResolver
MaterialType mt = MaterialType.valueOf( materialName );
// itemName = itemName.substring( 0, itemName.indexOf( "." ) );
if( mt.itemInstance == ItemMultiMaterial.instance && mt.damageValue >= 0 && mt.isRegistered() )
{
return new ResolverResult( "ItemMultiMaterial", mt.damageValue );
}
}
if( itemName.startsWith( "ItemPart." ) )
@@ -129,7 +137,9 @@ public class AEItemResolver implements ISubItemResolver
// itemName = itemName.substring( 0, itemName.indexOf( "." ) );
int dVal = ItemMultiPart.instance.getDamageByType( pt );
if( dVal >= 0 )
{
return new ResolverResult( "ItemMultiPart", dVal );
}
}
}
@@ -150,7 +160,9 @@ public class AEItemResolver implements ISubItemResolver
}
if( col == AEColor.Transparent )
{
return null;
}
ItemStack is = partType.stack( col, 1 );
return new ResolverResult( "ItemPaintBall", ( lumen ? 20 : 0 ) + is.getItemDamage() );
@@ -47,8 +47,12 @@ public class GroupIngredient implements IIngredient
this.name = myName;
for( IIngredient I : ingredients )
{
if( I.isAir() )
{
throw new RecipeError( "Cannot include air in a group." );
}
}
this.ingredients = ingredients;
}
@@ -70,10 +74,14 @@ public class GroupIngredient implements IIngredient
public ItemStack[] getItemStackSet() throws RegistrationError, MissingIngredientError
{
if( this.baked != null )
{
return this.baked;
}
if( this.isInside )
{
return new ItemStack[0];
}
List<ItemStack> out = new LinkedList<ItemStack>();
this.isInside = true;
@@ -97,10 +105,14 @@ public class GroupIngredient implements IIngredient
}
if( out.size() == 0 )
{
throw new MissingIngredientError( this.toString() + " - group could not be resolved to any items." );
}
for( ItemStack is : out )
{
is.stackSize = this.qty;
}
return out.toArray( new ItemStack[out.size()] );
}
@@ -79,7 +79,9 @@ public class Ingredient implements IIngredient
if( this.nameSpace.equals( "oreDictionary" ) )
{
if( parts.length == 3 )
{
throw new RecipeError( "Cannot specify meta when using ore dictionary." );
}
sel = OreDictionary.WILDCARD_VALUE;
}
else
@@ -128,7 +130,9 @@ public class Ingredient implements IIngredient
this.itemName = tmpName;
}
else
{
throw new RecipeError( input + " : Needs at least Namespace and Name." );
}
handler.data.knownItem.add( this.toString() );
}
@@ -143,28 +147,40 @@ public class Ingredient implements IIngredient
public ItemStack getItemStack() throws RegistrationError, MissingIngredientError
{
if( this.isAir )
{
throw new RegistrationError( "Found blank item and expected a real item." );
}
if( this.nameSpace.equalsIgnoreCase( "oreDictionary" ) )
{
throw new RegistrationError( "Recipe format expected a single item, but got a set of items." );
}
Block blk = GameRegistry.findBlock( this.nameSpace, this.itemName );
if( blk == null )
{
blk = GameRegistry.findBlock( this.nameSpace, "tile." + this.itemName );
}
if( blk != null )
{
Item it = Item.getItemFromBlock( blk );
if( it != null )
{
return this.MakeItemStack( it, this.qty, this.meta, this.nbt );
}
}
Item it = GameRegistry.findItem( this.nameSpace, this.itemName );
if( it == null )
{
it = GameRegistry.findItem( this.nameSpace, "item." + this.itemName );
}
if( it != null )
{
return this.MakeItemStack( it, this.qty, this.meta, this.nbt );
}
/*
* Object o = Item.itemRegistry.getObject( nameSpace + ":" + itemName ); if ( o instanceof Item ) return new
@@ -193,7 +209,9 @@ public class Ingredient implements IIngredient
public ItemStack[] getItemStackSet() throws RegistrationError, MissingIngredientError
{
if( this.baked != null )
{
return this.baked;
}
if( this.nameSpace.equalsIgnoreCase( "oreDictionary" ) )
{
@@ -209,7 +227,9 @@ public class Ingredient implements IIngredient
}
if( set.length == 0 )
{
throw new MissingIngredientError( this.itemName + " - ore dictionary could not be resolved to any items." );
}
return set;
}
@@ -56,19 +56,27 @@ public class IngredientSet implements IIngredient
public ItemStack[] getItemStackSet() throws RegistrationError, MissingIngredientError
{
if( this.baked != null )
{
return this.baked;
}
if( this.isInside )
{
return new ItemStack[0];
}
List<ItemStack> out = new LinkedList<ItemStack>();
out.addAll( this.items );
if( out.size() == 0 )
{
throw new MissingIngredientError( this.toString() + " - group could not be resolved to any items." );
}
for( ItemStack is : out )
{
is.stackSize = this.qty;
}
return out.toArray( new ItemStack[out.size()] );
}
@@ -118,7 +118,9 @@ public class RecipeHandler implements IRecipeHandler
String realName = id.modId + ':' + id.name;
if( !id.modId.equals( AppEng.MOD_ID ) && !id.modId.equals( "minecraft" ) )
{
throw new RecipeError( "Not applicable for website" );
}
final IDefinitions definitions = AEApi.instance().definitions();
final IItems items = definitions.items();
@@ -134,11 +136,17 @@ public class RecipeHandler implements IRecipeHandler
{
int dmg = is.getItemDamage();
if( dmg < ItemCrystalSeed.Nether )
{
realName += ".Certus";
}
else if( dmg < ItemCrystalSeed.Fluix )
{
realName += ".Nether";
}
else if( dmg < ItemCrystalSeed.END )
{
realName += ".Fluix";
}
}
else if( maybeSkyStoneItem.isPresent() && is.getItem() == maybeSkyStoneItem.get() )
{
@@ -203,7 +211,9 @@ public class RecipeHandler implements IRecipeHandler
realName += '.' + ( (ItemMultiPart) is.getItem() ).getTypeByStack( is ).name();
}
else if( is.getItemDamage() > 0 )
{
realName += "." + is.getItemDamage();
}
return realName;
}
@@ -213,7 +223,9 @@ public class RecipeHandler implements IRecipeHandler
String out = this.data.aliases.get( in );
if( out != null )
{
return out;
}
return in;
}
@@ -232,7 +244,9 @@ public class RecipeHandler implements IRecipeHandler
{
AELog.warning( "Error Loading Recipe File:" + path );
if( this.data.exceptions )
{
AELog.error( err );
}
return;
}
@@ -248,12 +262,16 @@ public class RecipeHandler implements IRecipeHandler
char c = (char) val;
if( c == '\n' )
{
line++;
}
if( inComment )
{
if( c == '\n' || c == '\r' )
{
inComment = false;
}
}
else if( inQuote )
{
@@ -288,7 +306,9 @@ public class RecipeHandler implements IRecipeHandler
this.processTokens( loader, path, line );
if( token.length() > 0 )
{
this.tokens.add( token );
}
token = "";
break;
@@ -303,7 +323,9 @@ public class RecipeHandler implements IRecipeHandler
case ' ':
if( token.length() > 0 )
{
this.tokens.add( token );
}
token = "";
break;
@@ -314,7 +336,9 @@ public class RecipeHandler implements IRecipeHandler
}
if( token.length() > 0 )
{
this.tokens.add( token );
}
reader.close();
this.processTokens( loader, path, line );
@@ -323,7 +347,9 @@ public class RecipeHandler implements IRecipeHandler
{
AELog.error( e );
if( this.data.crash )
{
throw new IllegalStateException( e );
}
}
}
@@ -331,7 +357,9 @@ public class RecipeHandler implements IRecipeHandler
public void injectRecipes()
{
if( cpw.mods.fml.common.Loader.instance().hasReachedState( LoaderState.POSTINITIALIZATION ) )
{
throw new IllegalStateException( "Recipes must now be loaded in Init." );
}
HashMap<Class, Integer> processed = new HashMap<Class, Integer>();
try
@@ -345,17 +373,25 @@ public class RecipeHandler implements IRecipeHandler
Class clz = ch.getClass();
Integer i = processed.get( clz );
if( i == null )
{
processed.put( clz, 1 );
}
else
{
processed.put( clz, i + 1 );
}
}
catch( RegistrationError e )
{
AELog.warning( "Unable to register a recipe: " + e.getMessage() );
if( this.data.exceptions )
{
AELog.error( e );
}
if( this.data.crash )
{
throw e;
}
}
catch( MissingIngredientError e )
{
@@ -363,9 +399,13 @@ public class RecipeHandler implements IRecipeHandler
{
AELog.warning( "Unable to register a recipe:" + e.getMessage() );
if( this.data.exceptions )
{
AELog.error( e );
}
if( this.data.crash )
{
throw e;
}
}
}
}
@@ -373,9 +413,13 @@ public class RecipeHandler implements IRecipeHandler
catch( Throwable e )
{
if( this.data.exceptions )
{
AELog.error( e );
}
if( this.data.crash )
{
throw new IllegalStateException( e );
}
}
for( Entry<Class, Integer> e : processed.entrySet() )
@@ -403,7 +447,9 @@ public class RecipeHandler implements IRecipeHandler
String realName = this.getName( is );
List<IWebsiteSerializer> recipes = this.findRecipe( is );
if( !recipes.isEmpty() )
{
combined.putAll( realName, recipes );
}
}
}
catch( RecipeError ignored )
@@ -482,7 +528,9 @@ public class RecipeHandler implements IRecipeHandler
IRecipeHandlerRegistry cr = AEApi.instance().registries().recipes();
if( this.tokens.isEmpty() )
{
return;
}
int split = this.tokens.indexOf( "->" );
if( split != -1 )
@@ -492,9 +540,13 @@ public class RecipeHandler implements IRecipeHandler
if( operation.equals( "alias" ) )
{
if( this.tokens.size() == 3 && this.tokens.indexOf( "->" ) == 1 )
{
this.data.aliases.put( this.tokens.get( 0 ), this.tokens.get( 2 ) );
}
else
{
throw new RecipeError( "Alias must have exactly 1 input and 1 output." );
}
}
else if( operation.equals( "group" ) )
{
@@ -508,7 +560,9 @@ public class RecipeHandler implements IRecipeHandler
this.data.groups.put( post.get( 0 ), new GroupIngredient( post.get( 0 ), inputs.get( 0 ) ) );
}
else
{
throw new RecipeError( "Group must have exactly 1 output, and 1 or more inputs." );
}
}
else if( operation.equals( "ore" ) )
{
@@ -523,7 +577,9 @@ public class RecipeHandler implements IRecipeHandler
this.addCrafting( ch );
}
else
{
throw new RecipeError( "Group must have exactly 1 output, and 1 or more inputs in a single row." );
}
}
else
{
@@ -541,7 +597,9 @@ public class RecipeHandler implements IRecipeHandler
this.addCrafting( ch );
}
else
{
throw new RecipeError( "Invalid crafting type: " + operation );
}
}
}
else
@@ -555,7 +613,9 @@ public class RecipeHandler implements IRecipeHandler
this.data.exceptions = this.tokens.get( 0 ).equals( "true" );
}
else
{
throw new RecipeError( "exceptions must be true or false explicitly." );
}
}
else if( operation.equals( "crash" ) && ( this.tokens.get( 0 ).equals( "true" ) || this.tokens.get( 0 ).equals( "false" ) ) )
{
@@ -564,7 +624,9 @@ public class RecipeHandler implements IRecipeHandler
this.data.crash = this.tokens.get( 0 ).equals( "true" );
}
else
{
throw new RecipeError( "crash must be true or false explicitly." );
}
}
else if( operation.equals( "erroronmissing" ) )
{
@@ -573,26 +635,38 @@ public class RecipeHandler implements IRecipeHandler
this.data.errorOnMissing = this.tokens.get( 0 ).equals( "true" );
}
else
{
throw new RecipeError( "erroronmissing must be true or false explicitly." );
}
}
else if( operation.equals( "import" ) )
{
if( this.tokens.size() == 1 )
{
( new RecipeHandler( this ) ).parseRecipes( loader, this.tokens.get( 0 ) );
}
else
{
throw new RecipeError( "Import must have exactly 1 input." );
}
}
else
{
throw new RecipeError( operation + ": " + this.tokens.toString() + "; recipe without an output." );
}
}
}
catch( RecipeError e )
{
AELog.warning( "Recipe Error '" + e.getMessage() + "' near line:" + line + " in " + file + " with: " + this.tokens.toString() );
if( this.data.exceptions )
{
AELog.error( e );
}
if( this.data.crash )
{
throw e;
}
}
this.tokens.clear();
@@ -611,9 +685,13 @@ public class RecipeHandler implements IRecipeHandler
if( v.equals( "," ) )
{
if( hasQty )
{
throw new RecipeError( "Qty found with no item." );
}
if( !cList.isEmpty() )
{
out.add( cList );
}
cList = new LinkedList<IIngredient>();
}
else
@@ -621,7 +699,9 @@ public class RecipeHandler implements IRecipeHandler
if( this.isNumber( v ) )
{
if( hasQty )
{
throw new RecipeError( "Qty found with no item." );
}
hasQty = true;
qty = Integer.parseInt( v );
}
@@ -633,13 +713,17 @@ public class RecipeHandler implements IRecipeHandler
hasQty = false;
}
else
{
cList.add( this.findIngredient( v, 1 ) );
}
}
}
}
if( !cList.isEmpty() )
{
out.add( cList );
}
return out;
}
@@ -649,7 +733,9 @@ public class RecipeHandler implements IRecipeHandler
GroupIngredient gi = this.data.groups.get( v );
if( gi != null )
{
return gi.copy( qty );
}
try
{
@@ -664,13 +750,17 @@ public class RecipeHandler implements IRecipeHandler
private boolean isNumber( String v )
{
if( v.length() <= 0 )
{
return false;
}
int l = v.length();
for( int x = 0; x < l; x++ )
{
if( !Character.isDigit( v.charAt( x ) ) )
{
return false;
}
}
return true;
@@ -93,7 +93,9 @@ public final class DisassembleRecipe implements IRecipe
// needs a single input in the recipe
itemCount++;
if ( itemCount > 1 )
{
return MISMATCHED_STACK;
}
// handle storage cells
for( ItemStack storageCellStack : this.getCellOutput( stackInSlot ).asSet() )
@@ -104,7 +106,9 @@ public final class DisassembleRecipe implements IRecipe
{
IItemList<IAEItemStack> list = cellInv.getAvailableItems( StorageChannel.ITEMS.createList() );
if( !list.isEmpty() )
{
return null;
}
}
output = storageCellStack;
@@ -69,7 +69,9 @@ public final class FacadeRecipe implements IRecipe
ItemStack facades = facade.createFacadeForItem( inv.getStackInSlot( 4 ), !createFacade );
if( facades != null && createFacade )
{
facades.stackSize = 4;
}
return facades;
}
}
@@ -144,7 +144,9 @@ public class ShapedRecipe implements IRecipe, IRecipeBakeable
public boolean matches( InventoryCrafting inv, World world )
{
if( this.disable )
{
return false;
}
for( int x = 0; x <= MAX_CRAFT_GRID_WIDTH - this.width; x++ )
{
@@ -187,7 +189,9 @@ public class ShapedRecipe implements IRecipe, IRecipeBakeable
private boolean checkMatch( InventoryCrafting inv, int startX, int startY, boolean mirror )
{
if( this.disable )
{
return false;
}
for( int x = 0; x < MAX_CRAFT_GRID_WIDTH; x++ )
{
@@ -310,7 +314,9 @@ public class ShapedRecipe implements IRecipe, IRecipeBakeable
for( Object o : this.input )
{
if( o instanceof IIngredient )
{
( (IIngredient) o ).bake();
}
}
}
catch( MissingIngredientError err )
@@ -71,7 +71,9 @@ public class ShapelessRecipe implements IRecipe, IRecipeBakeable
public boolean matches( InventoryCrafting var1, World world )
{
if( this.disable )
{
return false;
}
ArrayList<Object> required = new ArrayList<Object>( this.input );
@@ -167,7 +169,9 @@ public class ShapelessRecipe implements IRecipe, IRecipeBakeable
for( Object o : this.input )
{
if( o instanceof IIngredient )
{
( (IIngredient) o ).bake();
}
}
}
catch( MissingIngredientError e )
@@ -59,7 +59,9 @@ public class Grind implements ICraftHandler, IWebsiteSerializer
public void register() throws RegistrationError, MissingIngredientError
{
for( ItemStack is : this.pro_input.getItemStackSet() )
{
AEApi.instance().registries().grinder().addRecipe( is, this.pro_output[0].getItemStack(), 8 );
}
}
@Override
@@ -47,9 +47,13 @@ public final class Inscribe extends InscriberProcess
public void register() throws RegistrationError, MissingIngredientError
{
if ( this.getImprintable() == null )
{
return;
}
if ( this.getOutput() == null )
{
return;
}
final ItemStack[] realInput = this.getImprintable().getItemStackSet();
final List<ItemStack> inputs = new ArrayList<ItemStack>( realInput.length );
@@ -49,15 +49,21 @@ public abstract class InscriberProcess implements ICraftHandler, IWebsiteSeriali
this.topOptional = input.get( 0 ).get( 1 );
if( input.get( 0 ).size() > 2 )
{
this.botOptional = input.get( 0 ).get( 2 );
}
this.output = output.get( 0 ).get( 0 );
}
else
{
throw new RecipeError( "Inscriber recipes cannot have rows, and must have more then one input." );
}
}
else
{
throw new RecipeError( "Inscriber recipes must produce a single output." );
}
}
@Override
@@ -78,13 +84,19 @@ public abstract class InscriberProcess implements ICraftHandler, IWebsiteSeriali
}
if( this.topOptional != null )
{
pattern += handler.getName( this.topOptional ) + '\n';
}
if ( this.imprintable != null )
{
pattern += handler.getName( this.imprintable );
}
if( this.botOptional != null )
{
pattern += '\n' + handler.getName( this.botOptional );
}
return pattern;
}
@@ -47,9 +47,13 @@ public final class Press extends InscriberProcess
public void register() throws RegistrationError, MissingIngredientError
{
if ( this.getImprintable() == null )
{
return;
}
if ( this.getOutput() == null )
{
return;
}
final ItemStack[] realInput = this.getImprintable().getItemStackSet();
final List<ItemStack> inputs = new ArrayList<ItemStack>( realInput.length );
@@ -68,13 +68,19 @@ public class Shaped implements ICraftHandler, IWebsiteSerializer
this.output = output.get( 0 ).get( 0 );
}
else
{
throw new RecipeError( "Crafting recipes must have 1-3 columns." );
}
}
else
{
throw new RecipeError( "shaped crafting recipes must have 1-3 rows." );
}
}
else
{
throw new RecipeError( "Crafting must produce a single output." );
}
}
@Override
@@ -89,7 +95,9 @@ public class Shaped implements ICraftHandler, IWebsiteSerializer
for( int x = 0; x < this.cols; x++ )
{
if( this.inputs.get( y ).get( x ).isAir() )
{
row.append( ' ' );
}
else
{
row.append( first );
@@ -123,15 +131,21 @@ public class Shaped implements ICraftHandler, IWebsiteSerializer
o += h.getName( this.output ) + '\n';
for( int y = 0; y < this.rows; y++ )
{
for( int x = 0; x < this.cols; x++ )
{
IIngredient i = this.inputs.get( y ).get( x );
if( i.isAir() )
{
o += "air" + ( x + 1 == this.cols ? "\n" : " " );
}
else
{
o += h.getName( i ) + ( x + 1 == this.cols ? "\n" : " " );
}
}
}
return o.trim();
}
@@ -140,6 +154,7 @@ public class Shaped implements ICraftHandler, IWebsiteSerializer
public boolean canCraft( ItemStack reqOutput ) throws RegistrationError, MissingIngredientError
{
for( int y = 0; y < this.rows; y++ )
{
for( int x = 0; x < this.cols; x++ )
{
IIngredient i = this.inputs.get( y ).get( x );
@@ -149,10 +164,13 @@ public class Shaped implements ICraftHandler, IWebsiteSerializer
for( ItemStack r : i.getItemStackSet() )
{
if( Platform.isSameItemPrecise( r, reqOutput ) )
{
return false;
}
}
}
}
}
return Platform.isSameItemPrecise( this.output.getItemStack(), reqOutput );
}
@@ -54,10 +54,14 @@ public class Shapeless implements ICraftHandler, IWebsiteSerializer
this.output = output.get( 0 ).get( 0 );
}
else
{
throw new RecipeError( "Shapeless crafting recipes cannot have rows." );
}
}
else
{
throw new RecipeError( "Crafting must produce a single output." );
}
}
@Override
@@ -65,7 +69,9 @@ public class Shapeless implements ICraftHandler, IWebsiteSerializer
{
List<Object> args = new ArrayList<Object>();
for( IIngredient i : this.inputs )
{
args.add( i );
}
ItemStack outIS = this.output.getItemStack();
@@ -61,10 +61,14 @@ public class Smelt implements ICraftHandler, IWebsiteSerializer
public void register() throws RegistrationError, MissingIngredientError
{
if( this.in.getItemStack().getItem() == null )
{
throw new RegistrationError( this.in.toString() + ": Smelting Input is not a valid item." );
}
if( this.out.getItemStack().getItem() == null )
{
throw new RegistrationError( this.out.toString() + ": Smelting Output is not a valid item." );
}
GameRegistry.addSmelting( this.in.getItemStack(), this.out.getItemStack(), 0 );
}
@@ -45,16 +45,22 @@ public class OreDictionaryHandler
public void onOreDictionaryRegister( OreDictionary.OreRegisterEvent event )
{
if( event.Name == null || event.Ore == null )
{
return;
}
if( this.shouldCare( event.Name ) )
{
for( IOreListener v : this.ol )
{
v.oreRegistered( event.Name, event.Ore );
}
}
if( this.enableRebaking )
{
this.bakeRecipes();
}
}
/**
@@ -107,7 +113,9 @@ public class OreDictionaryHandler
for( ItemStack item : OreDictionary.getOres( name ) )
{
if( item != null )
{
n.oreRegistered( name, item );
}
}
}
}