Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of TauhmantsPaintings v1.1.0
test1.dll
Decompiled a year agousing System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("test1")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyCopyright("Copyright © 2025 Tauhmant")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("test1")] [assembly: AssemblyTitle("test1")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace test1 { public static class MyPluginInfo { public const string PLUGIN_GUID = "test1"; public const string PLUGIN_NAME = "test1"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace REPO_MaterialReplacer { [BepInPlugin("Tauhmant.Paintings", "Tauhmant's Paintings", "1.1.0")] public class MyPlugin : BaseUnityPlugin { [HarmonyPatch(typeof(Module))] [HarmonyPatch("Start")] private class ModuleStartPatch { private static void Postfix(Component __instance) { if (CandidateMaterials.Count == 0) { LoggerInstance.LogWarning((object)"No candidate materials available!"); return; } MeshRenderer[] componentsInChildren = __instance.GetComponentsInChildren<MeshRenderer>(); foreach (MeshRenderer val in componentsInChildren) { Material[] sharedMaterials = ((Renderer)val).sharedMaterials; for (int j = 0; j < sharedMaterials.Length; j++) { if ((Object)(object)sharedMaterials[j] != (Object)null && ((Object)sharedMaterials[j]).name.Contains("painting teacher") && CandidateMaterials.Count > 0) { int index = random.Next(CandidateMaterials.Count); Material val2 = (sharedMaterials[j] = CandidateMaterials[index]); CandidateMaterials.RemoveAt(index); LoggerInstance.LogInfo((object)("Replaced painting with material: " + ((Object)val2).name)); } } ((Renderer)val).sharedMaterials = sharedMaterials; } } } public static List<Material> CandidateMaterials = new List<Material>(); internal Harmony HarmonyInstance; public static Random random; internal static MyPlugin Instance { get; private set; } internal static ManualLogSource LoggerInstance => ((BaseUnityPlugin)Instance).Logger; private void Awake() { Instance = this; ((Component)this).gameObject.transform.parent = null; ((Object)((Component)this).gameObject).hideFlags = (HideFlags)61; string text = DateTime.UtcNow.ToString("yyyyMMddHH"); int hashCode = text.GetHashCode(); random = new Random(hashCode); ((BaseUnityPlugin)this).Logger.LogInfo((object)$"Random generator seeded with {hashCode} (derived from UTC time {text})."); LoadAssets(); ApplyPatches(); ((BaseUnityPlugin)this).Logger.LogInfo((object)$"Plugin {((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} loaded!"); } private void ApplyPatches() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown HarmonyInstance = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID); HarmonyInstance.PatchAll(Assembly.GetExecutingAssembly()); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Harmony patches applied."); } private void LoadAssets() { string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "cormemus"); ((BaseUnityPlugin)this).Logger.LogInfo((object)("Loading AssetBundle from: " + text)); AssetBundle val = AssetBundle.LoadFromFile(text); if ((Object)(object)val == (Object)null) { ((BaseUnityPlugin)this).Logger.LogError((object)"Failed to load AssetBundle!"); return; } Material[] collection = val.LoadAllAssets<Material>(); CandidateMaterials = new List<Material>(collection); ((BaseUnityPlugin)this).Logger.LogInfo((object)$"Loaded {CandidateMaterials.Count} candidate materials."); } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }