33 lines
941 B
C#
33 lines
941 B
C#
|
using System;
|
|||
|
using System.Reflection;
|
|||
|
|
|||
|
using RobocraftX.GUI;
|
|||
|
using RobocraftX.GUI.Hotbar;
|
|||
|
using Svelto.ECS;
|
|||
|
|
|||
|
using Harmony;
|
|||
|
using GamecraftModdingAPI.Blocks;
|
|||
|
|
|||
|
namespace GamecraftModdingAPI.Inventory
|
|||
|
{
|
|||
|
[HarmonyPatch]
|
|||
|
public class HotbarSlotSelectionHandlerEnginePatch
|
|||
|
{
|
|||
|
private static int selectedBlockInt = 0;
|
|||
|
|
|||
|
public static BlockIDs EquippedPartID { get => (BlockIDs)selectedBlockInt; }
|
|||
|
|
|||
|
private static MethodInfo PatchedMethod { get; } = AccessTools.Method(AccessTools.TypeByName("RobocraftX.GUI.Hotbar.HotbarSlotSelectionHandlerEngine"), "HandleEquippedCubeChanged", parameters: new Type[] { typeof(uint), typeof(int), typeof(ExclusiveGroupStruct) });
|
|||
|
|
|||
|
public static void Prefix(uint playerID, int selectedDBPartID, ExclusiveGroupStruct groupID)
|
|||
|
{
|
|||
|
selectedBlockInt = selectedDBPartID;
|
|||
|
}
|
|||
|
|
|||
|
public static MethodBase TargetMethod(HarmonyInstance instance)
|
|||
|
{
|
|||
|
return PatchedMethod;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|