Browse Source

Use the intended method to create a CubeListData

The block can be selected but not placed
tags/v1.8.0
NorbiPeti 4 years ago
parent
commit
78f0ea0162
1 changed files with 14 additions and 17 deletions
  1. +14
    -17
      GamecraftModdingAPI/Blocks/CustomBlock.cs

+ 14
- 17
GamecraftModdingAPI/Blocks/CustomBlock.cs View File

@@ -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<CubeListData>();
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()


Loading…
Cancel
Save