Some mods target the Mono version of the game, which is available by opting into the Steam beta branch "alternate"
Decompiled source of SnailMucus v1.0.1
SnailMucus_Mono.dll
Decompiled 2 days agousing System; using System.Diagnostics; using System.IO; using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using HS_SFW; using HS_SFW.Patches; using HarmonyLib; using MelonLoader; using Microsoft.CodeAnalysis; using ScheduleOne; using ScheduleOne.Equipping; using ScheduleOne.ItemFramework; using ScheduleOne.Storage; using ScheduleOne.Trash; using ScheduleOne.UI.Items; using ScheduleOne.UI.Shop; using TMPro; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: MelonInfo(typeof(Core), "SnailMucus", "1.0.0", "Bars", null)] [assembly: MelonGame("TVGS", "Schedule I")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("SnailMucus_Mono")] [assembly: AssemblyConfiguration("Mono")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("SnailMucus_Mono")] [assembly: AssemblyTitle("SnailMucus_Mono")] [assembly: NeutralResourcesLanguage("en-US")] [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 HS_SFW { public class Core : MelonMod { public override void OnInitializeMelon() { ((MelonBase)this).LoggerInstance.Msg("Initialized."); ((MelonBase)this).LoggerInstance.Msg("Starting initialization of custom assets..."); ItemUIPatches.InitializeCustomIcon(); EquippableViewmodelPatches.InitializeCustomLabelMaterial(); ItemShelfPatches.InitializeCustomLabelMaterial(); Material labelMaterial = ItemShelfPatches.GetLabelMaterial(); ((MelonBase)this).LoggerInstance.Msg($"- Shelf Material: {(Object)(object)labelMaterial != (Object)null}, Same as Viewmodel: {(Object)(object)labelMaterial == (Object)(object)EquippableViewmodelPatches.GetLabelMaterial()}"); ApplyPatches(); } private void ApplyPatches() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown ((MelonBase)this).LoggerInstance.Msg("Applying patches..."); try { Harmony val = new Harmony("com.bars.hs-sfw"); Assembly executingAssembly = Assembly.GetExecutingAssembly(); val.PatchAll(executingAssembly); ((MelonBase)this).LoggerInstance.Msg("Snail Mucus Patches applied successfully!"); } catch (Exception ex) { ((MelonBase)this).LoggerInstance.Error("Error applying patches: " + ex.Message); ((MelonBase)this).LoggerInstance.Error(ex.StackTrace); } } } } namespace HS_SFW.Patches { public class EquippableViewmodelPatches { [HarmonyPatch] public static class EquippableViewmodelParameterCountPatch { public static MethodBase TargetMethod() { Type typeFromHandle = typeof(Equippable_Viewmodel); MethodInfo[] methods = typeFromHandle.GetMethods(); foreach (MethodInfo methodInfo in methods) { if (methodInfo.Name == "Equip" && methodInfo.GetParameters().Length == 1) { return methodInfo; } } MelonLogger.Error("[EquippableViewmodelPatches] Could not find method"); return null; } public static void Postfix(Component __instance, object __0) { //IL_010a: Unknown result type (might be due to invalid IL or missing references) try { PropertyInfo propertyInfo = __0?.GetType().GetProperty("ID"); if (propertyInfo == null) { return; } string text = propertyInfo.GetValue(__0, null) as string; if (text != "horsesemen") { return; } MeshRenderer[] componentsInChildren = __instance.GetComponentsInChildren<MeshRenderer>(); bool flag = false; MeshRenderer[] array = componentsInChildren; foreach (MeshRenderer val in array) { if (!(((Object)((Component)val).gameObject).name != "Label")) { flag = true; if (!((Object)(object)cleanLabelMaterial == (Object)null)) { ((Renderer)val).material = cleanLabelMaterial; break; } } } if (!flag) { MelonLogger.Warning("[EquippableViewmodelPatches] No Label object found in mesh renderers"); } bool flag2 = false; MeshRenderer[] array2 = componentsInChildren; foreach (MeshRenderer val2 in array2) { if (!(((Object)((Component)val2).gameObject).name != "Body")) { flag2 = true; ((Renderer)val2).material.color = bodyColor; break; } } if (!flag2) { MelonLogger.Warning("[EquippableViewmodelPatches] No Body object found in mesh renderers"); } } catch (Exception ex) { MelonLogger.Error("[EquippableViewmodelPatches] Error in parameter count patch: " + ex.Message); MelonLogger.Error(ex.StackTrace); } } } [HarmonyPatch] public static class EquippableViewmodelGenericPatch { public static MethodBase TargetMethod() { Type typeFromHandle = typeof(Equippable_Viewmodel); MethodInfo[] methods = typeFromHandle.GetMethods(); foreach (MethodInfo methodInfo in methods) { if (methodInfo.Name == "Equip" && methodInfo.GetParameters().Length == 1) { return methodInfo; } } MelonLogger.Error("[EquippableViewmodelPatches] Could not find Equip method with one parameter"); return null; } public static void Postfix(object __instance, object __0) { //IL_016c: Unknown result type (might be due to invalid IL or missing references) try { MelonLogger.Msg($"[EquippableViewmodelPatches] GenericPatch called, IL2CPP: {IlCppBuild()}"); Component val = (Component)((__instance is Component) ? __instance : null); if ((Object)(object)val == (Object)null) { MelonLogger.Error("[EquippableViewmodelPatches] Instance is not a Component"); return; } string text = null; try { PropertyInfo propertyInfo = __0?.GetType().GetProperty("ID"); if (propertyInfo != null) { text = propertyInfo.GetValue(__0, null) as string; } } catch (Exception ex) { MelonLogger.Error("[EquippableViewmodelPatches] Error getting ID: " + ex.Message); } if (text != "horsesemen") { return; } MeshRenderer[] componentsInChildren = val.GetComponentsInChildren<MeshRenderer>(); bool flag = false; MeshRenderer[] array = componentsInChildren; foreach (MeshRenderer val2 in array) { if (!(((Object)((Component)val2).gameObject).name != "Label")) { flag = true; if ((Object)(object)cleanLabelMaterial != (Object)null) { ((Renderer)val2).material = cleanLabelMaterial; } break; } } if (!flag) { MelonLogger.Warning("[EquippableViewmodelPatches] No Label object found in mesh renderers"); } bool flag2 = false; MeshRenderer[] array2 = componentsInChildren; foreach (MeshRenderer val3 in array2) { if (!(((Object)((Component)val3).gameObject).name != "Body")) { flag2 = true; ((Renderer)val3).material.color = bodyColor; break; } } if (!flag2) { MelonLogger.Warning("[EquippableViewmodelPatches] No Body object found in mesh renderers"); } } catch (Exception ex2) { MelonLogger.Error("[EquippableViewmodelPatches] Error in generic patch: " + ex2.Message); MelonLogger.Error(ex2.StackTrace); } } } [HarmonyPatch(typeof(Equippable_Viewmodel), "Equip")] public static class EquippableViewmodelEquipPatch { public static void Postfix(Equippable_Viewmodel __instance, ItemInstance item) { //IL_00e7: Unknown result type (might be due to invalid IL or missing references) try { if (((item is StorableItemInstance) ? item : null)?.ID != "horsesemen") { return; } MeshRenderer[] componentsInChildren = ((Component)__instance).gameObject.GetComponentsInChildren<MeshRenderer>(); bool flag = false; MeshRenderer[] array = componentsInChildren; foreach (MeshRenderer val in array) { if (!(((Object)((Component)val).gameObject).name != "Label")) { flag = true; if (!((Object)(object)cleanLabelMaterial == (Object)null)) { ((Renderer)val).material = cleanLabelMaterial; } } } if (!flag) { MelonLogger.Warning("[EquippableViewmodelPatches] No Label object found in mesh renderers"); } bool flag2 = false; MeshRenderer[] array2 = componentsInChildren; foreach (MeshRenderer val2 in array2) { if (!(((Object)((Component)val2).gameObject).name != "Body")) { flag2 = true; ((Renderer)val2).material.color = bodyColor; break; } } if (!flag2) { MelonLogger.Warning("[EquippableViewmodelPatches] No Body object found in mesh renderers"); } } catch (Exception ex) { MelonLogger.Error("[EquippableViewmodelPatches] Error in equip patch: " + ex.Message); MelonLogger.Error(ex.StackTrace); } } } private static Material cleanLabelMaterial = null; private static readonly Color bodyColor = new Color(0.6039f, 0.651f, 0.6314f, 1f); public static Material GetLabelMaterial() { return cleanLabelMaterial; } public static void InitializeCustomLabelMaterial() { //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Expected O, but got Unknown //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Expected O, but got Unknown //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Expected O, but got Unknown //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Expected O, but got Unknown //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Expected O, but got Unknown //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Expected O, but got Unknown try { Assembly executingAssembly = Assembly.GetExecutingAssembly(); using Stream stream = executingAssembly.GetManifestResourceStream("HS_SFW.Assets.HorseSemenLabel_icon.png"); if (stream == null) { MelonLogger.Error("[EquippableViewmodelPatches] Failed to find embedded resource: HorseSemenLabel_icon.png"); return; } byte[] array = new byte[stream.Length]; stream.Read(array, 0, array.Length); Texture2D val = new Texture2D(2, 2, (TextureFormat)4, false); if (ImageConversion.LoadImage(val, array)) { Material val2 = null; Shader val3 = Shader.Find("Universal Render Pipeline/Lit"); if ((Object)(object)val3 != (Object)null) { val2 = new Material(val3); } if ((Object)(object)val2 == (Object)null) { Shader val4 = Shader.Find("Standard"); if ((Object)(object)val4 != (Object)null) { val2 = new Material(val4); } } if ((Object)(object)val2 == (Object)null) { Shader val5 = Shader.Find("Unlit/Texture"); if ((Object)(object)val5 != (Object)null) { val2 = new Material(val5); } } if ((Object)(object)val2 == (Object)null) { Shader val6 = Shader.Find("Default-Diffuse"); if ((Object)(object)val6 != (Object)null) { val2 = new Material(val6); } } if ((Object)(object)val2 == (Object)null) { val2 = new Material(Shader.Find("Diffuse")); } if ((Object)(object)val2 != (Object)null) { val2.mainTexture = (Texture)(object)val; int num = Shader.PropertyToID("_MainTex"); val2.SetTexture(num, (Texture)(object)val); cleanLabelMaterial = val2; } else { MelonLogger.Error("[EquippableViewmodelPatches] Failed to create material - no suitable shader found"); } } else { MelonLogger.Error("[EquippableViewmodelPatches] Failed to load custom horsesemen label texture"); } if ((Object)(object)cleanLabelMaterial == (Object)null) { MelonLogger.Error("[EquippableViewmodelPatches] Material is still null after initialization!"); } } catch (Exception ex) { MelonLogger.Error("[EquippableViewmodelPatches] Error initializing custom horsesemen label material: " + ex.Message); MelonLogger.Error(ex.StackTrace); } } private static bool IlCppBuild() { return false; } } public class ItemShelfPatches { [HarmonyPatch(typeof(StoredItem), "InitializeStoredItem")] public static class StoredItem_InitializeStoredItem_Patch { public static void Postfix(StoredItem __instance, StorableItemInstance _item) { //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) try { if (_item == null || !(((ItemInstance)_item).ID == "horsesemen")) { return; } MeshRenderer[] componentsInChildren = ((Component)__instance).GetComponentsInChildren<MeshRenderer>(true); bool flag = false; MeshRenderer[] array = componentsInChildren; foreach (MeshRenderer val in array) { if (!(((Object)((Component)val).gameObject).name != "Label")) { flag = true; if (!((Object)(object)cleanLabelMaterial == (Object)null)) { Material material = ((Renderer)val).material; ((Renderer)val).material = cleanLabelMaterial; break; } } } if (!flag) { MelonLogger.Warning("[ItemShelfPatches] No Label object found in mesh renderers"); } bool flag2 = false; MeshRenderer[] array2 = componentsInChildren; foreach (MeshRenderer val2 in array2) { if (!(((Object)((Component)val2).gameObject).name != "Body")) { flag2 = true; Color color = ((Renderer)val2).material.color; ((Renderer)val2).material.color = bodyColor; break; } } if (!flag2) { MelonLogger.Warning("[ItemShelfPatches] No Body object found in mesh renderers"); } } catch (Exception ex) { MelonLogger.Error("[ItemShelfPatches] Error in StoredItem.InitializeStoredItem patch: " + ex.Message); MelonLogger.Error(ex.StackTrace); } } } [HarmonyPatch(typeof(StoredItem), "CreateGhostModel")] public static class StoredItem_CreateGhostModel_Patch { public static void Postfix(ref GameObject __result, ItemInstance _item) { //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) try { if (_item == null || !(_item.ID == "horsesemen") || (Object)(object)__result == (Object)null) { return; } MeshRenderer[] componentsInChildren = __result.GetComponentsInChildren<MeshRenderer>(true); bool flag = false; MeshRenderer[] array = componentsInChildren; foreach (MeshRenderer val in array) { if (!(((Object)((Component)val).gameObject).name != "Label")) { flag = true; if (!((Object)(object)cleanLabelMaterial == (Object)null)) { Material material = ((Renderer)val).material; ((Renderer)val).material = cleanLabelMaterial; break; } } } if (!flag) { MelonLogger.Warning("[ItemShelfPatches] No Label object found in ghost mesh renderers"); } bool flag2 = false; MeshRenderer[] array2 = componentsInChildren; foreach (MeshRenderer val2 in array2) { if (!(((Object)((Component)val2).gameObject).name != "Body")) { flag2 = true; Color color = ((Renderer)val2).material.color; ((Renderer)val2).material.color = bodyColor; break; } } if (!flag2) { MelonLogger.Warning("[ItemShelfPatches] No Body object found in ghost mesh renderers"); } } catch (Exception ex) { MelonLogger.Error("[ItemShelfPatches] Error in StoredItem.CreateGhostModel patch: " + ex.Message); MelonLogger.Error(ex.StackTrace); } } } private static Material cleanLabelMaterial = null; private static readonly Color bodyColor = new Color(0.6039f, 0.651f, 0.6314f, 1f); public static Material GetLabelMaterial() { return cleanLabelMaterial; } public static void InitializeCustomLabelMaterial() { //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Expected O, but got Unknown //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Expected O, but got Unknown try { if ((Object)(object)EquippableViewmodelPatches.GetLabelMaterial() != (Object)null) { cleanLabelMaterial = EquippableViewmodelPatches.GetLabelMaterial(); return; } Assembly executingAssembly = Assembly.GetExecutingAssembly(); using Stream stream = executingAssembly.GetManifestResourceStream("HS_SFW.Assets.HorseSemenLabel_icon.png"); if (stream == null) { MelonLogger.Error("[ItemShelfPatches] Failed to find embedded resource: HorseSemenLabel_icon.png"); return; } byte[] array = new byte[stream.Length]; stream.Read(array, 0, array.Length); Texture2D val = new Texture2D(2, 2); if (ImageConversion.LoadImage(val, array)) { cleanLabelMaterial = new Material(Shader.Find("Universal Render Pipeline/Lit")) { mainTexture = (Texture)(object)val }; } else { MelonLogger.Error("[ItemShelfPatches] Failed to load custom horsesemen label texture"); } } catch (Exception ex) { MelonLogger.Error("[ItemShelfPatches] Error initializing custom horsesemen label material for shelf items: " + ex.Message); MelonLogger.Error(ex.StackTrace); } } private static bool IlCppBuild() { return false; } } public class ItemUIPatches { [HarmonyPatch(typeof(ItemUI), "UpdateUI")] public static class ItemUI_UpdateUI_Patch { public static void Postfix(ItemUI __instance) { try { ItemInstance itemInstance = __instance.itemInstance; if (itemInstance != null && itemInstance.ID == "horsesemen" && !((Object)(object)cleanHorseSemenIcon == (Object)null)) { __instance.IconImg.sprite = cleanHorseSemenIcon; __instance.IconImg.overrideSprite = cleanHorseSemenIcon; } } catch (Exception ex) { MelonLogger.Error("Error in ItemUI.UpdateUI patch: " + ex.Message); } } } [HarmonyPatch(typeof(ItemInstance), "get_Name")] public static class ItemInstance_Name_Patch { public static bool Prefix(ItemInstance __instance, ref string __result) { try { if (__instance.ID == "horsesemen") { __result = "Snail Mucus"; return false; } } catch (Exception ex) { MelonLogger.Error("Error in ItemInstance.get_Name patch: " + ex.Message); } return true; } } [HarmonyPatch(typeof(ItemInstance), "get_Description")] public static class ItemInstance_Description_Patch { public static bool Prefix(ItemInstance __instance, ref string __result) { try { if (__instance.ID == "horsesemen") { __result = "A viscous secretion from a rare snail species. NOT RECOMMENDED FOR CONSUMPTION"; return false; } } catch (Exception ex) { MelonLogger.Error("Error in ItemInstance.get_Description patch: " + ex.Message); } return true; } } [HarmonyPatch(typeof(ItemInfoContent), "Initialize", new Type[] { typeof(ItemInstance) })] public static class ItemInfoContent_Initialize_Patch { public static void Postfix(ItemInfoContent __instance, ItemInstance instance) { try { if (instance != null && instance.ID == "horsesemen") { ((TMP_Text)__instance.NameLabel).text = "Snail Mucus"; ((TMP_Text)__instance.DescriptionLabel).text = "A viscous secretion from a rare snail species. NOT RECOMMENDED FOR CONSUMPTION"; } } catch (Exception ex) { MelonLogger.Error("Error in ItemInfoContent.Initialize postfix: " + ex.Message); } } } [HarmonyPatch(typeof(ListingUI), "Initialize")] public static class ListingUI_Initialize_Patch { public static void Postfix(ListingUI __instance, ShopListing listing) { try { if (listing != null && !((Object)(object)listing.Item == (Object)null) && !(((ItemDefinition)listing.Item).ID != "horsesemen")) { if ((Object)(object)cleanHorseSemenIcon != (Object)null) { __instance.Icon.sprite = cleanHorseSemenIcon; } ((TMP_Text)__instance.NameLabel).text = "Snail Mucus"; } } catch (Exception ex) { MelonLogger.Error("Error in ListingUI.Initialize patch: " + ex.Message); } } } [HarmonyPatch(typeof(ShopInterfaceDetailPanel), "Open")] public static class ShopDetailPanel_Open_Patch { public static void Postfix(ShopInterfaceDetailPanel __instance, ListingUI _listing) { try { if (!((Object)(object)_listing == (Object)null) && _listing.Listing != null && !((Object)(object)_listing.Listing.Item == (Object)null) && !(((ItemDefinition)_listing.Listing.Item).ID != "horsesemen") && (Object)(object)__instance.DescriptionLabel != (Object)null) { ((TMP_Text)__instance.DescriptionLabel).text = "A viscous secretion from a rare snail species. NOT RECOMMENDED FOR CONSUMPTION"; } } catch (Exception ex) { MelonLogger.Error("Error in ShopInterfaceDetailPanel.Open patch: " + ex.Message); } } } [HarmonyPatch(typeof(StorableItemDefinition), "GetDefaultInstance")] public static class ItemDefinition_GetDefaultInstance_Patch { public static void Prefix(StorableItemDefinition __instance) { try { if (!((Object)(object)__instance == (Object)null) && !(((ItemDefinition)__instance).ID != "horsesemen")) { ((ItemDefinition)__instance).Name = "Snail Mucus"; ((ItemDefinition)__instance).Description = "A viscous secretion from a rare snail species. NOT RECOMMENDED FOR CONSUMPTION"; } } catch (Exception ex) { MelonLogger.Error("Error in ItemDefinition.GetDefaultInstance patch: " + ex.Message); } } } [HarmonyPatch(typeof(Registry), "_GetItem")] public static class Registry_GetItem_Patch { public static void Postfix(ref ItemDefinition __result) { try { if (!((Object)(object)__result == (Object)null) && !(__result.ID != "horsesemen")) { __result.Name = "Snail Mucus"; __result.Description = "A viscous secretion from a rare snail species. NOT RECOMMENDED FOR CONSUMPTION"; } } catch (Exception ex) { MelonLogger.Error("Error in Registry._GetItem patch: " + ex.Message); } } } private static Sprite cleanHorseSemenIcon; public static void InitializeCustomIcon() { //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Expected O, but got Unknown //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) try { Assembly executingAssembly = Assembly.GetExecutingAssembly(); using Stream stream = executingAssembly.GetManifestResourceStream("HS_SFW.Assets.HorseSemen_Icon.png"); if (stream == null) { MelonLogger.Error("Failed to find embedded resource: HorseSemen_Icon.png"); return; } byte[] array = new byte[stream.Length]; stream.Read(array, 0, array.Length); Texture2D val = new Texture2D(2, 2); if (ImageConversion.LoadImage(val, array)) { cleanHorseSemenIcon = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f)); } else { MelonLogger.Error("Failed to load custom snail mucus icon texture"); } } catch (Exception ex) { MelonLogger.Error("Error initializing custom snail mucus icon: " + ex.Message); MelonLogger.Error(ex.StackTrace); } } } public class TrashItemPatches { [HarmonyPatch(typeof(TrashItem), "Awake")] public static class TrashItem_Awake_Patch { public static void Postfix(TrashItem __instance) { //IL_0052: Unknown result type (might be due to invalid IL or missing references) try { if (__instance.ID != "chemicaljug") { return; } MeshRenderer[] componentsInChildren = ((Component)__instance).GetComponentsInChildren<MeshRenderer>(true); MeshRenderer[] array = componentsInChildren; foreach (MeshRenderer val in array) { if (!(((Object)((Component)val).gameObject).name != "Body")) { ((Renderer)val).material.color = bodyColor; break; } } } catch (Exception ex) { MelonLogger.Error("Error in TrashItem.Awake patch: " + ex.Message); MelonLogger.Error(ex.StackTrace); } } } [HarmonyPatch(typeof(TrashItem), "Start")] public static class TrashItem_Start_Patch { public static void Postfix(TrashItem __instance) { //IL_0052: Unknown result type (might be due to invalid IL or missing references) try { if (__instance.ID != "chemicaljug") { return; } MeshRenderer[] componentsInChildren = ((Component)__instance).GetComponentsInChildren<MeshRenderer>(true); MeshRenderer[] array = componentsInChildren; foreach (MeshRenderer val in array) { if (!(((Object)((Component)val).gameObject).name != "Body")) { ((Renderer)val).material.color = bodyColor; break; } } } catch (Exception ex) { MelonLogger.Error("Error in TrashItem.Start patch: " + ex.Message); MelonLogger.Error(ex.StackTrace); } } } private static readonly Color bodyColor = new Color(0.6039f, 0.651f, 0.6314f, 1f); } }