Decompiled source of CustomItemSpawn v1.0.0

CustomItemMod-1.0.0.dll

Decompiled 5 months ago
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
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("CustomItemMod")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CustomItemMod")]
[assembly: AssemblyCopyright("Copyright ©  2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("8a00c0fa-89df-4b1a-98ff-a58b790792bb")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
[BepInPlugin("com.yourname.customitem", "Custom Item Spawner", "1.0.0")]
public class CustomItemSpawner : BaseUnityPlugin
{
	private void Awake()
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Expected O, but got Unknown
		GameObject val = new GameObject("CustomItemController");
		val.AddComponent<CustomItemController>();
		Object.DontDestroyOnLoad((Object)(object)val);
	}
}
public class CustomItemController : MonoBehaviour
{
	private AssetBundle customBundle;

	private GameObject customItemPrefab;

	private void Start()
	{
		string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
		string text = Path.Combine(directoryName, "customcube");
		if (!File.Exists(text))
		{
			Debug.LogError((object)("❌ AssetBundle not found at " + text));
			return;
		}
		customBundle = AssetBundle.LoadFromFile(text);
		if ((Object)(object)customBundle == (Object)null)
		{
			Debug.LogError((object)"❌ Failed to load AssetBundle.");
			return;
		}
		customItemPrefab = customBundle.LoadAsset<GameObject>("CustomCube");
		if ((Object)(object)customItemPrefab == (Object)null)
		{
			Debug.LogError((object)"❌ Failed to load 'CustomCube' prefab from AssetBundle.");
		}
		else
		{
			Debug.Log((object)"✅ CustomCube prefab successfully loaded.");
		}
	}

	private void Update()
	{
		//IL_0028: Unknown result type (might be due to invalid IL or missing references)
		//IL_0037: Unknown result type (might be due to invalid IL or missing references)
		//IL_0041: Unknown result type (might be due to invalid IL or missing references)
		//IL_0046: Unknown result type (might be due to invalid IL or missing references)
		//IL_004b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0052: Unknown result type (might be due to invalid IL or missing references)
		//IL_0053: Unknown result type (might be due to invalid IL or missing references)
		if (Input.GetKeyDown((KeyCode)104) && (Object)(object)customItemPrefab != (Object)null)
		{
			Vector3 val = ((Component)Camera.main).transform.position + ((Component)Camera.main).transform.forward * 2f;
			Object.Instantiate<GameObject>(customItemPrefab, val, Quaternion.identity);
			Debug.Log((object)"\ud83e\uddca Spawned CustomCube prefab.");
		}
	}
}