|
|
@@ -104,7 +104,7 @@ namespace GamecraftModdingAPI.Blocks |
|
|
|
private U GetBlockInitInfo<T, U>(Block block, Func<T, U> 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<T>()) |
|
|
|
return getter(initializer.Get<T>()); |
|
|
|
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<T>() ? initializer.Get<T>() : 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<T>(); |
|
|
|
} |
|
|
|
|
|
|
|