mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-20 03:59:45 +00:00
Minor code cleanup
This commit is contained in:
1 parent
6fb07b9d40
commit
e528609212
2 files changed
+8
-9
No files matched your search
@@ -135,7 +135,7 @@ public class ShapedRecipeCustom implements IDescriptiveRecipe {
|
||||
if (resource == null && compare == null)
|
||||
return true;
|
||||
|
||||
if (resource == null && compare != null || resource != null && compare == null)
|
||||
if (resource == null || compare == null)
|
||||
return false;
|
||||
|
||||
if (compare.getItem() != resource.getItem())
|
||||
|
||||
@@ -64,9 +64,7 @@ public class MachineCentrifuge extends TilePowered implements ISidedInventory, I
|
||||
public boolean matches(ItemStack res) {
|
||||
if (res == null && resource == null)
|
||||
return true;
|
||||
else if (res == null && resource != null)
|
||||
return false;
|
||||
else if (res != null && resource == null)
|
||||
else if (res == null || resource == null)
|
||||
return false;
|
||||
else
|
||||
return resource.isItemEqual(res);
|
||||
@@ -428,10 +426,11 @@ public class MachineCentrifuge extends TilePowered implements ISidedInventory, I
|
||||
ItemStack product = null;
|
||||
|
||||
for (int i = SLOT_PRODUCT_1; i < inventory.getSizeInventory(); i++) {
|
||||
if (inventory.getStackInSlot(i) == null)
|
||||
ItemStack stack = inventory.getStackInSlot(i);
|
||||
if (stack == null)
|
||||
continue;
|
||||
|
||||
product = new ItemStack(inventory.getStackInSlot(i).getItem(), 1, inventory.getStackInSlot(i).getItemDamage());
|
||||
product = StackUtils.createSplitStack(stack, 1);
|
||||
if (doRemove)
|
||||
decrStackSize(i, 1);
|
||||
|
||||
@@ -456,15 +455,15 @@ public class MachineCentrifuge extends TilePowered implements ISidedInventory, I
|
||||
if (!StackUtils.isIdenticalItem(resource, stack))
|
||||
return 0;
|
||||
|
||||
int space = inventory.getStackInSlot(SLOT_RESOURCE).getMaxStackSize() - inventory.getStackInSlot(SLOT_RESOURCE).stackSize;
|
||||
int space = resource.getMaxStackSize() - resource.stackSize;
|
||||
if (space <= 0)
|
||||
return 0;
|
||||
|
||||
if (doAdd)
|
||||
if (stack.stackSize <= space)
|
||||
inventory.getStackInSlot(SLOT_RESOURCE).stackSize += stack.stackSize;
|
||||
resource.stackSize += stack.stackSize;
|
||||
else
|
||||
inventory.getStackInSlot(SLOT_RESOURCE).stackSize += space;
|
||||
resource.stackSize += space;
|
||||
|
||||
return Math.min(stack.stackSize, space);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user