public static void addResearch(String string, String category, BookPage... pages) {
    if (!category.substring(0, 1).equals("!")) {
      research.add(MutablePair.of(string, category));
      researchPages.put(string, pages);
      int pageNum = 0;
      for (BookPage page : pages) {
        if (page instanceof ICraftingPage) {
          for (ItemStack craftedItem : ((ICraftingPage) page).getCraftedItem()) {
            bookRecipes.put(craftedItem, MutablePair.of(string, pageNum));
          }
        }
        pageNum++;
      }
    } else {

      BookPage[] targetPages = researchPages.get(category.substring(1));
      int pageNum = targetPages.length;
      for (BookPage page : pages) {
        if (page instanceof ICraftingPage) {
          for (ItemStack craftedItem : ((ICraftingPage) page).getCraftedItem()) {
            bookRecipes.put(craftedItem, MutablePair.of(category.substring(1), pageNum));
          }
        }
        pageNum++;
      }
      ArrayList<BookPage> pages2 = new ArrayList<BookPage>(Arrays.asList(targetPages));
      for (BookPage page : pages) {
        pages2.add(page);
      }
      researchPages.put(category.substring(1), (BookPage[]) pages2.toArray(new BookPage[0]));
    }
  }
Exemplo n.º 2
0
 public void hideRecommendation(int userid, int beatmapid, long mods) {
   for (MutablePair<GivenRecommendation, Boolean> rec :
       database.users.get(userid).givenRecommendations) {
     if (rec.left.beatmapid == beatmapid && rec.left.mods == mods) {
       rec.right = false;
     }
   }
 }
 public static void registerSmeltTool(Item item, CrucibleLiquid liquid, int m) {
   for (int i = 0; i < item.getMaxDamage(); i++) {
     smeltThings.put(
         MutablePair.of(item, i),
         MutablePair.of(
             liquid,
             MathHelper.floor_double(
                 m * ((float) (item.getMaxDamage() - i) / (float) item.getMaxDamage()))));
   }
 }
 public static void addSteamFood(Item food1, Item food2) {
   steamedFoods.put(MutablePair.of(food1, -1), MutablePair.of(food2, -1));
 }
 public static void addSteamFood(Item food1, int i, Item food2, int j) {
   steamedFoods.put(MutablePair.of(food1, i), MutablePair.of(food2, j));
 }
 public static void registerSmeltThing(Item item, CrucibleLiquid liquid, int m) {
   smeltThings.put(MutablePair.of(item, -1), MutablePair.of(liquid, m));
 }
 public static void registerDunkThing(
     Item item, CrucibleLiquid liquid, int liquidAmount, ItemStack result) {
   dunkThings.put(new Tuple3(item, -1, liquid), MutablePair.of(liquidAmount, result));
 }