using System; using GamecraftModdingAPI.Utility; using GCMC; using Unity.Mathematics; namespace GamecraftModdingAPI.Blocks { /// /// Common block movement operations /// public static class Placement { private static PlacementEngine placementEngine = new PlacementEngine(); /// /// Place a block at the given position. If scaled, position means the center of the block. The default block size is 0.2 in terms of position. /// Place blocks next to each other to connect them. /// /// The block's type /// The block's color /// The block color's darkness (0-9) - 0 is default color /// The block's position in the grid - default block size is 0.2 /// The block's rotation /// The block's uniform scale - default scale is 1 (with 0.2 width) /// The block's non-uniform scale - 0 means is used /// The player who placed the block /// public static bool PlaceBlock(BlockIDs block, float3 position, quaternion rotation = new quaternion(), BlockColors color = BlockColors.Default, byte darkness = 0, int uscale = 1, float3 scale = new float3(), uint playerId = 0) { if (placementEngine.IsInGame && GameState.IsBuildMode()) { placementEngine.PlaceBlock(block, color, darkness, position, uscale, scale, playerId, rotation); return true; } return false; } public static void Init() { GameEngineManager.AddGameEngine(placementEngine); } } }