using System; using RobocraftX.Common.Input; using RobocraftX.Multiplayer.Input; using HarmonyLib; using TechbloxModdingAPI.Blocks; using TechbloxModdingAPI.Utility; namespace TechbloxModdingAPI.Inventory { public static class Hotbar { private static readonly HotbarEngine hotbarEngine = new HotbarEngine(); /// /// Switch the block in the player's hand /// /// The block to switch to. /// The player. Omit this to use the local player. public static void EquipBlock(BlockIDs block, uint playerID = uint.MaxValue) { if (playerID == uint.MaxValue) { playerID = hotbarEngine.GetLocalPlayerID(); } hotbarEngine.SelectBlock((int) block, playerID); // cubeSelectedByPick = true will crash the game // (this would be equivalent to mouse middle click pick block action) // reason: the game expects a Dictionary entry for the tweaked stats } /// /// Gets the block in the player's hand /// /// The equipped block. public static BlockIDs GetEquippedBlock() { return HotbarSlotSelectionHandlerEnginePatch.EquippedPartID; } public static void Init() { GameEngineManager.AddGameEngine(hotbarEngine); } } }