Skip to content

Commit

Permalink
Fix fluid amount not updated in multiblock ui (#3561)
Browse files Browse the repository at this point in the history
Co-authored-by: Martin Robertz <dream-master@gmx.net>
Co-authored-by: Maya <10861407+serenibyss@users.noreply.github.com>
  • Loading branch information
3 people authored Nov 28, 2024
1 parent ff9a4a3 commit ec7328e
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import java.util.Map;
import java.util.Optional;
import java.util.function.LongConsumer;
import java.util.stream.Collectors;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;
Expand Down Expand Up @@ -2695,7 +2696,15 @@ && getBaseMetaTileEntity().wasShutdown()))
|| (mOutputItems != null && mOutputItems.length > 0)))
.widget(
new FakeSyncWidget.ListSyncer<>(
() -> mOutputFluids != null ? Arrays.asList(mOutputFluids) : Collections.emptyList(),
() -> mOutputFluids != null ? Arrays.stream(mOutputFluids)
.map(fluidStack -> new FluidStack(fluidStack, fluidStack.amount) {

@Override
public boolean isFluidEqual(FluidStack other) {
return super.isFluidEqual(other) && amount == other.amount;
}
})
.collect(Collectors.toList()) : Collections.emptyList(),
val -> mOutputFluids = val.toArray(new FluidStack[0]),
NetworkUtils::writeFluidStack,
NetworkUtils::readFluidStack))
Expand Down

0 comments on commit ec7328e

Please sign in to comment.