mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-04 03:56:41 +00:00
Continue the great purge
This commit is contained in:
@ -19,11 +19,12 @@
|
||||
|
||||
package com.sk89q.worldedit.command.tool;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.LocalConfiguration;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||
import com.sk89q.worldedit.WorldVector;
|
||||
import com.sk89q.worldedit.command.tool.brush.Brush;
|
||||
import com.sk89q.worldedit.command.tool.brush.SphereBrush;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
@ -34,11 +35,10 @@ import com.sk89q.worldedit.function.mask.Mask;
|
||||
import com.sk89q.worldedit.function.mask.MaskIntersection;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.session.request.Request;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
/**
|
||||
* Builds a shape at the place being looked at.
|
||||
*/
|
||||
@ -162,7 +162,7 @@ public class BrushTool implements TraceTool {
|
||||
|
||||
@Override
|
||||
public boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session) {
|
||||
WorldVector target = null;
|
||||
Location target = null;
|
||||
target = player.getBlockTrace(getRange(), true);
|
||||
|
||||
if (target == null) {
|
||||
@ -189,7 +189,7 @@ public class BrushTool implements TraceTool {
|
||||
}
|
||||
|
||||
try {
|
||||
brush.build(editSession, target, material, size);
|
||||
brush.build(editSession, target.toVector(), material, size);
|
||||
} catch (MaxChangedBlocksException e) {
|
||||
player.printError("Max blocks change limit reached.");
|
||||
} finally {
|
||||
|
@ -25,6 +25,7 @@ import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.extension.platform.Platform;
|
||||
import com.sk89q.worldedit.extension.platform.permission.ActorSelectorLimits;
|
||||
import com.sk89q.worldedit.regions.RegionSelector;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
|
||||
/**
|
||||
* A wand that can be used at a distance.
|
||||
@ -43,12 +44,12 @@ public class DistanceWand extends BrushTool implements DoubleActionTraceTool {
|
||||
@Override
|
||||
public boolean actSecondary(Platform server, LocalConfiguration config, Player player, LocalSession session) {
|
||||
if (session.isToolControlEnabled() && player.hasPermission("worldedit.selection.pos")) {
|
||||
WorldVector target = getTarget(player);
|
||||
Location target = getTarget(player);
|
||||
if (target == null) return true;
|
||||
|
||||
RegionSelector selector = session.getRegionSelector(player.getWorld());
|
||||
if (selector.selectPrimary(target, ActorSelectorLimits.forActor(player))) {
|
||||
selector.explainPrimarySelection(player, session, target);
|
||||
if (selector.selectPrimary(target.toVector(), ActorSelectorLimits.forActor(player))) {
|
||||
selector.explainPrimarySelection(player, session, target.toVector());
|
||||
}
|
||||
return true;
|
||||
|
||||
@ -60,12 +61,12 @@ public class DistanceWand extends BrushTool implements DoubleActionTraceTool {
|
||||
@Override
|
||||
public boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session) {
|
||||
if (session.isToolControlEnabled() && player.hasPermission("worldedit.selection.pos")) {
|
||||
WorldVector target = getTarget(player);
|
||||
Location target = getTarget(player);
|
||||
if (target == null) return true;
|
||||
|
||||
RegionSelector selector = session.getRegionSelector(player.getWorld());
|
||||
if (selector.selectSecondary(target, ActorSelectorLimits.forActor(player))) {
|
||||
selector.explainSecondarySelection(player, session, target);
|
||||
if (selector.selectSecondary(target.toVector(), ActorSelectorLimits.forActor(player))) {
|
||||
selector.explainSecondarySelection(player, session, target.toVector());
|
||||
}
|
||||
return true;
|
||||
|
||||
@ -73,8 +74,8 @@ public class DistanceWand extends BrushTool implements DoubleActionTraceTool {
|
||||
return false;
|
||||
}
|
||||
|
||||
public WorldVector getTarget(Player player) {
|
||||
WorldVector target = null;
|
||||
public Location getTarget(Player player) {
|
||||
Location target;
|
||||
if (this.range > -1) {
|
||||
target = player.getBlockTrace(getRange(), true);
|
||||
} else {
|
||||
|
@ -19,20 +19,24 @@
|
||||
|
||||
package com.sk89q.worldedit.command.tool;
|
||||
|
||||
import com.sk89q.worldedit.*;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.LocalConfiguration;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.blocks.BlockID;
|
||||
import com.sk89q.worldedit.blocks.type.BlockTypes;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.extension.platform.Platform;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
|
||||
/**
|
||||
* A tool that can place (or remove) blocks at a distance.
|
||||
*/
|
||||
public class LongRangeBuildTool extends BrushTool implements DoubleActionTraceTool {
|
||||
|
||||
BaseBlock primary;
|
||||
BaseBlock secondary;
|
||||
private BaseBlock primary;
|
||||
private BaseBlock secondary;
|
||||
|
||||
public LongRangeBuildTool(BaseBlock primary, BaseBlock secondary) {
|
||||
super("worldedit.tool.lrbuild");
|
||||
@ -47,14 +51,14 @@ public class LongRangeBuildTool extends BrushTool implements DoubleActionTraceTo
|
||||
|
||||
@Override
|
||||
public boolean actSecondary(Platform server, LocalConfiguration config, Player player, LocalSession session) {
|
||||
WorldVectorFace pos = getTargetFace(player);
|
||||
Location pos = getTargetFace(player);
|
||||
if (pos == null) return false;
|
||||
EditSession eS = session.createEditSession(player);
|
||||
try {
|
||||
if (secondary.getType().getLegacyId() == BlockID.AIR) {
|
||||
eS.setBlock(pos, secondary);
|
||||
if (secondary.getType() == BlockTypes.AIR) {
|
||||
eS.setBlock(pos.toVector(), secondary);
|
||||
} else {
|
||||
eS.setBlock(pos.getFaceVector(), secondary);
|
||||
eS.setBlock(pos.getDirection(), secondary);
|
||||
}
|
||||
return true;
|
||||
} catch (MaxChangedBlocksException e) {
|
||||
@ -66,14 +70,14 @@ public class LongRangeBuildTool extends BrushTool implements DoubleActionTraceTo
|
||||
|
||||
@Override
|
||||
public boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session) {
|
||||
WorldVectorFace pos = getTargetFace(player);
|
||||
Location pos = getTargetFace(player);
|
||||
if (pos == null) return false;
|
||||
EditSession eS = session.createEditSession(player);
|
||||
try {
|
||||
if (primary.getType().getLegacyId() == BlockID.AIR) {
|
||||
eS.setBlock(pos, primary);
|
||||
if (primary.getType() == BlockTypes.AIR) {
|
||||
eS.setBlock(pos.toVector(), primary);
|
||||
} else {
|
||||
eS.setBlock(pos.getFaceVector(), primary);
|
||||
eS.setBlock(pos.getDirection(), primary);
|
||||
}
|
||||
return true;
|
||||
} catch (MaxChangedBlocksException e) {
|
||||
@ -82,9 +86,8 @@ public class LongRangeBuildTool extends BrushTool implements DoubleActionTraceTo
|
||||
return false;
|
||||
}
|
||||
|
||||
public WorldVectorFace getTargetFace(Player player) {
|
||||
WorldVectorFace target = null;
|
||||
target = player.getBlockTraceFace(getRange(), true);
|
||||
public Location getTargetFace(Player player) {
|
||||
Location target = player.getBlockTraceFace(getRange(), true);
|
||||
|
||||
if (target == null) {
|
||||
player.printError("No block in sight!");
|
||||
|
@ -21,15 +21,14 @@ package com.sk89q.worldedit.command.tool.brush;
|
||||
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.internal.LocalWorldAdapter;
|
||||
import com.sk89q.worldedit.math.convolution.HeightMap;
|
||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.WorldVector;
|
||||
import com.sk89q.worldedit.math.convolution.GaussianKernel;
|
||||
import com.sk89q.worldedit.math.convolution.HeightMapFilter;
|
||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
|
||||
public class SmoothBrush implements Brush {
|
||||
|
||||
@ -47,9 +46,9 @@ public class SmoothBrush implements Brush {
|
||||
|
||||
@Override
|
||||
public void build(EditSession editSession, Vector position, Pattern pattern, double size) throws MaxChangedBlocksException {
|
||||
WorldVector min = new WorldVector(LocalWorldAdapter.adapt(editSession.getWorld()), position.subtract(size, size, size));
|
||||
Location min = new Location(editSession.getWorld(), position.subtract(size, size, size));
|
||||
Vector max = position.add(size, size + 10, size);
|
||||
Region region = new CuboidRegion(editSession.getWorld(), min, max);
|
||||
Region region = new CuboidRegion(editSession.getWorld(), min.toVector(), max);
|
||||
HeightMap heightMap = new HeightMap(editSession, region, naturalOnly);
|
||||
HeightMapFilter filter = new HeightMapFilter(new GaussianKernel(5, 1.0));
|
||||
heightMap.applyFilter(filter, iterations);
|
||||
|
Reference in New Issue
Block a user