Skip to content

Commit

Permalink
add tag server.recipe_result
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed May 26, 2020
1 parent e4f8687 commit 5240ef1
Showing 1 changed file with 16 additions and 0 deletions.
Expand Up @@ -261,6 +261,22 @@ else if (recipe instanceof CookingRecipe<?>) {
return;
}

// <--[tag]
// @attribute <server.recipe_result[<id>]>
// @returns ItemTag
// @description
// Returns the item that a recipe will create when crafted.
// -->
if (attribute.startsWith("recipe_result") && attribute.hasContext(1)) {
NamespacedKey key = Utilities.parseNamespacedKey(attribute.getContext(1));
Recipe recipe = NMSHandler.getItemHelper().getRecipeById(key);
if (recipe == null) {
return;
}
event.setReplacedObject(new ItemTag(recipe.getResult()));
return;
}

if (attribute.startsWith("scoreboard")) {
Scoreboard board;
String name = "main";
Expand Down

0 comments on commit 5240ef1

Please sign in to comment.