mirror of
https://github.com/Creators-of-Create/Create.git
synced 2025-01-30 14:55:07 +01:00
fix: enchantments getting trimmed from non-filter items (#7216)
This commit is contained in:
parent
507829443f
commit
fc94c75866
1 changed files with 17 additions and 10 deletions
|
@ -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);
|
||||
|
@ -39,11 +40,17 @@ public class FilterItemStack {
|
|||
public static FilterItemStack of(CompoundTag tag) {
|
||||
return of(ItemStack.of(tag));
|
||||
}
|
||||
|
||||
|
||||
public static FilterItemStack empty() {
|
||||
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();
|
||||
}
|
||||
|
@ -51,16 +58,16 @@ public class FilterItemStack {
|
|||
public CompoundTag serializeNBT() {
|
||||
return filterItemStack.serializeNBT();
|
||||
}
|
||||
|
||||
|
||||
public ItemStack item() {
|
||||
return filterItemStack;
|
||||
}
|
||||
|
||||
|
||||
public FluidStack fluid(Level level) {
|
||||
resolveFluid(level);
|
||||
return filterFluidStack;
|
||||
}
|
||||
|
||||
|
||||
public boolean isFilterItem() {
|
||||
return filterItemStack.getItem() instanceof FilterItem;
|
||||
}
|
||||
|
@ -98,7 +105,7 @@ public class FilterItemStack {
|
|||
}
|
||||
|
||||
//
|
||||
|
||||
|
||||
private void resolveFluid(Level world) {
|
||||
if (!fluidExtracted) {
|
||||
fluidExtracted = true;
|
||||
|
|
Loading…
Reference in a new issue