Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-11-10 05:20:04 +01:00
Make inset/outset use varargs contract/expand, so they can be used with cylinders and ellipses.
Dieser Commit ist enthalten in:
Ursprung
8506bb437e
Commit
760f77e681
@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
package com.sk89q.worldedit.commands;
|
package com.sk89q.worldedit.commands;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
@ -438,31 +439,11 @@ public class SelectionCommands {
|
|||||||
@CommandPermissions("worldedit.selection.outset")
|
@CommandPermissions("worldedit.selection.outset")
|
||||||
public void outset(CommandContext args, LocalSession session, LocalPlayer player,
|
public void outset(CommandContext args, LocalSession session, LocalPlayer player,
|
||||||
EditSession editSession) throws WorldEditException {
|
EditSession editSession) throws WorldEditException {
|
||||||
int change = args.getInteger(0);
|
|
||||||
|
|
||||||
Region region = session.getSelection(player.getWorld());
|
Region region = session.getSelection(player.getWorld());
|
||||||
|
region.expand(getChangesForEachDir(args));
|
||||||
try {
|
session.getRegionSelector(player.getWorld()).learnChanges();
|
||||||
if (!args.hasFlag('h')) {
|
session.getRegionSelector(player.getWorld()).explainRegionAdjust(player, session);
|
||||||
region.expand((new Vector(0, 1, 0)).multiply(change));
|
player.print("Region outset.");
|
||||||
region.expand((new Vector(0, -1, 0)).multiply(change));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!args.hasFlag('v')) {
|
|
||||||
region.expand((new Vector(1, 0, 0)).multiply(change));
|
|
||||||
region.expand((new Vector(-1, 0, 0)).multiply(change));
|
|
||||||
region.expand((new Vector(0, 0, 1)).multiply(change));
|
|
||||||
region.expand((new Vector(0, 0, -1)).multiply(change));
|
|
||||||
}
|
|
||||||
|
|
||||||
session.getRegionSelector(player.getWorld()).learnChanges();
|
|
||||||
|
|
||||||
session.getRegionSelector(player.getWorld()).explainRegionAdjust(player, session);
|
|
||||||
|
|
||||||
player.print("Region outset.");
|
|
||||||
} catch (RegionOperationException e) {
|
|
||||||
player.printError(e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Command(
|
@Command(
|
||||||
@ -481,27 +462,30 @@ public class SelectionCommands {
|
|||||||
@CommandPermissions("worldedit.selection.inset")
|
@CommandPermissions("worldedit.selection.inset")
|
||||||
public void inset(CommandContext args, LocalSession session, LocalPlayer player,
|
public void inset(CommandContext args, LocalSession session, LocalPlayer player,
|
||||||
EditSession editSession) throws WorldEditException {
|
EditSession editSession) throws WorldEditException {
|
||||||
|
Region region = session.getSelection(player.getWorld());
|
||||||
|
region.contract(getChangesForEachDir(args));
|
||||||
|
session.getRegionSelector(player.getWorld()).learnChanges();
|
||||||
|
session.getRegionSelector(player.getWorld()).explainRegionAdjust(player, session);
|
||||||
|
player.print("Region inset.");
|
||||||
|
}
|
||||||
|
|
||||||
|
private Vector[] getChangesForEachDir(CommandContext args) {
|
||||||
|
List<Vector> changes = new ArrayList<Vector>(6);
|
||||||
int change = args.getInteger(0);
|
int change = args.getInteger(0);
|
||||||
|
|
||||||
Region region = session.getSelection(player.getWorld());
|
|
||||||
|
|
||||||
if (!args.hasFlag('h')) {
|
if (!args.hasFlag('h')) {
|
||||||
region.contract((new Vector(0, 1, 0)).multiply(change));
|
changes.add((new Vector(0, 1, 0)).multiply(change));
|
||||||
region.contract((new Vector(0, -1, 0)).multiply(change));
|
changes.add((new Vector(0, -1, 0)).multiply(change));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!args.hasFlag('v')) {
|
if (!args.hasFlag('v')) {
|
||||||
region.contract((new Vector(1, 0, 0)).multiply(change));
|
changes.add((new Vector(1, 0, 0)).multiply(change));
|
||||||
region.contract((new Vector(-1, 0, 0)).multiply(change));
|
changes.add((new Vector(-1, 0, 0)).multiply(change));
|
||||||
region.contract((new Vector(0, 0, 1)).multiply(change));
|
changes.add((new Vector(0, 0, 1)).multiply(change));
|
||||||
region.contract((new Vector(0, 0, -1)).multiply(change));
|
changes.add((new Vector(0, 0, -1)).multiply(change));
|
||||||
}
|
}
|
||||||
|
|
||||||
session.getRegionSelector(player.getWorld()).learnChanges();
|
return changes.toArray(new Vector[0]);
|
||||||
|
|
||||||
session.getRegionSelector(player.getWorld()).explainRegionAdjust(player, session);
|
|
||||||
|
|
||||||
player.print("Region inset.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Command(
|
@Command(
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren