Please disclose if your mod was created primarily 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 FMS Shovel v1.1.2
FMSPlugin.dll
Decompiled 9 months agousing System; using System.Diagnostics; 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("FMSPlugin")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("My first plugin")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("FMSPlugin")] [assembly: AssemblyTitle("FMSPlugin")] [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 FMSPlugin { [BepInPlugin("isagoarth.ShovelFMS", "ShovelFMS", "1.1.2")] public class Plugin : BaseUnityPlugin { public static Plugin Instance; public static AssetBundle testBundle; private const string MyGUID = "isagoarth.ShovelFMS"; private const string PluginName = "ShovelFMS"; private const string VersionString = "1.1.2"; private static readonly Harmony Harmony = new Harmony("isagoarth.ShovelFMS"); public static ManualLogSource Log = new ManualLogSource("ShovelFMS"); private void Awake() { Instance = this; string location = ((BaseUnityPlugin)Instance).Info.Location; string text = "FMSPlugin.dll"; string text2 = location.TrimEnd(text.ToCharArray()); string text3 = "testAsset.bundle"; ((BaseUnityPlugin)this).Logger.LogInfo((object)("Loading AssetBundle from: " + text2 + text3)); testBundle = AssetBundle.LoadFromFile(text2 + text3); Harmony.PatchAll(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"PluginName: ShovelFMS, VersionString: 1.1.2 is loaded."); Log = ((BaseUnityPlugin)this).Logger; } } [HarmonyPatch(typeof(GrabbableObject))] internal class ShovelPatch { [HarmonyPatch("Start")] [HarmonyPostfix] private static void ChangeModel(GrabbableObject __instance) { Plugin.Log.LogInfo((object)"Launching postfix method"); Shovel val = (Shovel)(object)((__instance is Shovel) ? __instance : null); if ((Object)(object)val == (Object)null) { Plugin.Log.LogInfo((object)"GrabableObject is not a Shovel"); } else { ChangeModel(val); } } public static void ChangeModel(Shovel self) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Expected O, but got Unknown //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)((Component)self).transform.Find("mesh") != (Object)null) { GameObject gameObject = ((GameObject)Plugin.testBundle.LoadAsset("Assets/FMS/FullMoonSword.prefab")).gameObject; Material val = (Material)Plugin.testBundle.LoadAsset("Assets/FMS/fmsmat.mat"); Mesh mesh = gameObject.GetComponent<MeshFilter>().mesh; GameObject gameObject2 = ((Component)((Component)self).transform.GetChild(0)).gameObject; MeshRenderer component = gameObject2.GetComponent<MeshRenderer>(); MeshFilter component2 = gameObject2.GetComponent<MeshFilter>(); Material[] array = (Material[])(object)new Material[((Renderer)component).materials.Length]; for (int i = 0; i < array.Length; i++) { array[i] = val; } ((Renderer)component).materials = array; component2.mesh = mesh; gameObject2.transform.localPosition = gameObject2.transform.localPosition + new Vector3(0f, 0f, -1f); Plugin.Log.LogInfo((object)"Model changng ended"); } } } }