Skip to content

Commit

Permalink
attempted to fix relocating converter
Browse files Browse the repository at this point in the history
  • Loading branch information
NotStirred committed Oct 2, 2020
1 parent b74caee commit 5ea63d4
Showing 1 changed file with 18 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -250,31 +250,36 @@ else if(task.getType() == EditTask.Type.CUT) {
tagMap.remove(vector2i);
continue;
}
if(!modified && !isCubeInCopyOrPasteLoc(this.relocateTasks, cubeX, cubeY, cubeZ)) {
if(!modified && !isCubeSrc(this.relocateTasks, cubeX, cubeY, cubeZ) && !isCubeDst(this.relocateTasks, cubeX, cubeY, cubeZ)) {
tagMap.computeIfAbsent(new Vector2i(cubeX, cubeZ), key->new HashMap<>()).put(cubeY, entry.getValue());
}
}

return tagMap;
}
//Returns true if cube data is going to be used for copy
private static boolean isCubeInCopyOrPasteLoc(List<EditTask> tasks, int x, int y, int z) {
for(EditTask task : tasks) {
if (task.getSourceBox().intersects(x, y, z)) {
if (task.getOffset() == null) continue;
if (task.getSourceBox().intersects(
x - task.getOffset().getX(),
y - task.getOffset().getY(),
z - task.getOffset().getZ())) {

private static boolean isCubeSrc(List<EditTask> tasks, int x, int y, int z) {
for (EditTask editTask : tasks) {
if (editTask.getSourceBox().intersects(x, y, z))
return true;
}
return false;
}
private static boolean isCubeDst(List<EditTask> tasks, int x, int y, int z) {
for (EditTask editTask : tasks) {
if (editTask.getOffset() != null) {
if (editTask.getSourceBox().add(editTask.getOffset()).intersects(x, y, z))
return true;
}

if(editTask.getType() == EditTask.Type.CUT || editTask.getType() == EditTask.Type.REMOVE) {
if (editTask.getSourceBox().intersects(x, y, z))
return true;
}
}
}
return false;
}



public static boolean isRegionInCopyOrPasteLoc(List<EditTask> tasks, int x, int y, int z) {
for(EditTask task : tasks) {
if (task.getSourceBox().intersects(x, y, z)) {
Expand Down

0 comments on commit 5ea63d4

Please sign in to comment.