Fix faster_ingredients bypassing defensive copy of ItemValue

Kudos to @nutant233 for noticing this
This commit is contained in:
embeddedt 2025-07-04 18:42:39 -04:00
parent cf5c81f7e2
commit 6b37051980
No known key found for this signature in database
GPG Key ID: A69433EC199B5613

View File

@ -142,9 +142,7 @@ public abstract class IngredientMixin implements ExtendedIngredient {
private ItemStack[] computeItemsArray() {
// Fast path for case with one item
if (this.values.length == 1) {
if (this.values[0] instanceof Ingredient.ItemValue itemValue) {
return new ItemStack[] { itemValue.item };
} else if (this.values[0] instanceof Ingredient.TagValue tagValue && mfix$areTagsAvailable()) {
if (this.values[0] instanceof Ingredient.TagValue tagValue && mfix$areTagsAvailable()) {
var tag = BuiltInRegistries.ITEM.getTag(tagValue.tag);
if (tag.isPresent() && tag.get().size() > 0) {
var holderSet = tag.get();