diff --git a/src/main/java/cubicchunks/converter/lib/convert/cc2ccrelocating/CC2CCRelocatingDataConverter.java b/src/main/java/cubicchunks/converter/lib/convert/cc2ccrelocating/CC2CCRelocatingDataConverter.java index 099e4ea..a8c5add 100644 --- a/src/main/java/cubicchunks/converter/lib/convert/cc2ccrelocating/CC2CCRelocatingDataConverter.java +++ b/src/main/java/cubicchunks/converter/lib/convert/cc2ccrelocating/CC2CCRelocatingDataConverter.java @@ -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 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 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 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 tasks, int x, int y, int z) { for(EditTask task : tasks) { if (task.getSourceBox().intersects(x, y, z)) {