Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-12-25 02:20:07 +01:00
There's no need to duplicate everything when copying the intersection masks, as the Set and array should be the same. (#680)
* There's no need to duplicate everything when copying the intersection masks, as the Set and array should be the same. * do the same for Union mask
Dieser Commit ist enthalten in:
Ursprung
fc606ff5ff
Commit
b06d943f7c
@ -61,12 +61,6 @@ public class MaskIntersection extends AbstractMask {
|
|||||||
formArray();
|
formArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected MaskIntersection(Set<Mask> masks, Mask[] masksArray, boolean defaultReturn) {
|
|
||||||
this.masks = masks;
|
|
||||||
this.masksArray = masksArray;
|
|
||||||
this.defaultReturn = defaultReturn;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Mask of(Mask... masks) {
|
public static Mask of(Mask... masks) {
|
||||||
Set<Mask> set = new LinkedHashSet<>();
|
Set<Mask> set = new LinkedHashSet<>();
|
||||||
for (Mask mask : masks) {
|
for (Mask mask : masks) {
|
||||||
@ -260,8 +254,7 @@ public class MaskIntersection extends AbstractMask {
|
|||||||
@Override
|
@Override
|
||||||
public Mask copy(){
|
public Mask copy(){
|
||||||
Set<Mask> masks = this.masks.stream().map(Mask::copy).collect(Collectors.toSet());
|
Set<Mask> masks = this.masks.stream().map(Mask::copy).collect(Collectors.toSet());
|
||||||
Mask[] maskArray = (Mask[]) Arrays.stream(this.masksArray).map(Mask::copy).toArray();
|
return new MaskIntersection(masks);
|
||||||
return new MaskIntersection(masks, maskArray, this.defaultReturn);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,6 @@ package com.sk89q.worldedit.function.mask;
|
|||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.LinkedHashSet;
|
import java.util.LinkedHashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -57,10 +56,6 @@ public class MaskUnion extends MaskIntersection {
|
|||||||
super(mask);
|
super(mask);
|
||||||
}
|
}
|
||||||
|
|
||||||
private MaskUnion(Set<Mask> masks, Mask[] maskArray, boolean defaultReturn) {
|
|
||||||
super(masks, maskArray, defaultReturn);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Mask of(Mask... masks) {
|
public static Mask of(Mask... masks) {
|
||||||
Set<Mask> set = new LinkedHashSet<>();
|
Set<Mask> set = new LinkedHashSet<>();
|
||||||
for (Mask mask : masks) {
|
for (Mask mask : masks) {
|
||||||
@ -121,7 +116,6 @@ public class MaskUnion extends MaskIntersection {
|
|||||||
@Override
|
@Override
|
||||||
public Mask copy() {
|
public Mask copy() {
|
||||||
Set<Mask> masksCopy = masks.stream().map(Mask::copy).collect(Collectors.toSet());
|
Set<Mask> masksCopy = masks.stream().map(Mask::copy).collect(Collectors.toSet());
|
||||||
Mask[] maskArray = (Mask[]) Arrays.stream(masksArray).map(Mask::copy).toArray();
|
return new MaskUnion(masksCopy);
|
||||||
return new MaskUnion(masksCopy, maskArray, defaultReturn);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren