diff --git a/GCMC/BlockType.cs b/GCMC/BlockType.cs index 86caadf..a169804 100644 --- a/GCMC/BlockType.cs +++ b/GCMC/BlockType.cs @@ -1,4 +1,4 @@ -using GamecraftModdingAPI.Blocks; +using TechbloxModdingAPI.Blocks; namespace GCMC { diff --git a/GCMC/BlockTypes.ini b/GCMC/BlockTypes.ini index 42f672a..a877bff 100644 --- a/GCMC/BlockTypes.ini +++ b/GCMC/BlockTypes.ini @@ -1,16 +1,19 @@ [Dirt] -type=DirtCube +type=Cube +color=Orange +darkness=5 [Grass] -type=GrassCube +type=Cube +color=Green [Stone,Coal_ore,Iron_ore] -type=ConcreteCube +type=Cube color=White darkness=5 [Leaves] -type=AluminiumCube +type=Cube color=Green darkness=5 @@ -18,14 +21,16 @@ darkness=5 ignore=true [Log] -type=WoodCube +type=Cube +color=Orange +darkness=8 [Water] -type=GlassCube +type=Cube color=Blue [Sand] -type=AluminiumCube +type=Cube color=Yellow [Long_grass] @@ -35,11 +40,11 @@ type=Flower1 type=Flower2 [Gravel] -type=ConcreteCube +type=Cube color=White darkness=7 [Clay] -type=ConcreteCube +type=Cube color=White darkness=4 diff --git a/GCMC/GCMC.csproj b/GCMC/GCMC.csproj index d2317d7..d5704aa 100644 --- a/GCMC/GCMC.csproj +++ b/GCMC/GCMC.csproj @@ -6,69 +6,69 @@ - + - + - - ..\..\ref\Gamecraft_Data\Managed\BlockEntityFactory.dll - - ..\..\ref\Gamecraft_Data\Managed\CommandLine.dll + ..\..\ref\TechbloxPreview_Data\Managed\CommandLine.dll - ..\..\ref\Gamecraft_Data\Managed\DataLoader.dll + ..\..\ref\TechbloxPreview_Data\Managed\DataLoader.dll + + + ..\..\ref\TechbloxPreview_Data\Managed\Svelto.Common.dll - - ..\..\GamecraftModdingAPI\GamecraftModdingAPI\bin\Debug\net472\GamecraftModdingAPI.dll + + ..\..\ref\TechbloxPreview_Data\Managed\Svelto.Tasks.dll - - IllusionPlugin.dll + + ..\..\ref\Plugins\TechbloxModdingAPI.dll + + + ..\..\ref\TechbloxPreview_Data\Managed\IllusionPlugin.dll - ..\..\ref\Gamecraft_Data\Managed\Newtonsoft.Json.dll + ..\..\ref\TechbloxPreview_Data\Managed\Newtonsoft.Json.dll - ..\..\ref\Gamecraft_Data\Managed\RobocraftX.Blocks.dll + ..\..\ref\TechbloxPreview_Data\Managed\RobocraftX.Blocks.dll - ..\..\ref\Gamecraft_Data\Managed\RobocraftX.Character.dll + ..\..\ref\TechbloxPreview_Data\Managed\RobocraftX.Character.dll - ..\..\ref\Gamecraft_Data\Managed\RobocraftX.Common.dll + ..\..\ref\TechbloxPreview_Data\Managed\RobocraftX.Common.dll - ..\..\ref\Gamecraft_Data\Managed\RobocraftX.GUI.dll + ..\..\ref\TechbloxPreview_Data\Managed\RobocraftX.GUI.dll - ..\..\ref\Gamecraft_Data\Managed\RobocraftX.Input.dll + ..\..\ref\TechbloxPreview_Data\Managed\RobocraftX.Input.dll - ..\..\ref\Gamecraft_Data\Managed\RobocraftX.MachineEditor.dll + ..\..\ref\TechbloxPreview_Data\Managed\RobocraftX.MachineEditor.dll - ..\..\ref\Gamecraft_Data\Managed\RobocraftX.StateSync.dll - - - D:\Games\SteamLibrary\steamapps\common\RobocraftX\Gamecraft_Data\Managed\Svelto.Common_3.dll + ..\..\ref\TechbloxPreview_Data\Managed\RobocraftX.StateSync.dll - ..\..\ref\Gamecraft_Data\Managed\Svelto.ECS.dll + ..\..\ref\TechbloxPreview_Data\Managed\Svelto.ECS.dll - ..\..\ref\Gamecraft_Data\Managed\Unity.Entities.dll + ..\..\ref\TechbloxPreview_Data\Managed\Unity.Entities.dll - - ..\..\ref\Gamecraft_Data\Managed\Unity.Mathematics.dll + + ..\..\ref\TechbloxPreview_Data\Managed\Unity.Mathematics.dll - ..\..\ref\Gamecraft_Data\Managed\UnityEngine.CoreModule.dll + ..\..\ref\TechbloxPreview_Data\Managed\UnityEngine.CoreModule.dll - ..\..\ref\Gamecraft_Data\Managed\uREPL.dll + ..\..\ref\TechbloxPreview_Data\Managed\uREPL.dll @@ -79,9 +79,9 @@ - - + diff --git a/GCMC/GCMCPlugin.cs b/GCMC/GCMCPlugin.cs index a5e39ed..9c45834 100644 --- a/GCMC/GCMCPlugin.cs +++ b/GCMC/GCMCPlugin.cs @@ -1,23 +1,27 @@ using System; +using System.Collections; using System.Collections.Generic; using System.IO; using System.Reflection; using System.Threading.Tasks; -using GamecraftModdingAPI; -using GamecraftModdingAPI.Blocks; -using GamecraftModdingAPI.Commands; using IllusionPlugin; using Newtonsoft.Json; +using Svelto.Tasks.ExtraLean; +using TechbloxModdingAPI; +using TechbloxModdingAPI.App; +using TechbloxModdingAPI.Blocks; +using TechbloxModdingAPI.Commands; +using TechbloxModdingAPI.Tasks; using Unity.Mathematics; using UnityEngine; using uREPL; namespace GCMC { - public class GCMCPlugin : IPlugin + public class GCMCPlugin : IEnhancedPlugin { - public string Name { get; } = Assembly.GetExecutingAssembly().GetName().Name; - public string Version { get; } = Assembly.GetExecutingAssembly().GetName().Version.ToString(); + public override string Name { get; } = Assembly.GetExecutingAssembly().GetName().Name; + public override string Version { get; } = Assembly.GetExecutingAssembly().GetName().Version.ToString(); private readonly Dictionary mapping = new Dictionary(10); private JsonSerializer _serializer = JsonSerializer.Create(); @@ -76,7 +80,7 @@ namespace GCMC { Material = mcblock.ToUpper(), Type = type, - Color = new BlockColor {Color = color, Darkness = darkness} + Color = new BlockColor(color, darkness) }); } } @@ -91,6 +95,7 @@ namespace GCMC }); Log.Output("Placing blocks..."); int i; + Block lastBlock = null; for (i = 0; i < blocksArray.Length; i++) { var blocks = blocksArray[i]; @@ -102,11 +107,18 @@ namespace GCMC if (type.Type == BlockIDs.Invalid) continue; - Block.PlaceNew(type.Type, (blocks.Start + blocks.End) / 10 * 3, color: type.Color.Color, - darkness: type.Color.Darkness, scale: (blocks.End - blocks.Start + 1) * 3, - rotation: float3.zero); + var block = new Block(type.Type, (blocks.Start + blocks.End) / 10 * 3 + new float3(5000, 0, 5000)) + { + Color = type.Color, + //Scale = (blocks.End - blocks.Start + 1) * 3 + }; + Console.WriteLine("Placed block at " + block.Position); + lastBlock = block; } + if (lastBlock != null) + Game.Simulate += (sender, args) => OnSimulationStarted(lastBlock).RunOn(Scheduler.extraLeanRunner); + Log.Output(i + " blocks placed."); } catch (Exception e) @@ -115,35 +127,33 @@ namespace GCMC Log.Error(e.Message); } } - - public void OnApplicationStart() - { - GamecraftModdingAPI.Main.Init(); - CommandBuilder.Builder("importWorld", "Imports a Minecraft world.") - .Action(ImportWorld).Build(); - _serializer.TraceWriter = _traceWriter; - Debug.Log("GCMC loaded"); - } - - public void OnApplicationQuit() + private IEnumerator OnSimulationStarted(Block lastBlock) { - } + SimBody body; + int C = 0; + while ((body = lastBlock.GetSimBody()) == null) + { + C++; + yield return null; + } - public void OnLevelWasLoaded(int level) - { + Console.WriteLine($"Body position: {body.Position} ({C})"); } - public void OnLevelWasInitialized(int level) + public override void OnApplicationStart() { - } + TechbloxModdingAPI.Main.Init(); + CommandBuilder.Builder("importWorld", "Imports a Minecraft world.") + .Action(ImportWorld).Build(); + //_serializer.TraceWriter = _traceWriter; - public void OnUpdate() - { + Debug.Log("GCMC loaded"); } - public void OnFixedUpdate() + public override void OnApplicationQuit() { + TechbloxModdingAPI.Main.Shutdown(); } } } \ No newline at end of file diff --git a/GCMC/IllusionPlugin.dll b/GCMC/IllusionPlugin.dll deleted file mode 100644 index aa7fa2e..0000000 Binary files a/GCMC/IllusionPlugin.dll and /dev/null differ