3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-12-26 02:50:06 +01:00

Add thickness to //hcyl and //br cylinder -h

- Closes #753
Dieser Commit ist enthalten in:
dordsor21 2021-08-08 10:02:58 +01:00
Ursprung 75b888a9f0
Commit 2376ce8d9d
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 1E53E88969FFCF0B
4 geänderte Dateien mit 53 neuen und 5 gelöschten Zeilen

Datei anzeigen

@ -1209,6 +1209,11 @@ public class BrushCommands {
Expression radius, Expression radius,
@Arg(desc = "The height of the cylinder", def = "1") @Arg(desc = "The height of the cylinder", def = "1")
int height, int height,
//FAWE start - hcyl thickness
@Arg(desc = "The thickness of the cylinder. Requires -h switch be given. 0 creates a standard hollow cylinder.",
def = "0")
double thickness,
//FAWE end
@Switch(name = 'h', desc = "Create hollow cylinders instead") @Switch(name = 'h', desc = "Create hollow cylinders instead")
boolean hollow boolean hollow
) throws WorldEditException { ) throws WorldEditException {
@ -1217,7 +1222,9 @@ public class BrushCommands {
BrushSettings settings; BrushSettings settings;
if (hollow) { if (hollow) {
settings = set(context, new HollowCylinderBrush(height)); //FAWE start - hcyl thickness
settings = set(context, new HollowCylinderBrush(height, thickness));
//FAWE end
} else { } else {
settings = set(context, new CylinderBrush(height)); settings = set(context, new CylinderBrush(height));
} }

Datei anzeigen

@ -103,10 +103,42 @@ public class GenerationCommands {
@Radii(2) @Radii(2)
List<Double> radii, List<Double> radii,
@Arg(desc = "The height of the cylinder", def = "1") @Arg(desc = "The height of the cylinder", def = "1")
int height int height,
//FAWE start - hcyl thickness
@Arg(desc = "Thickness of the cyclinder. 0 creates a normal //hcyl.", def = "0")
double thickness
) throws WorldEditException { ) throws WorldEditException {
return cyl(actor, session, editSession, pattern, radii, height, true); final double radiusX;
final double radiusZ;
switch (radii.size()) {
case 1:
radiusX = radiusZ = Math.max(1, radii.get(0));
break;
case 2:
radiusX = Math.max(1, radii.get(0));
radiusZ = Math.max(1, radii.get(1));
break;
default:
actor.print(Caption.of("worldedit.cyl.invalid-radius"));
return 0;
}
worldEdit.checkMaxRadius(radiusX);
worldEdit.checkMaxRadius(radiusZ);
worldEdit.checkMaxRadius(height);
if (thickness > radiusX || thickness > radiusZ) {
actor.print(Caption.of("worldedit.hcyl.thickness-too-large"));
return 0;
}
BlockVector3 pos = session.getPlacementPosition(actor);
int affected = editSession.makeCylinder(pos, pattern, radiusX, radiusZ, height, thickness, false);
actor.print(Caption.of("worldedit.cyl.created", TextComponent.of(affected)));
return affected;
} }
//FAWE end
@Command( @Command(
name = "/cyl", name = "/cyl",

Datei anzeigen

@ -28,9 +28,15 @@ import com.sk89q.worldedit.world.block.BlockTypes;
public class HollowCylinderBrush implements Brush { public class HollowCylinderBrush implements Brush {
private final int height; private final int height;
//FAWE start - hcyl thickness
private final double thickness;
//FAWE end
public HollowCylinderBrush(int height) { public HollowCylinderBrush(int height, double thickness) {
this.height = height; this.height = height;
//FAWE start - hcyl thickness
this.thickness = thickness;
//FAWE end
} }
@Override @Override
@ -39,7 +45,9 @@ public class HollowCylinderBrush implements Brush {
if (pattern == null) { if (pattern == null) {
pattern = BlockTypes.COBBLESTONE.getDefaultState(); pattern = BlockTypes.COBBLESTONE.getDefaultState();
} }
editSession.makeCylinder(position, pattern, size, size, height, false); //FAWE start - hcyl thickness
editSession.makeCylinder(position, pattern, size, size, height, thickness, false);
//FAWE end
} }
} }

Datei anzeigen

@ -494,6 +494,7 @@
"worldedit.cyl.invalid-radius": "You must either specify 1 or 2 radius values.", "worldedit.cyl.invalid-radius": "You must either specify 1 or 2 radius values.",
"worldedit.cyl.created": "{0} blocks have been created.", "worldedit.cyl.created": "{0} blocks have been created.",
"worldedit.hcyl.thickness-too-large": "Thickness cannot be larger than x or z radii.",
"worldedit.sphere.invalid-radius": "You must either specify 1 or 3 radius values.", "worldedit.sphere.invalid-radius": "You must either specify 1 or 3 radius values.",
"worldedit.sphere.created": "{0} blocks have been created.", "worldedit.sphere.created": "{0} blocks have been created.",
"worldedit.forestgen.created": "{0} trees created.", "worldedit.forestgen.created": "{0} trees created.",