fix: enchantments getting trimmed from non-filter items (#7216)

This commit is contained in:
VoidLeech 2025-01-10 18:20:13 +01:00 committed by GitHub
parent 507829443f
commit fc94c75866
Failed to generate hash of commit

View file

@ -23,14 +23,15 @@ public class FilterItemStack {
public static FilterItemStack of(ItemStack filter) {
if (filter.hasTag()) {
CompoundTag stackTag = filter.getTag();
stackTag.remove("Enchantments");
stackTag.remove("AttributeModifiers");
if (AllItems.FILTER.isIn(filter))
if (AllItems.FILTER.isIn(filter)){
trimFilterTag(filter);
return new ListFilterItemStack(filter);
if (AllItems.ATTRIBUTE_FILTER.isIn(filter))
}
if (AllItems.ATTRIBUTE_FILTER.isIn(filter)){
trimFilterTag(filter);
return new AttributeFilterItemStack(filter);
}
}
return new FilterItemStack(filter);
@ -44,6 +45,12 @@ public class FilterItemStack {
return of(ItemStack.EMPTY);
}
private static void trimFilterTag(ItemStack filter){
CompoundTag stackTag = filter.getTag();
stackTag.remove("Enchantments");
stackTag.remove("AttributeModifiers");
}
public boolean isEmpty() {
return filterItemStack.isEmpty();
}