Package appeng.api.exceptions

Examples of appeng.api.exceptions.RecipeError


  {
    UniqueIdentifier id = GameRegistry.findUniqueIdentifierFor( is.getItem() );
    String realName = id.modId + ":" + id.name;

    if ( !id.modId.equals( AppEng.modid ) && !id.modId.equals( "minecraft" ) )
      throw new RecipeError( "Not applicable for website" );

    if ( is.getItem() == AEApi.instance().items().itemCrystalSeed.item() )
    {
      int dmg = is.getItemDamage();
      if ( dmg < ItemCrystalSeed.Nether )
View Full Code Here


        if ( operation.equals( "alias" ) )
        {
          if ( tokens.size() == 3 && tokens.indexOf( "->" ) == 1 )
            data.aliases.put( tokens.get( 0 ), tokens.get( 2 ) );
          else
            throw new RecipeError( "Alias must have exactly 1 input and 1 output." );
        }
        else if ( operation.equals( "group" ) )
        {
          List<String> pre = tokens.subList( 0, split - 1 );
          List<String> post = tokens.subList( split, tokens.size() );

          List<List<IIngredient>> inputs = parseLines( pre );

          if ( inputs.size() == 1 && inputs.get( 0 ).size() > 0 && post.size() == 1 )
          {
            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" ) )
        {
          List<String> pre = tokens.subList( 0, split - 1 );
          List<String> post = tokens.subList( split, tokens.size() );

          List<List<IIngredient>> inputs = parseLines( pre );

          if ( inputs.size() == 1 && inputs.get( 0 ).size() > 0 && post.size() == 1 )
          {
            ICraftHandler ch = new OreRegistration( inputs.get( 0 ), post.get( 0 ) );
            addCrafting( ch );
          }
          else
            throw new RecipeError( "Group must have exactly 1 output, and 1 or more inputs in a single row." );
        }
        else
        {
          List<String> pre = tokens.subList( 0, split - 1 );
          List<String> post = tokens.subList( split, tokens.size() );

          List<List<IIngredient>> inputs = parseLines( pre );
          List<List<IIngredient>> outputs = parseLines( post );

          ICraftHandler ch = cr.getCraftHandlerFor( operation );

          if ( ch != null )
          {
            ch.setup( inputs, outputs );
            addCrafting( ch );
          }
          else
            throw new RecipeError( "Invalid crafting type: " + operation );
        }
      }
      else
      {
        String operation = tokens.remove( 0 ).toLowerCase();

        if ( operation.equals( "exceptions" ) && (tokens.get( 0 ).equals( "true" ) || tokens.get( 0 ).equals( "false" )) )
        {
          if ( tokens.size() == 1 )
          {
            data.exceptions = tokens.get( 0 ).equals( "true" );
          }
          else
            throw new RecipeError( "exceptions must be true or false explicitly." );
        }
        else if ( operation.equals( "crash" ) && (tokens.get( 0 ).equals( "true" ) || tokens.get( 0 ).equals( "false" )) )
        {
          if ( tokens.size() == 1 )
          {
            data.crash = tokens.get( 0 ).equals( "true" );
          }
          else
            throw new RecipeError( "crash must be true or false explicitly." );
        }
        else if ( operation.equals( "erroronmissing" ) )
        {
          if ( tokens.size() == 1 && (tokens.get( 0 ).equals( "true" ) || tokens.get( 0 ).equals( "false" )) )
          {
            data.erroronmissing = tokens.get( 0 ).equals( "true" );
          }
          else
            throw new RecipeError( "erroronmissing must be true or false explicitly." );
        }
        else if ( operation.equals( "import" ) )
        {
          if ( tokens.size() == 1 )
            (new RecipeHandler( this )).parseRecipes( loader, tokens.get( 0 ) );
          else
            throw new RecipeError( "Import must have exactly 1 input." );
        }
        else
          throw new RecipeError( operation + ": " + tokens.toString() + "; recipe without an output." );
      }

    }
    catch (RecipeError e)
    {
View Full Code Here

    for (String v : subList)
    {
      if ( v.equals( "," ) )
      {
        if ( hasQty )
          throw new RecipeError( "Qty found with no item." );
        if ( !cList.isEmpty() )
          out.add( cList );
        cList = new LinkedList<IIngredient>();
      }
      else
      {
        if ( isNumber( v ) )
        {
          if ( hasQty )
            throw new RecipeError( "Qty found with no item." );
          hasQty = true;
          qty = Integer.parseInt( v );
        }
        else
        {
View Full Code Here

      {
        inputs = input.get( 0 );
        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." );
  }
View Full Code Here

        pro_input = input.get( 0 ).get( 0 );
        pro_output = output.get( 0 ).toArray( new IIngredient[outs] );
        return;
      }
    }
    throw new RecipeError( "Grind must have a single input, and single output." );
  }
View Full Code Here

        pro_input = input.get( 0 ).get( 0 );
        pro_output = output.get( 0 ).toArray( new IIngredient[outs] );
        return;
      }
    }
    throw new RecipeError( "Grind must have a single input, and single output." );
  }
View Full Code Here

        {
          for (List<IIngredient> anInput : input)
          {
            if ( anInput.size() != cols )
            {
              throw new RecipeError( "all rows in a shaped crafting recipe must contain the same number of ingredients." );
            }
          }

          inputs = input;
          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." );
  }
View Full Code Here

TOP

Related Classes of appeng.api.exceptions.RecipeError

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.