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.

HotbarSlotSelectionHandlerEnginePatch.cs 937B

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