Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-12-25 02:20:07 +01:00
Added more brush shapes.
Dieser Commit ist enthalten in:
Ursprung
5fb442c7c5
Commit
11b00e1165
22
plugin.yml
22
plugin.yml
@ -2,6 +2,18 @@ name: WorldEdit
|
|||||||
main: com.sk89q.worldedit.bukkit.WorldEditPlugin
|
main: com.sk89q.worldedit.bukkit.WorldEditPlugin
|
||||||
version: "WEVERSIONMACRO"
|
version: "WEVERSIONMACRO"
|
||||||
commands:
|
commands:
|
||||||
|
/sb:
|
||||||
|
description: Choose the sphere brush
|
||||||
|
usage: /<command> [-h] <block> [radius]
|
||||||
|
aliases: ['/sphereb']
|
||||||
|
/cb:
|
||||||
|
description: Choose the cylinder brush
|
||||||
|
usage: /<command> [-h] <block> [radius] [height]
|
||||||
|
aliases: ['/cylb']
|
||||||
|
/cbb:
|
||||||
|
description: Choose the clipboard brush
|
||||||
|
usage: /<command> [-a]
|
||||||
|
aliases: ['/copyb']
|
||||||
chunkinfo:
|
chunkinfo:
|
||||||
description: Get information about the chunk that you are inside
|
description: Get information about the chunk that you are inside
|
||||||
usage: /<command>
|
usage: /<command>
|
||||||
@ -197,12 +209,12 @@ commands:
|
|||||||
cycler:
|
cycler:
|
||||||
description: Block data cycler tool
|
description: Block data cycler tool
|
||||||
usage: /<command>
|
usage: /<command>
|
||||||
brush:
|
/brush:
|
||||||
description: Build spheres from far away
|
description: Build from far away
|
||||||
usage: /<command> <block> [radius] [no-replace?]
|
usage: /<command> [-r]
|
||||||
rbrush:
|
/rbrush:
|
||||||
description: Brush tool that will only replace blocks
|
description: Brush tool that will only replace blocks
|
||||||
usage: /<command> <block> [radius]
|
usage: /<command>
|
||||||
recur:
|
recur:
|
||||||
description: Enable the recursive super pickaxe pickaxe mode
|
description: Enable the recursive super pickaxe pickaxe mode
|
||||||
usage: /<command> <radius>
|
usage: /<command> <radius>
|
||||||
|
@ -267,6 +267,15 @@ public class CuboidClipboard {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the size of the copy.
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Vector getSize() {
|
||||||
|
return size;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Saves the clipboard data to a .schematic-format file.
|
* Saves the clipboard data to a .schematic-format file.
|
||||||
|
@ -23,6 +23,7 @@ import java.util.LinkedList;
|
|||||||
import com.sk89q.worldedit.snapshots.Snapshot;
|
import com.sk89q.worldedit.snapshots.Snapshot;
|
||||||
import com.sk89q.worldedit.superpickaxe.SinglePickaxe;
|
import com.sk89q.worldedit.superpickaxe.SinglePickaxe;
|
||||||
import com.sk89q.worldedit.superpickaxe.SuperPickaxeMode;
|
import com.sk89q.worldedit.superpickaxe.SuperPickaxeMode;
|
||||||
|
import com.sk89q.worldedit.superpickaxe.brushes.BrushShape;
|
||||||
import com.sk89q.worldedit.bags.BlockBag;
|
import com.sk89q.worldedit.bags.BlockBag;
|
||||||
import com.sk89q.worldedit.regions.Region;
|
import com.sk89q.worldedit.regions.Region;
|
||||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||||
@ -55,6 +56,7 @@ public class LocalSession {
|
|||||||
private Snapshot snapshot;
|
private Snapshot snapshot;
|
||||||
private String lastScript;
|
private String lastScript;
|
||||||
private CompassMode compassMode = CompassMode.JUMPTO;
|
private CompassMode compassMode = CompassMode.JUMPTO;
|
||||||
|
private BrushShape brushShape = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clear history.
|
* Clear history.
|
||||||
@ -447,4 +449,18 @@ public class LocalSession {
|
|||||||
public void setCompassMode(CompassMode compassMode) {
|
public void setCompassMode(CompassMode compassMode) {
|
||||||
this.compassMode = compassMode;
|
this.compassMode = compassMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the brushShape
|
||||||
|
*/
|
||||||
|
public BrushShape getBrushShape() {
|
||||||
|
return brushShape;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param brushShape the brushShape to set
|
||||||
|
*/
|
||||||
|
public void setBrushShape(BrushShape brushShape) {
|
||||||
|
this.brushShape = brushShape;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -97,6 +97,7 @@ public class WorldEdit {
|
|||||||
commands.register(SelectionCommands.class);
|
commands.register(SelectionCommands.class);
|
||||||
commands.register(SnapshotCommands.class);
|
commands.register(SnapshotCommands.class);
|
||||||
commands.register(SuperPickaxeCommands.class);
|
commands.register(SuperPickaxeCommands.class);
|
||||||
|
commands.register(BrushShapeCommands.class);
|
||||||
commands.register(UtilityCommands.class);
|
commands.register(UtilityCommands.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
154
src/com/sk89q/worldedit/commands/BrushShapeCommands.java
Normale Datei
154
src/com/sk89q/worldedit/commands/BrushShapeCommands.java
Normale Datei
@ -0,0 +1,154 @@
|
|||||||
|
// $Id$
|
||||||
|
/*
|
||||||
|
* WorldEdit
|
||||||
|
* Copyright (C) 2010, 2011 sk89q <http://www.sk89q.com>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.sk89q.worldedit.commands;
|
||||||
|
|
||||||
|
import com.sk89q.util.commands.Command;
|
||||||
|
import com.sk89q.util.commands.CommandContext;
|
||||||
|
import com.sk89q.worldedit.CuboidClipboard;
|
||||||
|
import com.sk89q.worldedit.EditSession;
|
||||||
|
import com.sk89q.worldedit.LocalConfiguration;
|
||||||
|
import com.sk89q.worldedit.LocalPlayer;
|
||||||
|
import com.sk89q.worldedit.LocalSession;
|
||||||
|
import com.sk89q.worldedit.Vector;
|
||||||
|
import com.sk89q.worldedit.WorldEdit;
|
||||||
|
import com.sk89q.worldedit.WorldEditException;
|
||||||
|
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||||
|
import com.sk89q.worldedit.superpickaxe.brushes.ClipboardBrushShape;
|
||||||
|
import com.sk89q.worldedit.superpickaxe.brushes.CylinderBrushShape;
|
||||||
|
import com.sk89q.worldedit.superpickaxe.brushes.HollowCylinderBrushShape;
|
||||||
|
import com.sk89q.worldedit.superpickaxe.brushes.SphereBrushShape;
|
||||||
|
import com.sk89q.worldedit.superpickaxe.brushes.HollowSphereBrushShape;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Brush shape commands.
|
||||||
|
*
|
||||||
|
* @author sk89q
|
||||||
|
*/
|
||||||
|
public class BrushShapeCommands {
|
||||||
|
@Command(
|
||||||
|
aliases = {"/sb", "/sphereb"},
|
||||||
|
usage = "<block> [radius]",
|
||||||
|
flags = "h",
|
||||||
|
desc = "Choose the sphere brush",
|
||||||
|
min = 1,
|
||||||
|
max = 2
|
||||||
|
)
|
||||||
|
@CommandPermissions({"worldedit.superpickaxe.drawing.brush.sphere"})
|
||||||
|
public static void sphereBrush(CommandContext args, WorldEdit we,
|
||||||
|
LocalSession session, LocalPlayer player, EditSession editSession)
|
||||||
|
throws WorldEditException {
|
||||||
|
|
||||||
|
LocalConfiguration config = we.getConfiguration();
|
||||||
|
|
||||||
|
int radius = args.argsLength() > 1 ? args.getInteger(1) : 2;
|
||||||
|
if (radius > config.maxBrushRadius) {
|
||||||
|
player.printError("Maximum allowed brush radius: "
|
||||||
|
+ config.maxBrushRadius);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
BaseBlock targetBlock = we.getBlock(player, args.getString(0));
|
||||||
|
|
||||||
|
if (args.hasFlag('h')) {
|
||||||
|
session.setBrushShape(new HollowSphereBrushShape(targetBlock, radius));
|
||||||
|
} else {
|
||||||
|
session.setBrushShape(new SphereBrushShape(targetBlock, radius));
|
||||||
|
}
|
||||||
|
|
||||||
|
player.print("Sphere brush shape equipped.");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Command(
|
||||||
|
aliases = {"/cb", "/cylb"},
|
||||||
|
usage = "<block> [radius] [height]",
|
||||||
|
flags = "h",
|
||||||
|
desc = "Choose the cylinder brush",
|
||||||
|
min = 1,
|
||||||
|
max = 2
|
||||||
|
)
|
||||||
|
@CommandPermissions({"worldedit.superpickaxe.drawing.brush.cylinder"})
|
||||||
|
public static void cylinderBrush(CommandContext args, WorldEdit we,
|
||||||
|
LocalSession session, LocalPlayer player, EditSession editSession)
|
||||||
|
throws WorldEditException {
|
||||||
|
|
||||||
|
LocalConfiguration config = we.getConfiguration();
|
||||||
|
|
||||||
|
int radius = args.argsLength() > 1 ? args.getInteger(1) : 2;
|
||||||
|
if (radius > config.maxBrushRadius) {
|
||||||
|
player.printError("Maximum allowed brush radius: "
|
||||||
|
+ config.maxBrushRadius);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int height = args.argsLength() > 1 ? args.getInteger(1) : 1;
|
||||||
|
if (height > config.maxBrushRadius) {
|
||||||
|
player.printError("Maximum allowed brush radius/height: "
|
||||||
|
+ config.maxBrushRadius);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
BaseBlock targetBlock = we.getBlock(player, args.getString(0));
|
||||||
|
|
||||||
|
if (args.hasFlag('h')) {
|
||||||
|
session.setBrushShape(new HollowCylinderBrushShape(targetBlock, radius, height));
|
||||||
|
} else {
|
||||||
|
session.setBrushShape(new CylinderBrushShape(targetBlock, radius, height));
|
||||||
|
}
|
||||||
|
|
||||||
|
player.print("Cylinder brush shape equipped.");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Command(
|
||||||
|
aliases = {"/cbb", "/copyb"},
|
||||||
|
usage = "",
|
||||||
|
flags = "a",
|
||||||
|
desc = "Choose the clipboard brush",
|
||||||
|
min = 0,
|
||||||
|
max = 0
|
||||||
|
)
|
||||||
|
@CommandPermissions({"worldedit.superpickaxe.drawing.brush.clipboard"})
|
||||||
|
public static void clipboardBrush(CommandContext args, WorldEdit we,
|
||||||
|
LocalSession session, LocalPlayer player, EditSession editSession)
|
||||||
|
throws WorldEditException {
|
||||||
|
|
||||||
|
LocalConfiguration config = we.getConfiguration();
|
||||||
|
|
||||||
|
CuboidClipboard clipboard = session.getClipboard();
|
||||||
|
|
||||||
|
if (clipboard == null) {
|
||||||
|
player.printError("Copy something first.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Vector size = clipboard.getSize();
|
||||||
|
|
||||||
|
if (size.getBlockX() > config.maxBrushRadius
|
||||||
|
|| size.getBlockY() > config.maxBrushRadius
|
||||||
|
|| size.getBlockZ() > config.maxBrushRadius) {
|
||||||
|
player.printError("Maximum allowed brush radius/height: "
|
||||||
|
+ config.maxBrushRadius);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
session.setBrushShape(new ClipboardBrushShape(clipboard, args.hasFlag('a')));
|
||||||
|
|
||||||
|
player.print("Clipboard brush shape equipped.");
|
||||||
|
}
|
||||||
|
}
|
@ -237,61 +237,43 @@ public class SuperPickaxeCommands {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Command(
|
@Command(
|
||||||
aliases = {"brush"},
|
aliases = {"/brush"},
|
||||||
usage = "<block> [radius] [no-replace?]",
|
usage = "",
|
||||||
desc = "Build spheres from far away",
|
flags = "r",
|
||||||
min = 1,
|
desc = "Build from far away",
|
||||||
max = 3
|
min = 0,
|
||||||
|
max = 0
|
||||||
)
|
)
|
||||||
@CommandPermissions({"worldedit.superpickaxe.drawing.brush"})
|
@CommandPermissions({"worldedit.superpickaxe.drawing.brush"})
|
||||||
public static void brush(CommandContext args, WorldEdit we,
|
public static void brush(CommandContext args, WorldEdit we,
|
||||||
LocalSession session, LocalPlayer player, EditSession editSession)
|
LocalSession session, LocalPlayer player, EditSession editSession)
|
||||||
throws WorldEditException {
|
throws WorldEditException {
|
||||||
|
|
||||||
LocalConfiguration config = we.getConfiguration();
|
boolean nonReplacing = args.hasFlag('r');
|
||||||
|
|
||||||
int radius = args.argsLength() > 1 ? args.getInteger(1) : 2;
|
|
||||||
boolean nonReplacing = args.argsLength() > 2
|
|
||||||
? (args.getString(2).equalsIgnoreCase("true")
|
|
||||||
|| args.getString(2).equalsIgnoreCase("yes")) : false;
|
|
||||||
if (radius > config.maxBrushRadius) {
|
|
||||||
player.printError("Maximum allowed brush radius: "
|
|
||||||
+ config.maxBrushRadius);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
BaseBlock targetBlock = we.getBlock(player, args.getString(0));
|
|
||||||
session.setRightClickMode(null);
|
session.setRightClickMode(null);
|
||||||
session.setArmSwingMode(new SphereBrush(targetBlock, radius, nonReplacing));
|
session.setArmSwingMode(new Brush(nonReplacing));
|
||||||
if (nonReplacing) {
|
if (nonReplacing) {
|
||||||
player.print("Non-replacing sphere brush tool equipped.");
|
player.print("Non-replacing brush tool equipped.");
|
||||||
} else {
|
} else {
|
||||||
player.print("Sphere brush tool equipped. Swing with a pickaxe.");
|
player.print("Brush tool equipped. Swing with a pickaxe.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Command(
|
@Command(
|
||||||
aliases = {"rbrush"},
|
aliases = {"/rbrush"},
|
||||||
usage = "<block> [radius] ",
|
usage = "",
|
||||||
desc = "Brush tool that will only replace blocks",
|
desc = "Brush tool that will only replace blocks",
|
||||||
min = 1,
|
min = 0,
|
||||||
max = 2
|
max = 0
|
||||||
)
|
)
|
||||||
@CommandPermissions({"worldedit.superpickaxe.drawing.brush"})
|
@CommandPermissions({"worldedit.superpickaxe.drawing.brush"})
|
||||||
public static void rbrush(CommandContext args, WorldEdit we,
|
public static void rbrush(CommandContext args, WorldEdit we,
|
||||||
LocalSession session, LocalPlayer player, EditSession editSession)
|
LocalSession session, LocalPlayer player, EditSession editSession)
|
||||||
throws WorldEditException {
|
throws WorldEditException {
|
||||||
|
|
||||||
LocalConfiguration config = we.getConfiguration();
|
|
||||||
|
|
||||||
int radius = args.argsLength() > 1 ? args.getInteger(1) : 2;
|
|
||||||
if (radius > config.maxBrushRadius) {
|
|
||||||
player.printError("Maximum allowed brush radius: "
|
|
||||||
+ config.maxBrushRadius);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
BaseBlock targetBlock = we.getBlock(player, args.getString(0));
|
|
||||||
session.setRightClickMode(null);
|
session.setRightClickMode(null);
|
||||||
session.setArmSwingMode(new ReplacingSphereBrush(targetBlock, radius));
|
session.setArmSwingMode(new ReplacingBrush());
|
||||||
player.print("Replacing sphere brush tool equipped. Swing with a pickaxe.");
|
player.print("Replacing brush tool equipped. Swing with a pickaxe.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,21 +21,17 @@ package com.sk89q.worldedit.superpickaxe;
|
|||||||
|
|
||||||
import com.sk89q.worldedit.*;
|
import com.sk89q.worldedit.*;
|
||||||
import com.sk89q.worldedit.bags.BlockBag;
|
import com.sk89q.worldedit.bags.BlockBag;
|
||||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
import com.sk89q.worldedit.superpickaxe.brushes.BrushShape;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Builds a sphere at the place being looked at.
|
* Builds a shape at the place being looked at.
|
||||||
*
|
*
|
||||||
* @author sk89q
|
* @author sk89q
|
||||||
*/
|
*/
|
||||||
public class SphereBrush implements SuperPickaxeMode {
|
public class Brush implements SuperPickaxeMode {
|
||||||
private BaseBlock targetBlock;
|
|
||||||
private int radius;
|
|
||||||
private boolean nonReplacing;
|
private boolean nonReplacing;
|
||||||
|
|
||||||
public SphereBrush(BaseBlock targetBlock, int radius, boolean nonReplacing) {
|
public Brush(boolean nonReplacing) {
|
||||||
this.targetBlock = targetBlock;
|
|
||||||
this.radius = radius;
|
|
||||||
this.nonReplacing = nonReplacing;
|
this.nonReplacing = nonReplacing;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,6 +47,13 @@ public class SphereBrush implements SuperPickaxeMode {
|
|||||||
|
|
||||||
BlockBag bag = session.getBlockBag(player);
|
BlockBag bag = session.getBlockBag(player);
|
||||||
|
|
||||||
|
BrushShape shape = session.getBrushShape();
|
||||||
|
|
||||||
|
if (shape == null) {
|
||||||
|
player.printError("Select a brush first.");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
ReplacingEditSession editSession = new ReplacingEditSession(server, target.getWorld(),
|
ReplacingEditSession editSession = new ReplacingEditSession(server, target.getWorld(),
|
||||||
session.getBlockChangeLimit(), bag);
|
session.getBlockChangeLimit(), bag);
|
||||||
|
|
||||||
@ -59,7 +62,7 @@ public class SphereBrush implements SuperPickaxeMode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
editSession.makeSphere(target, targetBlock, radius, true);
|
shape.build(editSession, target);
|
||||||
} catch (MaxChangedBlocksException e) {
|
} catch (MaxChangedBlocksException e) {
|
||||||
player.printError("Max blocks change limit reached.");
|
player.printError("Max blocks change limit reached.");
|
||||||
} finally {
|
} finally {
|
@ -21,23 +21,14 @@ package com.sk89q.worldedit.superpickaxe;
|
|||||||
|
|
||||||
import com.sk89q.worldedit.*;
|
import com.sk89q.worldedit.*;
|
||||||
import com.sk89q.worldedit.bags.BlockBag;
|
import com.sk89q.worldedit.bags.BlockBag;
|
||||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
import com.sk89q.worldedit.superpickaxe.brushes.BrushShape;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Builds a sphere at the place being looked at.
|
* Builds a sphere at the place being looked at.
|
||||||
*
|
*
|
||||||
* @author sk89q
|
* @author sk89q
|
||||||
*/
|
*/
|
||||||
public class ReplacingSphereBrush implements SuperPickaxeMode {
|
public class ReplacingBrush implements SuperPickaxeMode {
|
||||||
private BaseBlock targetBlock;
|
|
||||||
private int radius;
|
|
||||||
|
|
||||||
public ReplacingSphereBrush(BaseBlock targetBlock, int radius) {
|
|
||||||
this.targetBlock = targetBlock;
|
|
||||||
this.radius = radius;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean act(ServerInterface server, LocalConfiguration config,
|
public boolean act(ServerInterface server, LocalConfiguration config,
|
||||||
LocalPlayer player, LocalSession session, WorldVector clicked) {
|
LocalPlayer player, LocalSession session, WorldVector clicked) {
|
||||||
WorldVector target = player.getBlockTrace(500);
|
WorldVector target = player.getBlockTrace(500);
|
||||||
@ -49,6 +40,13 @@ public class ReplacingSphereBrush implements SuperPickaxeMode {
|
|||||||
|
|
||||||
BlockBag bag = session.getBlockBag(player);
|
BlockBag bag = session.getBlockBag(player);
|
||||||
|
|
||||||
|
BrushShape shape = session.getBrushShape();
|
||||||
|
|
||||||
|
if (shape == null) {
|
||||||
|
player.printError("Select a brush first.");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
ReplacingExistingEditSession editSession =
|
ReplacingExistingEditSession editSession =
|
||||||
new ReplacingExistingEditSession(server, target.getWorld(),
|
new ReplacingExistingEditSession(server, target.getWorld(),
|
||||||
session.getBlockChangeLimit(), bag);
|
session.getBlockChangeLimit(), bag);
|
||||||
@ -56,7 +54,7 @@ public class ReplacingSphereBrush implements SuperPickaxeMode {
|
|||||||
editSession.enableReplacing();
|
editSession.enableReplacing();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
editSession.makeSphere(target, targetBlock, radius, true);
|
shape.build(editSession, target);
|
||||||
} catch (MaxChangedBlocksException e) {
|
} catch (MaxChangedBlocksException e) {
|
||||||
player.printError("Max blocks change limit reached.");
|
player.printError("Max blocks change limit reached.");
|
||||||
} finally {
|
} finally {
|
41
src/com/sk89q/worldedit/superpickaxe/brushes/BrushShape.java
Normale Datei
41
src/com/sk89q/worldedit/superpickaxe/brushes/BrushShape.java
Normale Datei
@ -0,0 +1,41 @@
|
|||||||
|
// $Id$
|
||||||
|
/*
|
||||||
|
* WorldEdit
|
||||||
|
* Copyright (C) 2010, 2011 sk89q <http://www.sk89q.com>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.sk89q.worldedit.superpickaxe.brushes;
|
||||||
|
|
||||||
|
import com.sk89q.worldedit.EditSession;
|
||||||
|
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||||
|
import com.sk89q.worldedit.Vector;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents a shape.
|
||||||
|
*
|
||||||
|
* @author sk89q
|
||||||
|
*/
|
||||||
|
public interface BrushShape {
|
||||||
|
/**
|
||||||
|
* Build the object.
|
||||||
|
*
|
||||||
|
* @param build
|
||||||
|
* @param pos
|
||||||
|
* @throws MaxChangedBlocksException
|
||||||
|
*/
|
||||||
|
public void build(EditSession editSession, Vector pos)
|
||||||
|
throws MaxChangedBlocksException;
|
||||||
|
}
|
@ -0,0 +1,41 @@
|
|||||||
|
// $Id$
|
||||||
|
/*
|
||||||
|
* WorldEdit
|
||||||
|
* Copyright (C) 2010, 2011 sk89q <http://www.sk89q.com>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.sk89q.worldedit.superpickaxe.brushes;
|
||||||
|
|
||||||
|
import com.sk89q.worldedit.CuboidClipboard;
|
||||||
|
import com.sk89q.worldedit.EditSession;
|
||||||
|
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||||
|
import com.sk89q.worldedit.Vector;
|
||||||
|
|
||||||
|
public class ClipboardBrushShape implements BrushShape {
|
||||||
|
private CuboidClipboard clipboard;
|
||||||
|
private boolean noAir;
|
||||||
|
|
||||||
|
public ClipboardBrushShape(CuboidClipboard clipboard, boolean noAir) {
|
||||||
|
this.clipboard = clipboard;
|
||||||
|
this.noAir = noAir;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void build(EditSession editSession, Vector pos)
|
||||||
|
throws MaxChangedBlocksException {
|
||||||
|
clipboard.place(editSession,
|
||||||
|
pos.subtract(clipboard.getSize().divide(2)), noAir);
|
||||||
|
}
|
||||||
|
}
|
42
src/com/sk89q/worldedit/superpickaxe/brushes/CylinderBrushShape.java
Normale Datei
42
src/com/sk89q/worldedit/superpickaxe/brushes/CylinderBrushShape.java
Normale Datei
@ -0,0 +1,42 @@
|
|||||||
|
// $Id$
|
||||||
|
/*
|
||||||
|
* WorldEdit
|
||||||
|
* Copyright (C) 2010, 2011 sk89q <http://www.sk89q.com>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.sk89q.worldedit.superpickaxe.brushes;
|
||||||
|
|
||||||
|
import com.sk89q.worldedit.EditSession;
|
||||||
|
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||||
|
import com.sk89q.worldedit.Vector;
|
||||||
|
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||||
|
|
||||||
|
public class CylinderBrushShape implements BrushShape {
|
||||||
|
private BaseBlock targetBlock;
|
||||||
|
private int radius;
|
||||||
|
private int height;
|
||||||
|
|
||||||
|
public CylinderBrushShape(BaseBlock targetBlock, int radius, int height) {
|
||||||
|
this.targetBlock = targetBlock;
|
||||||
|
this.radius = radius;
|
||||||
|
this.height = height;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void build(EditSession editSession, Vector pos)
|
||||||
|
throws MaxChangedBlocksException {
|
||||||
|
editSession.makeCylinder(pos, targetBlock, radius, height);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,42 @@
|
|||||||
|
// $Id$
|
||||||
|
/*
|
||||||
|
* WorldEdit
|
||||||
|
* Copyright (C) 2010, 2011 sk89q <http://www.sk89q.com>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.sk89q.worldedit.superpickaxe.brushes;
|
||||||
|
|
||||||
|
import com.sk89q.worldedit.EditSession;
|
||||||
|
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||||
|
import com.sk89q.worldedit.Vector;
|
||||||
|
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||||
|
|
||||||
|
public class HollowCylinderBrushShape implements BrushShape {
|
||||||
|
private BaseBlock targetBlock;
|
||||||
|
private int radius;
|
||||||
|
private int height;
|
||||||
|
|
||||||
|
public HollowCylinderBrushShape(BaseBlock targetBlock, int radius, int height) {
|
||||||
|
this.targetBlock = targetBlock;
|
||||||
|
this.radius = radius;
|
||||||
|
this.height = height;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void build(EditSession editSession, Vector pos)
|
||||||
|
throws MaxChangedBlocksException {
|
||||||
|
editSession.makeHollowCylinder(pos, targetBlock, radius, height);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,40 @@
|
|||||||
|
// $Id$
|
||||||
|
/*
|
||||||
|
* WorldEdit
|
||||||
|
* Copyright (C) 2010, 2011 sk89q <http://www.sk89q.com>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.sk89q.worldedit.superpickaxe.brushes;
|
||||||
|
|
||||||
|
import com.sk89q.worldedit.EditSession;
|
||||||
|
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||||
|
import com.sk89q.worldedit.Vector;
|
||||||
|
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||||
|
|
||||||
|
public class HollowSphereBrushShape implements BrushShape {
|
||||||
|
private BaseBlock targetBlock;
|
||||||
|
private int radius;
|
||||||
|
|
||||||
|
public HollowSphereBrushShape(BaseBlock targetBlock, int radius) {
|
||||||
|
this.targetBlock = targetBlock;
|
||||||
|
this.radius = radius;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void build(EditSession editSession, Vector pos)
|
||||||
|
throws MaxChangedBlocksException {
|
||||||
|
editSession.makeSphere(pos, targetBlock, radius, false);
|
||||||
|
}
|
||||||
|
}
|
40
src/com/sk89q/worldedit/superpickaxe/brushes/SphereBrushShape.java
Normale Datei
40
src/com/sk89q/worldedit/superpickaxe/brushes/SphereBrushShape.java
Normale Datei
@ -0,0 +1,40 @@
|
|||||||
|
// $Id$
|
||||||
|
/*
|
||||||
|
* WorldEdit
|
||||||
|
* Copyright (C) 2010, 2011 sk89q <http://www.sk89q.com>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.sk89q.worldedit.superpickaxe.brushes;
|
||||||
|
|
||||||
|
import com.sk89q.worldedit.EditSession;
|
||||||
|
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||||
|
import com.sk89q.worldedit.Vector;
|
||||||
|
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||||
|
|
||||||
|
public class SphereBrushShape implements BrushShape {
|
||||||
|
private BaseBlock targetBlock;
|
||||||
|
private int radius;
|
||||||
|
|
||||||
|
public SphereBrushShape(BaseBlock targetBlock, int radius) {
|
||||||
|
this.targetBlock = targetBlock;
|
||||||
|
this.radius = radius;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void build(EditSession editSession, Vector pos)
|
||||||
|
throws MaxChangedBlocksException {
|
||||||
|
editSession.makeSphere(pos, targetBlock, radius, true);
|
||||||
|
}
|
||||||
|
}
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren