TechbloxModdingAPI/GamecraftModdingAPI/Inventory/HotbarSlotSelectionHandlerEnginePatch.cs

31 lines
815 B
C#
Raw Normal View History

2020-04-02 09:50:30 -04:00
using System;
using System.Reflection;
using Svelto.ECS;
2020-05-03 15:31:09 -04:00
using HarmonyLib;
2020-04-02 09:50:30 -04:00
using GamecraftModdingAPI.Blocks;
namespace GamecraftModdingAPI.Inventory
{
[HarmonyPatch]
public class HotbarSlotSelectionHandlerEnginePatch
{
private static int selectedBlockInt = 0;
public static BlockIDs EquippedPartID { get => (BlockIDs)selectedBlockInt; }
2021-04-12 17:37:51 +02:00
private static MethodInfo PatchedMethod { get; } = AccessTools.Method("Gamecraft.GUI.Hotbar.Blocks.SyncHotbarSlotSelectedToEquippedPartEngine:ActivateSlotForCube", parameters: new Type[] { typeof(uint), typeof(int) });
2020-04-02 09:50:30 -04:00
2021-04-12 17:37:51 +02:00
public static void Prefix(uint playerID, int selectedDBPartID)
2020-04-02 09:50:30 -04:00
{
selectedBlockInt = selectedDBPartID;
}
2020-05-03 15:31:09 -04:00
public static MethodBase TargetMethod(Harmony harmonyInstance)
2020-04-02 09:50:30 -04:00
{
return PatchedMethod;
}
}
}