Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/inverter card for fluid storage bus #224

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.function.Predicate;

import javax.annotation.Nullable;

Expand Down Expand Up @@ -91,7 +92,7 @@ public class PartFluidStorageBus extends PartUpgradeable
private boolean wasActive = false;
private byte resetCacheLogic = 0;
/**
* used when changing access settings to read the changes once
* used to read changes once when the list of extractable items was changed
*/
private boolean readOncePass = false;

Expand Down Expand Up @@ -136,14 +137,6 @@ protected int getUpgradeSlots() {

@Override
public void updateSetting(final IConfigManager manager, final Enum settingName, final Enum newValue) {
if (settingName == Settings.ACCESS && this.handler != null) {
AccessRestriction currentAccess = this.handler.getAccess();
if (newValue != currentAccess && currentAccess.hasPermission(AccessRestriction.READ)) {
if (newValue == AccessRestriction.WRITE || newValue == AccessRestriction.READ) {
this.readOncePass = true;
}
}
}
this.resetCache(true);
this.getHost().markForSave();
}
Expand Down Expand Up @@ -273,8 +266,9 @@ private Iterable<IAEFluidStack> filterChanges(final Iterable<IAEFluidStack> chan
if (this.handler != null && this.handler.isExtractFilterActive()
&& !this.handler.getExtractPartitionList().isEmpty()) {
List<IAEFluidStack> filteredChanges = new ArrayList<>();
Predicate<IAEFluidStack> extractFilterCondition = this.handler.getExtractFilterCondition();
for (final IAEFluidStack changedFluid : change) {
if (this.handler.getExtractPartitionList().isListed(changedFluid)) {
if (extractFilterCondition.test(changedFluid)) {
filteredChanges.add(changedFluid);
}
}
Expand Down Expand Up @@ -381,6 +375,7 @@ public MEInventoryHandler<IAEFluidStack> getInternalHandler() {
this.handlerHash = newHandlerHash;
this.handler = null;
this.monitor = null;
this.readOncePass = true;
if (target != null) {
final IExternalStorageHandler esh = AEApi.instance().registries().externalStorage()
.getHandler(target, this.getSide().getOpposite(), StorageChannel.FLUIDS, this.source);
Expand Down
Loading