Variable: clone method - ScreamingSandals/SimpleInventories GitHub Wiki
This sets clone method!
There are three clone methods:
-
default,missing- This is the default mehod! It clones just missing variables! Yaml:- id: hello stack: APPLE - clone-method: default clone: $hello stack: DIRT # Final item will be DIRT
Groovy:
item('APPLE') { id 'hello' } itemClone('$hello') { cloneMethod 'default' stack.type 'DIRT' // Final item will be DIRT }
-
override- This always clones all variables from parent item!Yaml:
- id: hello stack: APPLE - clone-method: override clone: $hello stack: DIRT # Final item will be APPLE
Groovy:
item('APPLE') { id 'hello' } itemClone('$hello') { cloneMethod 'override' stack.type 'DIRT' // Final item will be APPLE }
-
increment,increment-<method>- This merges two lists (for exampleitems:) and for other variables uses method after dashincrement-missing,increment-overrideYaml:
- id: hello stack: APPLE items: - stack: ... - stack: ... - clone-method: increment clone: $hello stack: DIRT # Final item will be DIRT items: - stack: ... - stack: ... # Final number of childs will be 4
Groovy:
item('APPLE') { id 'hello' item('...') item('...') } itemClone('$hello') { cloneMethod 'increment' stack.type 'DIRT' // Final item will be DIRT item('...') item('...') // Final number of childs will be 4 }