选区指令

基本信息

属性 值
来源类 com.sk89q.worldedit.command.SelectionCommands
文件 src/main/java/com/sk89q/worldedit/command/SelectionCommands.java
注册位置 CommandManager.java:147(根节点直接注册)
命令数 16
文件行数 846(wc -l)

命令表

指令 别名 说明 权限节点
//pos1 — Set position 1 worldedit.selection.pos
//pos2 — Set position 2 worldedit.selection.pos
//hpos1 — Set position 1 to targeted block worldedit.selection.hpos
//hpos2 — Set position 2 to targeted block worldedit.selection.hpos
//chunk — Set the selection to your current chunk. worldedit.selection.chunk
//wand — Get the wand object worldedit.wand
toggleeditwand — Toggle functionality of the edit wand worldedit.wand.toggle
//expand — Expand the selection area worldedit.selection.expand
//contract — Contract the selection area worldedit.selection.contract
//shift — Shift the selection area worldedit.selection.shift
//outset — Outset the selection area worldedit.selection.outset
//inset — Inset the selection area worldedit.selection.inset
//size — Get information about the selection worldedit.selection.size
//count — Counts the number of a certain type of block worldedit.analysis.count
//distr — Get the distribution of blocks in the selection worldedit.analysis.distr
//sel ;、//desel、//deselect Choose a region selector (无)

别名与说明均由源码 @Command(aliases=..., desc=...) 注解逐条提取(SelectionCommands.java),权限来自其上的 @CommandPermissions 注解。

功能

  • //pos1 / //pos2 无参时取玩家所在方块坐标;//pos1 [x,y,z] 形式取绝对坐标

  • //hpos1 / //hpos2 取玩家准星所指方块坐标

  • //chunk 把选区设为当前所在区块

  • //wand 发放法杖物品,物品 id 取自配置项 wand-item,默认 ItemID.WOOD_AXE = 271(LocalConfiguration.java:69)

  • //expand 用法 <amount> [reverse-amount] <direction>(SelectionCommands.java:284-289)。首个参数为特殊关键字 vert / vertical 时,选区纵向撑满天空到基岩(按 world.getMaxY() + 1 双向扩展,SelectionCommands.java:295-325),而非数值

  • //contract 用法 <amount> [reverse-amount] [direction](SelectionCommands.java:403-409)

  • //shift 用法 <amount> [direction],平移而非缩放(SelectionCommands.java:492-500)

  • //outset / //inset 标志 hv(SelectionCommands.java:546-551、569-574):默认三轴同时缩放;-h 只水平(跳过 ±Y),-v 只垂直(跳过 ±X/±Z),实现见 getChangesForEachDir(SelectionCommands.java:588-605)

  • //size 报告选区三轴边长、总方块数

  • //count / //distr 统计选区内方块构成,不修改世界

  • //sel 切换选区模式,源码 SelectionCommands.java:774-823 共接受 7 种模式(convex/hull/polyhedron 三个名字共用同一实现):

    模式 选择器类 交互提示(源码原文)
    cuboid CuboidRegionSelector 左键点 1,右键点 2
    extend ExtendingCuboidRegionSelector 左键起点,右键延伸
    poly Polygonal2DRegionSelector 左/右键加点
    ellipsoid EllipsoidRegionSelector 左键中心,右键延伸
    sphere SphereRegionSelector 左键中心,右键设半径
    cyl CylinderRegionSelector 左键中心,右键延伸
    convex / hull / polyhedron ConvexPolyhedralRegionSelector 左键首顶点,右键加点

    参数不匹配时打印可选模式列表后返回(SelectionCommands.java:806-823)。追加 -d 标志可把该模式设为个人默认(SelectionCommands.java:825-840)。

  • poly 与 convex 模式受顶点数上限约束:上限由 ActorSelectorLimits.getPolygonVertexLimit() / getPolyhedronVertexLimit()(extension/platform/permission/ActorSelectorLimits.java:41、60)计算,读取配置 default-max-polygon-points(默认 -1)、max-polygon-points(默认 20)及对应的 polyhedron 两项,取二者较小值;拥有 OverridePermissions.NO_LIMITS 时绕过(ActorSelectorLimits.java:44-49、63-68)

交互

选区状态保存在每个玩家自己的 LocalSession 中(WorldEdit.getInstance().getSessionManager().get(player),见 ForgeWorldEdit.java:312-317),因此 //pos1 只有设置者本人可见。

相关条目