Skip to content

Commit

Permalink
More brokenness fixed! How did this ever get past my testing?! Did I …
Browse files Browse the repository at this point in the history
…even test?!

Note to self: test EVERYTHING after a big change, not just the thing you believe it may have affected.
  • Loading branch information
gigaherz committed Jan 1, 2017
1 parent 540b630 commit 0b8e530
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 28 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
1 change: 0 additions & 1 deletion src/main/java/gigaherz/enderRift/EnderRiftMod.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
12 changes: 0 additions & 12 deletions src/main/java/gigaherz/enderRift/automation/AutomationHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
25 changes: 13 additions & 12 deletions src/main/java/gigaherz/enderRift/rift/storage/RiftInventory.java
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand All @@ -127,21 +130,19 @@ public ItemStack insertItem(int index, ItemStack stack, boolean simulate)
}
}

onContentsChanged();
if (!simulate) onContentsChanged();

return remaining;
}

@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;
Expand All @@ -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;
Expand Down

0 comments on commit 0b8e530

Please sign in to comment.