diff --git a/GamecraftModdingAPI/Blocks/CustomBlock.cs b/GamecraftModdingAPI/Blocks/CustomBlock.cs index 2cf6b72..7a79345 100644 --- a/GamecraftModdingAPI/Blocks/CustomBlock.cs +++ b/GamecraftModdingAPI/Blocks/CustomBlock.cs @@ -111,9 +111,8 @@ namespace GamecraftModdingAPI.Blocks /*var res = Addressables.LoadContentCatalogAsync("customCatalog.json"); while (!res.IsDone) yield return Yield.It;*/ - for (int i = 0; i < prefabData.Count; i++) + foreach (var gameObject in prefabs) { - var gameObject = prefabs[i]; switch (gameObject.name) { case "Cube": @@ -251,21 +250,19 @@ namespace GamecraftModdingAPI.Blocks public static void Prefix(World physicsWorld, BlobAssetStore blobStore, IDataDB dataDB) { data = (physicsWorld, blobStore); - var blocks = dataDB.GetValues(); - blocks.Add("modded_ConsoleBlock", new CubeListData - { - cubeType = CubeType.Block, - cubeCategory = CubeCategory.ConsoleBlock, - inventoryCategory = InventoryCategory.Logic, - ID = 500, - Path = "Assets/Prefabs/Cube.prefab", //Index out of range exception: Asset failed to load (wrong path) - SpriteName = "CTR_CommandBlock", - CubeNameKey = "strConsoleBlock", - SelectableFaces = new[] {0, 1, 2, 3, 4, 5}, - GridScale = new[] {1, 1, 1}, - Mass = 1, - JointBreakAngle = 1 - }); + //RobocraftX.CR.MachineEditing.UpdateSelectedGhostBlockEngine.UpdateGhostBlock + var cld = (CubeListData) ((DataImplementor) dataDB).CreateDataObject("500", typeof(CubeListData), null); + cld.cubeType = CubeType.Block; + cld.cubeCategory = CubeCategory.General; + cld.inventoryCategory = InventoryCategory.Shapes; + cld.ID = 500; + cld.Path = "Assets/Prefabs/Cube.prefab"; //Index out of range exception: Asset failed to load (wrong path) + cld.SpriteName = "CTR_CommandBlock"; + cld.CubeNameKey = "strConsoleBlock"; + cld.SelectableFaces = new[] {0, 1, 2, 3, 4, 5}; + cld.GridScale = new[] {1, 1, 1}; + cld.Mass = 1; + cld.JointBreakAngle = 1; } public static MethodBase TargetMethod()