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");
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()