TechbloxModdingAPI/GamecraftModdingAPI/Inventory/HotbarSlotSelectionHandlerEnginePatch.cs
NorbiPeti 0bd348bd47
Fix initial issues and add error on patch fail
Fixed compilation and loading issues for 2020.10.27.17.13
2020-10-29 00:37:47 +01:00

30 lines
874 B
C#

using System;
using System.Reflection;
using Svelto.ECS;
using HarmonyLib;
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("Gamecraft.GUI.Hotbar.Blocks.SyncHotbarSlotSelectedToEquipedPartEngine:ActivateSlotForCube", 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(Harmony harmonyInstance)
{
return PatchedMethod;
}
}
}