This commit is contained in:
raoulvdberge
2017-01-20 22:38:34 +01:00
parent fa7d60cced
commit cd00810ea1

View File

@@ -48,17 +48,23 @@ public abstract class StorageItemExternal implements IStorage<ItemStack> {
} else if (cached.isEmpty() && !actual.isEmpty()) {
// If the cached is empty and the actual isn't, we added this item
network.getItemStorageCache().add(actual, actual.getCount(), false);
network.getCraftingManager().track(actual, actual.getCount());
} else if (cached.isEmpty() && actual.isEmpty()) {
// If they're both empty, nothing happens
} else if (!API.instance().getComparer().isEqualNoQuantity(cached, actual)) {
// If both items mismatch, remove the old and add the new
network.getItemStorageCache().remove(cached, cached.getCount());
network.getItemStorageCache().add(actual, actual.getCount(), false);
network.getCraftingManager().track(actual, actual.getCount());
} else if (cached.getCount() != actual.getCount()) {
int delta = actual.getCount() - cached.getCount();
if (delta > 0) {
network.getItemStorageCache().add(actual, delta, false);
network.getCraftingManager().track(actual, delta);
} else {
network.getItemStorageCache().remove(actual, Math.abs(delta));
}