Ejemplo n.º 1
0
 @Override
 public ArrayList<PacketEntry> getPacketInformation() {
   ArrayList<PacketEntry> entries = new ArrayList<PacketEntry>();
   String[] recipes = new String[addedRecipes.size()];
   for (int zahl = 0; zahl < recipes.length; zahl++)
     recipes[zahl] =
         StringUtils.ObjectsToString(
             WorkbenchHelper.getRecipeCategoryString(addedRecipes.get(zahl)),
             WorkbenchHelper.RecipeToString((IRecipe) addedRecipes.get(zahl)));
   entries.addAll(ArrayPacketEntry.getPacketArray(recipes));
   return entries;
 }
Ejemplo n.º 2
0
 @Override
 public void saveConfig(Configuration config) {
   if (config.getCategory("addshapedore") != null) config.getCategory("addshapedore").clear();
   if (config.getCategory("addshapelessore") != null)
     config.getCategory("addshapelessore").clear();
   for (int zahl = 0; zahl < addedRecipes.size(); zahl++) {
     IRecipe recipeO = (IRecipe) addedRecipes.get(zahl);
     if (recipeO != null)
       config.get(
           "add" + WorkbenchHelper.getRecipeCategoryString(recipeO),
           WorkbenchHelper.RecipeToString(recipeO),
           true);
   }
 }
Ejemplo n.º 3
0
  @Override
  public void loadConfig(Configuration config) {
    addedRecipes.clear();

    // items|result|x|y
    Map<String, Property> shaped = config.getCategory("addshapedore").getValues();
    for (int zahl = 0; zahl < shaped.size(); zahl++) {
      Property RecipeData = (Property) shaped.values().toArray()[zahl];
      String Data = RecipeData.getName();
      IRecipe recipe = WorkbenchHelper.StringToRecipe(true, Data);
      if (recipe != null) addedRecipes.add(recipe);
    }

    Map<String, Property> shapless = config.getCategory("addshapelessore").getValues();
    for (int zahl = 0; zahl < shapless.size(); zahl++) {
      Property RecipeData = (Property) shapless.values().toArray()[zahl];
      String Data = RecipeData.getName();
      IRecipe recipe = WorkbenchHelper.StringToRecipe(false, Data);
      if (recipe != null) addedRecipes.add(recipe);
    }
    CraftingManager.getInstance().getRecipeList().addAll(addedRecipes);
  }
Ejemplo n.º 4
0
 @Override
 public void UpdateInformation(ArrayList<PacketEntry> Packet) {
   addedRecipes.clear();
   String[] input = ArrayPacketEntry.getArray(Packet);
   for (int zahl = 0; zahl < input.length; zahl++) {
     Object[] objects = StringUtils.StringToObjects(input[zahl]);
     if (objects.length == 2 && objects[0] instanceof String && objects[1] instanceof String) {
       IRecipe recipe =
           WorkbenchHelper.StringToRecipe(objects[0].equals("shapedore"), (String) objects[1]);
       if (recipe != null && !addedRecipes.contains(recipe)) addedRecipes.add(recipe);
     }
   }
   List mcRecipes = CraftingManager.getInstance().getRecipeList();
   List newRecipes = new ArrayList();
   for (int i = 0; i < mcRecipes.size(); i++) {
     if (!(mcRecipes.get(i) instanceof BetterShapedRecipe)
         && !(mcRecipes.get(i) instanceof BetterShapelessRecipe)) newRecipes.add(mcRecipes.get(i));
   }
   newRecipes.addAll(addedRecipes);
   mcRecipes.clear();
   mcRecipes.addAll(newRecipes);
 }