diff --git a/worldeditadditions/lib/copy.lua b/worldeditadditions/lib/copy.lua index 030b76f..2cb4a64 100644 --- a/worldeditadditions/lib/copy.lua +++ b/worldeditadditions/lib/copy.lua @@ -27,10 +27,12 @@ function worldeditadditions.copy(source_pos1, source_pos2, target_pos1, target_p -- Fetch the nodes in the source area local manip_source, area_source = worldedit.manip_helpers.init(source_pos1, source_pos2) local data_source = manip_source:get_data() + local data_source_param2 = manip_source:get_param2_data() -- Fetch a manip for the target area local manip_target, area_target = worldedit.manip_helpers.init(target_pos1, target_pos2) local data_target = manip_target:get_data() + local data_target_param2 = manip_target:get_param2_data() -- z y x is the preferred loop order (because CPU cache, since then we're iterating linearly through the data array backwards. This only holds true for little-endian machines however) local total_replaced = 0 @@ -48,6 +50,7 @@ function worldeditadditions.copy(source_pos1, source_pos2, target_pos1, target_p end if should_replace then data_target[target_i] = data_source[source_i] + data_target_param2[target_i] = data_source_param2[source_i] total_replaced = total_replaced + 1 end end @@ -55,6 +58,7 @@ function worldeditadditions.copy(source_pos1, source_pos2, target_pos1, target_p end -- Save the modified nodes back to disk & return + manip_target:set_param2_data(data_target_param2) worldedit.manip_helpers.finish(manip_target, data_target) return true, total_replaced