TechbloxModdingAPI/GamecraftModdingAPI/Inventory/Hotbar.cs
2020-04-02 09:50:30 -04:00

38 lines
974 B
C#

using System;
using RobocraftX.Common.Input;
using RobocraftX.Multiplayer.Input;
using GamecraftModdingAPI.Blocks;
using GamecraftModdingAPI.Utility;
using Harmony;
namespace GamecraftModdingAPI.Inventory
{
public static class Hotbar
{
private static HotbarEngine hotbarEngine = new HotbarEngine();
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
}
public static BlockIDs GetEquippedBlock()
{
return HotbarSlotSelectionHandlerEnginePatch.EquippedPartID;
}
public static void Init()
{
GameEngineManager.AddGameEngine(hotbarEngine);
}
}
}