mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-05 20:36:42 +00:00
Add /tracemask. (#474)
Allows setting a mask used for block traces. This allows brush tools to pass through various materials, such as water (e.g. `/tracemask #solid` or `/tracemask !air,water`) before starting to build. By default, a null mask is equivalent to #existing (original behavior). https://gfycat.com/ImmaculateFrayedCockatiel
This commit is contained in:
@ -23,6 +23,7 @@ import com.sk89q.worldedit.NotABlockException;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.function.mask.Mask;
|
||||
import com.sk89q.worldedit.internal.cui.CUIEvent;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.math.Vector3;
|
||||
@ -41,6 +42,7 @@ import com.sk89q.worldedit.world.gamemode.GameModes;
|
||||
import com.sk89q.worldedit.world.item.ItemType;
|
||||
import com.sk89q.worldedit.world.item.ItemTypes;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.io.File;
|
||||
|
||||
/**
|
||||
@ -323,13 +325,29 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
|
||||
|
||||
@Override
|
||||
public Location getBlockTrace(int range, boolean useLastBlock) {
|
||||
TargetBlock tb = new TargetBlock(this, range, 0.2);
|
||||
return (useLastBlock ? tb.getAnyTargetBlock() : tb.getTargetBlock());
|
||||
return getBlockTrace(range, useLastBlock, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Location getBlockTraceFace(int range, boolean useLastBlock) {
|
||||
return getBlockTraceFace(range, useLastBlock, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Location getBlockTrace(int range, boolean useLastBlock, @Nullable Mask stopMask) {
|
||||
TargetBlock tb = new TargetBlock(this, range, 0.2);
|
||||
if (stopMask != null) {
|
||||
tb.setStopMask(stopMask);
|
||||
}
|
||||
return (useLastBlock ? tb.getAnyTargetBlock() : tb.getTargetBlock());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Location getBlockTraceFace(int range, boolean useLastBlock, @Nullable Mask stopMask) {
|
||||
TargetBlock tb = new TargetBlock(this, range, 0.2);
|
||||
if (stopMask != null) {
|
||||
tb.setStopMask(stopMask);
|
||||
}
|
||||
return (useLastBlock ? tb.getAnyTargetBlockFace() : tb.getTargetBlockFace());
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user