Fixed item duplication bug with External Storage
This commit is contained in:
@@ -1,5 +1,10 @@
|
|||||||
# Refined Storage Changelog
|
# Refined Storage Changelog
|
||||||
|
|
||||||
|
### 0.8.19
|
||||||
|
**Bugfixes**
|
||||||
|
- Fixed item duplication bug with External Storage
|
||||||
|
- Fixed External Storage taking too long to update storage
|
||||||
|
|
||||||
### 0.8.18
|
### 0.8.18
|
||||||
**Bugfixes**
|
**Bugfixes**
|
||||||
- Fixed Detector mode not persisting
|
- Fixed Detector mode not persisting
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ public class GroupedItemStorage implements IGroupedItemStorage {
|
|||||||
if (CompareUtils.compareStackNoQuantity(otherStack, stack)) {
|
if (CompareUtils.compareStackNoQuantity(otherStack, stack)) {
|
||||||
otherStack.stackSize -= stack.stackSize;
|
otherStack.stackSize -= stack.stackSize;
|
||||||
|
|
||||||
if (otherStack.stackSize == 0) {
|
if (otherStack.stackSize <= 0) {
|
||||||
if (!NetworkUtils.hasPattern(network, stack)) {
|
if (!NetworkUtils.hasPattern(network, stack)) {
|
||||||
stacks.remove(otherStack.getItem(), otherStack);
|
stacks.remove(otherStack.getItem(), otherStack);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,21 +47,33 @@ public class ItemStorageItemHandler extends ItemStorageExternal {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack extractItem(ItemStack stack, int size, int flags) {
|
public ItemStack extractItem(ItemStack stack, int size, int flags) {
|
||||||
|
int remaining = size;
|
||||||
|
|
||||||
|
ItemStack received = null;
|
||||||
|
|
||||||
for (int i = 0; i < handler.getSlots(); ++i) {
|
for (int i = 0; i < handler.getSlots(); ++i) {
|
||||||
ItemStack slot = handler.getStackInSlot(i);
|
ItemStack slot = handler.getStackInSlot(i);
|
||||||
|
|
||||||
if (slot != null && CompareUtils.compareStack(slot, stack, flags)) {
|
if (slot != null && CompareUtils.compareStack(slot, stack, flags)) {
|
||||||
size = Math.min(size, slot.stackSize);
|
ItemStack got = handler.extractItem(i, remaining, false);
|
||||||
|
|
||||||
ItemStack took = ItemHandlerHelper.copyStackWithSize(slot, size);
|
if (got != null) {
|
||||||
|
if (received == null) {
|
||||||
|
received = got;
|
||||||
|
} else {
|
||||||
|
received.stackSize += got.stackSize;
|
||||||
|
}
|
||||||
|
|
||||||
handler.extractItem(i, size, false);
|
remaining -= got.stackSize;
|
||||||
|
|
||||||
return took;
|
if (remaining == 0) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return received;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -102,19 +102,17 @@ public class TileExternalStorage extends TileMultipartNode implements IStoragePr
|
|||||||
@Override
|
@Override
|
||||||
public void update() {
|
public void update() {
|
||||||
if (!worldObj.isRemote && network != null) {
|
if (!worldObj.isRemote && network != null) {
|
||||||
if (ticks % (20 * 4) == 0) {
|
boolean changeDetected = false;
|
||||||
boolean shouldRebuild = false;
|
|
||||||
|
|
||||||
for (ItemStorageExternal storage : storages) {
|
for (ItemStorageExternal storage : storages) {
|
||||||
if (storage.updateCache()) {
|
if (storage.updateCache()) {
|
||||||
shouldRebuild = true;
|
changeDetected = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (shouldRebuild) {
|
if (changeDetected) {
|
||||||
network.getItemStorage().rebuild();
|
network.getItemStorage().rebuild();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (getFacingTile() instanceof IDrawerGroup && lastDrawerCount != ((IDrawerGroup) getFacingTile()).getDrawerCount()) {
|
if (getFacingTile() instanceof IDrawerGroup && lastDrawerCount != ((IDrawerGroup) getFacingTile()).getDrawerCount()) {
|
||||||
lastDrawerCount = ((IDrawerGroup) getFacingTile()).getDrawerCount();
|
lastDrawerCount = ((IDrawerGroup) getFacingTile()).getDrawerCount();
|
||||||
|
|||||||
Reference in New Issue
Block a user