Skip to content

Commit 54ecb0a

Browse files
committed
Actually use allowNetworkIo
1 parent a3c1efd commit 54ecb0a

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/main/java/dev/technici4n/moderndynamics/network/fluid/FluidCache.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,6 @@ public void doTick() {
160160

161161
// For the MVP, we separate again and then sync each fluid value.
162162
// TODO: smarter fluid syncing logic
163-
// When this is removed, make sure to update the fluid variant in all the connected nodes.
164163
separate();
165164
}
166165

@@ -328,6 +327,10 @@ public class FluidCacheStorage extends SnapshotParticipant<ResourceAmount<FluidV
328327
public long insert(FluidVariant insertedVariant, long maxAmount, TransactionContext transaction) {
329328
StoragePreconditions.notBlankNotNegative(insertedVariant, maxAmount);
330329

330+
if (!allowNetworkIo) {
331+
return 0;
332+
}
333+
331334
if (insertedVariant.equals(variant) || (variant.isBlank() && canChangeVariant())) {
332335
long insertedAmount = Math.min(maxAmount, getCapacity() - amount);
333336
if (insertedAmount > 0) {
@@ -349,6 +352,10 @@ public long insert(FluidVariant insertedVariant, long maxAmount, TransactionCont
349352
public long extract(FluidVariant extractedVariant, long maxAmount, TransactionContext transaction) {
350353
StoragePreconditions.notBlankNotNegative(extractedVariant, maxAmount);
351354

355+
if (!allowNetworkIo) {
356+
return 0;
357+
}
358+
352359
if (extractedVariant.equals(variant)) {
353360
long extractedAmount = Math.min(maxAmount, amount);
354361
if (extractedAmount > 0) {

0 commit comments

Comments
 (0)