Use the intended method to create a CubeListData

The block can be selected but not placed
This commit is contained in:
Norbi Peti 2020-12-12 23:08:56 +01:00
parent 5dfb01ef0b
commit 78f0ea0162

View file

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