Add loadIfPresent method for use where the section should definitely exist and be FULL

This commit is contained in:
dordsor21
2021-09-13 12:47:00 +01:00
parent af890cf21d
commit 40a4010041
11 changed files with 79 additions and 13 deletions

View File

@ -33,6 +33,7 @@ import com.sk89q.worldedit.world.block.BlockState;
import java.io.IOException;
import java.util.Iterator;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.Future;
@ -170,7 +171,8 @@ public abstract class AbstractChangeSet implements ChangeSet, IBatchProcessor {
System.arraycopy(tmp, 0, (blocksGet = new char[4096]), 0, 4096);
}
char[] blocksSet;
System.arraycopy(set.load(layer), 0, (blocksSet = new char[4096]), 0, 4096);
// loadIfPresent shouldn't be null if set.hasSection(layer) is true
System.arraycopy(Objects.requireNonNull(set.loadIfPresent(layer)), 0, (blocksSet = new char[4096]), 0, 4096);
// Account for negative layers
int by = layer << 4;