Add //blob command equivalent to //br rock

This commit is contained in:
dordsor21
2021-09-18 17:42:58 +01:00
parent 7d032ba69f
commit 0a48765c98
4 changed files with 150 additions and 91 deletions

View File

@ -413,7 +413,7 @@ public class BrushCommands {
InjectedValueAccess context,
@Arg(desc = "Pattern")
Pattern fill,
@Arg(desc = "radius", def = "10")
@Arg(desc = "radii to multiply x,y,z by", def = "10")
Vector3 radius,
@Arg(name = "roundness", desc = "roundness", def = "100")
double sphericity,

View File

@ -23,6 +23,7 @@ import com.fastasyncworldedit.core.Fawe;
import com.fastasyncworldedit.core.configuration.Caption;
import com.fastasyncworldedit.core.function.generator.CavesGen;
import com.fastasyncworldedit.core.util.MainUtil;
import com.fastasyncworldedit.core.util.MathMan;
import com.fastasyncworldedit.core.util.TextureUtil;
import com.fastasyncworldedit.core.util.image.ImageUtil;
import com.sk89q.worldedit.EditSession;
@ -647,6 +648,47 @@ public class GenerationCommands {
editSession.addOre(region, mask, material, size, freq, rarity, minY, maxY);
actor.print(Caption.of("fawe.worldedit.visitor.visitor.block", editSession.getBlockChangeCount()));
}
@Command(
name = "/blob",
aliases = {"/rock"},
desc = "Creates a distorted sphere"
)
@Logging(PLACEMENT)
@CommandPermissions("worldedit.generation.blob")
public int blobBrush(
Actor actor, LocalSession session, EditSession editSession,
@Arg(desc = "Pattern")
Pattern pattern,
@Arg(desc = "size", def = "5")
double size,
@Arg(desc = "radius", def = "5")
Vector3 radius,
@Arg(name = "roundness", desc = "roundness", def = "100")
double sphericity,
@Arg(desc = "double", def = "30")
double frequency,
@Arg(desc = "double", def = "50")
double amplitude
) throws WorldEditException {
double max = MathMan.max(radius.getX(), radius.getY(), radius.getZ());
worldEdit.checkMaxRadius(max);
BlockVector3 pos = session.getPlacementPosition(actor);
int affected = editSession.makeBlob(
pos,
pattern,
size,
frequency / 100,
amplitude / 100,
radius.divide(max),
sphericity / 100
);
if (actor instanceof Player) {
((Player) actor).findFreePosition();
}
actor.print(Caption.of("worldedit.sphere.created", TextComponent.of(affected)));
return affected;
}
//FAWE end
}