mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-23 01:37:37 +00:00
parent
75b888a9f0
commit
2376ce8d9d
@ -1209,6 +1209,11 @@ public class BrushCommands {
|
||||
Expression radius,
|
||||
@Arg(desc = "The height of the cylinder", def = "1")
|
||||
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")
|
||||
boolean hollow
|
||||
) throws WorldEditException {
|
||||
@ -1217,7 +1222,9 @@ public class BrushCommands {
|
||||
|
||||
BrushSettings settings;
|
||||
if (hollow) {
|
||||
settings = set(context, new HollowCylinderBrush(height));
|
||||
//FAWE start - hcyl thickness
|
||||
settings = set(context, new HollowCylinderBrush(height, thickness));
|
||||
//FAWE end
|
||||
} else {
|
||||
settings = set(context, new CylinderBrush(height));
|
||||
}
|
||||
|
@ -103,10 +103,42 @@ public class GenerationCommands {
|
||||
@Radii(2)
|
||||
List<Double> radii,
|
||||
@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 {
|
||||
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(
|
||||
name = "/cyl",
|
||||
|
@ -28,9 +28,15 @@ import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
public class HollowCylinderBrush implements Brush {
|
||||
|
||||
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;
|
||||
//FAWE start - hcyl thickness
|
||||
this.thickness = thickness;
|
||||
//FAWE end
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -39,7 +45,9 @@ public class HollowCylinderBrush implements Brush {
|
||||
if (pattern == null) {
|
||||
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
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -494,6 +494,7 @@
|
||||
|
||||
"worldedit.cyl.invalid-radius": "You must either specify 1 or 2 radius values.",
|
||||
"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.created": "{0} blocks have been created.",
|
||||
"worldedit.forestgen.created": "{0} trees created.",
|
||||
|
Loading…
Reference in New Issue
Block a user