And I am someone who likes to reply ASAP, so that I dont waste peoples time, and I didnt want to waste your time. XD
@OvermindDL1 so we should ASM this into the Mojang Code:
net.minecraft.item.crafting.CraftingManager
At Line 307:
if (i == 0) return null;
That way if the Grid is empty (which it obviously would be for the Player Inventory) it will never iterate over the entire fucking Crafting Recipe List. This should also fix some other Lag Sources while it is at it.
public ItemStack findMatchingRecipe(InventoryCrafting p_82787_1_, World p_82787_2_)
{
int i = 0;
ItemStack itemstack = null;
ItemStack itemstack1 = null;
int j;
for (j = 0; j < p_82787_1_.getSizeInventory(); ++j)
{
ItemStack itemstack2 = p_82787_1_.getStackInSlot(j);
if (itemstack2 != null)
{
if (i == 0)
{
itemstack = itemstack2;
}
if (i == 1)
{
itemstack1 = itemstack2;
}
++i;
}
}
if (i == 0) return null; // This is the place to inject this Line
if (i == 2 && itemstack.getItem() == itemstack1.getItem() && itemstack.stackSize == 1 && itemstack1.stackSize == 1 && itemstack.getItem().isRepairable())
{
Item item = itemstack.getItem();
int j1 = item.getMaxDamage() - itemstack.getItemDamageForDisplay();
int k = item.getMaxDamage() - itemstack1.getItemDamageForDisplay();
int l = j1 + k + item.getMaxDamage() * 5 / 100;
int i1 = item.getMaxDamage() - l;
if (i1 < 0)
{
i1 = 0;
}
return new ItemStack(itemstack.getItem(), 1, i1);
}
else
{
for (j = 0; j < this.recipes.size(); ++j)
{
IRecipe irecipe = (IRecipe)this.recipes.get(j);
if (irecipe.matches(p_82787_1_, p_82787_2_))
{
return irecipe.getCraftingResult(p_82787_1_);
}
}
return null;
}
}