Пример #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;
 }
Пример #2
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);
 }