• Type: Bug
    • Resolution: Fixed
    • Priority: Minor
    • None
    • Affects Version/s: None
    • Environment:

      Spigot 1.9

      I am attempting to use the new MerchantRecipe API via the following code:

      String outputKey = tradeConfiguration.getString("output");
                              ItemStack output = controller.createItem(outputKey);
                              if (output == null || output.getType() == Material.AIR)
                              {
                                  controller.getLogger().warning("Invalid output specified in villager trade: " + outputKey);
                                  continue;
                              }
                              MerchantRecipe recipe = new MerchantRecipe(output, tradeConfiguration.getInt("max_uses", 1));
                              recipe.setExperienceReward(tradeConfiguration.getBoolean("experience_reward", true));
                              List<String> ingredientConfiguration = tradeConfiguration.getStringList("ingredients");
                              for (String ingredientKey : ingredientConfiguration) {
                                  ItemStack ingredient = controller.createItem(ingredientKey);
                                  if (ingredient == null || ingredient.getType() == Material.AIR)
                                  {
                                      controller.getLogger().warning("Invalid ingredient specified in villager trade: " + ingredientKey);
                                      continue;
                                  }
                                  recipe.addIngredient(ingredient);
                              }
                              villagerData.recipes.add(recipe);
      

      I have verified via debug prints that I am giving valid items to the villager. An example configuration I was testing is a simple emerald to stick conversion.

      The villager shows the emerald and a blank slot only. If I add an emerald to the trade slot, I will get a client crash. I also get a chunk save error- both logs are attached.

            Assignee:
            Xor Boole
            Reporter:
            Nathan Wolf
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: