From df6a2e84e156a3dd12c483ecdc5a22a26bd7e46e Mon Sep 17 00:00:00 2001 From: NorbiPeti Date: Fri, 30 Apr 2021 22:36:54 +0200 Subject: [PATCH] Update to Techblox 2021.04.29.18.37 --- GamecraftModdingAPI/Block.cs | 1 + GamecraftModdingAPI/Blocks/BlockEngine.cs | 6 +++--- GamecraftModdingAPI/Blocks/BlockEngineInit.cs | 1 + GamecraftModdingAPI/Blocks/CustomBlock.cs | 2 +- GamecraftModdingAPI/Blocks/MovementEngine.cs | 4 ++-- GamecraftModdingAPI/Blocks/RotationEngine.cs | 4 ++-- GamecraftModdingAPI/Blocks/SignalEngine.cs | 2 +- 7 files changed, 11 insertions(+), 9 deletions(-) diff --git a/GamecraftModdingAPI/Block.cs b/GamecraftModdingAPI/Block.cs index 99574ff..e4c50cd 100644 --- a/GamecraftModdingAPI/Block.cs +++ b/GamecraftModdingAPI/Block.cs @@ -80,6 +80,7 @@ namespace GamecraftModdingAPI var egid = initializer.EGID; var bl = New(egid.entityID, egid.groupID); bl.InitData.Group = BlockEngine.InitGroup(initializer); + bl.InitData.Reference = initializer.reference; Placed += bl.OnPlacedInit; return bl; } diff --git a/GamecraftModdingAPI/Blocks/BlockEngine.cs b/GamecraftModdingAPI/Blocks/BlockEngine.cs index 5eff5b2..e0291c0 100644 --- a/GamecraftModdingAPI/Blocks/BlockEngine.cs +++ b/GamecraftModdingAPI/Blocks/BlockEngine.cs @@ -104,7 +104,7 @@ namespace GamecraftModdingAPI.Blocks private U GetBlockInitInfo(Block block, Func getter, U def) where T : struct, IEntityComponent { if (block.InitData.Group == null) return def; - var initializer = new EntityInitializer(block.Id, block.InitData.Group); + var initializer = new EntityInitializer(block.Id, block.InitData.Group, block.InitData.Reference); if (initializer.Has()) return getter(initializer.Get()); return def; @@ -133,7 +133,7 @@ namespace GamecraftModdingAPI.Blocks { if (block.InitData.Group != null) { - var initializer = new EntityInitializer(block.Id, block.InitData.Group); + var initializer = new EntityInitializer(block.Id, block.InitData.Group, block.InitData.Reference); T component = initializer.Has() ? initializer.Get() : default; ref T structRef = ref component; setter(ref structRef, value); @@ -161,7 +161,7 @@ namespace GamecraftModdingAPI.Blocks return true; if (block.InitData.Group == null) return false; - var init = new EntityInitializer(block.Id, block.InitData.Group); + var init = new EntityInitializer(block.Id, block.InitData.Group, block.InitData.Reference); return init.Has(); } diff --git a/GamecraftModdingAPI/Blocks/BlockEngineInit.cs b/GamecraftModdingAPI/Blocks/BlockEngineInit.cs index aaed6ef..ac7f3c4 100644 --- a/GamecraftModdingAPI/Blocks/BlockEngineInit.cs +++ b/GamecraftModdingAPI/Blocks/BlockEngineInit.cs @@ -15,6 +15,7 @@ namespace GamecraftModdingAPI.Blocks internal struct BlockInitData { public FasterDictionary Group; + public EntityReference Reference; } internal delegate FasterDictionary GetInitGroup( diff --git a/GamecraftModdingAPI/Blocks/CustomBlock.cs b/GamecraftModdingAPI/Blocks/CustomBlock.cs index c979234..7c82fe1 100644 --- a/GamecraftModdingAPI/Blocks/CustomBlock.cs +++ b/GamecraftModdingAPI/Blocks/CustomBlock.cs @@ -131,7 +131,7 @@ namespace GamecraftModdingAPI.Blocks CubeNameKey = attr.NameKey, CubeDescriptionKey = attr.DescKey, SelectableFaces = new[] {0, 1, 2, 3, 4, 5}, - GridScale = new[] {5, 5, 5}, + GridScale = new[] {5f, 5, 5}, DefaultMaterialID = 0, //TODO: Material API scalingPermission = attr.ScalingPermission, SortIndex = attr.SortIndex, diff --git a/GamecraftModdingAPI/Blocks/MovementEngine.cs b/GamecraftModdingAPI/Blocks/MovementEngine.cs index 6a9b05e..87a7259 100644 --- a/GamecraftModdingAPI/Blocks/MovementEngine.cs +++ b/GamecraftModdingAPI/Blocks/MovementEngine.cs @@ -40,7 +40,7 @@ namespace GamecraftModdingAPI.Blocks if (!entitiesDB.Exists(blockID)) { if (data.Group == null) return float3.zero; - var init = new EntityInitializer(blockID, data.Group); + var init = new EntityInitializer(blockID, data.Group, data.Reference); init.GetOrCreate().position = vector; init.GetOrCreate().position = vector; init.GetOrCreate().position = vector; @@ -70,7 +70,7 @@ namespace GamecraftModdingAPI.Blocks if (!entitiesDB.Exists(blockID)) { if (data.Group == null) return float3.zero; - var init = new EntityInitializer(blockID, data.Group); + var init = new EntityInitializer(blockID, data.Group, data.Reference); return init.Has() ? init.Get().position : float3.zero; } ref PositionEntityStruct posStruct = ref this.entitiesDB.QueryEntity(blockID); diff --git a/GamecraftModdingAPI/Blocks/RotationEngine.cs b/GamecraftModdingAPI/Blocks/RotationEngine.cs index 3322b92..2d8d1db 100644 --- a/GamecraftModdingAPI/Blocks/RotationEngine.cs +++ b/GamecraftModdingAPI/Blocks/RotationEngine.cs @@ -40,7 +40,7 @@ namespace GamecraftModdingAPI.Blocks if (!entitiesDB.Exists(blockID)) { if (data.Group == null) return float3.zero; - var init = new EntityInitializer(blockID, data.Group); + var init = new EntityInitializer(blockID, data.Group, data.Reference); init.GetOrCreate().rotation = Quaternion.Euler(vector); init.GetOrCreate().rotation = Quaternion.Euler(vector); init.GetOrCreate().rotation = Quaternion.Euler(vector); @@ -77,7 +77,7 @@ namespace GamecraftModdingAPI.Blocks if (!entitiesDB.Exists(blockID)) { if (data.Group == null) return float3.zero; - var init = new EntityInitializer(blockID, data.Group); + var init = new EntityInitializer(blockID, data.Group, data.Reference); return init.Has() ? (float3) ((Quaternion) init.Get().rotation).eulerAngles : float3.zero; diff --git a/GamecraftModdingAPI/Blocks/SignalEngine.cs b/GamecraftModdingAPI/Blocks/SignalEngine.cs index 22865df..8329a3b 100644 --- a/GamecraftModdingAPI/Blocks/SignalEngine.cs +++ b/GamecraftModdingAPI/Blocks/SignalEngine.cs @@ -399,7 +399,7 @@ namespace GamecraftModdingAPI.Blocks exists = false; return ref defRef[0]; } - EntityInitializer initializer = new EntityInitializer(block.Id, block.InitData.Group); + EntityInitializer initializer = new EntityInitializer(block.Id, block.InitData.Group, block.InitData.Reference); if (initializer.Has()) { exists = true;