It takes a special kind of player

- Fixed Depot accepting item stacks with invalid amounts
- Fixed filter slots containing enchantment and attribute data of filter items
This commit is contained in:
simibubi 2024-09-02 21:20:17 +02:00
parent c267a413d9
commit fa5b71b7eb
4 changed files with 29 additions and 12 deletions

View File

@ -307,18 +307,27 @@ public class DepotBehaviour extends BlockEntityBehaviour {
return returned;
}
if (!simulate) {
if (this.isEmpty()) {
if (heldItem.insertedFrom.getAxis()
.isHorizontal())
AllSoundEvents.DEPOT_SLIDE.playOnServer(getWorld(), getPos());
else
AllSoundEvents.DEPOT_PLOP.playOnServer(getWorld(), getPos());
}
this.heldItem = heldItem;
onHeldInserted.accept(heldItem.stack);
ItemStack returned = ItemStack.EMPTY;
int maxCount = heldItem.stack.getMaxStackSize();
if (maxCount < heldItem.stack.getCount())
returned = ItemHandlerHelper.copyStackWithSize(heldItem.stack, heldItem.stack.getCount() - maxCount);
if (simulate)
return returned;
if (this.isEmpty()) {
if (heldItem.insertedFrom.getAxis()
.isHorizontal())
AllSoundEvents.DEPOT_SLIDE.playOnServer(getWorld(), getPos());
else
AllSoundEvents.DEPOT_PLOP.playOnServer(getWorld(), getPos());
}
return ItemStack.EMPTY;
heldItem = heldItem.copy();
heldItem.stack.setCount(maxCount);
this.heldItem = heldItem;
onHeldInserted.accept(heldItem.stack);
return returned;
}
public void setHeldItem(TransportedItemStack heldItem) {

View File

@ -23,6 +23,10 @@ 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))
return new ListFilterItemStack(filter);
if (AllItems.ATTRIBUTE_FILTER.isIn(filter))

View File

@ -380,7 +380,7 @@ public class BasinBlockEntity extends SmartBlockEntity implements IHaveGoggleInf
inserter = BlockEntityBehaviour.get(level, be.getBlockPos(), InvManipulationBehaviour.TYPE);
}
if (be instanceof BasinBlockEntity)
if (filter.isRecipeFilter())
filter = null; // Do not test spout outputs against the recipe filter
IItemHandler targetInv = be == null ? null

View File

@ -387,5 +387,9 @@ public class FilteringBehaviour extends BlockEntityBehaviour implements ValueSet
return setFilter(side, copied);
}
public boolean isRecipeFilter() {
return recipeFilter;
}
}