static void setEnergyCost(TechType techType, float energyCost) { #if GAME_SN CraftData.energyCost[techType] = energyCost; #elif GAME_BZ if (TechData.TryGetValue(techType, out JsonValue value)) { value.setDouble(TechData.propertyEnergyCost, energyCost); } #endif }
/// <summary> /// Safely accesses the crafting data from a Modded or Vanilla item.<para/> /// WARNING: This method is highly dependent on mod load order. /// Make sure your mod is loading after the mod whose TechData you are trying to access. /// </summary> /// <param name="techType">The TechType whose TechData you want to access.</param> /// <returns>The RecipeData from the item if it exists; Otherwise, returns <c>null</c>.</returns> RecipeData ICraftDataHandler.GetRecipeData(TechType techType) { RecipeData moddedRecipeData = GetModdedRecipeData(techType); if (moddedRecipeData != null) { return(moddedRecipeData); } if (!TechData.Contains(TechType.Knife)) { TechData.Initialize(); } if (TechData.TryGetValue(techType, out JsonValue techData)) { return(ConvertToRecipeData(techData)); } return(null); }