Skip to content

Commit

Permalink
My first commit of 2017! As a celebration, I'm fixing a bug, and rele…
Browse files Browse the repository at this point in the history
…asing a bugfix!
  • Loading branch information
gigaherz committed Dec 31, 2016
1 parent 8532f3e commit 540b630
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 29 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.0"
version = "2.1.1"
group= "gigaherz.enderRift"
archivesBaseName = "EnderRift-1.11.0"

Expand Down
1 change: 1 addition & 0 deletions src/main/java/gigaherz/enderRift/EnderRiftMod.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
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
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ public ItemStack slotClick(int slotId, int clickedButton, ClickType mode, Entity
copy.setCount(1);
slot.putStack(copy);
}
else if (slot.getStack() != null)
else if (slot.getStack().getCount() > 0)
{
slot.putStack(null);
slot.putStack(ItemStack.EMPTY);
}

return slot.getStack().copy();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.NonNullList;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.util.Constants;
import net.minecraftforge.items.CapabilityItemHandler;
Expand Down Expand Up @@ -111,7 +112,7 @@ public void update()
ItemStack inSlot = outputs.getStackInSlot(i);
if (inFilter.getCount() > 0)
{
if (inSlot.getCount() > 0)
if (inSlot.getCount() <= 0)
{
int free = 64;
inSlot = AutomationHelper.extractItems(getCombinedInventory(), inFilter, free, false);
Expand Down Expand Up @@ -237,11 +238,11 @@ public boolean isUseableByPlayer(EntityPlayer player)

private class FilterInventory implements IItemHandlerModifiable
{
final ItemStack[] filters;
final NonNullList<ItemStack> filters;

public FilterInventory(int slotCount)
{
filters = new ItemStack[slotCount];
filters = NonNullList.withSize(slotCount,ItemStack.EMPTY);
}

@Override
Expand All @@ -253,21 +254,22 @@ public int getSlots()
@Override
public ItemStack getStackInSlot(int slot)
{
if (slot < 0 || slot >= filters.length)
if (slot < 0 || slot >= filters.size())
return ItemStack.EMPTY;
return filters[slot];
return filters.get(slot);
}

@Override
public ItemStack insertItem(int slot, ItemStack stack, boolean simulate)
{
if (slot < 0 || slot >= filters.length)
if (slot < 0 || slot >= filters.size())
return stack;

if (!simulate)
{
filters[slot] = stack.copy();
filters[slot].setCount(1);
ItemStack cp = stack.copy();
cp.setCount(1);
filters.set(slot, cp);
}

return stack;
Expand All @@ -288,27 +290,12 @@ public int getSlotLimit(int slot)
@Override
public void setStackInSlot(int index, ItemStack stack)
{
filters[index] = stack;
stack = stack.copy();
stack.setCount(1);

if (stack.getCount() > this.getInventoryStackLimit())
{
stack.setCount(this.getInventoryStackLimit());
}
filters.set(index, stack);

markDirty();
}

public int getInventoryStackLimit()
{
return 1;
}

public void clear()
{
for (int i = 0; i < filters.length; ++i)
{
filters[i] = null;
}
}
}
}

0 comments on commit 540b630

Please sign in to comment.