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 JetpackPocket v1.0.0
BepInEx/plugins/JetpackPocket.dll
Decompiled 8 hours agousing System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using JetpackPocket.Patches; using LethalConfig; using LethalConfig.ConfigItems; using LethalConfig.ConfigItems.Options; using Unity.Netcode; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("JetpackPocket")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("JetpackPocket")] [assembly: AssemblyCopyright("Copyright © 2026")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("16975d87-0cf9-4922-88fd-a28d56a3ae51")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] namespace JetpackPocket { internal static class JetpackHelper { public struct JetpackState { public bool HasJetpack; public int HasTwoHandedItem; } private static readonly Dictionary<ulong, JetpackState> PlayerDictionary = new Dictionary<ulong, JetpackState>(); public static bool HasJetpack(PlayerControllerB player) { if ((Object)(object)player == (Object)null) { return false; } if (PlayerDictionary.TryGetValue(player.playerClientId, out var value)) { return value.HasJetpack; } return false; } public static bool HasTwoHandedAndJetpack(PlayerControllerB player) { if (PlayerDictionary.TryGetValue(player.playerClientId, out var value) && value.HasJetpack) { return value.HasTwoHandedItem > 0; } return false; } public static bool HasTwoHanded(PlayerControllerB player) { if (PlayerDictionary.TryGetValue(player.playerClientId, out var value)) { return value.HasTwoHandedItem > 0; } return false; } private static void SaveState(ulong player, JetpackState value) { PlayerDictionary[player] = value; } public static void Rescan(PlayerControllerB player) { if ((Object)(object)player == (Object)null) { return; } JetpackState value = default(JetpackState); GrabbableObject[] itemSlots = player.ItemSlots; foreach (GrabbableObject item in itemSlots) { if (IsJetpack(item)) { value.HasJetpack = true; } if (IsTwoHanded(item)) { value.HasTwoHandedItem++; } } SaveState(player.playerClientId, value); } private static bool IsJetpack(GrabbableObject item) { if ((Object)(object)item == (Object)null) { return false; } return ((object)item).GetType().Name == "JetpackItem"; } private static bool IsTwoHanded(GrabbableObject item) { if ((Object)(object)item == (Object)null) { return false; } return item.itemProperties.twoHanded; } } [BepInPlugin("PixelIndieDev_JetpackPocket", "Jetpack Pocket", "1.0.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class JetpackPocketPatchBase : BaseUnityPlugin { private readonly Harmony harmony = new Harmony("PixelIndieDev_JetpackPocket"); public static JetpackPocketPatchBase instance; public ConfigEntry<bool> JetpackPocketConfigEntry; internal ManualLogSource logSource; private void Awake() { //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Expected O, but got Unknown //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Expected O, but got Unknown if ((Object)(object)instance == (Object)null) { instance = this; } logSource = Logger.CreateLogSource("PixelIndieDev_JetpackPocket"); JetpackPocketConfigEntry = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Carry multiple two-handed items", false, "Enables carrying multiple two-handed items at the same time while having a jetpack."); LethalConfigManager.AddConfigItem((BaseConfigItem)new BoolCheckBoxConfigItem(JetpackPocketConfigEntry, new BoolCheckBoxOptions { RequiresRestart = false })); harmony.PatchAll(typeof(JetpackPocketPatchBase)); harmony.PatchAll(typeof(PlayerControllerBPatch)); harmony.PatchAll(typeof(NetworkPatch)); logSource.LogInfo((object)"Jetpack Pocket (version - 1.0.0.0): patches applied successfully"); } } internal static class ModInfo { internal const string modGUID = "PixelIndieDev_JetpackPocket"; internal const string modName = "Jetpack Pocket"; internal const string modVersion = "1.0.0.0"; } } namespace JetpackPocket.Patches { [HarmonyPatch(typeof(NetworkManager))] internal static class NetworkPatch { [HarmonyPostfix] [HarmonyPatch("SetSingleton")] private static void RegisterPrefab() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("PixelIndieDev_JetpackPocket Prefab"); ((Object)val).hideFlags = (HideFlags)(((Object)val).hideFlags | 0x3D); Object.DontDestroyOnLoad((Object)(object)val); NetworkObject obj = val.AddComponent<NetworkObject>(); typeof(NetworkObject).GetField("GlobalObjectIdHash", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(obj, GetHash("PixelIndieDev_JetpackPocket")); NetworkManager.Singleton.PrefabHandler.AddNetworkPrefab(val); } private static uint GetHash(string value) { return value?.Aggregate(17u, (uint current, char c) => (current * 31) ^ c) ?? 0; } } [HarmonyPatch(typeof(PlayerControllerB))] internal class PlayerControllerBPatch { [HarmonyPatch("GrabObjectClientRpc")] [HarmonyPostfix] private static void GrabObjectClientRpcPatch(PlayerControllerB __instance) { JetpackHelper.Rescan(__instance); UpdateHUD(__instance); } [HarmonyPatch("ThrowObjectClientRpc")] [HarmonyPostfix] private static void ThrowObjectClientRpcPatch(PlayerControllerB __instance) { JetpackHelper.Rescan(__instance); UpdateHUD(__instance); } [HarmonyPatch("PlaceObjectClientRpc")] [HarmonyPostfix] private static void PlaceObjectClientRpcPatch(PlayerControllerB __instance) { JetpackHelper.Rescan(__instance); UpdateHUD(__instance); } [HarmonyPatch("DropAllHeldItems")] [HarmonyPostfix] private static void DropAllHeldItemsPatch(PlayerControllerB __instance) { JetpackHelper.Rescan(__instance); UpdateHUD(__instance); } [HarmonyPatch("DespawnHeldObjectClientRpc")] [HarmonyPostfix] private static void DespawnHeldObjectClientRpcPatch(PlayerControllerB __instance) { JetpackHelper.Rescan(__instance); UpdateHUD(__instance); } [HarmonyPatch("ScrollMouse_performed")] [HarmonyPostfix] private static void ScrollPatch(PlayerControllerB __instance) { if (((NetworkBehaviour)__instance).IsOwner && __instance.isPlayerControlled && !__instance.inTerminalMenu) { if (__instance.twoHanded && JetpackHelper.HasJetpack(__instance)) { __instance.twoHanded = false; } UpdateHUD(__instance); } } [HarmonyPatch("BeginGrabObject")] [HarmonyPrefix] private static bool BeginGrabObjectPatch(PlayerControllerB __instance) { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) if (JetpackPocketPatchBase.instance.JetpackPocketConfigEntry.Value) { return true; } if (__instance.twoHanded) { return true; } if (!((NetworkBehaviour)__instance).IsOwner || !__instance.isPlayerControlled) { return true; } RaycastHit val = default(RaycastHit); if (!Physics.Raycast(new Ray(((Component)__instance.gameplayCamera).transform.position, ((Component)__instance.gameplayCamera).transform.forward), ref val, __instance.grabDistance, 1073742656) || ((Component)((RaycastHit)(ref val)).collider).gameObject.layer == 8 || ((Component)((RaycastHit)(ref val)).collider).tag != "PhysicsProp" || __instance.sinkingValue > 0.73f || Physics.Linecast(((Component)__instance.gameplayCamera).transform.position, ((Component)((RaycastHit)(ref val)).collider).transform.position + ((Component)__instance).transform.up * 0.16f, 1073741824, (QueryTriggerInteraction)1)) { return true; } if (JetpackHelper.HasTwoHanded(__instance)) { GrabbableObject component = ((Component)((Component)((RaycastHit)(ref val)).collider).transform).gameObject.GetComponent<GrabbableObject>(); if ((Object)(object)component != (Object)null && component.itemProperties.twoHanded) { UpdateHUD(__instance); return false; } } return true; } private static void UpdateHUD(PlayerControllerB __instance) { ((Behaviour)HUDManager.Instance.holdingTwoHandedItem).enabled = JetpackHelper.HasTwoHanded(__instance) && !JetpackPocketPatchBase.instance.JetpackPocketConfigEntry.Value; } } }