diff --git a/Source/AthenaFramework/Harmony/HarmonyPatches_Misc.cs b/Source/AthenaFramework/Harmony/HarmonyPatches_Misc.cs index ac32da8..5d41c63 100644 --- a/Source/AthenaFramework/Harmony/HarmonyPatches_Misc.cs +++ b/Source/AthenaFramework/Harmony/HarmonyPatches_Misc.cs @@ -331,7 +331,10 @@ public static void Postfix(Thing t, Pawn p, ref bool __result) return; } - GeneLockedRecipeExtension extension = t.def.GetModExtension(); + //GeneLockedRecipeExtension extension = t.def.GetModExtension(); + //At that point the building doesn't exists yet, the def you're pointing to is either the blueprint or the frame. + //The mod extension will likely be added to the buildingdef though, hence : + GeneLockedRecipeExtension extension = t.def.entityDefToBuild.GetModExtension(); if (extension != null && !extension.CanCreate(p)) { @@ -350,7 +353,8 @@ public static void Postfix(Bill __instance, Pawn p, ref bool __result) return; } - GeneLockedRecipeExtension extension = __instance.recipe.GetModExtension(); + //This will allow you to reach recipes hidden in recipeMakers by adding the modExtension to the parent thingDef instead + GeneLockedRecipeExtension extension = __instance.recipe.GetModExtension() ?? __instance.recipe.ProducedThingDef?.GetModExtension(); if (extension != null && !extension.CanCreate(p)) {