Skip to content

Commit

Permalink
Set clipboard after regen to prevent unnecessary clipboard loss on fa…
Browse files Browse the repository at this point in the history
…ilure (EngineHub#2503)

* Set clipboard after regen to prevent unnecessary clipboard loss on failure

* Remove the cast
  • Loading branch information
me4502 authored Apr 4, 2024
1 parent 177e70d commit 79a06b1
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -459,13 +459,16 @@ void regenerate(Actor actor, World world, LocalSession session, EditSession edit
.regenBiomes(regenBiomes)
.build();
Extent outputExtent = editSession;
BlockArrayClipboard clipboard = null;
if (toClipboard) {
var clipboard = new BlockArrayClipboard(region);
clipboard = new BlockArrayClipboard(region);
clipboard.setOrigin(session.getPlacementPosition(actor));
session.setClipboard(new ClipboardHolder(clipboard));
outputExtent = clipboard;
}
success = world.regenerate(region, outputExtent, options);
if (success && toClipboard) {
session.setClipboard(new ClipboardHolder(clipboard));
}
} finally {
session.setMask(mask);
}
Expand Down

0 comments on commit 79a06b1

Please sign in to comment.