-
-
Notifications
You must be signed in to change notification settings - Fork 204
/
NoXPattern.java
44 lines (36 loc) · 1.27 KB
/
NoXPattern.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package com.fastasyncworldedit.core.function.pattern;
import com.fastasyncworldedit.core.math.MutableBlockVector3;
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.function.pattern.AbstractPattern;
import com.sk89q.worldedit.function.pattern.Pattern;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.world.block.BaseBlock;
public class NoXPattern extends AbstractPattern {
private final Pattern pattern;
private final MutableBlockVector3 mutable = new MutableBlockVector3();
/**
* Create a new {@link Pattern} instance
*
* @param pattern pattern to apply
*/
public NoXPattern(Pattern pattern) {
this.pattern = pattern;
}
@Override
public BaseBlock applyBlock(BlockVector3 pos) {
mutable.mutY(pos.getY());
mutable.mutZ(pos.getZ());
return pattern.applyBlock(mutable);
}
@Override
public boolean apply(Extent extent, BlockVector3 get, BlockVector3 set) throws WorldEditException {
mutable.mutY(get.getY());
mutable.mutZ(get.getZ());
return pattern.apply(extent, mutable, set);
}
@Override
public Pattern fork() {
return new NoXPattern(this.pattern.fork());
}
}