mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-01 02:46:41 +00:00
Current progress with update
This commit is contained in:
@ -30,8 +30,6 @@ import com.sk89q.minecraft.util.commands.CommandPermissions;
|
||||
import com.sk89q.minecraft.util.commands.Logging;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.Vector2D;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
@ -44,7 +42,12 @@ import com.sk89q.worldedit.function.mask.Mask;
|
||||
import com.sk89q.worldedit.function.mask.Mask2D;
|
||||
import com.sk89q.worldedit.function.operation.Operations;
|
||||
import com.sk89q.worldedit.function.visitor.FlatRegionVisitor;
|
||||
<<<<<<< HEAD
|
||||
import com.sk89q.worldedit.function.visitor.RegionVisitor;
|
||||
=======
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||
import com.sk89q.worldedit.regions.FlatRegion;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
@ -150,6 +153,7 @@ public class BiomeCommands extends MethodCommands {
|
||||
return;
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
BaseBiome biome = player.getWorld().getBiome(blockPosition.toVector().toVector2D());
|
||||
biomes[biome.getId()]++;
|
||||
size = 1;
|
||||
@ -157,11 +161,23 @@ public class BiomeCommands extends MethodCommands {
|
||||
BaseBiome biome = player.getWorld().getBiome(player.getLocation().toVector().toVector2D());
|
||||
biomes[biome.getId()]++;
|
||||
size = 1;
|
||||
=======
|
||||
BaseBiome biome = player.getWorld().getBiome(blockPosition.toVector().toBlockPoint().toBlockVector2());
|
||||
biomes.add(biome);
|
||||
|
||||
qualifier = "at line of sight point";
|
||||
} else if (args.hasFlag('p')) {
|
||||
BaseBiome biome = player.getWorld().getBiome(player.getLocation().toVector().toBlockPoint().toBlockVector2());
|
||||
biomes.add(biome);
|
||||
|
||||
qualifier = "at your position";
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
} else {
|
||||
World world = player.getWorld();
|
||||
Region region = session.getSelection(world);
|
||||
|
||||
if (region instanceof FlatRegion) {
|
||||
<<<<<<< HEAD
|
||||
for (Vector2D pt : new Fast2DIterator(((FlatRegion) region).asFlatRegion(), editSession)) {
|
||||
biomes[editSession.getBiome(pt).getId()]++;
|
||||
size++;
|
||||
@ -176,6 +192,15 @@ public class BiomeCommands extends MethodCommands {
|
||||
}, editSession);
|
||||
Operations.completeBlindly(visitor);
|
||||
size += visitor.getAffected();
|
||||
=======
|
||||
for (BlockVector2 pt : ((FlatRegion) region).asFlatRegion()) {
|
||||
biomes.add(world.getBiome(pt));
|
||||
}
|
||||
} else {
|
||||
for (BlockVector3 pt : region) {
|
||||
biomes.add(world.getBiome(pt.toBlockVector2()));
|
||||
}
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
}
|
||||
}
|
||||
|
||||
@ -219,7 +244,7 @@ public class BiomeCommands extends MethodCommands {
|
||||
Mask2D mask2d = mask != null ? mask.toMask2D() : null;
|
||||
|
||||
if (atPosition) {
|
||||
region = new CuboidRegion(player.getLocation().toVector(), player.getLocation().toVector());
|
||||
region = new CuboidRegion(player.getLocation().toVector().toBlockPoint(), player.getLocation().toVector().toBlockPoint());
|
||||
} else {
|
||||
region = session.getSelection(world);
|
||||
}
|
||||
|
@ -39,6 +39,19 @@ import com.sk89q.minecraft.util.commands.CommandPermissions;
|
||||
import com.sk89q.minecraft.util.commands.Step;
|
||||
import com.sk89q.worldedit.*;
|
||||
import com.sk89q.worldedit.command.tool.brush.*;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.LocalConfiguration;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.command.tool.brush.ButcherBrush;
|
||||
import com.sk89q.worldedit.command.tool.brush.ClipboardBrush;
|
||||
import com.sk89q.worldedit.command.tool.brush.CylinderBrush;
|
||||
import com.sk89q.worldedit.command.tool.brush.GravityBrush;
|
||||
import com.sk89q.worldedit.command.tool.brush.HollowCylinderBrush;
|
||||
import com.sk89q.worldedit.command.tool.brush.HollowSphereBrush;
|
||||
import com.sk89q.worldedit.command.tool.brush.SmoothBrush;
|
||||
import com.sk89q.worldedit.command.tool.brush.SphereBrush;
|
||||
import com.sk89q.worldedit.command.util.CreatureButcher;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.extension.input.ParserContext;
|
||||
@ -47,9 +60,10 @@ import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormat;
|
||||
import com.sk89q.worldedit.function.mask.ExistingBlockMask;
|
||||
import com.sk89q.worldedit.function.mask.Mask;
|
||||
import com.sk89q.worldedit.function.mask.SingleBlockTypeMask;
|
||||
import com.sk89q.worldedit.function.pattern.BlockPattern;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.internal.expression.Expression;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.math.Vector3;
|
||||
import com.sk89q.worldedit.session.ClipboardHolder;
|
||||
import com.sk89q.worldedit.util.command.InvalidUsageException;
|
||||
import com.sk89q.worldedit.util.command.binding.Range;
|
||||
@ -63,9 +77,6 @@ import java.awt.*;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.*;
|
||||
import java.net.URI;
|
||||
import java.net.URL;
|
||||
import java.nio.channels.Channels;
|
||||
import java.nio.channels.ReadableByteChannel;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@ -268,8 +279,8 @@ public class BrushCommands extends BrushProcessor {
|
||||
max = 5
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.rock")
|
||||
public BrushSettings blobBrush(Player player, EditSession editSession, LocalSession session, Pattern fill, @Optional("10") Vector radius, @Optional("100") double sphericity, @Optional("30") double frequency, @Optional("50") double amplitude, CommandContext context) throws WorldEditException {
|
||||
double max = MathMan.max(radius.getBlockX(), radius.getBlockY(), radius.getBlockZ());
|
||||
public BrushSettings blobBrush(Player player, EditSession editSession, LocalSession session, Pattern fill, @Optional("10") Vector3 radius, @Optional("100") double sphericity, @Optional("30") double frequency, @Optional("50") double amplitude, CommandContext context) throws WorldEditException {
|
||||
double max = MathMan.max(radius.getX(), radius.getY(), radius.getZ());
|
||||
getWorldEdit().checkMaxBrushRadius(max);
|
||||
Brush brush = new BlobBrush(radius.divide(max), frequency / 100, amplitude / 100, sphericity / 100);
|
||||
return set(session, context,
|
||||
@ -600,7 +611,7 @@ public class BrushCommands extends BrushProcessor {
|
||||
ClipboardHolder holder = session.getClipboard();
|
||||
Clipboard clipboard = holder.getClipboard();
|
||||
|
||||
Vector size = clipboard.getDimensions();
|
||||
BlockVector3 size = clipboard.getDimensions();
|
||||
|
||||
getWorldEdit().checkMaxBrushRadius(size.getBlockX());
|
||||
getWorldEdit().checkMaxBrushRadius(size.getBlockY());
|
||||
|
@ -26,11 +26,15 @@ import com.sk89q.minecraft.util.commands.CommandPermissions;
|
||||
import com.sk89q.minecraft.util.commands.Logging;
|
||||
import com.sk89q.worldedit.LocalConfiguration;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
<<<<<<< HEAD
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.Vector2D;
|
||||
=======
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
import com.sk89q.worldedit.math.MathUtils;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.world.storage.LegacyChunkStore;
|
||||
@ -75,10 +79,17 @@ public class ChunkCommands {
|
||||
String filename = "c." + Integer.toString(chunkX, 36)
|
||||
+ "." + Integer.toString(chunkZ, 36) + ".dat";
|
||||
|
||||
<<<<<<< HEAD
|
||||
player.print(BBC.getPrefix() + "Chunk: " + chunkX + ", " + chunkZ);
|
||||
player.print(BBC.getPrefix() + "Old format: " + folder1 + "/" + folder2 + "/" + filename);
|
||||
player.print(BBC.getPrefix() + "McRegion: region/" + McRegionChunkStore.getFilename(
|
||||
new Vector2D(chunkX, chunkZ)));
|
||||
=======
|
||||
player.print("Chunk: " + chunkX + ", " + chunkZ);
|
||||
player.print("Old format: " + folder1 + "/" + folder2 + "/" + filename);
|
||||
player.print("McRegion: region/" + McRegionChunkStore.getFilename(
|
||||
new BlockVector2(chunkX, chunkZ)));
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -89,11 +100,19 @@ public class ChunkCommands {
|
||||
max = 0
|
||||
)
|
||||
@CommandPermissions("worldedit.listchunks")
|
||||
<<<<<<< HEAD
|
||||
public void listChunks(Player player, LocalSession session, CommandContext args) throws WorldEditException {
|
||||
Set<Vector2D> chunks = session.getSelection(player.getWorld()).getChunks();
|
||||
|
||||
for (Vector2D chunk : chunks) {
|
||||
player.print(BBC.getPrefix() + LegacyChunkStore.getFilename(chunk));
|
||||
=======
|
||||
public void listChunks(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException {
|
||||
Set<BlockVector2> chunks = session.getSelection(player.getWorld()).getChunks();
|
||||
|
||||
for (BlockVector2 chunk : chunks) {
|
||||
player.print(LegacyChunkStore.getFilename(chunk));
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
}
|
||||
}
|
||||
|
||||
@ -110,7 +129,7 @@ public class ChunkCommands {
|
||||
player.print(BBC.getPrefix() + "Note that this command does not yet support the mcregion format.");
|
||||
LocalConfiguration config = worldEdit.getConfiguration();
|
||||
|
||||
Set<Vector2D> chunks = session.getSelection(player.getWorld()).getChunks();
|
||||
Set<BlockVector2> chunks = session.getSelection(player.getWorld()).getChunks();
|
||||
FileOutputStream out = null;
|
||||
|
||||
if (config.shellSaveType == null) {
|
||||
@ -127,7 +146,7 @@ public class ChunkCommands {
|
||||
writer.write("ECHO.\r\n");
|
||||
writer.write("PAUSE\r\n");
|
||||
|
||||
for (Vector2D chunk : chunks) {
|
||||
for (BlockVector2 chunk : chunks) {
|
||||
String filename = LegacyChunkStore.getFilename(chunk);
|
||||
writer.write("ECHO " + filename + "\r\n");
|
||||
writer.write("DEL \"world/" + filename + "\"\r\n");
|
||||
@ -159,7 +178,7 @@ public class ChunkCommands {
|
||||
writer.write("echo\n");
|
||||
writer.write("read -p \"Press any key to continue...\"\n");
|
||||
|
||||
for (Vector2D chunk : chunks) {
|
||||
for (BlockVector2 chunk : chunks) {
|
||||
String filename = LegacyChunkStore.getFilename(chunk);
|
||||
writer.write("echo " + filename + "\n");
|
||||
writer.write("rm \"world/" + filename + "\"\n");
|
||||
|
@ -19,6 +19,7 @@
|
||||
|
||||
package com.sk89q.worldedit.command;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import com.boydti.fawe.Fawe;
|
||||
import com.boydti.fawe.FaweAPI;
|
||||
import com.boydti.fawe.config.BBC;
|
||||
@ -40,6 +41,19 @@ import com.boydti.fawe.util.gui.FormBuilder;
|
||||
import com.boydti.fawe.wrappers.FakePlayer;
|
||||
import com.sk89q.minecraft.util.commands.*;
|
||||
import com.sk89q.worldedit.*;
|
||||
=======
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static com.sk89q.minecraft.util.commands.Logging.LogMode.PLACEMENT;
|
||||
import static com.sk89q.minecraft.util.commands.Logging.LogMode.REGION;
|
||||
|
||||
import com.sk89q.minecraft.util.commands.Command;
|
||||
import com.sk89q.minecraft.util.commands.CommandPermissions;
|
||||
import com.sk89q.minecraft.util.commands.Logging;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.event.extent.PasteEvent;
|
||||
import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard;
|
||||
@ -55,6 +69,8 @@ import com.sk89q.worldedit.function.operation.Operations;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.internal.annotation.Direction;
|
||||
import com.sk89q.worldedit.internal.annotation.Selection;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.math.Vector3;
|
||||
import com.sk89q.worldedit.math.transform.AffineTransform;
|
||||
import com.sk89q.worldedit.math.transform.Transform;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
@ -465,9 +481,14 @@ public class ClipboardCommands extends MethodCommands {
|
||||
}
|
||||
Clipboard clipboard = holder.getClipboard();
|
||||
Region region = clipboard.getRegion();
|
||||
<<<<<<< HEAD
|
||||
Vector to = atOrigin ? clipboard.getOrigin() : session.getPlacementPosition(player);
|
||||
checkPaste(player, editSession, to, holder, clipboard);
|
||||
|
||||
=======
|
||||
|
||||
BlockVector3 to = atOrigin ? clipboard.getOrigin() : session.getPlacementPosition(player);
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
Operation operation = holder
|
||||
.createPaste(editSession)
|
||||
.to(to)
|
||||
@ -478,10 +499,17 @@ public class ClipboardCommands extends MethodCommands {
|
||||
Operations.completeLegacy(operation);
|
||||
|
||||
if (selectPasted) {
|
||||
<<<<<<< HEAD
|
||||
Vector clipboardOffset = clipboard.getRegion().getMinimumPoint().subtract(clipboard.getOrigin());
|
||||
Vector realTo = to.add(new Vector(holder.getTransform().apply(clipboardOffset)));
|
||||
Vector max = realTo.add(new Vector(holder.getTransform().apply(region.getMaximumPoint().subtract(region.getMinimumPoint()))));
|
||||
RegionSelector selector = new CuboidRegionSelector(player.getWorld(), realTo, max);
|
||||
=======
|
||||
BlockVector3 clipboardOffset = clipboard.getRegion().getMinimumPoint().subtract(clipboard.getOrigin());
|
||||
Vector3 realTo = to.toVector3().add(holder.getTransform().apply(clipboardOffset.toVector3()));
|
||||
Vector3 max = realTo.add(holder.getTransform().apply(region.getMaximumPoint().subtract(region.getMinimumPoint()).toVector3()));
|
||||
RegionSelector selector = new CuboidRegionSelector(player.getWorld(), realTo.toBlockPoint(), max.toBlockPoint());
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
session.setRegionSelector(player.getWorld(), selector);
|
||||
selector.learnChanges();
|
||||
selector.explainRegionAdjust(player, session);
|
||||
@ -577,14 +605,24 @@ public class ClipboardCommands extends MethodCommands {
|
||||
max = 1
|
||||
)
|
||||
@CommandPermissions("worldedit.clipboard.flip")
|
||||
<<<<<<< HEAD
|
||||
public void flip(Player player, LocalSession session,
|
||||
@Optional(Direction.AIM) @Direction Vector direction) throws WorldEditException {
|
||||
=======
|
||||
public void flip(Player player, LocalSession session, EditSession editSession,
|
||||
@Optional(Direction.AIM) @Direction BlockVector3 direction) throws WorldEditException {
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
ClipboardHolder holder = session.getClipboard();
|
||||
Clipboard clipboard = holder.getClipboard();
|
||||
AffineTransform transform = new AffineTransform();
|
||||
<<<<<<< HEAD
|
||||
transform = transform.scale(direction.positive().multiply(-2).add(1, 1, 1));
|
||||
holder.setTransform(transform.combine(holder.getTransform()));
|
||||
BBC.COMMAND_FLIPPED.send(player);
|
||||
=======
|
||||
transform = transform.scale(direction.abs().multiply(-2).add(1, 1, 1).toVector3());
|
||||
holder.setTransform(holder.getTransform().combine(transform));
|
||||
player.print("The clipboard copy has been flipped.");
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
}
|
||||
|
||||
@Deprecated // See SchematicCommands#clear
|
||||
|
@ -19,12 +19,18 @@
|
||||
|
||||
package com.sk89q.worldedit.command;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import com.sk89q.worldedit.Vector;
|
||||
=======
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||
import com.sk89q.worldedit.extent.transform.BlockTransformExtent;
|
||||
import com.sk89q.worldedit.function.operation.ForwardExtentCopy;
|
||||
import com.sk89q.worldedit.function.operation.Operation;
|
||||
import com.sk89q.worldedit.math.Vector3;
|
||||
import com.sk89q.worldedit.math.transform.AffineTransform;
|
||||
import com.sk89q.worldedit.math.transform.CombinedTransform;
|
||||
import com.sk89q.worldedit.math.transform.Transform;
|
||||
@ -67,8 +73,8 @@ public class FlattenedClipboardTransform {
|
||||
*/
|
||||
public Region getTransformedRegion() {
|
||||
Region region = original.getRegion();
|
||||
Vector minimum = region.getMinimumPoint();
|
||||
Vector maximum = region.getMaximumPoint();
|
||||
Vector3 minimum = region.getMinimumPoint().toVector3();
|
||||
Vector3 maximum = region.getMaximumPoint().toVector3();
|
||||
|
||||
Transform transformAround =
|
||||
new CombinedTransform(
|
||||
@ -76,6 +82,7 @@ public class FlattenedClipboardTransform {
|
||||
transform,
|
||||
new AffineTransform().translate(original.getOrigin()));
|
||||
|
||||
<<<<<<< HEAD
|
||||
// new Vector(minimum.getX(), minimum.getY(), minimum.getZ())
|
||||
// new Vector(maximum.getX(), maximum.getY(), maximum.getZ())
|
||||
Vector[] corners = new Vector[]{
|
||||
@ -87,26 +94,44 @@ public class FlattenedClipboardTransform {
|
||||
new Vector(minimum.getX(), maximum.getY(), maximum.getZ()),
|
||||
new Vector(maximum.getX(), minimum.getY(), maximum.getZ()),
|
||||
new Vector(maximum.getX(), maximum.getY(), minimum.getZ())};
|
||||
=======
|
||||
Vector3[] corners = new Vector3[] {
|
||||
minimum,
|
||||
maximum,
|
||||
minimum.withX(maximum.getX()),
|
||||
minimum.withY(maximum.getY()),
|
||||
minimum.withZ(maximum.getZ()),
|
||||
maximum.withX(minimum.getX()),
|
||||
maximum.withY(minimum.getY()),
|
||||
maximum.withZ(minimum.getZ()) };
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
|
||||
for (int i = 0; i < corners.length; i++) {
|
||||
corners[i] = transformAround.apply(new Vector(corners[i]));
|
||||
}
|
||||
|
||||
Vector newMinimum = corners[0];
|
||||
Vector newMaximum = corners[0];
|
||||
Vector3 newMinimum = corners[0];
|
||||
Vector3 newMaximum = corners[0];
|
||||
|
||||
for (int i = 1; i < corners.length; i++) {
|
||||
newMinimum = Vector.getMinimum(newMinimum, corners[i]);
|
||||
newMaximum = Vector.getMaximum(newMaximum, corners[i]);
|
||||
newMinimum = newMinimum.getMinimum(corners[i]);
|
||||
newMaximum = newMaximum.getMaximum(corners[i]);
|
||||
}
|
||||
|
||||
// After transformation, the points may not really sit on a block,
|
||||
// so we should expand the region for edge cases
|
||||
<<<<<<< HEAD
|
||||
newMinimum.mutX(Math.ceil(Math.floor(newMinimum.getX())));
|
||||
newMinimum.mutY(Math.ceil(Math.floor(newMinimum.getY())));
|
||||
newMinimum.mutZ(Math.ceil(Math.floor(newMinimum.getZ())));
|
||||
|
||||
return new CuboidRegion(newMinimum, newMaximum);
|
||||
=======
|
||||
newMinimum = newMinimum.floor();
|
||||
newMaximum = newMaximum.ceil();
|
||||
|
||||
return new CuboidRegion(newMinimum.toBlockPoint(), newMaximum.toBlockPoint());
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -31,9 +31,16 @@ import com.sk89q.minecraft.util.commands.Command;
|
||||
import com.sk89q.minecraft.util.commands.CommandContext;
|
||||
import com.sk89q.minecraft.util.commands.CommandPermissions;
|
||||
import com.sk89q.minecraft.util.commands.Logging;
|
||||
<<<<<<< HEAD
|
||||
import com.sk89q.worldedit.*;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
=======
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.function.RegionFunction;
|
||||
import com.sk89q.worldedit.function.mask.Mask;
|
||||
@ -42,7 +49,12 @@ import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.function.visitor.RegionVisitor;
|
||||
import com.sk89q.worldedit.internal.annotation.Selection;
|
||||
import com.sk89q.worldedit.internal.expression.ExpressionException;
|
||||
<<<<<<< HEAD
|
||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||
=======
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.math.Vector3;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
import com.sk89q.worldedit.util.TreeGenerator;
|
||||
import com.sk89q.worldedit.util.TreeGenerator.TreeType;
|
||||
@ -201,6 +213,7 @@ public class GenerationCommands extends MethodCommands {
|
||||
}, getArguments(context), (int) max, context);
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
@Command(
|
||||
aliases = {"/cyl"},
|
||||
usage = "<pattern> <radius>[,<radius>] [height]",
|
||||
@ -224,6 +237,11 @@ public class GenerationCommands extends MethodCommands {
|
||||
int affected = editSession.makeCylinder(pos, pattern, radius.getX(), radius.getZ(), Math.min(256, height), !hollow);
|
||||
BBC.VISITOR_BLOCK.send(fp, affected);
|
||||
}, getArguments(context), (int) max, context);
|
||||
=======
|
||||
BlockVector3 pos = session.getPlacementPosition(player);
|
||||
int affected = editSession.makeCylinder(pos, pattern, radiusX, radiusZ, height, !hollow);
|
||||
player.print(affected + " block(s) have been created.");
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -259,6 +277,7 @@ public class GenerationCommands extends MethodCommands {
|
||||
)
|
||||
@CommandPermissions("worldedit.generation.sphere")
|
||||
@Logging(PLACEMENT)
|
||||
<<<<<<< HEAD
|
||||
public void sphere(FawePlayer fp, Player player, LocalSession session, EditSession editSession, Pattern pattern, Vector radius, @Optional("false") boolean raised, @Switch('h') boolean hollow, CommandContext context) throws WorldEditException, ParameterException {
|
||||
double max = MathMan.max(radius.getBlockX(), radius.getBlockY(), radius.getBlockZ());
|
||||
worldEdit.checkMaxRadius(max);
|
||||
@ -269,6 +288,39 @@ public class GenerationCommands extends MethodCommands {
|
||||
player.findFreePosition();
|
||||
BBC.VISITOR_BLOCK.send(fp, affected);
|
||||
}, getArguments(context), (int) max, context);
|
||||
=======
|
||||
public void sphere(Player player, LocalSession session, EditSession editSession, Pattern pattern, String radiusString, @Optional("false") boolean raised, @Switch('h') boolean hollow) throws WorldEditException {
|
||||
String[] radii = radiusString.split(",");
|
||||
final double radiusX, radiusY, radiusZ;
|
||||
switch (radii.length) {
|
||||
case 1:
|
||||
radiusX = radiusY = radiusZ = Math.max(1, Double.parseDouble(radii[0]));
|
||||
break;
|
||||
|
||||
case 3:
|
||||
radiusX = Math.max(1, Double.parseDouble(radii[0]));
|
||||
radiusY = Math.max(1, Double.parseDouble(radii[1]));
|
||||
radiusZ = Math.max(1, Double.parseDouble(radii[2]));
|
||||
break;
|
||||
|
||||
default:
|
||||
player.printError("You must either specify 1 or 3 radius values.");
|
||||
return;
|
||||
}
|
||||
|
||||
worldEdit.checkMaxRadius(radiusX);
|
||||
worldEdit.checkMaxRadius(radiusY);
|
||||
worldEdit.checkMaxRadius(radiusZ);
|
||||
|
||||
BlockVector3 pos = session.getPlacementPosition(player);
|
||||
if (raised) {
|
||||
pos = pos.add(0, (int) radiusY, 0);
|
||||
}
|
||||
|
||||
int affected = editSession.makeSphere(pos, pattern, radiusX, radiusY, radiusZ, !hollow);
|
||||
player.findFreePosition();
|
||||
player.print(affected + " block(s) have been created.");
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -324,7 +376,12 @@ public class GenerationCommands extends MethodCommands {
|
||||
)
|
||||
@CommandPermissions("worldedit.generation.pyramid")
|
||||
@Logging(PLACEMENT)
|
||||
<<<<<<< HEAD
|
||||
public void pyramid(FawePlayer fp, Player player, LocalSession session, EditSession editSession, Pattern pattern, @Range(min = 1) int size, @Switch('h') boolean hollow, CommandContext context) throws WorldEditException, ParameterException {
|
||||
=======
|
||||
public void pyramid(Player player, LocalSession session, EditSession editSession, Pattern pattern, @Range(min = 1) int size, @Switch('h') boolean hollow) throws WorldEditException {
|
||||
BlockVector3 pos = session.getPlacementPosition(player);
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
worldEdit.checkMaxRadius(size);
|
||||
Vector pos = session.getPlacementPosition(player);
|
||||
fp.checkConfirmationRadius(() -> {
|
||||
@ -362,33 +419,46 @@ public class GenerationCommands extends MethodCommands {
|
||||
@Switch('h') boolean hollow,
|
||||
@Switch('r') boolean useRawCoords,
|
||||
@Switch('o') boolean offset,
|
||||
<<<<<<< HEAD
|
||||
@Switch('c') boolean offsetCenter,
|
||||
CommandContext context) throws WorldEditException, ParameterException {
|
||||
final Vector zero;
|
||||
Vector unit;
|
||||
=======
|
||||
@Switch('c') boolean offsetCenter) throws WorldEditException {
|
||||
|
||||
final Vector3 zero;
|
||||
Vector3 unit;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
|
||||
if (useRawCoords) {
|
||||
zero = Vector.ZERO;
|
||||
unit = Vector.ONE;
|
||||
zero = Vector3.ZERO;
|
||||
unit = Vector3.ONE;
|
||||
} else if (offset) {
|
||||
zero = session.getPlacementPosition(player);
|
||||
unit = Vector.ONE;
|
||||
zero = session.getPlacementPosition(player).toVector3();
|
||||
unit = Vector3.ONE;
|
||||
} else if (offsetCenter) {
|
||||
final Vector min = region.getMinimumPoint();
|
||||
final Vector max = region.getMaximumPoint();
|
||||
final Vector3 min = region.getMinimumPoint().toVector3();
|
||||
final Vector3 max = region.getMaximumPoint().toVector3();
|
||||
|
||||
zero = max.add(min).multiply(0.5);
|
||||
unit = Vector.ONE;
|
||||
unit = Vector3.ONE;
|
||||
} else {
|
||||
final Vector min = region.getMinimumPoint();
|
||||
final Vector max = region.getMaximumPoint();
|
||||
final Vector3 min = region.getMinimumPoint().toVector3();
|
||||
final Vector3 max = region.getMaximumPoint().toVector3();
|
||||
|
||||
zero = max.add(min).multiply(0.5);
|
||||
unit = max.subtract(zero);
|
||||
|
||||
<<<<<<< HEAD
|
||||
if (unit.getX() == 0) unit.mutX(1);
|
||||
if (unit.getY() == 0) unit.mutY(1);
|
||||
if (unit.getZ() == 0) unit.mutZ(1);
|
||||
=======
|
||||
if (unit.getX() == 0) unit = unit.withX(1.0);
|
||||
if (unit.getY() == 0) unit = unit.withY(1.0);
|
||||
if (unit.getZ() == 0) unit = unit.withZ(1.0);
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
}
|
||||
|
||||
fp.checkConfirmationRegion(() -> {
|
||||
@ -430,33 +500,53 @@ public class GenerationCommands extends MethodCommands {
|
||||
@Switch('h') boolean hollow,
|
||||
@Switch('r') boolean useRawCoords,
|
||||
@Switch('o') boolean offset,
|
||||
<<<<<<< HEAD
|
||||
@Switch('c') boolean offsetCenter,
|
||||
CommandContext context) throws WorldEditException, ParameterException {
|
||||
final Vector zero;
|
||||
Vector unit;
|
||||
=======
|
||||
@Switch('c') boolean offsetCenter) throws WorldEditException {
|
||||
final Vector3 zero;
|
||||
Vector3 unit;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
|
||||
if (useRawCoords) {
|
||||
zero = Vector.ZERO;
|
||||
unit = Vector.ONE;
|
||||
zero = Vector3.ZERO;
|
||||
unit = Vector3.ONE;
|
||||
} else if (offset) {
|
||||
zero = session.getPlacementPosition(player);
|
||||
unit = Vector.ONE;
|
||||
zero = session.getPlacementPosition(player).toVector3();
|
||||
unit = Vector3.ONE;
|
||||
} else if (offsetCenter) {
|
||||
final Vector min = region.getMinimumPoint();
|
||||
final Vector max = region.getMaximumPoint();
|
||||
final Vector3 min = region.getMinimumPoint().toVector3();
|
||||
final Vector3 max = region.getMaximumPoint().toVector3();
|
||||
|
||||
zero = max.add(min).multiply(0.5);
|
||||
unit = Vector.ONE;
|
||||
unit = Vector3.ONE;
|
||||
} else {
|
||||
final Vector min = region.getMinimumPoint();
|
||||
final Vector max = region.getMaximumPoint();
|
||||
final Vector3 min = region.getMinimumPoint().toVector3();
|
||||
final Vector3 max = region.getMaximumPoint().toVector3();
|
||||
|
||||
zero = max.add(min).multiply(0.5);
|
||||
unit = max.subtract(zero);
|
||||
|
||||
<<<<<<< HEAD
|
||||
if (unit.getX() == 0) unit.mutX(1);
|
||||
if (unit.getY() == 0) unit.mutY(1);
|
||||
if (unit.getZ() == 0) unit.mutZ(1);
|
||||
=======
|
||||
if (unit.getX() == 0) unit = unit.withX(1.0);
|
||||
if (unit.getY() == 0) unit = unit.withY(1.0);
|
||||
if (unit.getZ() == 0) unit = unit.withZ(1.0);
|
||||
}
|
||||
|
||||
try {
|
||||
final int affected = editSession.makeBiomeShape(region, zero, unit, target, expression, hollow);
|
||||
player.findFreePosition();
|
||||
player.print("" + affected + " columns affected.");
|
||||
} catch (ExpressionException e) {
|
||||
player.printError(e.getMessage());
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
}
|
||||
fp.checkConfirmationRegion(() -> {
|
||||
try {
|
||||
|
@ -34,9 +34,16 @@ import com.sk89q.minecraft.util.commands.Command;
|
||||
import com.sk89q.minecraft.util.commands.CommandContext;
|
||||
import com.sk89q.minecraft.util.commands.CommandPermissions;
|
||||
import com.sk89q.minecraft.util.commands.Logging;
|
||||
<<<<<<< HEAD
|
||||
import com.sk89q.worldedit.*;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
=======
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.extension.platform.Capability;
|
||||
import com.sk89q.worldedit.function.GroundFunction;
|
||||
@ -51,6 +58,8 @@ import com.sk89q.worldedit.function.visitor.LayerVisitor;
|
||||
import com.sk89q.worldedit.internal.annotation.Direction;
|
||||
import com.sk89q.worldedit.internal.annotation.Selection;
|
||||
import com.sk89q.worldedit.internal.expression.ExpressionException;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.math.Vector3;
|
||||
import com.sk89q.worldedit.math.convolution.GaussianKernel;
|
||||
import com.sk89q.worldedit.math.convolution.HeightMap;
|
||||
import com.sk89q.worldedit.math.convolution.HeightMapFilter;
|
||||
@ -247,8 +256,8 @@ public class RegionCommands extends MethodCommands {
|
||||
}
|
||||
|
||||
CuboidRegion cuboidregion = (CuboidRegion) region;
|
||||
Vector pos1 = cuboidregion.getPos1();
|
||||
Vector pos2 = cuboidregion.getPos2();
|
||||
BlockVector3 pos1 = cuboidregion.getPos1();
|
||||
BlockVector3 pos2 = cuboidregion.getPos2();
|
||||
int blocksChanged = editSession.drawLine(pattern, pos1, pos2, thickness, !shell);
|
||||
|
||||
BBC.VISITOR_BLOCK.send(player, blocksChanged);
|
||||
@ -281,9 +290,14 @@ public class RegionCommands extends MethodCommands {
|
||||
}
|
||||
worldEdit.checkMaxRadius(thickness);
|
||||
|
||||
<<<<<<< HEAD
|
||||
player.checkConfirmationRegion(() -> {
|
||||
ConvexPolyhedralRegion cpregion = (ConvexPolyhedralRegion) region;
|
||||
List<Vector> vectors = new ArrayList<Vector>(cpregion.getVertices());
|
||||
=======
|
||||
ConvexPolyhedralRegion cpregion = (ConvexPolyhedralRegion) region;
|
||||
List<BlockVector3> vectors = new ArrayList<>(cpregion.getVertices());
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
|
||||
int blocksChanged = editSession.drawSpline(pattern, vectors, 0, 0, 0, 10, thickness, !shell);
|
||||
|
||||
@ -537,6 +551,7 @@ public class RegionCommands extends MethodCommands {
|
||||
public void move(FawePlayer player, LocalSession session, EditSession editSession,
|
||||
@Selection Region region,
|
||||
@Optional("1") @Range(min = 1) int count,
|
||||
<<<<<<< HEAD
|
||||
@Optional(Direction.AIM) @Direction Vector direction,
|
||||
@Optional("air") Pattern replace,
|
||||
@Switch('b') boolean copyBiomes,
|
||||
@ -556,6 +571,22 @@ public class RegionCommands extends MethodCommands {
|
||||
} catch (RegionOperationException e) {
|
||||
player.sendMessage(BBC.getPrefix() + e.getMessage());
|
||||
}
|
||||
=======
|
||||
@Optional(Direction.AIM) @Direction BlockVector3 direction,
|
||||
@Optional("air") BlockStateHolder replace,
|
||||
@Switch('s') boolean moveSelection) throws WorldEditException {
|
||||
|
||||
int affected = editSession.moveRegion(region, direction, count, true, replace);
|
||||
|
||||
if (moveSelection) {
|
||||
try {
|
||||
region.shift(direction.multiply(count));
|
||||
|
||||
session.getRegionSelector(player.getWorld()).learnChanges();
|
||||
session.getRegionSelector(player.getWorld()).explainRegionAdjust(player, session);
|
||||
} catch (RegionOperationException e) {
|
||||
player.printError(e.getMessage());
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
}
|
||||
|
||||
BBC.VISITOR_BLOCK.send(player, affected);
|
||||
@ -604,8 +635,9 @@ public class RegionCommands extends MethodCommands {
|
||||
public void stack(FawePlayer player, LocalSession session, EditSession editSession,
|
||||
@Selection Region region,
|
||||
@Optional("1") @Range(min = 1) int count,
|
||||
@Optional(Direction.AIM) @Direction Vector direction,
|
||||
@Optional(Direction.AIM) @Direction BlockVector3 direction,
|
||||
@Switch('s') boolean moveSelection,
|
||||
<<<<<<< HEAD
|
||||
@Switch('b') boolean copyBiomes,
|
||||
@Switch('e') boolean skipEntities,
|
||||
@Switch('a') boolean ignoreAirBlocks, @Switch('m') Mask sourceMask, CommandContext context) throws WorldEditException {
|
||||
@ -626,6 +658,22 @@ public class RegionCommands extends MethodCommands {
|
||||
} catch (RegionOperationException e) {
|
||||
player.sendMessage(BBC.getPrefix() + e.getMessage());
|
||||
}
|
||||
=======
|
||||
@Switch('a') boolean ignoreAirBlocks) throws WorldEditException {
|
||||
int affected = editSession.stackCuboidRegion(region, direction, count, !ignoreAirBlocks);
|
||||
|
||||
if (moveSelection) {
|
||||
try {
|
||||
final BlockVector3 size = region.getMaximumPoint().subtract(region.getMinimumPoint());
|
||||
|
||||
final BlockVector3 shiftVector = direction.toVector3().multiply(count * (Math.abs(direction.dot(size)) + 1)).toBlockPoint();
|
||||
region.shift(shiftVector);
|
||||
|
||||
session.getRegionSelector(player.getWorld()).learnChanges();
|
||||
session.getRegionSelector(player.getWorld()).explainRegionAdjust(player, session);
|
||||
} catch (RegionOperationException e) {
|
||||
player.printError(e.getMessage());
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
}
|
||||
|
||||
BBC.VISITOR_BLOCK.send(player, affected);
|
||||
@ -651,27 +699,39 @@ public class RegionCommands extends MethodCommands {
|
||||
@Selection Region region,
|
||||
@Text String expression,
|
||||
@Switch('r') boolean useRawCoords,
|
||||
<<<<<<< HEAD
|
||||
@Switch('o') boolean offset,
|
||||
CommandContext context) throws WorldEditException {
|
||||
final Vector zero;
|
||||
Vector unit;
|
||||
=======
|
||||
@Switch('o') boolean offset) throws WorldEditException {
|
||||
final Vector3 zero;
|
||||
Vector3 unit;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
|
||||
if (useRawCoords) {
|
||||
zero = Vector.ZERO;
|
||||
unit = Vector.ONE;
|
||||
zero = Vector3.ZERO;
|
||||
unit = Vector3.ONE;
|
||||
} else if (offset) {
|
||||
zero = session.getPlacementPosition(player);
|
||||
unit = Vector.ONE;
|
||||
zero = session.getPlacementPosition(player).toVector3();
|
||||
unit = Vector3.ONE;
|
||||
} else {
|
||||
final Vector min = region.getMinimumPoint();
|
||||
final Vector max = region.getMaximumPoint();
|
||||
final Vector3 min = region.getMinimumPoint().toVector3();
|
||||
final Vector3 max = region.getMaximumPoint().toVector3();
|
||||
|
||||
zero = max.add(min).multiply(0.5);
|
||||
zero = max.add(min).divide(2);
|
||||
unit = max.subtract(zero);
|
||||
|
||||
<<<<<<< HEAD
|
||||
if (unit.getX() == 0) unit.mutX(1);
|
||||
if (unit.getY() == 0) unit.mutY(1);
|
||||
if (unit.getZ() == 0) unit.mutZ(1);
|
||||
=======
|
||||
if (unit.getX() == 0) unit = unit.withX(1.0);
|
||||
if (unit.getY() == 0) unit = unit.withY(1.0);
|
||||
if (unit.getZ() == 0) unit = unit.withZ(1.0);
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
}
|
||||
fp.checkConfirmationRegion(() -> {
|
||||
try {
|
||||
|
@ -32,8 +32,6 @@ import com.sk89q.minecraft.util.commands.CommandPermissions;
|
||||
import com.sk89q.minecraft.util.commands.Logging;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.Vector2D;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
@ -45,7 +43,12 @@ import com.sk89q.worldedit.extension.input.ParserContext;
|
||||
import com.sk89q.worldedit.extension.platform.permission.ActorSelectorLimits;
|
||||
import com.sk89q.worldedit.extent.AbstractDelegateExtent;
|
||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||
<<<<<<< HEAD
|
||||
import com.sk89q.worldedit.function.mask.Mask;
|
||||
=======
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
import com.sk89q.worldedit.regions.RegionOperationException;
|
||||
import com.sk89q.worldedit.regions.RegionSelector;
|
||||
@ -66,7 +69,10 @@ import com.sk89q.worldedit.util.formatting.StyledFragment;
|
||||
import com.sk89q.worldedit.util.formatting.component.CommandListBox;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
<<<<<<< HEAD
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
=======
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.world.item.ItemTypes;
|
||||
import com.sk89q.worldedit.world.storage.ChunkStore;
|
||||
import java.io.File;
|
||||
@ -117,6 +123,7 @@ public class SelectionCommands {
|
||||
} else {
|
||||
pos = player.getBlockIn().toVector();
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
pos = pos.clampY(0, player.getWorld().getMaximumPoint().getBlockY());
|
||||
if (!session.getRegionSelector(player.getWorld()).selectPrimary(pos, ActorSelectorLimits.forActor(player))) {
|
||||
BBC.SELECTOR_ALREADY_SET.send(player);
|
||||
@ -124,6 +131,16 @@ public class SelectionCommands {
|
||||
}
|
||||
|
||||
session.getRegionSelector(player.getWorld()).explainPrimarySelection(player, session, pos);
|
||||
=======
|
||||
|
||||
if (!session.getRegionSelector(player.getWorld()).selectPrimary(pos.toVector().toBlockPoint(), ActorSelectorLimits.forActor(player))) {
|
||||
player.printError("Position already set.");
|
||||
return;
|
||||
}
|
||||
|
||||
session.getRegionSelector(player.getWorld())
|
||||
.explainPrimarySelection(player, session, pos.toVector().toBlockPoint());
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -150,14 +167,24 @@ public class SelectionCommands {
|
||||
} else {
|
||||
pos = player.getBlockIn().toVector();
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
pos = pos.clampY(0, player.getWorld().getMaximumPoint().getBlockY());
|
||||
if (!session.getRegionSelector(player.getWorld()).selectSecondary(pos, ActorSelectorLimits.forActor(player))) {
|
||||
BBC.SELECTOR_ALREADY_SET.send(player);
|
||||
=======
|
||||
|
||||
if (!session.getRegionSelector(player.getWorld()).selectSecondary(pos.toVector().toBlockPoint(), ActorSelectorLimits.forActor(player))) {
|
||||
player.printError("Position already set.");
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
return;
|
||||
}
|
||||
|
||||
session.getRegionSelector(player.getWorld())
|
||||
<<<<<<< HEAD
|
||||
.explainSecondarySelection(player, session, pos);
|
||||
=======
|
||||
.explainSecondarySelection(player, session, pos.toVector().toBlockPoint());
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -172,13 +199,22 @@ public class SelectionCommands {
|
||||
Vector pos = player.getBlockTrace(300).toVector();
|
||||
|
||||
if (pos != null) {
|
||||
<<<<<<< HEAD
|
||||
if (!session.getRegionSelector(player.getWorld()).selectPrimary(pos, ActorSelectorLimits.forActor(player))) {
|
||||
BBC.SELECTOR_ALREADY_SET.send(player);
|
||||
=======
|
||||
if (!session.getRegionSelector(player.getWorld()).selectPrimary(pos.toVector().toBlockPoint(), ActorSelectorLimits.forActor(player))) {
|
||||
player.printError("Position already set.");
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
return;
|
||||
}
|
||||
|
||||
session.getRegionSelector(player.getWorld())
|
||||
<<<<<<< HEAD
|
||||
.explainPrimarySelection(player, session, pos);
|
||||
=======
|
||||
.explainPrimarySelection(player, session, pos.toVector().toBlockPoint());
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
} else {
|
||||
player.printError("No block in sight!");
|
||||
}
|
||||
@ -196,13 +232,22 @@ public class SelectionCommands {
|
||||
Vector pos = player.getBlockTrace(300).toVector();
|
||||
|
||||
if (pos != null) {
|
||||
<<<<<<< HEAD
|
||||
if (!session.getRegionSelector(player.getWorld()).selectSecondary(pos, ActorSelectorLimits.forActor(player))) {
|
||||
BBC.SELECTOR_ALREADY_SET.send(player);
|
||||
=======
|
||||
if (!session.getRegionSelector(player.getWorld()).selectSecondary(pos.toVector().toBlockPoint(), ActorSelectorLimits.forActor(player))) {
|
||||
player.printError("Position already set.");
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
return;
|
||||
}
|
||||
|
||||
session.getRegionSelector(player.getWorld())
|
||||
<<<<<<< HEAD
|
||||
.explainSecondarySelection(player, session, pos);
|
||||
=======
|
||||
.explainSecondarySelection(player, session, pos.toVector().toBlockPoint());
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
} else {
|
||||
player.printError("No block in sight!");
|
||||
}
|
||||
@ -226,22 +271,28 @@ public class SelectionCommands {
|
||||
)
|
||||
@Logging(POSITION)
|
||||
@CommandPermissions("worldedit.selection.chunk")
|
||||
<<<<<<< HEAD
|
||||
public void chunk(Player player, LocalSession session, CommandContext args) throws WorldEditException {
|
||||
final Vector min;
|
||||
final Vector max;
|
||||
=======
|
||||
public void chunk(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException {
|
||||
final BlockVector3 min;
|
||||
final BlockVector3 max;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
final World world = player.getWorld();
|
||||
if (args.hasFlag('s')) {
|
||||
Region region = session.getSelection(world);
|
||||
|
||||
final Vector2D min2D = ChunkStore.toChunk(region.getMinimumPoint());
|
||||
final Vector2D max2D = ChunkStore.toChunk(region.getMaximumPoint());
|
||||
final BlockVector2 min2D = ChunkStore.toChunk(region.getMinimumPoint());
|
||||
final BlockVector2 max2D = ChunkStore.toChunk(region.getMaximumPoint());
|
||||
|
||||
min = new Vector(min2D.getBlockX() * 16, 0, min2D.getBlockZ() * 16);
|
||||
max = new Vector(max2D.getBlockX() * 16 + 15, world.getMaxY(), max2D.getBlockZ() * 16 + 15);
|
||||
min = new BlockVector3(min2D.getBlockX() * 16, 0, min2D.getBlockZ() * 16);
|
||||
max = new BlockVector3(max2D.getBlockX() * 16 + 15, world.getMaxY(), max2D.getBlockZ() * 16 + 15);
|
||||
|
||||
BBC.SELECTION_CHUNKS.send(player, min2D.getBlockX() + ", " + min2D.getBlockZ(), max2D.getBlockX() + ", " + max2D.getBlockZ());
|
||||
} else {
|
||||
final Vector2D min2D;
|
||||
final BlockVector2 min2D;
|
||||
if (args.argsLength() == 1) {
|
||||
// coords specified
|
||||
String[] coords = args.getString(0).split(",");
|
||||
@ -250,14 +301,14 @@ public class SelectionCommands {
|
||||
}
|
||||
int x = Integer.parseInt(coords[0]);
|
||||
int z = Integer.parseInt(coords[1]);
|
||||
Vector2D pos = new Vector2D(x, z);
|
||||
min2D = (args.hasFlag('c')) ? pos : ChunkStore.toChunk(pos.toVector());
|
||||
BlockVector2 pos = new BlockVector2(x, z);
|
||||
min2D = (args.hasFlag('c')) ? pos : ChunkStore.toChunk(pos.toBlockVector3());
|
||||
} else {
|
||||
// use player loc
|
||||
min2D = ChunkStore.toChunk(player.getBlockIn().toVector());
|
||||
min2D = ChunkStore.toChunk(player.getBlockIn().toVector().toBlockPoint());
|
||||
}
|
||||
|
||||
min = new Vector(min2D.getBlockX() * 16, 0, min2D.getBlockZ() * 16);
|
||||
min = new BlockVector3(min2D.getBlockX() * 16, 0, min2D.getBlockZ() * 16);
|
||||
max = min.add(15, world.getMaxY(), 15);
|
||||
|
||||
BBC.SELECTION_CHUNK.send(player, min2D.getBlockX() + ", " + min2D.getBlockZ());
|
||||
@ -327,8 +378,8 @@ public class SelectionCommands {
|
||||
try {
|
||||
int oldSize = region.getArea();
|
||||
region.expand(
|
||||
new Vector(0, (player.getWorld().getMaxY() + 1), 0),
|
||||
new Vector(0, -(player.getWorld().getMaxY() + 1), 0));
|
||||
new BlockVector3(0, (player.getWorld().getMaxY() + 1), 0),
|
||||
new BlockVector3(0, -(player.getWorld().getMaxY() + 1), 0));
|
||||
session.getRegionSelector(player.getWorld()).learnChanges();
|
||||
int newSize = region.getArea();
|
||||
session.getRegionSelector(player.getWorld()).explainRegionAdjust(player, session);
|
||||
@ -340,7 +391,11 @@ public class SelectionCommands {
|
||||
return;
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
List<Vector> dirs = new ArrayList<Vector>();
|
||||
=======
|
||||
List<BlockVector3> dirs = new ArrayList<>();
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
int change = args.getInteger(0);
|
||||
int reverseChange = 0;
|
||||
|
||||
@ -385,11 +440,11 @@ public class SelectionCommands {
|
||||
int oldSize = region.getArea();
|
||||
|
||||
if (reverseChange == 0) {
|
||||
for (Vector dir : dirs) {
|
||||
for (BlockVector3 dir : dirs) {
|
||||
region.expand(dir.multiply(change));
|
||||
}
|
||||
} else {
|
||||
for (Vector dir : dirs) {
|
||||
for (BlockVector3 dir : dirs) {
|
||||
region.expand(dir.multiply(change), dir.multiply(-reverseChange));
|
||||
}
|
||||
}
|
||||
@ -410,8 +465,14 @@ public class SelectionCommands {
|
||||
)
|
||||
@Logging(REGION)
|
||||
@CommandPermissions("worldedit.selection.contract")
|
||||
<<<<<<< HEAD
|
||||
public void contract(Player player, LocalSession session, CommandContext args) throws WorldEditException {
|
||||
List<Vector> dirs = new ArrayList<Vector>();
|
||||
=======
|
||||
public void contract(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException {
|
||||
|
||||
List<BlockVector3> dirs = new ArrayList<>();
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
int change = args.getInteger(0);
|
||||
int reverseChange = 0;
|
||||
|
||||
@ -455,11 +516,11 @@ public class SelectionCommands {
|
||||
Region region = session.getSelection(player.getWorld());
|
||||
int oldSize = region.getArea();
|
||||
if (reverseChange == 0) {
|
||||
for (Vector dir : dirs) {
|
||||
for (BlockVector3 dir : dirs) {
|
||||
region.contract(dir.multiply(change));
|
||||
}
|
||||
} else {
|
||||
for (Vector dir : dirs) {
|
||||
for (BlockVector3 dir : dirs) {
|
||||
region.contract(dir.multiply(change), dir.multiply(-reverseChange));
|
||||
}
|
||||
}
|
||||
@ -483,8 +544,14 @@ public class SelectionCommands {
|
||||
)
|
||||
@Logging(REGION)
|
||||
@CommandPermissions("worldedit.selection.shift")
|
||||
<<<<<<< HEAD
|
||||
public void shift(Player player, LocalSession session, CommandContext args) throws WorldEditException {
|
||||
List<Vector> dirs = new ArrayList<Vector>();
|
||||
=======
|
||||
public void shift(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException {
|
||||
|
||||
List<BlockVector3> dirs = new ArrayList<>();
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
int change = args.getInteger(0);
|
||||
if (args.argsLength() == 2) {
|
||||
if (args.getString(1).contains(",")) {
|
||||
@ -501,7 +568,7 @@ public class SelectionCommands {
|
||||
try {
|
||||
Region region = session.getSelection(player.getWorld());
|
||||
|
||||
for (Vector dir : dirs) {
|
||||
for (BlockVector3 dir : dirs) {
|
||||
region.shift(dir.multiply(change));
|
||||
}
|
||||
|
||||
@ -560,23 +627,28 @@ public class SelectionCommands {
|
||||
BBC.SELECTION_INSET.send(player);
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
private Vector[] getChangesForEachDir(CommandContext args) {
|
||||
List<Vector> changes = new ArrayList<Vector>(6);
|
||||
=======
|
||||
private BlockVector3[] getChangesForEachDir(CommandContext args) {
|
||||
List<BlockVector3> changes = new ArrayList<>(6);
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
int change = args.getInteger(0);
|
||||
|
||||
if (!args.hasFlag('h')) {
|
||||
changes.add((new Vector(0, 1, 0)).multiply(change));
|
||||
changes.add((new Vector(0, -1, 0)).multiply(change));
|
||||
changes.add((new BlockVector3(0, 1, 0)).multiply(change));
|
||||
changes.add((new BlockVector3(0, -1, 0)).multiply(change));
|
||||
}
|
||||
|
||||
if (!args.hasFlag('v')) {
|
||||
changes.add((new Vector(1, 0, 0)).multiply(change));
|
||||
changes.add((new Vector(-1, 0, 0)).multiply(change));
|
||||
changes.add((new Vector(0, 0, 1)).multiply(change));
|
||||
changes.add((new Vector(0, 0, -1)).multiply(change));
|
||||
changes.add((new BlockVector3(1, 0, 0)).multiply(change));
|
||||
changes.add((new BlockVector3(-1, 0, 0)).multiply(change));
|
||||
changes.add((new BlockVector3(0, 0, 1)).multiply(change));
|
||||
changes.add((new BlockVector3(0, 0, -1)).multiply(change));
|
||||
}
|
||||
|
||||
return changes.toArray(new Vector[0]);
|
||||
return changes.toArray(new BlockVector3[0]);
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -588,6 +660,7 @@ public class SelectionCommands {
|
||||
max = 0
|
||||
)
|
||||
@CommandPermissions("worldedit.selection.size")
|
||||
<<<<<<< HEAD
|
||||
public void size(Player player, LocalSession session, CommandContext args) throws WorldEditException {
|
||||
if (args.hasFlag('c')) {
|
||||
ClipboardHolder root = session.getClipboard();
|
||||
@ -628,15 +701,33 @@ public class SelectionCommands {
|
||||
// player.print(BBC.getPrefix() + "Offset: " + origin);
|
||||
// player.print(BBC.getPrefix() + "Cuboid distance: " + size.distance(Vector.ONE));
|
||||
// player.print(BBC.getPrefix() + "# of blocks: " + (int) (size.getX() * size.getY() * size.getZ()));
|
||||
=======
|
||||
public void size(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException {
|
||||
if (args.hasFlag('c')) {
|
||||
ClipboardHolder holder = session.getClipboard();
|
||||
Clipboard clipboard = holder.getClipboard();
|
||||
Region region = clipboard.getRegion();
|
||||
BlockVector3 size = region.getMaximumPoint().subtract(region.getMinimumPoint());
|
||||
BlockVector3 origin = clipboard.getOrigin();
|
||||
|
||||
player.print("Cuboid dimensions (max - min): " + size);
|
||||
player.print("Offset: " + origin);
|
||||
player.print("Cuboid distance: " + size.distance(BlockVector3.ONE));
|
||||
player.print("# of blocks: " + (int) (size.getX() * size.getY() * size.getZ()));
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
return;
|
||||
}
|
||||
|
||||
Region region = session.getSelection(player.getWorld());
|
||||
Vector size = region.getMaximumPoint()
|
||||
BlockVector3 size = region.getMaximumPoint()
|
||||
.subtract(region.getMinimumPoint())
|
||||
.add(1, 1, 1);
|
||||
|
||||
<<<<<<< HEAD
|
||||
player.print(BBC.getPrefix() + "Type: " + session.getRegionSelector(player.getWorld())
|
||||
=======
|
||||
player.print("Type: " + session.getRegionSelector(player.getWorld())
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
.getTypeName());
|
||||
|
||||
for (String line : session.getRegionSelector(player.getWorld())
|
||||
@ -644,9 +735,15 @@ public class SelectionCommands {
|
||||
player.print(BBC.getPrefix() + line);
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
player.print(BBC.getPrefix() + "Size: " + size);
|
||||
player.print(BBC.getPrefix() + "Cuboid distance: " + region.getMaximumPoint().distance(region.getMinimumPoint()));
|
||||
player.print(BBC.getPrefix() + "# of blocks: " + region.getArea());
|
||||
=======
|
||||
player.print("Size: " + size);
|
||||
player.print("Cuboid distance: " + region.getMaximumPoint().distance(region.getMinimumPoint()));
|
||||
player.print("# of blocks: " + region.getArea());
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
}
|
||||
|
||||
|
||||
|
@ -19,6 +19,7 @@
|
||||
|
||||
package com.sk89q.worldedit.command;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import com.boydti.fawe.Fawe;
|
||||
import com.boydti.fawe.FaweAPI;
|
||||
import com.boydti.fawe.command.FaweParser;
|
||||
@ -42,6 +43,21 @@ import com.sk89q.worldedit.*;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
=======
|
||||
import static com.sk89q.minecraft.util.commands.Logging.LogMode.PLACEMENT;
|
||||
|
||||
import com.google.common.base.Joiner;
|
||||
import com.sk89q.minecraft.util.commands.Command;
|
||||
import com.sk89q.minecraft.util.commands.CommandContext;
|
||||
import com.sk89q.minecraft.util.commands.CommandException;
|
||||
import com.sk89q.minecraft.util.commands.CommandPermissions;
|
||||
import com.sk89q.minecraft.util.commands.Logging;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.LocalConfiguration;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.command.util.CreatureButcher;
|
||||
import com.sk89q.worldedit.command.util.EntityRemover;
|
||||
import com.sk89q.worldedit.entity.Entity;
|
||||
@ -64,6 +80,7 @@ import com.sk89q.worldedit.internal.annotation.Direction;
|
||||
import com.sk89q.worldedit.internal.expression.Expression;
|
||||
import com.sk89q.worldedit.internal.expression.ExpressionException;
|
||||
import com.sk89q.worldedit.internal.expression.runtime.EvaluationException;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||
import com.sk89q.worldedit.regions.CylinderRegion;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
@ -243,6 +260,7 @@ public class UtilityCommands extends MethodCommands {
|
||||
BBC.WORLDEDIT_CANCEL_COUNT.send(player, cancelled);
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
@Command(
|
||||
aliases = {"/fill"},
|
||||
usage = "<pattern> <radius> [depth] [direction]",
|
||||
@ -258,6 +276,11 @@ public class UtilityCommands extends MethodCommands {
|
||||
int affected;
|
||||
affected = editSession.fillDirection(pos, pattern, radius, (int) depth, direction);
|
||||
player.print(BBC.getPrefix() + affected + " block(s) have been created.");
|
||||
=======
|
||||
BlockVector3 pos = session.getPlacementPosition(player);
|
||||
int affected = editSession.fillXZ(pos, pattern, radius, depth, false);
|
||||
player.print(affected + " block(s) have been created.");
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -269,12 +292,35 @@ public class UtilityCommands extends MethodCommands {
|
||||
)
|
||||
@CommandPermissions("worldedit.fill.recursive")
|
||||
@Logging(PLACEMENT)
|
||||
<<<<<<< HEAD
|
||||
public void fillr(Player player, LocalSession session, EditSession editSession, Pattern pattern, double radius, @Optional("-1") double depth) throws WorldEditException {
|
||||
worldEdit.checkMaxRadius(radius);
|
||||
Vector pos = session.getPlacementPosition(player);
|
||||
if (depth == -1) depth = Integer.MAX_VALUE;
|
||||
int affected = editSession.fillXZ(pos, pattern, radius, (int) depth, true);
|
||||
player.print(BBC.getPrefix() + affected + " block(s) have been created.");
|
||||
=======
|
||||
public void fillr(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException {
|
||||
|
||||
ParserContext context = new ParserContext();
|
||||
context.setActor(player);
|
||||
context.setWorld(player.getWorld());
|
||||
context.setSession(session);
|
||||
Pattern pattern = we.getPatternFactory().parseFromInput(args.getString(0), context);
|
||||
|
||||
double radius = Math.max(1, args.getDouble(1));
|
||||
we.checkMaxRadius(radius);
|
||||
int depth = args.argsLength() > 2 ? Math.max(1, args.getInteger(2)) : Integer.MAX_VALUE;
|
||||
|
||||
BlockVector3 pos = session.getPlacementPosition(player);
|
||||
int affected = 0;
|
||||
if (pattern instanceof BlockPattern) {
|
||||
affected = editSession.fillXZ(pos, ((BlockPattern) pattern).getBlock(), radius, depth, true);
|
||||
} else {
|
||||
affected = editSession.fillXZ(pos, pattern, radius, depth, true);
|
||||
}
|
||||
player.print(affected + " block(s) have been created.");
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -384,9 +430,16 @@ public class UtilityCommands extends MethodCommands {
|
||||
if (from == null) {
|
||||
from = new ExistingBlockMask(editSession);
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
Vector base = session.getPlacementPosition(player);
|
||||
Vector min = base.subtract(size, size, size);
|
||||
Vector max = base.add(size, size, size);
|
||||
=======
|
||||
|
||||
BlockVector3 base = session.getPlacementPosition(player);
|
||||
BlockVector3 min = base.subtract(size, size, size);
|
||||
BlockVector3 max = base.add(size, size, size);
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
Region region = new CuboidRegion(player.getWorld(), min, max);
|
||||
|
||||
int affected = editSession.replaceBlocks(region, from, to);
|
||||
@ -521,8 +574,13 @@ public class UtilityCommands extends MethodCommands {
|
||||
EditSession editSession = null;
|
||||
|
||||
if (player != null) {
|
||||
<<<<<<< HEAD
|
||||
session = worldEdit.getSessionManager().get(player);
|
||||
Vector center = session.getPlacementPosition(player);
|
||||
=======
|
||||
session = we.getSessionManager().get(player);
|
||||
BlockVector3 center = session.getPlacementPosition(player);
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
editSession = session.createEditSession(player);
|
||||
List<? extends Entity> entities;
|
||||
if (radius >= 0) {
|
||||
@ -581,8 +639,13 @@ public class UtilityCommands extends MethodCommands {
|
||||
EditSession editSession = null;
|
||||
|
||||
if (player != null) {
|
||||
<<<<<<< HEAD
|
||||
session = worldEdit.getSessionManager().get(player);
|
||||
Vector center = session.getPlacementPosition(player);
|
||||
=======
|
||||
session = we.getSessionManager().get(player);
|
||||
BlockVector3 center = session.getPlacementPosition(player);
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
editSession = session.createEditSession(player);
|
||||
List<? extends Entity> entities;
|
||||
if (radius >= 0) {
|
||||
|
@ -22,12 +22,12 @@ package com.sk89q.worldedit.command.argument;
|
||||
import com.sk89q.minecraft.util.commands.CommandException;
|
||||
import com.sk89q.minecraft.util.commands.CommandLocals;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.blocks.BaseItem;
|
||||
import com.sk89q.worldedit.function.Contextual;
|
||||
import com.sk89q.worldedit.function.EditContext;
|
||||
import com.sk89q.worldedit.function.RegionFunction;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.util.Direction;
|
||||
import com.sk89q.worldedit.util.command.argument.CommandArgs;
|
||||
import com.sk89q.worldedit.util.command.composition.SimpleCommand;
|
||||
@ -82,7 +82,7 @@ public class ItemUseParser extends SimpleCommand<Contextual<RegionFunction>> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Vector position) throws WorldEditException {
|
||||
public boolean apply(BlockVector3 position) throws WorldEditException {
|
||||
return world.useItem(position, item, Direction.UP);
|
||||
}
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ public class DeformCommand extends SimpleCommand<Contextual<? extends Operation>
|
||||
Player player = (Player) locals.get(Actor.class);
|
||||
LocalSession session = WorldEdit.getInstance().getSessionManager().get(locals.get(Actor.class));
|
||||
try {
|
||||
deform.setOffset(session.getPlacementPosition(player));
|
||||
deform.setOffset(session.getPlacementPosition(player).toVector3());
|
||||
} catch (IncompleteRegionException e) {
|
||||
throw new WrappedCommandException(e);
|
||||
}
|
||||
|
@ -3,9 +3,18 @@ package com.sk89q.worldedit.command.tool;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.LocalConfiguration;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
<<<<<<< HEAD
|
||||
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.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;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.world.block.BlockType;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
|
||||
@ -30,7 +39,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()).getBlockType();
|
||||
BlockType initialType = clicked.getExtent().getBlock(clicked.toVector().toBlockPoint()).getBlockType();
|
||||
|
||||
if (initialType.getMaterial().isAir()) {
|
||||
return true;
|
||||
@ -40,6 +49,7 @@ public class AreaPickaxe implements BlockTool {
|
||||
return true;
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
EditSession editSession = session.createEditSession(player);
|
||||
editSession.getSurvivalExtent().setToolUse(config.superPickaxeManyDrop);
|
||||
|
||||
@ -48,6 +58,24 @@ public class AreaPickaxe implements BlockTool {
|
||||
for (int y = oy + range; y >= oy - range; --y) {
|
||||
if (initialType.equals(editSession.getLazyBlock(x, y, z))) {
|
||||
continue;
|
||||
=======
|
||||
try (EditSession editSession = session.createEditSession(player)) {
|
||||
editSession.getSurvivalExtent().setToolUse(config.superPickaxeManyDrop);
|
||||
|
||||
try {
|
||||
for (int x = ox - range; x <= ox + range; ++x) {
|
||||
for (int y = oy - range; y <= oy + range; ++y) {
|
||||
for (int z = oz - range; z <= oz + range; ++z) {
|
||||
BlockVector3 pos = new BlockVector3(x, y, z);
|
||||
if (editSession.getBlock(pos).getBlockType() != initialType) {
|
||||
continue;
|
||||
}
|
||||
|
||||
((World) clicked.getExtent()).queueBlockBreakEffect(server, pos, initialType, clicked.toVector().toBlockPoint().distanceSq(pos));
|
||||
|
||||
editSession.setBlock(pos, BlockTypes.AIR.getDefaultState());
|
||||
}
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
}
|
||||
editSession.setBlock(x, y, z, BlockTypes.AIR.getDefaultState());
|
||||
}
|
||||
|
@ -26,6 +26,11 @@ 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;
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.registry.state.Property;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
@ -45,7 +50,12 @@ public class BlockDataCyler implements DoubleActionBlockTool {
|
||||
|
||||
World world = (World) clicked.getExtent();
|
||||
|
||||
<<<<<<< HEAD
|
||||
BlockStateHolder block = world.getBlock(clicked.toVector());
|
||||
=======
|
||||
BlockVector3 blockPoint = clicked.toVector().toBlockPoint();
|
||||
BlockState block = world.getBlock(blockPoint);
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
|
||||
if (!config.allowedDataCycleBlocks.isEmpty()
|
||||
&& !player.hasPermission("worldedit.override.data-cycler")
|
||||
@ -57,6 +67,7 @@ public class BlockDataCyler implements DoubleActionBlockTool {
|
||||
if (block.getBlockType().getProperties().isEmpty()) {
|
||||
player.printError("That block's data cannot be cycled!");
|
||||
} else {
|
||||
<<<<<<< HEAD
|
||||
BlockStateHolder newBlock = block;
|
||||
|
||||
// TODO Forward = cycle value, Backward = Next property
|
||||
@ -70,6 +81,40 @@ public class BlockDataCyler implements DoubleActionBlockTool {
|
||||
player.printError("Max blocks change limit reached.");
|
||||
} finally {
|
||||
session.remember(editSession);
|
||||
=======
|
||||
Property currentProperty = selectedProperties.get(player.getUniqueId());
|
||||
|
||||
if (currentProperty == null || (forward && block.getState(currentProperty) == null)) {
|
||||
currentProperty = block.getStates().keySet().stream().findFirst().get();
|
||||
selectedProperties.put(player.getUniqueId(), currentProperty);
|
||||
}
|
||||
|
||||
if (forward) {
|
||||
block.getState(currentProperty);
|
||||
int index = currentProperty.getValues().indexOf(block.getState(currentProperty));
|
||||
index = (index + 1) % currentProperty.getValues().size();
|
||||
BlockState newBlock = block.with(currentProperty, currentProperty.getValues().get(index));
|
||||
|
||||
try (EditSession editSession = session.createEditSession(player)) {
|
||||
editSession.disableBuffering();
|
||||
|
||||
try {
|
||||
editSession.setBlock(blockPoint, newBlock);
|
||||
player.print("Value of " + currentProperty.getName() + " is now " + currentProperty.getValues().get(index).toString());
|
||||
} catch (MaxChangedBlocksException e) {
|
||||
player.printError("Max blocks change limit reached.");
|
||||
} finally {
|
||||
session.remember(editSession);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
List<Property<?>> properties = Lists.newArrayList(block.getStates().keySet());
|
||||
int index = properties.indexOf(currentProperty);
|
||||
index = (index + 1) % properties.size();
|
||||
currentProperty = properties.get(index);
|
||||
selectedProperties.put(player.getUniqueId(), currentProperty);
|
||||
player.print("Now cycling " + currentProperty.getName());
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -29,13 +29,13 @@ import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.LocalConfiguration;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
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.BlockStateHolder;
|
||||
|
||||
/**
|
||||
@ -58,10 +58,22 @@ public class BlockReplacer implements DoubleActionBlockTool {
|
||||
public boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session, com.sk89q.worldedit.util.Location clicked) {
|
||||
BlockBag bag = session.getBlockBag(player);
|
||||
|
||||
<<<<<<< HEAD
|
||||
EditSession editSession = session.createEditSession(player);
|
||||
|
||||
try {
|
||||
editSession.setBlock(clicked.toVector(), pattern);
|
||||
=======
|
||||
try (EditSession editSession = session.createEditSession(player)) {
|
||||
try {
|
||||
editSession.disableBuffering();
|
||||
BlockVector3 position = clicked.toVector().toBlockPoint();
|
||||
editSession.setBlock(position, pattern.apply(position));
|
||||
} catch (MaxChangedBlocksException ignored) {
|
||||
} finally {
|
||||
session.remember(editSession);
|
||||
}
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
} finally {
|
||||
if (bag != null) {
|
||||
bag.flushChanges();
|
||||
@ -75,9 +87,13 @@ public class BlockReplacer implements DoubleActionBlockTool {
|
||||
|
||||
@Override
|
||||
public boolean actSecondary(Platform server, LocalConfiguration config, Player player, LocalSession session, com.sk89q.worldedit.util.Location clicked) {
|
||||
<<<<<<< HEAD
|
||||
EditSession editSession = session.createEditSession(player);
|
||||
BlockStateHolder targetBlock = (editSession).getBlock(clicked.toVector());
|
||||
BlockType type = targetBlock.getBlockType();
|
||||
=======
|
||||
BlockStateHolder targetBlock = player.getWorld().getBlock(clicked.toVector().toBlockPoint());
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
|
||||
if (type != null) {
|
||||
this.pattern = targetBlock;
|
||||
|
@ -432,6 +432,7 @@ public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool
|
||||
});
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
public boolean act(BrushAction action, Platform server, LocalConfiguration config, Player player, LocalSession session) {
|
||||
switch (action) {
|
||||
case PRIMARY:
|
||||
@ -474,6 +475,14 @@ public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool
|
||||
MaskIntersection newMask = new MaskIntersection(existingMask);
|
||||
newMask.add(mask);
|
||||
editSession.setMask(newMask);
|
||||
=======
|
||||
try {
|
||||
brush.build(editSession, target.toVector().toBlockPoint(), material, size);
|
||||
} catch (MaxChangedBlocksException e) {
|
||||
player.printError("Max blocks change limit reached.");
|
||||
} finally {
|
||||
session.remember(editSession);
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
}
|
||||
}
|
||||
Mask sourceMask = current.getSourceMask();
|
||||
|
@ -24,6 +24,7 @@ import com.sk89q.worldedit.entity.Player;
|
||||
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.math.BlockVector3;
|
||||
import com.sk89q.worldedit.regions.RegionSelector;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
|
||||
@ -48,8 +49,9 @@ public class DistanceWand extends BrushTool implements DoubleActionTraceTool {
|
||||
if (target == null) return true;
|
||||
|
||||
RegionSelector selector = session.getRegionSelector(player.getWorld());
|
||||
if (selector.selectPrimary(target.toVector(), ActorSelectorLimits.forActor(player))) {
|
||||
selector.explainPrimarySelection(player, session, target.toVector());
|
||||
BlockVector3 blockPoint = target.toVector().toBlockPoint();
|
||||
if (selector.selectPrimary(blockPoint, ActorSelectorLimits.forActor(player))) {
|
||||
selector.explainPrimarySelection(player, session, blockPoint);
|
||||
}
|
||||
return true;
|
||||
|
||||
@ -65,8 +67,9 @@ public class DistanceWand extends BrushTool implements DoubleActionTraceTool {
|
||||
if (target == null) return true;
|
||||
|
||||
RegionSelector selector = session.getRegionSelector(player.getWorld());
|
||||
if (selector.selectSecondary(target.toVector(), ActorSelectorLimits.forActor(player))) {
|
||||
selector.explainSecondarySelection(player, session, target.toVector());
|
||||
BlockVector3 blockPoint = target.toVector().toBlockPoint();
|
||||
if (selector.selectSecondary(blockPoint, ActorSelectorLimits.forActor(player))) {
|
||||
selector.explainSecondarySelection(player, session, blockPoint);
|
||||
}
|
||||
return true;
|
||||
|
||||
|
@ -23,10 +23,10 @@ import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.LocalConfiguration;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
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.util.Direction;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
@ -69,13 +69,14 @@ public class FloatingTreeRemover implements BlockTool {
|
||||
Player player, LocalSession session, Location clicked) {
|
||||
|
||||
final World world = (World) clicked.getExtent();
|
||||
final BlockState state = world.getBlock(clicked.toVector());
|
||||
final BlockState state = world.getBlock(clicked.toVector().toBlockPoint());
|
||||
|
||||
if (!isTreeBlock(state.getBlockType())) {
|
||||
player.printError("That's not a tree.");
|
||||
return true;
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
final EditSession editSession = session.createEditSession(player);
|
||||
|
||||
try {
|
||||
@ -89,6 +90,21 @@ public class FloatingTreeRemover implements BlockTool {
|
||||
final BlockState otherState = editSession.getBlock(blockVector);
|
||||
if (isTreeBlock(otherState.getBlockType())) {
|
||||
editSession.setBlock(blockVector, BlockTypes.AIR.getDefaultState());
|
||||
=======
|
||||
try (EditSession editSession = session.createEditSession(player)) {
|
||||
try {
|
||||
final Set<BlockVector3> blockSet = bfs(world, clicked.toVector().toBlockPoint());
|
||||
if (blockSet == null) {
|
||||
player.printError("That's not a floating tree.");
|
||||
return true;
|
||||
}
|
||||
|
||||
for (BlockVector3 blockVector : blockSet) {
|
||||
final BlockState otherState = editSession.getBlock(blockVector);
|
||||
if (isTreeBlock(otherState.getBlockType())) {
|
||||
editSession.setBlock(blockVector, BlockTypes.AIR.getDefaultState());
|
||||
}
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
}
|
||||
}
|
||||
} catch (MaxChangedBlocksException e) {
|
||||
@ -100,13 +116,13 @@ public class FloatingTreeRemover implements BlockTool {
|
||||
return true;
|
||||
}
|
||||
|
||||
private Vector[] recurseDirections = {
|
||||
Direction.NORTH.toVector(),
|
||||
Direction.EAST.toVector(),
|
||||
Direction.SOUTH.toVector(),
|
||||
Direction.WEST.toVector(),
|
||||
Direction.UP.toVector(),
|
||||
Direction.DOWN.toVector(),
|
||||
private BlockVector3[] recurseDirections = {
|
||||
Direction.NORTH.toBlockVector(),
|
||||
Direction.EAST.toBlockVector(),
|
||||
Direction.SOUTH.toBlockVector(),
|
||||
Direction.WEST.toBlockVector(),
|
||||
Direction.UP.toBlockVector(),
|
||||
Direction.DOWN.toBlockVector(),
|
||||
};
|
||||
|
||||
/**
|
||||
@ -116,17 +132,17 @@ public class FloatingTreeRemover implements BlockTool {
|
||||
* @param origin any point contained in the floating tree
|
||||
* @return a set containing all blocks in the tree/shroom or null if this is not a floating tree/shroom.
|
||||
*/
|
||||
private Set<Vector> bfs(World world, Vector origin) throws MaxChangedBlocksException {
|
||||
final Set<Vector> visited = new HashSet<>();
|
||||
final LinkedList<Vector> queue = new LinkedList<>();
|
||||
private Set<BlockVector3> bfs(World world, BlockVector3 origin) throws MaxChangedBlocksException {
|
||||
final Set<BlockVector3> visited = new HashSet<>();
|
||||
final LinkedList<BlockVector3> queue = new LinkedList<>();
|
||||
|
||||
queue.addLast(origin);
|
||||
visited.add(origin);
|
||||
|
||||
while (!queue.isEmpty()) {
|
||||
final Vector current = queue.removeFirst();
|
||||
for (Vector recurseDirection : recurseDirections) {
|
||||
final Vector next = current.add(recurseDirection);
|
||||
final BlockVector3 current = queue.removeFirst();
|
||||
for (BlockVector3 recurseDirection : recurseDirections) {
|
||||
final BlockVector3 next = current.add(recurseDirection);
|
||||
if (origin.distanceSq(next) > rangeSq) {
|
||||
// Maximum range exceeded => stop walking
|
||||
continue;
|
||||
|
@ -19,11 +19,19 @@
|
||||
|
||||
package com.sk89q.worldedit.command.tool;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import com.sk89q.worldedit.*;
|
||||
=======
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.LocalConfiguration;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.extension.platform.Platform;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldedit.world.block.BlockType;
|
||||
@ -54,7 +62,12 @@ public class FloodFillTool implements BlockTool {
|
||||
public boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session, Location clicked) {
|
||||
World world = (World) clicked.getExtent();
|
||||
|
||||
<<<<<<< HEAD
|
||||
BlockType initialType = world.getBlockType(clicked.toVector());
|
||||
=======
|
||||
BlockVector3 origin = clicked.toVector().toBlockPoint();
|
||||
BlockType initialType = world.getBlock(origin).getBlockType();
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
|
||||
if (initialType.getMaterial().isAir()) {
|
||||
return true;
|
||||
@ -64,7 +77,19 @@ public class FloodFillTool implements BlockTool {
|
||||
return true;
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
EditSession editSession = session.createEditSession(player);
|
||||
=======
|
||||
try (EditSession editSession = session.createEditSession(player)) {
|
||||
try {
|
||||
recurse(editSession, origin, origin, range, initialType, new HashSet<>());
|
||||
} catch (MaxChangedBlocksException e) {
|
||||
player.printError("Max blocks change limit reached.");
|
||||
} finally {
|
||||
session.remember(editSession);
|
||||
}
|
||||
}
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
|
||||
try {
|
||||
recurse(editSession, clicked.toVector().toBlockVector(),
|
||||
@ -77,8 +102,13 @@ public class FloodFillTool implements BlockTool {
|
||||
return true;
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
private void recurse(EditSession editSession, BlockVector pos, Vector origin, int size, BlockType initialType,
|
||||
Set<BlockVector> visited) throws WorldEditException {
|
||||
=======
|
||||
private void recurse(EditSession editSession, BlockVector3 pos, BlockVector3 origin, int size, BlockType initialType,
|
||||
Set<BlockVector3> visited) throws MaxChangedBlocksException {
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
|
||||
if (origin.distance(pos) > size || visited.contains(pos)) {
|
||||
return;
|
||||
@ -92,17 +122,17 @@ public class FloodFillTool implements BlockTool {
|
||||
return;
|
||||
}
|
||||
|
||||
recurse(editSession, pos.add(1, 0, 0).toBlockVector(),
|
||||
recurse(editSession, pos.add(1, 0, 0),
|
||||
origin, size, initialType, visited);
|
||||
recurse(editSession, pos.add(-1, 0, 0).toBlockVector(),
|
||||
recurse(editSession, pos.add(-1, 0, 0),
|
||||
origin, size, initialType, visited);
|
||||
recurse(editSession, pos.add(0, 0, 1).toBlockVector(),
|
||||
recurse(editSession, pos.add(0, 0, 1),
|
||||
origin, size, initialType, visited);
|
||||
recurse(editSession, pos.add(0, 0, -1).toBlockVector(),
|
||||
recurse(editSession, pos.add(0, 0, -1),
|
||||
origin, size, initialType, visited);
|
||||
recurse(editSession, pos.add(0, 1, 0).toBlockVector(),
|
||||
recurse(editSession, pos.add(0, 1, 0),
|
||||
origin, size, initialType, visited);
|
||||
recurse(editSession, pos.add(0, -1, 0).toBlockVector(),
|
||||
recurse(editSession, pos.add(0, -1, 0),
|
||||
origin, size, initialType, visited);
|
||||
}
|
||||
|
||||
|
@ -28,6 +28,7 @@ import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.extension.platform.Platform;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
@ -55,7 +56,24 @@ public class LongRangeBuildTool extends BrushTool implements DoubleActionTraceTo
|
||||
public boolean actSecondary(Platform server, LocalConfiguration config, Player player, LocalSession session) {
|
||||
Location pos = getTargetFace(player);
|
||||
if (pos == null) return false;
|
||||
<<<<<<< HEAD
|
||||
EditSession eS = session.createEditSession(player);
|
||||
=======
|
||||
try (EditSession eS = session.createEditSession(player)) {
|
||||
eS.disableBuffering();
|
||||
BlockVector3 blockPoint = pos.toVector().toBlockPoint();
|
||||
BlockStateHolder applied = secondary.apply(blockPoint);
|
||||
if (applied.getBlockType().getMaterial().isAir()) {
|
||||
eS.setBlock(blockPoint, secondary);
|
||||
} else {
|
||||
eS.setBlock(pos.getDirection().toBlockPoint(), secondary);
|
||||
}
|
||||
return true;
|
||||
} catch (MaxChangedBlocksException e) {
|
||||
// one block? eat it
|
||||
}
|
||||
return false;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
|
||||
BlockStateHolder applied = secondary.apply(pos.toVector());
|
||||
if (applied.getBlockType().getMaterial().isAir()) {
|
||||
@ -70,12 +88,27 @@ public class LongRangeBuildTool extends BrushTool implements DoubleActionTraceTo
|
||||
public boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session) {
|
||||
Location pos = getTargetFace(player);
|
||||
if (pos == null) return false;
|
||||
<<<<<<< HEAD
|
||||
EditSession eS = session.createEditSession(player);
|
||||
BlockStateHolder applied = primary.apply(pos.toVector());
|
||||
if (applied.getBlockType().getMaterial().isAir()) {
|
||||
eS.setBlock(pos.toVector(), primary);
|
||||
} else {
|
||||
eS.setBlock(pos.add(pos.getDirection()), primary);
|
||||
=======
|
||||
try (EditSession eS = session.createEditSession(player)) {
|
||||
eS.disableBuffering();
|
||||
BlockVector3 blockPoint = pos.toVector().toBlockPoint();
|
||||
BlockStateHolder applied = primary.apply(blockPoint);
|
||||
if (applied.getBlockType().getMaterial().isAir()) {
|
||||
eS.setBlock(blockPoint, primary);
|
||||
} else {
|
||||
eS.setBlock(pos.getDirection().toBlockPoint(), primary);
|
||||
}
|
||||
return true;
|
||||
} catch (MaxChangedBlocksException e) {
|
||||
// one block? eat it
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -27,6 +27,7 @@ import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
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;
|
||||
|
||||
/**
|
||||
@ -44,13 +45,14 @@ public class QueryTool implements BlockTool {
|
||||
|
||||
World world = (World) clicked.getExtent();
|
||||
EditSession editSession = session.createEditSession(player);
|
||||
BlockStateHolder block = editSession.getFullBlock(clicked.toVector());
|
||||
BlockVector3 blockPoint = clicked.toVector().toBlockPoint();
|
||||
BlockStateHolder block = editSession.getFullBlock(blockPoint);
|
||||
|
||||
player.print("\u00A79@" + clicked.toVector() + ": " + "\u00A7e"
|
||||
+ block.getBlockType().getName() + "\u00A77" + " ("
|
||||
+ block.toString() + ") "
|
||||
+ "\u00A7f"
|
||||
+ " (" + world.getBlockLightLevel(clicked.toVector()) + "/" + world.getBlockLightLevel(clicked.toVector().add(0, 1, 0)) + ")");
|
||||
+ " (" + world.getBlockLightLevel(blockPoint) + "/" + world.getBlockLightLevel(blockPoint.add(0, 1, 0)) + ")");
|
||||
|
||||
if (block instanceof MobSpawnerBlock) {
|
||||
player.printRaw("\u00A7e" + "Mob Type: "
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.sk89q.worldedit.command.tool;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import com.boydti.fawe.object.mask.IdMask;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.LocalConfiguration;
|
||||
@ -12,6 +13,16 @@ 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;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
@ -37,7 +48,12 @@ public class RecursivePickaxe implements BlockTool {
|
||||
World world = (World) clicked.getExtent();
|
||||
final Vector pos = clicked.toVector();
|
||||
|
||||
<<<<<<< HEAD
|
||||
EditSession editSession = session.createEditSession(player);
|
||||
=======
|
||||
BlockVector3 origin = clicked.toVector().toBlockPoint();
|
||||
BlockType initialType = world.getBlock(origin).getBlockType();
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
|
||||
BlockStateHolder block = editSession.getBlock(pos);
|
||||
if (block.getBlockType().getMaterial().isAir()) {
|
||||
@ -50,6 +66,7 @@ public class RecursivePickaxe implements BlockTool {
|
||||
|
||||
editSession.getSurvivalExtent().setToolUse(config.superPickaxeManyDrop);
|
||||
|
||||
<<<<<<< HEAD
|
||||
final int radius = (int) range;
|
||||
final BlockReplace replace = new BlockReplace(editSession, (editSession.nullBlock));
|
||||
editSession.setMask((Mask) null);
|
||||
@ -59,9 +76,54 @@ public class RecursivePickaxe implements BlockTool {
|
||||
|
||||
editSession.flushQueue();
|
||||
session.remember(editSession);
|
||||
=======
|
||||
try {
|
||||
recurse(server, editSession, world, clicked.toVector().toBlockPoint(),
|
||||
clicked.toVector().toBlockPoint(), range, initialType, new HashSet<>());
|
||||
} catch (MaxChangedBlocksException e) {
|
||||
player.printError("Max blocks change limit reached.");
|
||||
} finally {
|
||||
session.remember(editSession);
|
||||
}
|
||||
}
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
private static void recurse(Platform server, EditSession editSession, World world, BlockVector3 pos,
|
||||
BlockVector3 origin, double size, BlockType initialType, Set<BlockVector3> visited) throws MaxChangedBlocksException {
|
||||
|
||||
final double distanceSq = origin.distanceSq(pos);
|
||||
if (distanceSq > size*size || visited.contains(pos)) {
|
||||
return;
|
||||
}
|
||||
|
||||
visited.add(pos);
|
||||
|
||||
if (editSession.getBlock(pos).getBlockType() != initialType) {
|
||||
return;
|
||||
}
|
||||
|
||||
world.queueBlockBreakEffect(server, pos, initialType, distanceSq);
|
||||
|
||||
editSession.setBlock(pos, BlockTypes.AIR.getDefaultState());
|
||||
|
||||
recurse(server, editSession, world, pos.add(1, 0, 0),
|
||||
origin, size, initialType, visited);
|
||||
recurse(server, editSession, world, pos.add(-1, 0, 0),
|
||||
origin, size, initialType, visited);
|
||||
recurse(server, editSession, world, pos.add(0, 0, 1),
|
||||
origin, size, initialType, visited);
|
||||
recurse(server, editSession, world, pos.add(0, 0, -1),
|
||||
origin, size, initialType, visited);
|
||||
recurse(server, editSession, world, pos.add(0, 1, 0),
|
||||
origin, size, initialType, visited);
|
||||
recurse(server, editSession, world, pos.add(0, -1, 0),
|
||||
origin, size, initialType, visited);
|
||||
}
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
|
||||
}
|
@ -25,6 +25,7 @@ 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.math.BlockVector3;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldedit.world.block.BlockType;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
@ -42,6 +43,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();
|
||||
<<<<<<< HEAD
|
||||
final BlockType blockType = world.getLazyBlock(clicked.toVector()).getBlockType();
|
||||
if (blockType == BlockTypes.BEDROCK && !player.canDestroyBedrock()) {
|
||||
return true;
|
||||
@ -49,6 +51,21 @@ public class SinglePickaxe implements BlockTool {
|
||||
|
||||
EditSession editSession = session.createEditSession(player);
|
||||
editSession.getSurvivalExtent().setToolUse(config.superPickaxeDrop);
|
||||
=======
|
||||
BlockVector3 blockPoint = clicked.toVector().toBlockPoint();
|
||||
final BlockType blockType = world.getBlock(blockPoint).getBlockType();
|
||||
if (blockType == BlockTypes.BEDROCK
|
||||
&& !player.canDestroyBedrock()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
try (EditSession editSession = session.createEditSession(player)) {
|
||||
editSession.getSurvivalExtent().setToolUse(config.superPickaxeDrop);
|
||||
editSession.setBlock(blockPoint, BlockTypes.AIR.getDefaultState());
|
||||
} catch (MaxChangedBlocksException e) {
|
||||
player.printError("Max blocks change limit reached.");
|
||||
}
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
|
||||
try {
|
||||
if (editSession.setBlock(clicked.getBlockX(), clicked.getBlockY(), clicked.getBlockZ(), EditSession.nullBlock)) {
|
||||
|
@ -50,6 +50,7 @@ public class TreePlanter implements BlockTool {
|
||||
|
||||
EditSession editSession = session.createEditSession(player);
|
||||
|
||||
<<<<<<< HEAD
|
||||
try {
|
||||
boolean successful = false;
|
||||
|
||||
@ -57,6 +58,13 @@ public class TreePlanter implements BlockTool {
|
||||
if (treeType.generate(editSession, clicked.toVector().add(0, 1, 0))) {
|
||||
successful = true;
|
||||
break;
|
||||
=======
|
||||
for (int i = 0; i < 10; i++) {
|
||||
if (treeType.generate(editSession, clicked.toVector().add(0, 1, 0).toBlockPoint())) {
|
||||
successful = true;
|
||||
break;
|
||||
}
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -21,9 +21,8 @@ package com.sk89q.worldedit.command.tool.brush;
|
||||
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
|
||||
/**
|
||||
* A brush is a long-range build tool.
|
||||
@ -39,6 +38,6 @@ public interface Brush {
|
||||
* @param size the size of the brush
|
||||
* @throws MaxChangedBlocksException
|
||||
*/
|
||||
void build(EditSession editSession, Vector position, Pattern pattern, double size) throws WorldEditException;
|
||||
void build(EditSession editSession, BlockVector3 position, Pattern pattern, double size) throws MaxChangedBlocksException;
|
||||
|
||||
}
|
||||
|
@ -21,12 +21,12 @@ package com.sk89q.worldedit.command.tool.brush;
|
||||
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.command.util.CreatureButcher;
|
||||
import com.sk89q.worldedit.entity.Entity;
|
||||
import com.sk89q.worldedit.function.operation.Operations;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.function.visitor.EntityVisitor;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.regions.CylinderRegion;
|
||||
|
||||
import java.util.List;
|
||||
@ -40,7 +40,7 @@ public class ButcherBrush implements Brush {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void build(EditSession editSession, Vector position, Pattern pattern, double size) throws MaxChangedBlocksException {
|
||||
public void build(EditSession editSession, BlockVector3 position, Pattern pattern, double size) throws MaxChangedBlocksException {
|
||||
CylinderRegion region = CylinderRegion.createRadius(editSession, position, size);
|
||||
List<? extends Entity> entities = editSession.getEntities(region);
|
||||
Operations.completeLegacy(new EntityVisitor(entities.iterator(), flags.createFunction()));
|
||||
|
@ -21,11 +21,11 @@ package com.sk89q.worldedit.command.tool.brush;
|
||||
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||
import com.sk89q.worldedit.function.operation.Operation;
|
||||
import com.sk89q.worldedit.function.operation.Operations;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
import com.sk89q.worldedit.session.ClipboardHolder;
|
||||
|
||||
@ -42,10 +42,10 @@ public class ClipboardBrush implements Brush {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void build(EditSession editSession, Vector position, Pattern pattern, double size) throws MaxChangedBlocksException {
|
||||
public void build(EditSession editSession, BlockVector3 position, Pattern pattern, double size) throws MaxChangedBlocksException {
|
||||
Clipboard clipboard = holder.getClipboard();
|
||||
Region region = clipboard.getRegion();
|
||||
Vector centerOffset = region.getCenter().subtract(clipboard.getOrigin());
|
||||
BlockVector3 centerOffset = region.getCenter().toBlockPoint().subtract(clipboard.getOrigin());
|
||||
|
||||
Operation operation = holder
|
||||
.createPaste(editSession)
|
||||
|
@ -21,10 +21,10 @@ package com.sk89q.worldedit.command.tool.brush;
|
||||
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
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.BlockTypes;
|
||||
|
||||
public class CylinderBrush implements Brush {
|
||||
|
||||
@ -35,7 +35,7 @@ public class CylinderBrush implements Brush {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void build(EditSession editSession, Vector position, Pattern pattern, double size) throws MaxChangedBlocksException {
|
||||
public void build(EditSession editSession, BlockVector3 position, Pattern pattern, double size) throws MaxChangedBlocksException {
|
||||
if (pattern == null) {
|
||||
pattern = new BlockPattern(BlockTypes.COBBLESTONE.getDefaultState());
|
||||
}
|
||||
|
@ -21,12 +21,12 @@ package com.sk89q.worldedit.command.tool.brush;
|
||||
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.function.mask.Mask;
|
||||
import com.sk89q.worldedit.function.mask.Masks;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
|
||||
public class GravityBrush implements Brush {
|
||||
@ -38,7 +38,7 @@ public class GravityBrush implements Brush {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void build(EditSession editSession, Vector position, Pattern pattern, double sizeDouble) throws MaxChangedBlocksException {
|
||||
public void build(EditSession editSession, BlockVector3 position, Pattern pattern, double sizeDouble) throws MaxChangedBlocksException {
|
||||
Mask mask = editSession.getMask();
|
||||
if (mask == Masks.alwaysTrue() || mask == Masks.alwaysTrue2D()) {
|
||||
mask = null;
|
||||
@ -47,12 +47,23 @@ public class GravityBrush implements Brush {
|
||||
int endY = position.getBlockY() + size;
|
||||
int startPerformY = Math.max(0, position.getBlockY() - size);
|
||||
int startCheckY = fullHeight ? 0 : startPerformY;
|
||||
Vector mutablePos = new Vector(0, 0, 0);
|
||||
// Vector mutablePos = new Vector(0, 0, 0);
|
||||
for (int x = position.getBlockX() + size; x > position.getBlockX() - size; --x) {
|
||||
for (int z = position.getBlockZ() + size; z > position.getBlockZ() - size; --z) {
|
||||
int freeSpot = startCheckY;
|
||||
for (int y = startCheckY; y <= endY; y++) {
|
||||
BlockStateHolder block = editSession.getLazyBlock(x, y, z);
|
||||
//=======
|
||||
// public void build(EditSession editSession, BlockVector3 position, Pattern pattern, double size) throws MaxChangedBlocksException {
|
||||
// final double startY = fullHeight ? editSession.getWorld().getMaxY() : position.getBlockY() + size;
|
||||
// for (double x = position.getBlockX() + size; x > position.getBlockX() - size; --x) {
|
||||
// for (double z = position.getBlockZ() + size; z > position.getBlockZ() - size; --z) {
|
||||
// double y = startY;
|
||||
// final List<BlockStateHolder> blockTypes = new ArrayList<>();
|
||||
// for (; y > position.getBlockY() - size; --y) {
|
||||
// final BlockVector3 pt = new BlockVector3(x, y, z);
|
||||
// final BlockStateHolder block = editSession.getBlock(pt);
|
||||
//>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
if (!block.getBlockType().getMaterial().isAir()) {
|
||||
if (y != freeSpot) {
|
||||
editSession.setBlock(x, y, z, EditSession.nullBlock);
|
||||
@ -61,6 +72,17 @@ public class GravityBrush implements Brush {
|
||||
freeSpot = y + 1;
|
||||
}
|
||||
}
|
||||
//<<<<<<< HEAD
|
||||
//=======
|
||||
// BlockVector3 pt = new BlockVector3(x, y, z);
|
||||
// Collections.reverse(blockTypes);
|
||||
// for (int i = 0; i < blockTypes.size();) {
|
||||
// if (editSession.getBlock(pt).getBlockType().getMaterial().isAir()) {
|
||||
// editSession.setBlock(pt, blockTypes.get(i++));
|
||||
// }
|
||||
// pt = pt.add(0, 1, 0);
|
||||
// }
|
||||
//>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -21,12 +21,10 @@ package com.sk89q.worldedit.command.tool.brush;
|
||||
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
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.BlockTypes;
|
||||
|
||||
public class HollowCylinderBrush implements Brush {
|
||||
|
||||
@ -37,7 +35,7 @@ public class HollowCylinderBrush implements Brush {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void build(EditSession editSession, Vector position, Pattern pattern, double size) throws MaxChangedBlocksException {
|
||||
public void build(EditSession editSession, BlockVector3 position, Pattern pattern, double size) throws MaxChangedBlocksException {
|
||||
if (pattern == null) {
|
||||
pattern = BlockTypes.COBBLESTONE.getDefaultState();
|
||||
}
|
||||
|
@ -21,17 +21,15 @@ package com.sk89q.worldedit.command.tool.brush;
|
||||
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
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.BlockTypes;
|
||||
|
||||
public class HollowSphereBrush implements Brush {
|
||||
|
||||
@Override
|
||||
public void build(EditSession editSession, Vector position, Pattern pattern, double size) throws MaxChangedBlocksException {
|
||||
public void build(EditSession editSession, BlockVector3 position, Pattern pattern, double size) throws MaxChangedBlocksException {
|
||||
if (pattern == null) {
|
||||
pattern = BlockTypes.COBBLESTONE.getDefaultState();
|
||||
}
|
||||
|
@ -21,12 +21,12 @@ package com.sk89q.worldedit.command.tool.brush;
|
||||
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.function.Contextual;
|
||||
import com.sk89q.worldedit.function.EditContext;
|
||||
import com.sk89q.worldedit.function.operation.Operation;
|
||||
import com.sk89q.worldedit.function.operation.Operations;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.regions.factory.RegionFactory;
|
||||
|
||||
public class OperationFactoryBrush implements Brush {
|
||||
@ -40,7 +40,7 @@ public class OperationFactoryBrush implements Brush {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void build(EditSession editSession, Vector position, Pattern pattern, double size) throws MaxChangedBlocksException {
|
||||
public void build(EditSession editSession, BlockVector3 position, Pattern pattern, double size) throws MaxChangedBlocksException {
|
||||
EditContext context = new EditContext();
|
||||
context.setDestination(editSession);
|
||||
context.setRegion(regionFactory.createCenteredAt(position, size));
|
||||
|
@ -23,7 +23,9 @@ import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.math.convolution.HeightMap;
|
||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.math.Vector3;
|
||||
import com.sk89q.worldedit.math.convolution.GaussianKernel;
|
||||
import com.sk89q.worldedit.math.convolution.HeightMapFilter;
|
||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||
@ -39,10 +41,11 @@ public class SmoothBrush implements Brush {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void build(EditSession editSession, Vector position, Pattern pattern, double size) throws MaxChangedBlocksException {
|
||||
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.toVector(), max);
|
||||
public void build(EditSession editSession, BlockVector3 position, Pattern pattern, double size) throws MaxChangedBlocksException {
|
||||
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);
|
||||
HeightMap heightMap = new HeightMap(editSession, region);
|
||||
HeightMapFilter filter = new HeightMapFilter(new GaussianKernel(5, 1.0));
|
||||
heightMap.applyFilter(filter, iterations);
|
||||
|
@ -21,17 +21,16 @@ package com.sk89q.worldedit.command.tool.brush;
|
||||
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
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.BlockTypes;
|
||||
|
||||
public class SphereBrush implements Brush {
|
||||
|
||||
@Override
|
||||
public void build(EditSession editSession, Vector position, Pattern pattern, double size) throws MaxChangedBlocksException {
|
||||
public void build(EditSession editSession, BlockVector3 position, Pattern pattern, double size) throws MaxChangedBlocksException {
|
||||
if (pattern == null) {
|
||||
pattern = new BlockPattern(new BaseBlock(BlockTypes.COBBLESTONE));
|
||||
}
|
||||
|
Reference in New Issue
Block a user