Skip to content

Commit

Permalink
Fixed tags not creating a criterion properly, closes #74
Browse files Browse the repository at this point in the history
  • Loading branch information
Buuz135 committed Dec 27, 2020
1 parent 33a8942 commit 2f07b51
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
import net.minecraft.advancements.criterion.InventoryChangeTrigger;
import net.minecraft.advancements.criterion.ItemPredicate;
import net.minecraft.data.ShapelessRecipeBuilder;
import net.minecraft.item.Item;
import net.minecraft.item.crafting.Ingredient;
import net.minecraft.tags.ITag;
import net.minecraft.util.IItemProvider;

public class TitaniumShapelessRecipeBuilder extends ShapelessRecipeBuilder {
Expand Down Expand Up @@ -38,4 +40,13 @@ public ShapelessRecipeBuilder addIngredient(Ingredient ingredientIn, int quantit
}
return super.addIngredient(ingredientIn, quantity);
}

@Override
public ShapelessRecipeBuilder addIngredient(ITag<Item> tagIn) {
if (!this.criterion) {
this.criterion = true;
addCriterion("has_item", InventoryChangeTrigger.Instance.forItems(ItemPredicate.Builder.create().tag(tagIn).build()));
}
return super.addIngredient(tagIn);
}
}

0 comments on commit 2f07b51

Please sign in to comment.