mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-16 03:34:03 +00:00
minor tweak for mutable vectors
This commit is contained in:
@@ -6,9 +6,6 @@ import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.extension.platform.Platform;
|
||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldedit.world.block.BlockType;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
|
||||
@@ -33,7 +30,7 @@ public class AreaPickaxe implements BlockTool {
|
||||
int ox = clicked.getBlockX();
|
||||
int oy = clicked.getBlockY();
|
||||
int oz = clicked.getBlockZ();
|
||||
BlockType initialType = clicked.getExtent().getBlock(clicked.toVector().toBlockPoint()).getBlockType();
|
||||
BlockType initialType = clicked.getExtent().getBlock(clicked.toBlockPoint()).getBlockType();
|
||||
|
||||
if (initialType.getMaterial().isAir()) {
|
||||
return true;
|
||||
@@ -63,7 +60,7 @@ public class AreaPickaxe implements BlockTool {
|
||||
// continue;
|
||||
// }
|
||||
//
|
||||
// ((World) clicked.getExtent()).queueBlockBreakEffect(server, pos, initialType, clicked.toVector().toBlockPoint().distanceSq(pos));
|
||||
// ((World) clicked.getExtent()).queueBlockBreakEffect(server, pos, initialType, clicked.toBlockPoint().distanceSq(pos));
|
||||
//
|
||||
// editSession.setBlock(pos, BlockTypes.AIR.getDefaultState());
|
||||
// }
|
||||
|
@@ -37,7 +37,6 @@ import com.sk89q.worldedit.registry.state.Property;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
|
||||
/**
|
||||
* A mode that cycles the data values of supported blocks.
|
||||
@@ -56,8 +55,8 @@ public class BlockDataCyler implements DoubleActionBlockTool {
|
||||
|
||||
World world = (World) clicked.getExtent();
|
||||
|
||||
// BlockStateHolder block = world.getBlock(clicked.toVector());
|
||||
BlockVector3 blockPoint = clicked.toVector().toBlockPoint();
|
||||
// BlockStateHolder block = world.getBlock(clicked);
|
||||
BlockVector3 blockPoint = clicked.toBlockPoint();
|
||||
BlockState block = world.getBlock(blockPoint);
|
||||
|
||||
if (!config.allowedDataCycleBlocks.isEmpty()
|
||||
|
@@ -19,24 +19,16 @@
|
||||
|
||||
package com.sk89q.worldedit.command.tool;
|
||||
|
||||
import com.boydti.fawe.object.extent.PatternTransform;
|
||||
import com.sk89q.worldedit.*;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.world.block.BlockType;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.LocalConfiguration;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.extension.platform.Platform;
|
||||
import com.sk89q.worldedit.extent.inventory.BlockBag;
|
||||
import com.sk89q.worldedit.function.pattern.BlockPattern;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
|
||||
/**
|
||||
* A mode that replaces one block.
|
||||
@@ -61,7 +53,7 @@ public class BlockReplacer implements DoubleActionBlockTool {
|
||||
EditSession editSession = session.createEditSession(player);
|
||||
|
||||
try {
|
||||
editSession.setBlock(clicked.toVector().toBlockPoint(), pattern);
|
||||
editSession.setBlock(clicked.toBlockPoint(), pattern);
|
||||
} finally {
|
||||
if (bag != null) {
|
||||
bag.flushChanges();
|
||||
@@ -76,7 +68,7 @@ public class BlockReplacer implements DoubleActionBlockTool {
|
||||
@Override
|
||||
public boolean actSecondary(Platform server, LocalConfiguration config, Player player, LocalSession session, com.sk89q.worldedit.util.Location clicked) {
|
||||
EditSession editSession = session.createEditSession(player);
|
||||
BlockStateHolder targetBlock = (editSession).getBlock(clicked.toVector().toBlockPoint());
|
||||
BlockStateHolder targetBlock = (editSession).getBlock(clicked.toBlockPoint());
|
||||
BlockType type = targetBlock.getBlockType();
|
||||
|
||||
if (type != null) {
|
||||
|
@@ -1,7 +1,6 @@
|
||||
package com.sk89q.worldedit.command.tool;
|
||||
|
||||
import com.boydti.fawe.Fawe;
|
||||
import com.boydti.fawe.FaweCache;
|
||||
import com.boydti.fawe.config.BBC;
|
||||
import com.boydti.fawe.object.FawePlayer;
|
||||
import com.boydti.fawe.object.RunnableVal;
|
||||
@@ -26,7 +25,6 @@ import com.sk89q.worldedit.*;
|
||||
import com.sk89q.worldedit.internal.expression.Expression;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.math.Vector3;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.blocks.BaseItem;
|
||||
import com.sk89q.worldedit.command.tool.brush.Brush;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
@@ -40,7 +38,6 @@ import com.sk89q.worldedit.function.mask.SolidBlockMask;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.session.request.Request;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
import com.sk89q.worldedit.world.block.BlockType;
|
||||
|
||||
import java.io.IOException;
|
||||
@@ -53,7 +50,6 @@ import java.util.concurrent.locks.ReentrantLock;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
|
||||
import static com.boydti.fawe.object.brush.TargetMode.TARGET_FACE_RANGE;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool, ResettableTool, Serializable {
|
||||
@@ -385,7 +381,7 @@ public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool
|
||||
Location loc = player.getLocation();
|
||||
switch (targetMode) {
|
||||
case TARGET_BLOCK_RANGE:
|
||||
return offset(trace(editSession, player, getRange(), true), loc.toVector()).toBlockPoint();
|
||||
return offset(trace(editSession, player, getRange(), true), loc).toBlockPoint();
|
||||
case FOWARD_POINT_PITCH: {
|
||||
int d = 0;
|
||||
float pitch = loc.getPitch();
|
||||
@@ -393,7 +389,7 @@ public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool
|
||||
d += (int) (Math.sin(Math.toRadians(pitch)) * 50);
|
||||
final Vector3 vector = loc.getDirection().withY(0).normalize().multiply(d).add(loc.getX(), loc.getY(), loc.getZ());
|
||||
// vector = vector.add(loc.getX(), loc.getY(), loc.getZ());
|
||||
return offset(vector, loc.toVector()).toBlockPoint();
|
||||
return offset(vector, loc).toBlockPoint();
|
||||
}
|
||||
case TARGET_POINT_HEIGHT: {
|
||||
final int height = loc.getBlockY();
|
||||
@@ -407,10 +403,10 @@ public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool
|
||||
}
|
||||
}
|
||||
final int distance = (height - y) + 8;
|
||||
return offset(trace(editSession, player, distance, true), loc.toVector()).toBlockPoint();
|
||||
return offset(trace(editSession, player, distance, true), loc).toBlockPoint();
|
||||
}
|
||||
case TARGET_FACE_RANGE:
|
||||
return offset(trace(editSession, player, getRange(), true), loc.toVector()).toBlockPoint();
|
||||
return offset(trace(editSession, player, getRange(), true), loc).toBlockPoint();
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
@@ -429,7 +425,7 @@ public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool
|
||||
@Override
|
||||
public void run(Vector3 value) {
|
||||
Location result = tb.getMaskedTargetBlock(useLastBlock);
|
||||
this.value = result.toVector();
|
||||
this.value = result;
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -478,7 +474,7 @@ public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool
|
||||
editSession.setMask(newMask);
|
||||
//=======
|
||||
// try {
|
||||
// brush.build(editSession, target.toVector().toBlockPoint(), material, size);
|
||||
// brush.build(editSession, target.toBlockPoint(), material, size);
|
||||
// } catch (MaxChangedBlocksException e) {
|
||||
// player.printError("Max blocks change limit reached.");
|
||||
// } finally {
|
||||
|
@@ -50,7 +50,7 @@ public class DistanceWand extends BrushTool implements DoubleActionTraceTool {
|
||||
if (target == null) return true;
|
||||
|
||||
RegionSelector selector = session.getRegionSelector(player.getWorld());
|
||||
BlockVector3 blockPoint = target.toVector().toBlockPoint();
|
||||
BlockVector3 blockPoint = target.toBlockPoint();
|
||||
if (selector.selectPrimary(blockPoint, ActorSelectorLimits.forActor(player))) {
|
||||
selector.explainPrimarySelection(player, session, blockPoint);
|
||||
}
|
||||
@@ -68,7 +68,7 @@ public class DistanceWand extends BrushTool implements DoubleActionTraceTool {
|
||||
if (target == null) return true;
|
||||
|
||||
RegionSelector selector = session.getRegionSelector(player.getWorld());
|
||||
BlockVector3 blockPoint = target.toVector().toBlockPoint();
|
||||
BlockVector3 blockPoint = target.toBlockPoint();
|
||||
if (selector.selectSecondary(blockPoint, ActorSelectorLimits.forActor(player))) {
|
||||
selector.explainSecondarySelection(player, session, blockPoint);
|
||||
}
|
||||
|
@@ -69,7 +69,7 @@ public class FloatingTreeRemover implements BlockTool {
|
||||
Player player, LocalSession session, Location clicked) {
|
||||
|
||||
final World world = (World) clicked.getExtent();
|
||||
final BlockState state = world.getBlock(clicked.toVector().toBlockPoint());
|
||||
final BlockState state = world.getBlock(clicked.toBlockPoint());
|
||||
|
||||
if (!isTreeBlock(state.getBlockType())) {
|
||||
player.printError("That's not a tree.");
|
||||
@@ -77,7 +77,7 @@ public class FloatingTreeRemover implements BlockTool {
|
||||
}
|
||||
final EditSession editSession = session.createEditSession(player);
|
||||
try /*(EditSession editSession = session.createEditSession(player))*/ {
|
||||
final Set<BlockVector3> blockSet = bfs(world, clicked.toVector().toBlockPoint());
|
||||
final Set<BlockVector3> blockSet = bfs(world, clicked.toBlockPoint());
|
||||
if (blockSet == null) {
|
||||
player.printError("That's not a floating tree.");
|
||||
return true;
|
||||
|
@@ -19,7 +19,6 @@
|
||||
|
||||
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;
|
||||
@@ -59,7 +58,7 @@ public class FloodFillTool implements BlockTool {
|
||||
public boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session, Location clicked) {
|
||||
World world = (World) clicked.getExtent();
|
||||
|
||||
BlockVector3 origin = clicked.toVector().toBlockPoint();
|
||||
BlockVector3 origin = clicked.toBlockPoint();
|
||||
BlockType initialType = world.getBlock(origin).getBlockType();
|
||||
|
||||
if (initialType.getMaterial().isAir()) {
|
||||
|
@@ -58,12 +58,12 @@ public class LongRangeBuildTool extends BrushTool implements DoubleActionTraceTo
|
||||
EditSession eS = session.createEditSession(player);
|
||||
try {
|
||||
// eS.disableBuffering();
|
||||
BlockVector3 blockPoint = pos.toVector().toBlockPoint();
|
||||
BlockVector3 blockPoint = pos.toBlockPoint();
|
||||
BaseBlock applied = secondary.apply(blockPoint);
|
||||
if (applied.getBlockType().getMaterial().isAir()) {
|
||||
eS.setBlock(blockPoint, secondary);
|
||||
} else {
|
||||
eS.setBlock(pos.toVector().subtract(pos.getDirection()).toBlockPoint(), secondary);
|
||||
eS.setBlock(pos.subtract(pos.getDirection()).toBlockPoint(), secondary);
|
||||
}
|
||||
return true;
|
||||
} catch (MaxChangedBlocksException e) {
|
||||
@@ -80,12 +80,12 @@ public class LongRangeBuildTool extends BrushTool implements DoubleActionTraceTo
|
||||
|
||||
try {
|
||||
// eS.disableBuffering();
|
||||
BlockVector3 blockPoint = pos.toVector().toBlockPoint();
|
||||
BlockVector3 blockPoint = pos.toBlockPoint();
|
||||
BaseBlock applied = primary.apply(blockPoint);
|
||||
if (applied.getBlockType().getMaterial().isAir()) {
|
||||
eS.setBlock(blockPoint, primary);
|
||||
} else {
|
||||
eS.setBlock(pos.toVector().subtract(pos.getDirection()).toBlockPoint(), primary);
|
||||
eS.setBlock(pos.subtract(pos.getDirection()).toBlockPoint(), primary);
|
||||
}
|
||||
return true;
|
||||
} catch (MaxChangedBlocksException e) {
|
||||
|
@@ -45,10 +45,10 @@ public class QueryTool implements BlockTool {
|
||||
|
||||
World world = (World) clicked.getExtent();
|
||||
EditSession editSession = session.createEditSession(player);
|
||||
BlockVector3 blockPoint = clicked.toVector().toBlockPoint();
|
||||
BlockVector3 blockPoint = clicked.toBlockPoint();
|
||||
BaseBlock block = editSession.getFullBlock(blockPoint);
|
||||
|
||||
player.print("\u00A79@" + clicked.toVector() + ": " + "\u00A7e"
|
||||
player.print("\u00A79@" + clicked + ": " + "\u00A7e"
|
||||
+ block.getBlockType().getName() + "\u00A77" + " ("
|
||||
+ block.toString() + ") "
|
||||
+ "\u00A7f"
|
||||
|
@@ -1,7 +1,5 @@
|
||||
package com.sk89q.worldedit.command.tool;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import com.boydti.fawe.object.mask.IdMask;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.LocalConfiguration;
|
||||
@@ -13,13 +11,6 @@ import com.sk89q.worldedit.function.block.BlockReplace;
|
||||
import com.sk89q.worldedit.function.mask.Mask;
|
||||
import com.sk89q.worldedit.function.operation.Operations;
|
||||
import com.sk89q.worldedit.function.visitor.RecursiveVisitor;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.LocalConfiguration;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.extension.platform.Platform;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
@@ -45,10 +36,10 @@ public class RecursivePickaxe implements BlockTool {
|
||||
@Override
|
||||
public boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session, com.sk89q.worldedit.util.Location clicked) {
|
||||
World world = (World) clicked.getExtent();
|
||||
final BlockVector3 pos = clicked.toVector().toBlockPoint();
|
||||
final BlockVector3 pos = clicked.toBlockPoint();
|
||||
|
||||
EditSession editSession = session.createEditSession(player);
|
||||
BlockVector3 origin = clicked.toVector().toBlockPoint();
|
||||
BlockVector3 origin = clicked.toBlockPoint();
|
||||
BlockType initialType = world.getBlock(origin).getBlockType();
|
||||
|
||||
BlockStateHolder block = editSession.getBlock(pos);
|
||||
@@ -74,8 +65,8 @@ public class RecursivePickaxe implements BlockTool {
|
||||
session.remember(editSession);
|
||||
//=======
|
||||
// try {
|
||||
// recurse(server, editSession, world, clicked.toVector().toBlockPoint(),
|
||||
// clicked.toVector().toBlockPoint(), range, initialType, new HashSet<>());
|
||||
// recurse(server, editSession, world, clicked.toBlockPoint(),
|
||||
// clicked.toBlockPoint(), range, initialType, new HashSet<>());
|
||||
// } catch (MaxChangedBlocksException e) {
|
||||
// player.printError("Max blocks change limit reached.");
|
||||
// } finally {
|
||||
|
@@ -44,7 +44,7 @@ public class SinglePickaxe implements BlockTool {
|
||||
@Override
|
||||
public boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session, com.sk89q.worldedit.util.Location clicked) {
|
||||
World world = (World) clicked.getExtent();
|
||||
BlockVector3 blockPoint = clicked.toVector().toBlockPoint();
|
||||
BlockVector3 blockPoint = clicked.toBlockPoint();
|
||||
final BlockType blockType = world.getBlock(blockPoint).getBlockType();
|
||||
if (blockType == BlockTypes.BEDROCK
|
||||
&& !player.canDestroyBedrock()) {
|
||||
@@ -61,7 +61,7 @@ public class SinglePickaxe implements BlockTool {
|
||||
try {
|
||||
if (editSession.setBlock(clicked.getBlockX(), clicked.getBlockY(), clicked.getBlockZ(), EditSession.nullBlock)) {
|
||||
// TODO FIXME play effect
|
||||
// world.playEffect(clicked.toVector(), 2001, blockType);
|
||||
// world.playEffect(clicked, 2001, blockType);
|
||||
}
|
||||
} finally {
|
||||
editSession.flushQueue();
|
||||
|
@@ -53,7 +53,7 @@ public class TreePlanter implements BlockTool {
|
||||
try {
|
||||
boolean successful = false;
|
||||
for (int i = 0; i < 10; i++) {
|
||||
if (treeType.generate(editSession, clicked.toVector().add(0, 1, 0).toBlockPoint())) {
|
||||
if (treeType.generate(editSession, clicked.add(0, 1, 0).toBlockPoint())) {
|
||||
successful = true;
|
||||
break;
|
||||
}
|
||||
|
@@ -44,7 +44,7 @@ public class SmoothBrush implements Brush {
|
||||
Vector3 posDouble = position.toVector3();
|
||||
Location min = new Location(editSession.getWorld(), posDouble.subtract(size, size, size));
|
||||
BlockVector3 max = posDouble.add(size, size + 10, size).toBlockPoint();
|
||||
Region region = new CuboidRegion(editSession.getWorld(), min.toVector().toBlockPoint(), max);
|
||||
Region region = new CuboidRegion(editSession.getWorld(), min.toBlockPoint(), max);
|
||||
HeightMap heightMap = new HeightMap(editSession, region);
|
||||
HeightMapFilter filter = new HeightMapFilter(new GaussianKernel(5, 1.0));
|
||||
heightMap.applyFilter(filter, iterations);
|
||||
|
Reference in New Issue
Block a user