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 RustyBag OreBagFix v1.0.0
RustyBag_OreBagFix.dll
Decompiled 4 months agousing System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using HarmonyLib; using RustyBags; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("RustyBag_OreBagFix")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("RustyBag_OreBagFix")] [assembly: AssemblyCopyright("Copyright © 2026")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("7065ef0e-963b-411b-972f-c5e24f28a657")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] namespace RustyBag_OreBagFix; [BepInPlugin("vakinn.mod.mymod", "My Mod", "1.0.0")] public class MyMod : BaseUnityPlugin { public const string PluginId = "vakinn.mod.mymod"; private static MyMod _instance; private Harmony _harmony; private void Awake() { _instance = this; _harmony = Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "vakinn.mod.mymod"); } private void OnDestroy() { _instance = null; Harmony harmony = _harmony; if (harmony != null) { harmony.UnpatchSelf(); } } } [HarmonyPatch(typeof(SE_OreBag), "ModifyInventoryWeight")] public static class ModifyInventoryWeight_Patch { private static readonly PropertyInfo InventoryWeightModifierProp = AccessTools.Property(typeof(SE_Bag), "inventoryWeightModifier"); private static void Postfix(SE_OreBag __instance, ref float weight) { if (!((Object)(object)__instance == (Object)null) && !(InventoryWeightModifierProp == null)) { float num = Mathf.Max(1f - (float)InventoryWeightModifierProp.GetValue(__instance), 0f); if (!Mathf.Approximately(num, 1f)) { weight *= num; } } } }