Closed Spiky-73 closed 1 year ago
Replicate the issue and send your logs.
The following code system causes the the game to freeze everytime when crafting a weapon rack, but never when crafting a torch. I have to Alt+F4 to close the game.
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace Testing;
public class RecipeSystem : ModSystem {
public override void PostAddRecipes() {
foreach (Recipe recipe in Main.recipe) {
recipe.AddConsumeItemCallback(WoodConsume);
}
}
public void WoodConsume(Recipe recipe, int type, ref int amount) {
Mod.Logger.Debug($"Callback Called: {recipe.createItem.Name}, type: {type} * {amount}");
if (type == ItemID.Wood) amount = 0;
}
}
Here are the logs client.log
Attempting to craft a recipe when the 1st item in
recipe.requiredItem
(e.g. the 1st item to test the consumption) cannot be consumed (or none of them can) causses the game to freze.Attempting to craft a potion where the water bottle is not consumed (the 1st material) causses an infinite loop. Same when non of the ingredients of this recipe are consumed.
I suspect this is the while loop in
MagicStorage.CraftingGUI.AttemptLazyBatchCraft(CraftingContext context)
.