Skip to content

Commit

Permalink
do not save item to slot unless the same item, attempted fix of #5
Browse files Browse the repository at this point in the history
  • Loading branch information
Trcx528 committed Mar 19, 2015
1 parent 27be116 commit 348c6ae
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/main/java/com/trcx/swapper/Common/Item/Swapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,15 @@ public static ItemStack getStack(int slot, ItemStack swapper){
public static void putLastStack(ItemStack swapper, ItemStack is){
ItemInventory inv = new ItemInventory(swapper,swapperSlots);
int slot = swapper.stackTagCompound.getInteger(stringLASTTOOL);
if (is.stackSize > 0) {
inv.setInventorySlotContents(slot, is);
ItemStack currentIs = getLastStack(swapper);
if (is != null) {
if (is.stackSize > 0) {
if (is.getItem() == currentIs.getItem()) {
inv.setInventorySlotContents(slot, is);
} // else don't do anything as this would probably dupe is
} else {
inv.setInventorySlotContents(slot, null);
}
} else {
inv.setInventorySlotContents(slot, null);
}
Expand Down

0 comments on commit 348c6ae

Please sign in to comment.