diff --git a/build.gradle b/build.gradle index c105b1d..3f06bba 100644 --- a/build.gradle +++ b/build.gradle @@ -33,7 +33,7 @@ repositories { apply plugin: 'net.minecraftforge.gradle.forge' -version = "2.1.1" +version = "2.1.2" group= "gigaherz.enderRift" archivesBaseName = "EnderRift-1.11.0" diff --git a/src/main/java/gigaherz/enderRift/EnderRiftMod.java b/src/main/java/gigaherz/enderRift/EnderRiftMod.java index cdcffb8..7c73850 100644 --- a/src/main/java/gigaherz/enderRift/EnderRiftMod.java +++ b/src/main/java/gigaherz/enderRift/EnderRiftMod.java @@ -37,7 +37,6 @@ import net.minecraftforge.fml.common.registry.GameRegistry; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.oredict.RecipeSorter; -import org.apache.commons.io.IOUtils; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; diff --git a/src/main/java/gigaherz/enderRift/automation/AutomationHelper.java b/src/main/java/gigaherz/enderRift/automation/AutomationHelper.java index ca710e2..ce151eb 100644 --- a/src/main/java/gigaherz/enderRift/automation/AutomationHelper.java +++ b/src/main/java/gigaherz/enderRift/automation/AutomationHelper.java @@ -72,18 +72,6 @@ public static ItemStack extractItems(IItemHandler parent, ItemStack stack, int w { ItemStack obtained = parent.extractItem(i, requested, simulate); - if (obtained.getCount() > 0 && !simulate) - { - int remaining = slot.getCount() - obtained.getCount(); - int found = 0; - slot = parent.getStackInSlot(i); - if (slot.getCount() > 0) - found = slot.getCount(); - - if (found != remaining) - EnderRiftMod.logger.warn("DAFUQ, Found an incorrect number of items in the slot " + i + " after extraction! Found: " + found + " expected " + remaining); - } - int returned = obtained.getCount(); extractCount += returned; diff --git a/src/main/java/gigaherz/enderRift/automation/browser/ContainerBrowser.java b/src/main/java/gigaherz/enderRift/automation/browser/ContainerBrowser.java index b0ac588..b61e3d2 100644 --- a/src/main/java/gigaherz/enderRift/automation/browser/ContainerBrowser.java +++ b/src/main/java/gigaherz/enderRift/automation/browser/ContainerBrowser.java @@ -333,7 +333,7 @@ public ItemStack slotClick(int slotId, int clickedButton, ClickType mode, Entity dropping.shrink(push.getCount()); - if (remaining != null) + if (remaining.getCount() > 0) { if (push.getCount() != remaining.getCount()) tile.markDirty(); diff --git a/src/main/java/gigaherz/enderRift/automation/iface/TileInterface.java b/src/main/java/gigaherz/enderRift/automation/iface/TileInterface.java index b1c85b5..74b9c16 100644 --- a/src/main/java/gigaherz/enderRift/automation/iface/TileInterface.java +++ b/src/main/java/gigaherz/enderRift/automation/iface/TileInterface.java @@ -242,7 +242,7 @@ private class FilterInventory implements IItemHandlerModifiable public FilterInventory(int slotCount) { - filters = NonNullList.withSize(slotCount,ItemStack.EMPTY); + filters = NonNullList.withSize(slotCount, ItemStack.EMPTY); } @Override diff --git a/src/main/java/gigaherz/enderRift/common/AutomationEnergyWrapper.java b/src/main/java/gigaherz/enderRift/common/AutomationEnergyWrapper.java index 3ddf5d5..9fd692b 100644 --- a/src/main/java/gigaherz/enderRift/common/AutomationEnergyWrapper.java +++ b/src/main/java/gigaherz/enderRift/common/AutomationEnergyWrapper.java @@ -110,6 +110,7 @@ public ItemStack extractItem(int slot, int wanted, boolean simulate) while (cost > energyBuffer.getEnergyStored() && wanted > 0) { wanted--; + cost = getEffectivePowerUsageToExtract(wanted); } if (wanted <= 0) diff --git a/src/main/java/gigaherz/enderRift/rift/storage/RiftInventory.java b/src/main/java/gigaherz/enderRift/rift/storage/RiftInventory.java index 708fbe6..6a5aef4 100644 --- a/src/main/java/gigaherz/enderRift/rift/storage/RiftInventory.java +++ b/src/main/java/gigaherz/enderRift/rift/storage/RiftInventory.java @@ -92,29 +92,32 @@ public void writeToNBT(NBTTagCompound nbtTagCompound) @Override public int getSlots() { - return inventorySlots.size() + 2; + return inventorySlots.size() + 1; } @Override public ItemStack getStackInSlot(int index) { - if (index <= 0 || (index - 1) >= inventorySlots.size()) + if (index >= inventorySlots.size()) return ItemStack.EMPTY; - return inventorySlots.get(index - 1); + return inventorySlots.get(index); } @Override public ItemStack insertItem(int index, ItemStack stack, boolean simulate) { - if (index <= 0 || (index - 1) >= inventorySlots.size()) + if (index >= inventorySlots.size()) { - inventorySlots.add(stack.copy()); + if (!simulate) { + inventorySlots.add(stack.copy()); + onContentsChanged(); + } return ItemStack.EMPTY; } ItemStack remaining = stack.copy(); - ItemStack slot = inventorySlots.get(index - 1); - if (slot != null) + ItemStack slot = inventorySlots.get(index); + if (slot.getCount() > 0) { int max = Math.min(remaining.getMaxStackSize(), 64); int transfer = Math.min(remaining.getCount(), max - slot.getCount()); @@ -127,7 +130,7 @@ public ItemStack insertItem(int index, ItemStack stack, boolean simulate) } } - onContentsChanged(); + if (!simulate) onContentsChanged(); return remaining; } @@ -135,13 +138,11 @@ public ItemStack insertItem(int index, ItemStack stack, boolean simulate) @Override public ItemStack extractItem(int index, int wanted, boolean simulate) { - if (index <= 0 || (index - 1) >= inventorySlots.size()) + if (index >= inventorySlots.size()) { return ItemStack.EMPTY; } - index--; - ItemStack slot = inventorySlots.get(index); if (slot == null) return ItemStack.EMPTY; @@ -165,7 +166,7 @@ public ItemStack extractItem(int index, int wanted, boolean simulate) if (extractedCount <= 0) return ItemStack.EMPTY; - onContentsChanged(); + if (!simulate) onContentsChanged(); _extracted.setCount(extractedCount); return _extracted;