Fixed External Storage sending storage updates when it is disabled. Fixes #2110

This commit is contained in:
raoulvdberge
2018-11-28 20:54:23 +01:00
parent f5beae667c
commit 168c3c6a6b
5 changed files with 9 additions and 7 deletions

View File

@@ -2,6 +2,7 @@
### 1.6.12
- Increased the speed of autocrafting (raoulvdberge)
- Fixed External Storage sending storage updates when it is disabled (raoulvdberge)
- Added a completion percentage to the Crafting Monitor (raoulvdberge)
- Updated Russian translation (kellixon)

View File

@@ -122,7 +122,7 @@ public class CraftingTask implements ICraftingTask {
this.executionStarted = tag.getLong(NBT_EXECUTION_STARTED);
if (tag.hasKey(NBT_TOTAL_STEPS)) {
totalSteps = tag.getInteger(NBT_TOTAL_STEPS);
this.totalSteps = tag.getInteger(NBT_TOTAL_STEPS);
}
StorageDiskFactoryItem factoryItem = new StorageDiskFactoryItem();

View File

@@ -83,7 +83,7 @@ public class NetworkNodeExternalStorage extends NetworkNode implements IStorageP
public void update() {
super.update();
if (network != null) {
if (canUpdate()) {
if (networkTicks++ == 0) {
updateStorage(network);

View File

@@ -60,7 +60,7 @@ public class StorageCacheFluid implements IStorageCache<FluidStack> {
if (!batched) {
listeners.forEach(l -> l.onChanged(stack, size));
} else {
batchedChanges.add(Pair.of(stack, size));
batchedChanges.add(Pair.of(stack.copy(), size));
}
}
}
@@ -71,7 +71,7 @@ public class StorageCacheFluid implements IStorageCache<FluidStack> {
if (!batched) {
listeners.forEach(l -> l.onChanged(stack, -size));
} else {
batchedChanges.add(Pair.of(stack, -size));
batchedChanges.add(Pair.of(stack.copy(), -size));
}
}
}

View File

@@ -62,7 +62,7 @@ public class StorageCacheItem implements IStorageCache<ItemStack> {
if (!batched) {
listeners.forEach(l -> l.onChanged(stack, size));
} else {
batchedChanges.add(Pair.of(stack, size));
batchedChanges.add(Pair.of(stack.copy(), size));
}
}
}
@@ -73,7 +73,7 @@ public class StorageCacheItem implements IStorageCache<ItemStack> {
if (!batched) {
listeners.forEach(l -> l.onChanged(stack, -size));
} else {
batchedChanges.add(Pair.of(stack, -size));
batchedChanges.add(Pair.of(stack.copy(), -size));
}
}
}
@@ -81,11 +81,12 @@ public class StorageCacheItem implements IStorageCache<ItemStack> {
@Override
public synchronized void flush() {
if (!batchedChanges.isEmpty()) {
if(batchedChanges.size() > 1) {
if (batchedChanges.size() > 1) {
listeners.forEach(l -> l.onChangedBulk(batchedChanges));
} else {
batchedChanges.forEach(c -> listeners.forEach(l -> l.onChanged(c.getKey(), c.getValue())));
}
batchedChanges.clear();
}
}