165165-- @param off
166166-- @param meta_backwards (not officially part of API)
167167-- @return The number of nodes copied.
168- function worldedit .copy2 (pos1 , pos2 , off , meta_backwards )
168+ function worldedit .copy2 (pos1 , pos2 , off , meta_backwards , skip_meta_sanitize )
169169 local pos1 , pos2 = worldedit .sort_pos (pos1 , pos2 )
170170
171171 local src_manip , src_area = mh .init (pos1 , pos2 )
@@ -226,6 +226,9 @@ function worldedit.copy2(pos1, pos2, off, meta_backwards)
226226 local pos = vector .new (pos1 .x + x , pos1 .y + y , pos1 .z + z )
227227 local meta = get_meta (pos ):to_table ()
228228 pos = vector .add (pos , off )
229+ if not skip_meta_sanitize then
230+ worldedit .sanitize_meta (meta )
231+ end
229232 get_meta (pos ):from_table (meta )
230233 end
231234 end
@@ -237,6 +240,9 @@ function worldedit.copy2(pos1, pos2, off, meta_backwards)
237240 local pos = vector .new (pos1 .x + x , pos1 .y + y , pos1 .z + z )
238241 local meta = get_meta (pos ):to_table ()
239242 pos = vector .add (pos , off )
243+ if not skip_meta_sanitize then
244+ worldedit .sanitize_meta (meta )
245+ end
240246 get_meta (pos ):from_table (meta )
241247 end
242248 end
@@ -285,7 +291,7 @@ function worldedit.move(pos1, pos2, axis, amount)
285291 -- Copy stuff to new location
286292 local off = vector .new ()
287293 off [axis ] = amount
288- worldedit .copy2 (pos1 , pos2 , off , backwards )
294+ worldedit .copy2 (pos1 , pos2 , off , backwards , true )
289295 -- Nuke old area
290296 if not overlap then
291297 nuke_area (vector .new (), dim )
@@ -375,6 +381,7 @@ function worldedit.stretch(pos1, pos2, stretch_x, stretch_y, stretch_z)
375381 while pos .z >= pos1 .z do
376382 local node = get_node (pos ) -- Get current node
377383 local meta = get_meta (pos ):to_table () -- Get meta of current node
384+ worldedit .sanitize_meta (meta )
378385
379386 -- Calculate far corner of the big node
380387 local pos_x = pos1 .x + (pos .x - pos1 .x ) * stretch_x
0 commit comments