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 SilverFightingKnife v0.0.1
plugins/SilverFightingKnife.dll
Decompiled 2 years 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 BepInEx; using Jotunn.Managers; using Jotunn.Utils; 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: IgnoresAccessChecksTo("assembly_guiutils")] [assembly: IgnoresAccessChecksTo("assembly_utils")] [assembly: IgnoresAccessChecksTo("assembly_valheim")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyCompany("Cheb Gonaz")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("0.0.1.0")] [assembly: AssemblyInformationalVersion("0.0.1.0+6aac01161500cb29a1e94aacab50da76467a2c09")] [assembly: AssemblyProduct("Valheim Mesh Replacer Template")] [assembly: AssemblyTitle("Valheim Mesh Replacer Template")] [assembly: NeutralResourcesLanguage("en")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.1.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 SilverFightingKnife { [BepInPlugin("com.Akora.SilverFightingKnife", "SilverFightingKnife", "0.0.1")] [BepInDependency(/*Could not decode attribute arguments.*/)] [NetworkCompatibility(/*Could not decode attribute arguments.*/)] internal class SilverFightingKnife : BaseUnityPlugin { public const string PluginGuid = "com.Akora.SilverFightingKnife"; public const string PluginName = "SilverFightingKnife"; public const string PluginVersion = "0.0.1"; private string _vanillaPrefab = "KnifeSilver"; private string _bundleName = "silverfightingknifebundle"; private string _meshName = "default"; private string _materialName = "SFKMaterial"; private Mesh _replacementMesh; private Material _replacementMaterial; private void Awake() { LoadAssetBundle(); PrefabManager.OnVanillaPrefabsAvailable += DoOnVanillaPrefabsAvailable; } private void DoOnVanillaPrefabsAvailable() { PrefabManager.OnVanillaPrefabsAvailable -= DoOnVanillaPrefabsAvailable; GameObject prefab = PrefabManager.Instance.GetPrefab(_vanillaPrefab); if ((Object)(object)prefab == (Object)null) { ((BaseUnityPlugin)this).Logger.LogError((object)("Failed to get " + _vanillaPrefab + " prefab")); return; } MeshFilter componentInChildren = prefab.GetComponentInChildren<MeshFilter>(true); if ((Object)(object)componentInChildren == (Object)null) { ((BaseUnityPlugin)this).Logger.LogError((object)("Failed to get " + _vanillaPrefab + " prefab's mesh filter")); return; } componentInChildren.mesh = _replacementMesh; MeshRenderer componentInChildren2 = prefab.GetComponentInChildren<MeshRenderer>(true); if ((Object)(object)componentInChildren2 == (Object)null) { ((BaseUnityPlugin)this).Logger.LogError((object)("Failed to get " + _vanillaPrefab + " prefab's mesh renderer")); } else { ((Renderer)componentInChildren2).sharedMaterial = _replacementMaterial; } } private void LoadAssetBundle() { string text = Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), _bundleName); AssetBundle val = AssetUtils.LoadAssetBundle(text); try { _replacementMesh = val.LoadAsset<Mesh>(_meshName); _replacementMaterial = val.LoadAsset<Material>(_materialName); } catch (Exception arg) { ((BaseUnityPlugin)this).Logger.LogWarning((object)$"Exception caught while loading assets: {arg}"); } finally { val.Unload(false); } } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }