public BlockBlueprintStateData MapBlockBlueprintState(BlockBlueprintState blueprintState) { var componentsData = new Dictionary <int, int>(); foreach (var component in blueprintState.GetComponents()) { var count = component.ActualCount; if (count == 0) { continue; } if (componentsData.TryGetValue(component.ItemType.Id, out var existingCount)) { count += existingCount; } componentsData[component.ItemType.Id] = count; } return(new BlockBlueprintStateData( integirty: blueprintState.Integrity, components: componentsData )); }
public void MapBlockBlueprintState(BlockBlueprintState blueprintState, BlockBlueprintStateData blueprintStateData) { foreach (var componentData in blueprintStateData.Components) { if (ItemTypes.GetItemTypeDictionary().TryGetValue(componentData.Key, out var itemType)) { if (itemType is StandardItemType standardItemType) { blueprintState.PutItem(standardItemType, componentData.Value); } } } blueprintState.Weld(blueprintStateData.Integirty); }
public StructuralBlock(IStructuralBlockType blockType) : base(blockType) { StructuralBlockType = blockType; BlueprintState = new BlockBlueprintState(blockType.Blueprint); }