Decompiled source of NoTreeStump v1.0.2

NoTreeStump.dll

Decompiled 2 months ago
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using HarmonyLib;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("NoTreeStump")]
[assembly: AssemblyDescription("https://valheim.thunderstore.io/package/blacks7ar/NoTreeStump/")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("blacks7ar")]
[assembly: AssemblyProduct("NoTreeStump")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("B11401F4-85ED-43E5-B5AA-CC7F51B9600D")]
[assembly: AssemblyFileVersion("1.0.2")]
[assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.2.0")]
[module: UnverifiableCode]
namespace NoTreeStump;

[BepInPlugin("blacks7ar.NoTreeStump", "NoTreeStump", "1.0.2")]
public class Plugin : BaseUnityPlugin
{
	[HarmonyPatch(typeof(ZNetScene), "Awake")]
	private static class Patches
	{
		private static void Postfix(ZNetScene __instance)
		{
			if ((Object)(object)__instance == (Object)null || __instance.m_prefabs.Count <= 0)
			{
				return;
			}
			foreach (TreeBase item in from prefab in __instance.m_prefabs
				select prefab.GetComponent<TreeBase>() into component
				where Object.op_Implicit((Object)(object)component) && (Object)(object)component.m_stubPrefab != (Object)null
				select component)
			{
				item.m_stubPrefab = null;
			}
		}
	}

	private const string modGUID = "blacks7ar.NoTreeStump";

	public const string modName = "NoTreeStump";

	public const string modAuthor = "blacks7ar";

	public const string modVersion = "1.0.2";

	public const string modLink = "https://valheim.thunderstore.io/package/blacks7ar/NoTreeStump/";

	private static readonly Harmony _harmony = new Harmony("blacks7ar.NoTreeStump");

	public void Awake()
	{
		Assembly executingAssembly = Assembly.GetExecutingAssembly();
		_harmony.PatchAll(executingAssembly);
	}
}