Skip to content

Commit

Permalink
Pretend I fixed the bin dupe.
Browse files Browse the repository at this point in the history
  • Loading branch information
juanmuscaria committed May 3, 2021
1 parent 001dfbf commit 00d8b41
Showing 1 changed file with 57 additions and 55 deletions.
112 changes: 57 additions & 55 deletions src/main/java/mekanism/common/recipe/BinRecipe.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,61 +50,63 @@ public ItemStack getCraftingResult(InventoryCrafting inv)

public ItemStack getResult(IInventory inv)
{
ItemStack bin = null;

for(int i = 0; i < inv.getSizeInventory(); i++)
{
ItemStack stack = inv.getStackInSlot(i);

if(isBin(stack))
{
if(bin != null)
{
return null;
}

bin = stack.copy();
}
}

if(bin == null || bin.stackSize > 1)
{
return null;
}

ItemStack addStack = null;

for(int i = 0; i < 9; i++)
{
ItemStack stack = inv.getStackInSlot(i);

if(stack != null && !isBin(stack))
{
if(addStack != null)
{
return null;
}

addStack = stack.copy();
}
}

InventoryBin binInv = new InventoryBin(bin);

if(addStack != null)
{
if(binInv.getItemType() != null && !binInv.getItemType().isItemEqual(addStack))
{
return null;
}

binInv.add(addStack);

return bin;
}
else {
return binInv.removeStack();
}
// ItemStack bin = null;
//
// for(int i = 0; i < inv.getSizeInventory(); i++)
// {
// ItemStack stack = inv.getStackInSlot(i);
//
// if(isBin(stack))
// {
// if(bin != null)
// {
// return null;
// }
//
// bin = stack.copy();
// }
// }
//
// if(bin == null || bin.stackSize > 1)
// {
// return null;
// }
//
// ItemStack addStack = null;
//
// for(int i = 0; i < 9; i++)
// {
// ItemStack stack = inv.getStackInSlot(i);
//
// if(stack != null && !isBin(stack))
// {
// if(addStack != null)
// {
// return null;
// }
//
// addStack = stack.copy();
// }
// }
//
// InventoryBin binInv = new InventoryBin(bin);
//
// if(addStack != null)
// {
// if(binInv.getItemType() != null && !binInv.getItemType().isItemEqual(addStack))
// {
// return null;
// }
//
// binInv.add(addStack);
//
// return bin;
// }
// else {
// return binInv.removeStack();
// }
//TODO: Actually fix this dupe.
return null;
}

@Override
Expand Down

0 comments on commit 00d8b41

Please sign in to comment.