<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.factorio.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=GlassBricks</id>
	<title>Official Factorio Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.factorio.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=GlassBricks"/>
	<link rel="alternate" type="text/html" href="https://wiki.factorio.com/Special:Contributions/GlassBricks"/>
	<updated>2026-04-26T11:18:41Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.5</generator>
	<entry>
		<id>https://wiki.factorio.com/index.php?title=Talk:Blueprint_string_format&amp;diff=206837</id>
		<title>Talk:Blueprint string format</title>
		<link rel="alternate" type="text/html" href="https://wiki.factorio.com/index.php?title=Talk:Blueprint_string_format&amp;diff=206837"/>
		<updated>2024-11-22T05:56:12Z</updated>

		<summary type="html">&lt;p&gt;GlassBricks: /* Probably complete BlueprintEntity type for v2.0 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Decode snippets ==&lt;br /&gt;
&lt;br /&gt;
Since there are some short snippets to decode blueprint strings to JSON / Lua tables I think it would make sense to also have snippets for the inverse operation. -- [[User:Fgardt|fgardt]] ([[User talk:Fgardt|talk]]) 03:35, 3 August 2024 (CEST)&lt;br /&gt;
&lt;br /&gt;
== v2.x introduced new &amp;quot;wires&amp;quot; array of uncertain structure ==&lt;br /&gt;
&lt;br /&gt;
My [https://github.com/nyurik/fatul FaTul tool] minimizes versioned blueprint storage in git by making all IDs relative - e.g. connected to (-1,0) instead of a long entity number. Wires used to work in 1.x, but now I am observing a new &amp;quot;wires&amp;quot; blueprint root entry - this is an example of two electric poles connected by copper, red, and green wires. The format of the &amp;quot;wires&amp;quot; seem to be a list of connections, with each sub-array always having 4 numbers:&lt;br /&gt;
&lt;br /&gt;
* source entity_number&lt;br /&gt;
* color of the wire at the source&lt;br /&gt;
* destination entity_number&lt;br /&gt;
* color of the wire at the destination&lt;br /&gt;
&lt;br /&gt;
I guess the developers were trying to allow color-changing in the wire, e.g. starts as green, but ends as red?  For now, I only saw same color on both sides (2nd and 4th value is always the same).  The color indexes are:  5 - copper, 1 - red, 2 - green.&lt;br /&gt;
&lt;br /&gt;
 {&lt;br /&gt;
  &amp;quot;blueprint&amp;quot;: {&lt;br /&gt;
    &amp;quot;icons&amp;quot;: [{&amp;quot;signal&amp;quot;: {&amp;quot;name&amp;quot;: &amp;quot;big-electric-pole&amp;quot;}, &amp;quot;index&amp;quot;: 1}],&lt;br /&gt;
    &amp;quot;entities&amp;quot;: [&lt;br /&gt;
      {&amp;quot;entity_number&amp;quot;: 1, &amp;quot;name&amp;quot;: &amp;quot;big-electric-pole&amp;quot;, &amp;quot;position&amp;quot;: {&amp;quot;x&amp;quot;: 163, &amp;quot;y&amp;quot;: -240}},&lt;br /&gt;
      {&amp;quot;entity_number&amp;quot;: 2, &amp;quot;name&amp;quot;: &amp;quot;big-electric-pole&amp;quot;, &amp;quot;position&amp;quot;: {&amp;quot;x&amp;quot;: 195, &amp;quot;y&amp;quot;: -240}}&lt;br /&gt;
    ],&lt;br /&gt;
    &amp;quot;wires&amp;quot;: [[1, 1, 2, 1], [1, 2, 2, 2], [1, 5, 2, 5]],&lt;br /&gt;
    &amp;quot;item&amp;quot;: &amp;quot;blueprint&amp;quot;,&lt;br /&gt;
    &amp;quot;version&amp;quot;: 562949954076673&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
=== Response ===&lt;br /&gt;
&lt;br /&gt;
I have done some research on this. The wire &amp;quot;color&amp;quot; is actually a merge of wire color and the old `circuit_connector_id`, which was removed. The format seem to be:&lt;br /&gt;
&lt;br /&gt;
* source entity_number&lt;br /&gt;
* color of the wire at the source, +2 if it is connected to the &amp;quot;output&amp;quot; of the object for green or red, or +1 for copper&lt;br /&gt;
* destination entity_number&lt;br /&gt;
* color of the wire at the destination, +2 if it is connected to the &amp;quot;output&amp;quot; of the object for green or red, or +1 for copper&lt;br /&gt;
&lt;br /&gt;
e.g. an arithmetic combinator which has its output connected to the input of another combinator (or any 1 sided object) with green wire would be:&lt;br /&gt;
&lt;br /&gt;
    [1,4,2,2]&lt;br /&gt;
&lt;br /&gt;
While if it were connected to the output, it would be:&lt;br /&gt;
&lt;br /&gt;
    [1,4,2,4]&lt;br /&gt;
&lt;br /&gt;
Or, for 2 power poles connected with a switch:&lt;br /&gt;
&lt;br /&gt;
    [[1, 5, 2, 5], [2, 6, 3, 5]]&lt;br /&gt;
&lt;br /&gt;
It also seems to normalize and sort the connections by lowest entity number. You&#039;ll note that rather than the old method of setting connections on both objects, there is on one &amp;quot;wire&amp;quot; entry per connection, and it seems to always pick the lower entity number to be at the start of the &amp;quot;wire&amp;quot; entry.&lt;br /&gt;
&lt;br /&gt;
=== Edit ===&lt;br /&gt;
After more research, it&#039;s based on `wire_connector_id`, which was added to the defines:&lt;br /&gt;
&lt;br /&gt;
    wire_connector_id = {&lt;br /&gt;
        circuit_green = 2,&lt;br /&gt;
        circuit_red = 1,&lt;br /&gt;
        combinator_input_green = 2,&lt;br /&gt;
        combinator_input_red = 1,&lt;br /&gt;
        combinator_output_green = 4,&lt;br /&gt;
        combinator_output_red = 3,&lt;br /&gt;
        pole_copper = 5,&lt;br /&gt;
        power_switch_left_copper = 5,&lt;br /&gt;
        power_switch_right_copper = 6&lt;br /&gt;
    },&lt;br /&gt;
&lt;br /&gt;
-- [[User:HuFlungDu|HuFlungDu]] ([[User talk:HuFlungDu|talk]])&lt;br /&gt;
&lt;br /&gt;
== v2.X SignalID has optional &amp;quot;type&amp;quot; now ==&lt;br /&gt;
&lt;br /&gt;
Blueprint:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;0eNqVkd1uhCAQhd9lrnGzWm2ir9JsDOLEnRQGC2hrDO9e0Dbbqza9Y5hzvvnbYdALzo44QLcDKcseupcdPE0sdf5jaRA6kN6jGTTxVBip7sRYVBAFEI/4AV0ZbwKQAwXCk3AEW8+LGdAlgfiVJGC2Ppkt55oZeL00Ajboni5NKuNQ0Zzd5CwXE0pXvN8RNXyn+rdF6lQwSdg6I3OGApqzGRp/jDI7Oy4q0JrkhUlvjcckpzqJuSdeU//Wbaf7EdUCfJDq9Zg4RvE3+mtN/4NfM/yWd5qNCfw4k4AVnT8W1TxXbd22TV3WVVWWMX4CClCeDw==&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Beginning of JSON:&lt;br /&gt;
&lt;br /&gt;
    {&lt;br /&gt;
        &amp;quot;blueprint&amp;quot;: {&lt;br /&gt;
            &amp;quot;icons&amp;quot;: [&lt;br /&gt;
                {&lt;br /&gt;
                    &amp;quot;signal&amp;quot;: {&lt;br /&gt;
                        &amp;quot;name&amp;quot;: &amp;quot;assembling-machine-2&amp;quot;&lt;br /&gt;
                    },&lt;br /&gt;
                    &amp;quot;index&amp;quot;: 1&lt;br /&gt;
                }&lt;br /&gt;
            ],&lt;br /&gt;
&lt;br /&gt;
Notice there is no &amp;lt;code&amp;gt;&amp;quot;type&amp;quot;: &amp;quot;item&amp;quot;&amp;lt;/code&amp;gt; property.&lt;br /&gt;
&lt;br /&gt;
== v2.x introduced new &amp;quot;stock_connections&amp;quot; array for trains(?) ==&lt;br /&gt;
&lt;br /&gt;
Similar to above, for my [https://github.com/nyurik/fatul FaTul] blueprint GIT management tool, I am seeing a new &amp;lt;code&amp;gt;stock_connections&amp;lt;/code&amp;gt; top level property for connections entities like trains. If my entities represent a train with 4 cargo wagons (entities 1-4) and two locomotives (entities 5 and 6), this represents their connectivity LCCCCL:&lt;br /&gt;
&lt;br /&gt;
    &amp;quot;stock_connections&amp;quot;: [&lt;br /&gt;
      {&amp;quot;back&amp;quot;: 1, &amp;quot;stock&amp;quot;: 5},&lt;br /&gt;
      {&amp;quot;back&amp;quot;: 2, &amp;quot;front&amp;quot;: 5, &amp;quot;stock&amp;quot;: 1},&lt;br /&gt;
      {&amp;quot;back&amp;quot;: 3, &amp;quot;front&amp;quot;: 1, &amp;quot;stock&amp;quot;: 2},&lt;br /&gt;
      {&amp;quot;back&amp;quot;: 4, &amp;quot;front&amp;quot;: 2, &amp;quot;stock&amp;quot;: 3},&lt;br /&gt;
      {&amp;quot;back&amp;quot;: 6, &amp;quot;front&amp;quot;: 3, &amp;quot;stock&amp;quot;: 4},&lt;br /&gt;
      {&amp;quot;front&amp;quot;: 4, &amp;quot;stock&amp;quot;: 6}&lt;br /&gt;
    ]&lt;br /&gt;
&lt;br /&gt;
== Probably complete BlueprintEntity type for v2.0 ==&lt;br /&gt;
&lt;br /&gt;
BlueprintEntity format is actually https://lua-api.factorio.com/latest/concepts/BlueprintEntity.html&lt;br /&gt;
&lt;br /&gt;
Notably, this contains the &amp;quot;wires&amp;quot; field, which is already documented, and some others, so no need to reverse engineer that.&lt;br /&gt;
&lt;br /&gt;
However, there&#039;s still a ton attributes not documented, but I&#039;ve slowly dug them out:&lt;br /&gt;
The results can be found here:&lt;br /&gt;
https://github.com/GlassBricks/typed-factorio/blob/3632b3d5eca9a9f5f3b85345ddf33d23f995dbdd/runtime/generated/concepts.d.ts#L2824&lt;br /&gt;
Or the manually defined input here, which might be more clear:&lt;br /&gt;
https://github.com/GlassBricks/typed-factorio/blob/3632b3d5eca9a9f5f3b85345ddf33d23f995dbdd/generator/input/manual-defs-runtime.ts#L568&lt;br /&gt;
Even if you don&#039;t know typescript its probably readable.&lt;br /&gt;
&lt;br /&gt;
Non-documented types are BlueprintRequestFilters, BlueprintEquipment, BlueprintEntity (in &#039;&#039;addition&#039;&#039; to the ones already documented), BlueprintControlBehavior, BlueprintInventory, InfinityContainerFilter.&lt;br /&gt;
All other types you should be able to find (also) on lua-api.factorio.com.&lt;br /&gt;
&lt;br /&gt;
You can show the entities of a blueprint in-game, in your cursor, with /c game.print(serpent.block(game.player.cursor_stack.get_blueprint_entities())) .&lt;br /&gt;
You can also use log() instead of game.print() to put it to Factorio logs&lt;br /&gt;
&lt;br /&gt;
There might still be new stuff in the Blueprint json itself (not just entities).&lt;/div&gt;</summary>
		<author><name>GlassBricks</name></author>
	</entry>
	<entry>
		<id>https://wiki.factorio.com/index.php?title=Talk:Blueprint_string_format&amp;diff=206836</id>
		<title>Talk:Blueprint string format</title>
		<link rel="alternate" type="text/html" href="https://wiki.factorio.com/index.php?title=Talk:Blueprint_string_format&amp;diff=206836"/>
		<updated>2024-11-22T05:55:32Z</updated>

		<summary type="html">&lt;p&gt;GlassBricks: /* Near complete reverse engineering work for BlueprintEntity type */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Decode snippets ==&lt;br /&gt;
&lt;br /&gt;
Since there are some short snippets to decode blueprint strings to JSON / Lua tables I think it would make sense to also have snippets for the inverse operation. -- [[User:Fgardt|fgardt]] ([[User talk:Fgardt|talk]]) 03:35, 3 August 2024 (CEST)&lt;br /&gt;
&lt;br /&gt;
== v2.x introduced new &amp;quot;wires&amp;quot; array of uncertain structure ==&lt;br /&gt;
&lt;br /&gt;
My [https://github.com/nyurik/fatul FaTul tool] minimizes versioned blueprint storage in git by making all IDs relative - e.g. connected to (-1,0) instead of a long entity number. Wires used to work in 1.x, but now I am observing a new &amp;quot;wires&amp;quot; blueprint root entry - this is an example of two electric poles connected by copper, red, and green wires. The format of the &amp;quot;wires&amp;quot; seem to be a list of connections, with each sub-array always having 4 numbers:&lt;br /&gt;
&lt;br /&gt;
* source entity_number&lt;br /&gt;
* color of the wire at the source&lt;br /&gt;
* destination entity_number&lt;br /&gt;
* color of the wire at the destination&lt;br /&gt;
&lt;br /&gt;
I guess the developers were trying to allow color-changing in the wire, e.g. starts as green, but ends as red?  For now, I only saw same color on both sides (2nd and 4th value is always the same).  The color indexes are:  5 - copper, 1 - red, 2 - green.&lt;br /&gt;
&lt;br /&gt;
 {&lt;br /&gt;
  &amp;quot;blueprint&amp;quot;: {&lt;br /&gt;
    &amp;quot;icons&amp;quot;: [{&amp;quot;signal&amp;quot;: {&amp;quot;name&amp;quot;: &amp;quot;big-electric-pole&amp;quot;}, &amp;quot;index&amp;quot;: 1}],&lt;br /&gt;
    &amp;quot;entities&amp;quot;: [&lt;br /&gt;
      {&amp;quot;entity_number&amp;quot;: 1, &amp;quot;name&amp;quot;: &amp;quot;big-electric-pole&amp;quot;, &amp;quot;position&amp;quot;: {&amp;quot;x&amp;quot;: 163, &amp;quot;y&amp;quot;: -240}},&lt;br /&gt;
      {&amp;quot;entity_number&amp;quot;: 2, &amp;quot;name&amp;quot;: &amp;quot;big-electric-pole&amp;quot;, &amp;quot;position&amp;quot;: {&amp;quot;x&amp;quot;: 195, &amp;quot;y&amp;quot;: -240}}&lt;br /&gt;
    ],&lt;br /&gt;
    &amp;quot;wires&amp;quot;: [[1, 1, 2, 1], [1, 2, 2, 2], [1, 5, 2, 5]],&lt;br /&gt;
    &amp;quot;item&amp;quot;: &amp;quot;blueprint&amp;quot;,&lt;br /&gt;
    &amp;quot;version&amp;quot;: 562949954076673&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
=== Response ===&lt;br /&gt;
&lt;br /&gt;
I have done some research on this. The wire &amp;quot;color&amp;quot; is actually a merge of wire color and the old `circuit_connector_id`, which was removed. The format seem to be:&lt;br /&gt;
&lt;br /&gt;
* source entity_number&lt;br /&gt;
* color of the wire at the source, +2 if it is connected to the &amp;quot;output&amp;quot; of the object for green or red, or +1 for copper&lt;br /&gt;
* destination entity_number&lt;br /&gt;
* color of the wire at the destination, +2 if it is connected to the &amp;quot;output&amp;quot; of the object for green or red, or +1 for copper&lt;br /&gt;
&lt;br /&gt;
e.g. an arithmetic combinator which has its output connected to the input of another combinator (or any 1 sided object) with green wire would be:&lt;br /&gt;
&lt;br /&gt;
    [1,4,2,2]&lt;br /&gt;
&lt;br /&gt;
While if it were connected to the output, it would be:&lt;br /&gt;
&lt;br /&gt;
    [1,4,2,4]&lt;br /&gt;
&lt;br /&gt;
Or, for 2 power poles connected with a switch:&lt;br /&gt;
&lt;br /&gt;
    [[1, 5, 2, 5], [2, 6, 3, 5]]&lt;br /&gt;
&lt;br /&gt;
It also seems to normalize and sort the connections by lowest entity number. You&#039;ll note that rather than the old method of setting connections on both objects, there is on one &amp;quot;wire&amp;quot; entry per connection, and it seems to always pick the lower entity number to be at the start of the &amp;quot;wire&amp;quot; entry.&lt;br /&gt;
&lt;br /&gt;
=== Edit ===&lt;br /&gt;
After more research, it&#039;s based on `wire_connector_id`, which was added to the defines:&lt;br /&gt;
&lt;br /&gt;
    wire_connector_id = {&lt;br /&gt;
        circuit_green = 2,&lt;br /&gt;
        circuit_red = 1,&lt;br /&gt;
        combinator_input_green = 2,&lt;br /&gt;
        combinator_input_red = 1,&lt;br /&gt;
        combinator_output_green = 4,&lt;br /&gt;
        combinator_output_red = 3,&lt;br /&gt;
        pole_copper = 5,&lt;br /&gt;
        power_switch_left_copper = 5,&lt;br /&gt;
        power_switch_right_copper = 6&lt;br /&gt;
    },&lt;br /&gt;
&lt;br /&gt;
-- [[User:HuFlungDu|HuFlungDu]] ([[User talk:HuFlungDu|talk]])&lt;br /&gt;
&lt;br /&gt;
== v2.X SignalID has optional &amp;quot;type&amp;quot; now ==&lt;br /&gt;
&lt;br /&gt;
Blueprint:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;0eNqVkd1uhCAQhd9lrnGzWm2ir9JsDOLEnRQGC2hrDO9e0Dbbqza9Y5hzvvnbYdALzo44QLcDKcseupcdPE0sdf5jaRA6kN6jGTTxVBip7sRYVBAFEI/4AV0ZbwKQAwXCk3AEW8+LGdAlgfiVJGC2Ppkt55oZeL00Ajboni5NKuNQ0Zzd5CwXE0pXvN8RNXyn+rdF6lQwSdg6I3OGApqzGRp/jDI7Oy4q0JrkhUlvjcckpzqJuSdeU//Wbaf7EdUCfJDq9Zg4RvE3+mtN/4NfM/yWd5qNCfw4k4AVnT8W1TxXbd22TV3WVVWWMX4CClCeDw==&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Beginning of JSON:&lt;br /&gt;
&lt;br /&gt;
    {&lt;br /&gt;
        &amp;quot;blueprint&amp;quot;: {&lt;br /&gt;
            &amp;quot;icons&amp;quot;: [&lt;br /&gt;
                {&lt;br /&gt;
                    &amp;quot;signal&amp;quot;: {&lt;br /&gt;
                        &amp;quot;name&amp;quot;: &amp;quot;assembling-machine-2&amp;quot;&lt;br /&gt;
                    },&lt;br /&gt;
                    &amp;quot;index&amp;quot;: 1&lt;br /&gt;
                }&lt;br /&gt;
            ],&lt;br /&gt;
&lt;br /&gt;
Notice there is no &amp;lt;code&amp;gt;&amp;quot;type&amp;quot;: &amp;quot;item&amp;quot;&amp;lt;/code&amp;gt; property.&lt;br /&gt;
&lt;br /&gt;
== v2.x introduced new &amp;quot;stock_connections&amp;quot; array for trains(?) ==&lt;br /&gt;
&lt;br /&gt;
Similar to above, for my [https://github.com/nyurik/fatul FaTul] blueprint GIT management tool, I am seeing a new &amp;lt;code&amp;gt;stock_connections&amp;lt;/code&amp;gt; top level property for connections entities like trains. If my entities represent a train with 4 cargo wagons (entities 1-4) and two locomotives (entities 5 and 6), this represents their connectivity LCCCCL:&lt;br /&gt;
&lt;br /&gt;
    &amp;quot;stock_connections&amp;quot;: [&lt;br /&gt;
      {&amp;quot;back&amp;quot;: 1, &amp;quot;stock&amp;quot;: 5},&lt;br /&gt;
      {&amp;quot;back&amp;quot;: 2, &amp;quot;front&amp;quot;: 5, &amp;quot;stock&amp;quot;: 1},&lt;br /&gt;
      {&amp;quot;back&amp;quot;: 3, &amp;quot;front&amp;quot;: 1, &amp;quot;stock&amp;quot;: 2},&lt;br /&gt;
      {&amp;quot;back&amp;quot;: 4, &amp;quot;front&amp;quot;: 2, &amp;quot;stock&amp;quot;: 3},&lt;br /&gt;
      {&amp;quot;back&amp;quot;: 6, &amp;quot;front&amp;quot;: 3, &amp;quot;stock&amp;quot;: 4},&lt;br /&gt;
      {&amp;quot;front&amp;quot;: 4, &amp;quot;stock&amp;quot;: 6}&lt;br /&gt;
    ]&lt;br /&gt;
&lt;br /&gt;
== Probably complete BlueprintEntity type for v2.0 ==&lt;br /&gt;
&lt;br /&gt;
BlueprintEntity format is actually https://lua-api.factorio.com/latest/concepts/BlueprintEntity.html&lt;br /&gt;
&lt;br /&gt;
Notably, this contains the &amp;quot;wires&amp;quot; field, which is already documented, and some others, so no need to reverse engineer that.&lt;br /&gt;
&lt;br /&gt;
However, there&#039;s still a ton attributes not documented, but I&#039;ve slowly dug them out:&lt;br /&gt;
The results can be found here:&lt;br /&gt;
https://github.com/GlassBricks/typed-factorio/blob/3632b3d5eca9a9f5f3b85345ddf33d23f995dbdd/runtime/generated/concepts.d.ts#L2824&lt;br /&gt;
Or the manually defined input here, which might be more clear:&lt;br /&gt;
https://github.com/GlassBricks/typed-factorio/blob/3632b3d5eca9a9f5f3b85345ddf33d23f995dbdd/generator/input/manual-defs-runtime.ts#L568&lt;br /&gt;
Even if you don&#039;t know typescript its probably readable.&lt;br /&gt;
&lt;br /&gt;
Non-documented types are BlueprintRequestFilters, BlueprintEquipment, BlueprintEntity (in &#039;&#039;addition&#039;&#039; to the ones already documented), BlueprintControlBehavior, BlueprintInventory, InfinityContainerFilter.&lt;br /&gt;
All other types you should be able to find (also) on lua-api.factorio.com.&lt;br /&gt;
&lt;br /&gt;
You can show the entities of a blueprint in-game, in your cursor, with /c game.print(serpent.block(game.player.cursor_stack.get_blueprint_entities())) .&lt;br /&gt;
You can also use log() instead of game.print() to put it to Factorio logs&lt;br /&gt;
&lt;br /&gt;
There might still be new types for the Blueprint json itself (not just entities).&lt;/div&gt;</summary>
		<author><name>GlassBricks</name></author>
	</entry>
	<entry>
		<id>https://wiki.factorio.com/index.php?title=Talk:Blueprint_string_format&amp;diff=206835</id>
		<title>Talk:Blueprint string format</title>
		<link rel="alternate" type="text/html" href="https://wiki.factorio.com/index.php?title=Talk:Blueprint_string_format&amp;diff=206835"/>
		<updated>2024-11-22T05:54:06Z</updated>

		<summary type="html">&lt;p&gt;GlassBricks: /* Near complete reverse engineering work for BlueprintEntity type */ new section&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Decode snippets ==&lt;br /&gt;
&lt;br /&gt;
Since there are some short snippets to decode blueprint strings to JSON / Lua tables I think it would make sense to also have snippets for the inverse operation. -- [[User:Fgardt|fgardt]] ([[User talk:Fgardt|talk]]) 03:35, 3 August 2024 (CEST)&lt;br /&gt;
&lt;br /&gt;
== v2.x introduced new &amp;quot;wires&amp;quot; array of uncertain structure ==&lt;br /&gt;
&lt;br /&gt;
My [https://github.com/nyurik/fatul FaTul tool] minimizes versioned blueprint storage in git by making all IDs relative - e.g. connected to (-1,0) instead of a long entity number. Wires used to work in 1.x, but now I am observing a new &amp;quot;wires&amp;quot; blueprint root entry - this is an example of two electric poles connected by copper, red, and green wires. The format of the &amp;quot;wires&amp;quot; seem to be a list of connections, with each sub-array always having 4 numbers:&lt;br /&gt;
&lt;br /&gt;
* source entity_number&lt;br /&gt;
* color of the wire at the source&lt;br /&gt;
* destination entity_number&lt;br /&gt;
* color of the wire at the destination&lt;br /&gt;
&lt;br /&gt;
I guess the developers were trying to allow color-changing in the wire, e.g. starts as green, but ends as red?  For now, I only saw same color on both sides (2nd and 4th value is always the same).  The color indexes are:  5 - copper, 1 - red, 2 - green.&lt;br /&gt;
&lt;br /&gt;
 {&lt;br /&gt;
  &amp;quot;blueprint&amp;quot;: {&lt;br /&gt;
    &amp;quot;icons&amp;quot;: [{&amp;quot;signal&amp;quot;: {&amp;quot;name&amp;quot;: &amp;quot;big-electric-pole&amp;quot;}, &amp;quot;index&amp;quot;: 1}],&lt;br /&gt;
    &amp;quot;entities&amp;quot;: [&lt;br /&gt;
      {&amp;quot;entity_number&amp;quot;: 1, &amp;quot;name&amp;quot;: &amp;quot;big-electric-pole&amp;quot;, &amp;quot;position&amp;quot;: {&amp;quot;x&amp;quot;: 163, &amp;quot;y&amp;quot;: -240}},&lt;br /&gt;
      {&amp;quot;entity_number&amp;quot;: 2, &amp;quot;name&amp;quot;: &amp;quot;big-electric-pole&amp;quot;, &amp;quot;position&amp;quot;: {&amp;quot;x&amp;quot;: 195, &amp;quot;y&amp;quot;: -240}}&lt;br /&gt;
    ],&lt;br /&gt;
    &amp;quot;wires&amp;quot;: [[1, 1, 2, 1], [1, 2, 2, 2], [1, 5, 2, 5]],&lt;br /&gt;
    &amp;quot;item&amp;quot;: &amp;quot;blueprint&amp;quot;,&lt;br /&gt;
    &amp;quot;version&amp;quot;: 562949954076673&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
=== Response ===&lt;br /&gt;
&lt;br /&gt;
I have done some research on this. The wire &amp;quot;color&amp;quot; is actually a merge of wire color and the old `circuit_connector_id`, which was removed. The format seem to be:&lt;br /&gt;
&lt;br /&gt;
* source entity_number&lt;br /&gt;
* color of the wire at the source, +2 if it is connected to the &amp;quot;output&amp;quot; of the object for green or red, or +1 for copper&lt;br /&gt;
* destination entity_number&lt;br /&gt;
* color of the wire at the destination, +2 if it is connected to the &amp;quot;output&amp;quot; of the object for green or red, or +1 for copper&lt;br /&gt;
&lt;br /&gt;
e.g. an arithmetic combinator which has its output connected to the input of another combinator (or any 1 sided object) with green wire would be:&lt;br /&gt;
&lt;br /&gt;
    [1,4,2,2]&lt;br /&gt;
&lt;br /&gt;
While if it were connected to the output, it would be:&lt;br /&gt;
&lt;br /&gt;
    [1,4,2,4]&lt;br /&gt;
&lt;br /&gt;
Or, for 2 power poles connected with a switch:&lt;br /&gt;
&lt;br /&gt;
    [[1, 5, 2, 5], [2, 6, 3, 5]]&lt;br /&gt;
&lt;br /&gt;
It also seems to normalize and sort the connections by lowest entity number. You&#039;ll note that rather than the old method of setting connections on both objects, there is on one &amp;quot;wire&amp;quot; entry per connection, and it seems to always pick the lower entity number to be at the start of the &amp;quot;wire&amp;quot; entry.&lt;br /&gt;
&lt;br /&gt;
=== Edit ===&lt;br /&gt;
After more research, it&#039;s based on `wire_connector_id`, which was added to the defines:&lt;br /&gt;
&lt;br /&gt;
    wire_connector_id = {&lt;br /&gt;
        circuit_green = 2,&lt;br /&gt;
        circuit_red = 1,&lt;br /&gt;
        combinator_input_green = 2,&lt;br /&gt;
        combinator_input_red = 1,&lt;br /&gt;
        combinator_output_green = 4,&lt;br /&gt;
        combinator_output_red = 3,&lt;br /&gt;
        pole_copper = 5,&lt;br /&gt;
        power_switch_left_copper = 5,&lt;br /&gt;
        power_switch_right_copper = 6&lt;br /&gt;
    },&lt;br /&gt;
&lt;br /&gt;
-- [[User:HuFlungDu|HuFlungDu]] ([[User talk:HuFlungDu|talk]])&lt;br /&gt;
&lt;br /&gt;
== v2.X SignalID has optional &amp;quot;type&amp;quot; now ==&lt;br /&gt;
&lt;br /&gt;
Blueprint:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;0eNqVkd1uhCAQhd9lrnGzWm2ir9JsDOLEnRQGC2hrDO9e0Dbbqza9Y5hzvvnbYdALzo44QLcDKcseupcdPE0sdf5jaRA6kN6jGTTxVBip7sRYVBAFEI/4AV0ZbwKQAwXCk3AEW8+LGdAlgfiVJGC2Ppkt55oZeL00Ajboni5NKuNQ0Zzd5CwXE0pXvN8RNXyn+rdF6lQwSdg6I3OGApqzGRp/jDI7Oy4q0JrkhUlvjcckpzqJuSdeU//Wbaf7EdUCfJDq9Zg4RvE3+mtN/4NfM/yWd5qNCfw4k4AVnT8W1TxXbd22TV3WVVWWMX4CClCeDw==&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Beginning of JSON:&lt;br /&gt;
&lt;br /&gt;
    {&lt;br /&gt;
        &amp;quot;blueprint&amp;quot;: {&lt;br /&gt;
            &amp;quot;icons&amp;quot;: [&lt;br /&gt;
                {&lt;br /&gt;
                    &amp;quot;signal&amp;quot;: {&lt;br /&gt;
                        &amp;quot;name&amp;quot;: &amp;quot;assembling-machine-2&amp;quot;&lt;br /&gt;
                    },&lt;br /&gt;
                    &amp;quot;index&amp;quot;: 1&lt;br /&gt;
                }&lt;br /&gt;
            ],&lt;br /&gt;
&lt;br /&gt;
Notice there is no &amp;lt;code&amp;gt;&amp;quot;type&amp;quot;: &amp;quot;item&amp;quot;&amp;lt;/code&amp;gt; property.&lt;br /&gt;
&lt;br /&gt;
== v2.x introduced new &amp;quot;stock_connections&amp;quot; array for trains(?) ==&lt;br /&gt;
&lt;br /&gt;
Similar to above, for my [https://github.com/nyurik/fatul FaTul] blueprint GIT management tool, I am seeing a new &amp;lt;code&amp;gt;stock_connections&amp;lt;/code&amp;gt; top level property for connections entities like trains. If my entities represent a train with 4 cargo wagons (entities 1-4) and two locomotives (entities 5 and 6), this represents their connectivity LCCCCL:&lt;br /&gt;
&lt;br /&gt;
    &amp;quot;stock_connections&amp;quot;: [&lt;br /&gt;
      {&amp;quot;back&amp;quot;: 1, &amp;quot;stock&amp;quot;: 5},&lt;br /&gt;
      {&amp;quot;back&amp;quot;: 2, &amp;quot;front&amp;quot;: 5, &amp;quot;stock&amp;quot;: 1},&lt;br /&gt;
      {&amp;quot;back&amp;quot;: 3, &amp;quot;front&amp;quot;: 1, &amp;quot;stock&amp;quot;: 2},&lt;br /&gt;
      {&amp;quot;back&amp;quot;: 4, &amp;quot;front&amp;quot;: 2, &amp;quot;stock&amp;quot;: 3},&lt;br /&gt;
      {&amp;quot;back&amp;quot;: 6, &amp;quot;front&amp;quot;: 3, &amp;quot;stock&amp;quot;: 4},&lt;br /&gt;
      {&amp;quot;front&amp;quot;: 4, &amp;quot;stock&amp;quot;: 6}&lt;br /&gt;
    ]&lt;br /&gt;
&lt;br /&gt;
== Near complete reverse engineering work for BlueprintEntity type ==&lt;br /&gt;
&lt;br /&gt;
BlueprintEntity format is actually https://lua-api.factorio.com/latest/concepts/BlueprintEntity.html&lt;br /&gt;
&lt;br /&gt;
Notably, this contains the &amp;quot;wires&amp;quot; field, which is already documented, and some others, so no need to reverse engineer that.&lt;br /&gt;
&lt;br /&gt;
However, there&#039;s still a ton attributes not documented, but I&#039;ve slowly dug them out:&lt;br /&gt;
The results can be found here:&lt;br /&gt;
https://github.com/GlassBricks/typed-factorio/blob/3632b3d5eca9a9f5f3b85345ddf33d23f995dbdd/runtime/generated/concepts.d.ts#L2824&lt;br /&gt;
Or the manually defined input here, which might be more clear:&lt;br /&gt;
https://github.com/GlassBricks/typed-factorio/blob/3632b3d5eca9a9f5f3b85345ddf33d23f995dbdd/generator/input/manual-defs-runtime.ts#L568&lt;br /&gt;
Even if you don&#039;t know typescript its probably readable.&lt;br /&gt;
&lt;br /&gt;
Non-documented types are BlueprintRequestFilters, BlueprintEquipment, BlueprintEntity (in &#039;&#039;addition&#039;&#039; to the ones already documented), BlueprintControlBehavior, BlueprintInventory, InfinityContainerFilter.&lt;br /&gt;
All other types you should be able to find (also) on lua-api.factorio.com.&lt;br /&gt;
&lt;br /&gt;
You can show the entities of a blueprint in-game, in your cursor, with /c game.print(serpent.block(game.player.cursor_stack.get_blueprint_entities())) .&lt;br /&gt;
You can also use log() instead of game.print() to put it to Factorio logs&lt;br /&gt;
&lt;br /&gt;
There might still be new types for the Blueprint json itself (not just entities).&lt;/div&gt;</summary>
		<author><name>GlassBricks</name></author>
	</entry>
</feed>