A stable modding interface between Techblox and mods https://mod.exmods.org/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
874B

  1. using System;
  2. using System.Reflection;
  3. using Svelto.ECS;
  4. using HarmonyLib;
  5. using GamecraftModdingAPI.Blocks;
  6. namespace GamecraftModdingAPI.Inventory
  7. {
  8. [HarmonyPatch]
  9. public class HotbarSlotSelectionHandlerEnginePatch
  10. {
  11. private static int selectedBlockInt = 0;
  12. public static BlockIDs EquippedPartID { get => (BlockIDs)selectedBlockInt; }
  13. private static MethodInfo PatchedMethod { get; } = AccessTools.Method("Gamecraft.GUI.Hotbar.Blocks.SyncHotbarSlotSelectedToEquipedPartEngine:ActivateSlotForCube", parameters: new Type[] { typeof(uint), typeof(int), typeof(ExclusiveGroupStruct) });
  14. public static void Prefix(uint playerID, int selectedDBPartID, ExclusiveGroupStruct groupID)
  15. {
  16. selectedBlockInt = selectedDBPartID;
  17. }
  18. public static MethodBase TargetMethod(Harmony harmonyInstance)
  19. {
  20. return PatchedMethod;
  21. }
  22. }
  23. }