Initial stab at 1.11
About halfway.
This commit is contained in:
parent
ce52aea512
commit
00d6f8eb46
157 changed files with 1036 additions and 1554 deletions
|
@ -20,15 +20,15 @@ public class AdvancedCompressionHandler extends CompressionHandler
|
|||
{
|
||||
for (ItemStack invStack : inv)
|
||||
{
|
||||
if (invStack == null)
|
||||
if (invStack.isEmpty())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
for (int i = 2; i <= 3; i++)
|
||||
{
|
||||
ItemStack stacky = getRecipe(invStack, world, i);
|
||||
if (stacky != null)
|
||||
ItemStack stack = getRecipe(invStack, world, i);
|
||||
if (!stack.isEmpty())
|
||||
{
|
||||
int threshold = CompressionRegistry.getItemThreshold(invStack);
|
||||
|
||||
|
@ -37,13 +37,13 @@ public class AdvancedCompressionHandler extends CompressionHandler
|
|||
if (neededLeft <= 0)
|
||||
{
|
||||
iterateThroughInventory(invStack, 0, inv, needed, true);
|
||||
return stacky;
|
||||
return stack;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
public int iterateThroughInventory(ItemStack required, int kept, ItemStack[] inv, int needed, boolean doDrain)
|
||||
|
@ -54,14 +54,14 @@ public class AdvancedCompressionHandler extends CompressionHandler
|
|||
{
|
||||
i++;
|
||||
|
||||
if (invStack == null)
|
||||
if (invStack.isEmpty())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (invStack.isItemEqual(required) && (invStack.getTagCompound() == null ? required.getTagCompound() == null : invStack.getTagCompound().equals(required.getTagCompound())))
|
||||
{
|
||||
int stackSize = invStack.stackSize;
|
||||
int stackSize = invStack.getCount();
|
||||
int used = 0;
|
||||
if (kept > 0)
|
||||
{
|
||||
|
@ -76,10 +76,10 @@ public class AdvancedCompressionHandler extends CompressionHandler
|
|||
int remainingFromStack = Math.max(stackSize - used - needed, 0);
|
||||
if (doDrain)
|
||||
{
|
||||
invStack.stackSize = remainingFromStack + used;
|
||||
if (invStack.stackSize <= 0)
|
||||
invStack.setCount(remainingFromStack + used);
|
||||
if (invStack.isEmpty())
|
||||
{
|
||||
inv[i] = null;
|
||||
inv[i] = ItemStack.EMPTY;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -98,7 +98,7 @@ public class AdvancedCompressionHandler extends CompressionHandler
|
|||
|
||||
public static boolean isResultStackReversible(ItemStack stack, int gridSize, World world)
|
||||
{
|
||||
if (stack == null)
|
||||
if (stack.isEmpty())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -113,12 +113,12 @@ public class AdvancedCompressionHandler extends CompressionHandler
|
|||
inventory.setInventorySlotContents(0, stack);
|
||||
|
||||
ItemStack returnStack = StorageBlockCraftingManager.getInstance().findMatchingRecipe(inventory, world);
|
||||
if (returnStack == null)
|
||||
if (returnStack.isEmpty())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
ItemStack compressedStack = null;
|
||||
ItemStack compressedStack = ItemStack.EMPTY;
|
||||
switch (gridSize)
|
||||
{
|
||||
case 2:
|
||||
|
@ -129,7 +129,7 @@ public class AdvancedCompressionHandler extends CompressionHandler
|
|||
break;
|
||||
}
|
||||
|
||||
return compressedStack != null && CompressionRegistry.areItemStacksEqual(stack, compressedStack);
|
||||
return !compressedStack.isEmpty() && CompressionRegistry.areItemStacksEqual(stack, compressedStack);
|
||||
}
|
||||
|
||||
public static ItemStack getRecipe(ItemStack stack, World world, int gridSize)
|
||||
|
@ -151,7 +151,7 @@ public class AdvancedCompressionHandler extends CompressionHandler
|
|||
|
||||
public static boolean has22Recipe(ItemStack stack, World world)
|
||||
{
|
||||
return get22Recipe(stack, world) != null;
|
||||
return !get22Recipe(stack, world).isEmpty();
|
||||
}
|
||||
|
||||
public static ItemStack get22Recipe(ItemStack stack, World world)
|
||||
|
@ -161,7 +161,7 @@ public class AdvancedCompressionHandler extends CompressionHandler
|
|||
|
||||
public static boolean has33Recipe(ItemStack stack, World world)
|
||||
{
|
||||
return get33Recipe(stack, world) != null;
|
||||
return !get33Recipe(stack, world).isEmpty();
|
||||
}
|
||||
|
||||
public static ItemStack get33Recipe(ItemStack stack, World world)
|
||||
|
|
|
@ -38,7 +38,7 @@ public class BaseCompressionHandler extends CompressionHandler
|
|||
return this.getResultStack();
|
||||
}
|
||||
|
||||
return null;
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
public int getRemainingNeeded(ItemStack[] inv)
|
||||
|
@ -53,7 +53,7 @@ public class BaseCompressionHandler extends CompressionHandler
|
|||
|
||||
public int iterateThroughInventory(ItemStack[] inv, boolean doDrain)
|
||||
{
|
||||
int needed = this.required.stackSize;
|
||||
int needed = this.required.getCount();
|
||||
int kept = this.getLeftover();
|
||||
int i = -1;
|
||||
|
||||
|
@ -68,7 +68,7 @@ public class BaseCompressionHandler extends CompressionHandler
|
|||
|
||||
if (invStack.isItemEqual(this.required) && (invStack.getTagCompound() == null ? this.required.getTagCompound() == null : invStack.getTagCompound().equals(this.required.getTagCompound())))
|
||||
{
|
||||
int stackSize = invStack.stackSize;
|
||||
int stackSize = invStack.getCount();
|
||||
int used = 0;
|
||||
if (kept > 0)
|
||||
{
|
||||
|
@ -83,10 +83,10 @@ public class BaseCompressionHandler extends CompressionHandler
|
|||
int remainingFromStack = Math.max(stackSize - used - needed, 0);
|
||||
if (doDrain)
|
||||
{
|
||||
invStack.stackSize = remainingFromStack + used;
|
||||
if (invStack.stackSize <= 0)
|
||||
invStack.setCount(remainingFromStack + used);
|
||||
if (invStack.isEmpty())
|
||||
{
|
||||
inv[i] = null;
|
||||
inv[i] = ItemStack.EMPTY;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ public class StorageBlockCraftingManager
|
|||
|
||||
private static boolean isResultStackReversible(ItemStack stack, int gridSize, World world, List list)
|
||||
{
|
||||
if (stack == null)
|
||||
if (stack.isEmpty())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -47,12 +47,12 @@ public class StorageBlockCraftingManager
|
|||
inventory.setInventorySlotContents(0, stack);
|
||||
|
||||
ItemStack returnStack = StorageBlockCraftingManager.getInstance().findMatchingRecipe(inventory, world, list);
|
||||
if (returnStack == null || returnStack.getItem() == null)
|
||||
if (returnStack.isEmpty())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
ItemStack compressedStack = null;
|
||||
ItemStack compressedStack = ItemStack.EMPTY;
|
||||
switch (gridSize)
|
||||
{
|
||||
case 2:
|
||||
|
@ -63,7 +63,7 @@ public class StorageBlockCraftingManager
|
|||
break;
|
||||
}
|
||||
|
||||
return compressedStack != null && CompressionRegistry.areItemStacksEqual(stack, compressedStack);
|
||||
return !compressedStack.isEmpty() && CompressionRegistry.areItemStacksEqual(stack, compressedStack);
|
||||
}
|
||||
|
||||
private static ItemStack getRecipe(ItemStack stack, World world, int gridSize, List list)
|
||||
|
@ -85,7 +85,7 @@ public class StorageBlockCraftingManager
|
|||
|
||||
private static boolean has22Recipe(ItemStack stack, World world, List list)
|
||||
{
|
||||
return get22Recipe(stack, world, list) != null;
|
||||
return !get22Recipe(stack, world, list).isEmpty();
|
||||
}
|
||||
|
||||
private static ItemStack get22Recipe(ItemStack stack, World world, List list)
|
||||
|
@ -95,7 +95,7 @@ public class StorageBlockCraftingManager
|
|||
|
||||
private static boolean has33Recipe(ItemStack stack, World world, List list)
|
||||
{
|
||||
return get33Recipe(stack, world, list) != null;
|
||||
return !get33Recipe(stack, world, list).isEmpty();
|
||||
}
|
||||
|
||||
private static ItemStack get33Recipe(ItemStack stack, World world, List list)
|
||||
|
@ -111,15 +111,15 @@ public class StorageBlockCraftingManager
|
|||
private ItemStack findMatchingRecipe(InventoryCrafting craftingInventory, World world, List list)
|
||||
{
|
||||
int i = 0;
|
||||
ItemStack itemstack = null;
|
||||
ItemStack itemstack1 = null;
|
||||
ItemStack itemstack = ItemStack.EMPTY;
|
||||
ItemStack itemstack1 = ItemStack.EMPTY;
|
||||
int j;
|
||||
|
||||
for (j = 0; j < craftingInventory.getSizeInventory(); ++j)
|
||||
{
|
||||
ItemStack itemstack2 = craftingInventory.getStackInSlot(j);
|
||||
|
||||
if (itemstack2 != null)
|
||||
if (!itemstack2.isEmpty())
|
||||
{
|
||||
if (i == 0)
|
||||
{
|
||||
|
@ -135,13 +135,13 @@ public class StorageBlockCraftingManager
|
|||
}
|
||||
}
|
||||
|
||||
if (i == 2 && itemstack.getItem() == itemstack1.getItem() && itemstack.stackSize == 1 && itemstack1.stackSize == 1 && itemstack.getItem().isRepairable())
|
||||
if (i == 2 && itemstack.getItem() == itemstack1.getItem() && itemstack.getCount() == 1 && itemstack1.getCount() == 1 && itemstack.getItem().isRepairable())
|
||||
{
|
||||
Item item = itemstack.getItem();
|
||||
int j1 = item.getMaxDamage() - itemstack.getItemDamage();
|
||||
int k = item.getMaxDamage() - itemstack1.getItemDamage();
|
||||
int l = j1 + k + item.getMaxDamage() * 5 / 100;
|
||||
int i1 = item.getMaxDamage() - l;
|
||||
int j1 = item.getMaxDamage(itemstack) - itemstack.getItemDamage();
|
||||
int k = item.getMaxDamage(itemstack) - itemstack1.getItemDamage();
|
||||
int l = j1 + k + item.getMaxDamage(itemstack) * 5 / 100;
|
||||
int i1 = item.getMaxDamage(itemstack) - l;
|
||||
|
||||
if (i1 < 0)
|
||||
{
|
||||
|
@ -161,7 +161,7 @@ public class StorageBlockCraftingManager
|
|||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,10 +33,10 @@ public class StorageBlockCraftingRecipeAssimilator
|
|||
continue;
|
||||
|
||||
ItemStack output = recipe.getRecipeOutput();
|
||||
if (output == null || output.getItem() == null)
|
||||
if (output.isEmpty())
|
||||
continue;
|
||||
|
||||
if (output.stackSize == 1)
|
||||
if (output.getCount() == 1)
|
||||
{
|
||||
PackingRecipe packingRecipe = getPackingRecipe(recipe);
|
||||
|
||||
|
@ -44,7 +44,7 @@ public class StorageBlockCraftingRecipeAssimilator
|
|||
{
|
||||
packingRecipes.add(packingRecipe);
|
||||
}
|
||||
} else if ((output.stackSize == 4 || output.stackSize == 9) && recipe.getRecipeSize() == 1)
|
||||
} else if ((output.getCount() == 4 || output.getCount() == 9) && recipe.getRecipeSize() == 1)
|
||||
{
|
||||
unpackingRecipes.add(recipe);
|
||||
}
|
||||
|
@ -81,7 +81,7 @@ public class StorageBlockCraftingRecipeAssimilator
|
|||
{
|
||||
// the recipe could be parsed, use its inputs directly since that's faster verify recipe size
|
||||
|
||||
if (recipePack.inputCount != unpacked.stackSize)
|
||||
if (recipePack.inputCount != unpacked.getCount())
|
||||
continue;
|
||||
|
||||
// check if any of the input options matches the unpacked
|
||||
|
@ -99,14 +99,14 @@ public class StorageBlockCraftingRecipeAssimilator
|
|||
{
|
||||
// unknown IRecipe, check through the recipe conventionally verify recipe size for 3x3 to skip anything smaller quickly
|
||||
|
||||
if (unpacked.stackSize == 9 && recipePack.recipe.getRecipeSize() < 9)
|
||||
if (unpacked.getCount() == 9 && recipePack.recipe.getRecipeSize() < 9)
|
||||
continue;
|
||||
|
||||
// initialize inventory late, but only once per unpack recipe
|
||||
|
||||
if (inventory == null)
|
||||
{
|
||||
if (unpacked.stackSize == 4)
|
||||
if (unpacked.getCount() == 4)
|
||||
{
|
||||
inventory = inventory2x2;
|
||||
} else
|
||||
|
@ -114,7 +114,7 @@ public class StorageBlockCraftingRecipeAssimilator
|
|||
inventory = inventory3x3;
|
||||
}
|
||||
|
||||
for (int i = 0; i < unpacked.stackSize; i++)
|
||||
for (int i = 0; i < unpacked.getCount(); i++)
|
||||
{
|
||||
inventory.setInventorySlotContents(i, unpacked.copy());
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue