Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: make RegionMaskingFilter upstream compatible again #3030

Merged
merged 1 commit into from
Dec 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ public void setBiome(

RegionFunction replace = new BiomeReplace(editSession, target);
if (mask != null) {
replace = new RegionMaskingFilter(editSession, mask, replace);
replace = new RegionMaskingFilter(mask, replace);
}
RegionVisitor visitor = new RegionVisitor(region, replace);
Operations.completeLegacy(visitor);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -818,7 +818,7 @@ default int replaceBlocks(Region region, Mask mask, Pattern pattern) throws MaxC
checkNotNull(pattern);

BlockReplace replace = new BlockReplace(this, pattern);
RegionMaskingFilter filter = new RegionMaskingFilter(this, mask, replace);
RegionMaskingFilter filter = new RegionMaskingFilter(mask, replace);
//FAWE start > add extent to RegionVisitor to allow chunk preloading
RegionVisitor visitor = new RegionVisitor(region, filter, this);
//FAWE end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,28 +35,33 @@ public class RegionMaskingFilter implements RegionFunction {

private final RegionFunction function;
private final Mask mask;
//FAWE start
private final Extent extent;
//FAWE end

/**
* Create a new masking filter.
*
* @param mask the mask
* @param mask the mask
* @param function the function
*/
//FAWE start - Extent
public RegionMaskingFilter(Extent extent, Mask mask, RegionFunction function) {
public RegionMaskingFilter(Mask mask, RegionFunction function) {
checkNotNull(function);
checkNotNull(mask);
//FAWE start
checkNotNull(extent);
this.extent = extent;
//FAWE end
this.mask = mask;
this.function = function;
}

/**
* Create a new masking filter.
*
* @param mask the mask
* @param function the function
*/
//FAWE start - Extent
@Deprecated(since = "TODO")
public RegionMaskingFilter(@SuppressWarnings("unused") Extent extent, Mask mask, RegionFunction function) {
this(mask, function);
}
//FAWE end - Extent

@Override
public boolean apply(BlockVector3 position) throws WorldEditException {
return mask.test(position) && function.apply(position);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ public Operation resume(RunContext run) throws WorldEditException {
}
if (sourceMask != Masks.alwaysTrue()) {
new MaskTraverser(sourceMask).reset(transExt);
copy = new RegionMaskingFilter(source, sourceMask, copy);
copy = new RegionMaskingFilter(sourceMask, copy);
}
if (copyingBiomes && (source.isWorld() || region instanceof FlatRegion)) {
copy = CombinedRegionFunction.combine(copy, new BiomeCopy(source, finalDest));
Expand Down Expand Up @@ -394,7 +394,7 @@ public Operation resume(RunContext run) throws WorldEditException {
if (maskFunc != null) {
copy = new RegionMaskTestFunction(sourceMask, copy, maskFunc);
} else {
copy = new RegionMaskingFilter(source, sourceMask, copy);
copy = new RegionMaskingFilter(sourceMask, copy);
}
}
if (copyingBiomes && (source.isWorld() || region instanceof FlatRegion)) {
Expand Down
Loading