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 ### 1.6.12
- Increased the speed of autocrafting (raoulvdberge) - 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) - Added a completion percentage to the Crafting Monitor (raoulvdberge)
- Updated Russian translation (kellixon) - Updated Russian translation (kellixon)

View File

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

View File

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

View File

@@ -60,7 +60,7 @@ public class StorageCacheFluid implements IStorageCache<FluidStack> {
if (!batched) { if (!batched) {
listeners.forEach(l -> l.onChanged(stack, size)); listeners.forEach(l -> l.onChanged(stack, size));
} else { } 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) { if (!batched) {
listeners.forEach(l -> l.onChanged(stack, -size)); listeners.forEach(l -> l.onChanged(stack, -size));
} else { } 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) { if (!batched) {
listeners.forEach(l -> l.onChanged(stack, size)); listeners.forEach(l -> l.onChanged(stack, size));
} else { } 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) { if (!batched) {
listeners.forEach(l -> l.onChanged(stack, -size)); listeners.forEach(l -> l.onChanged(stack, -size));
} else { } else {
batchedChanges.add(Pair.of(stack, -size)); batchedChanges.add(Pair.of(stack.copy(), -size));
} }
} }
} }
@@ -86,6 +86,7 @@ public class StorageCacheItem implements IStorageCache<ItemStack> {
} else { } else {
batchedChanges.forEach(c -> listeners.forEach(l -> l.onChanged(c.getKey(), c.getValue()))); batchedChanges.forEach(c -> listeners.forEach(l -> l.onChanged(c.getKey(), c.getValue())));
} }
batchedChanges.clear(); batchedChanges.clear();
} }
} }