Craftorithm Wiki
  • Craftorithm
  • 开始
    • 安装
    • 默认配置
    • 命令和权限
    • 本地化
    • 升级Craftorithm版本
  • 物品系统
    • 配置构成
    • 物品的保存与使用
    • 自定义燃料
  • 配方编写
    • 配置构成
    • 有序配方
    • 无序配方
    • 烧炼配方
    • 锻造配方
    • 切石机配方
    • 随机烧炼配方
    • 酿造配方
    • 铁砧配方
    • 在配方中使用物品Tag
    • 在配方中使用其他插件的物品
    • 配方分类
    • 通过GUI创建配方
  • 动作系统
    • 基础
      • 在配方中使用
    • 语句
      • Perm
      • Level
      • Money
      • Points
      • Papi
      • If
      • All
      • Any
      • Take-Level
      • Take-Money
      • Take-Points
      • Command
      • Console
      • Return
    • 进阶
      • 函数
  • 开发者相关
    • 物品提供源
    • 注册配方
由 GitBook 提供支持
在本页
  • 定义
  • 格式
  • 示例
  1. 动作系统
  2. 进阶

函数

在function.yml中定义的动作组

定义

我们可以在plugins/Craftorithm/function.yml中将多个动作打包为一个组,称之为函数。

格式

函数名:
  - '语句1'
  - '语句2'
  ...

在此处定义的函数体,会被视为语句进行解析,可以被当作语句使用。

示例

function.yml

example:
  - 'if level > 100'
  - |-
    take-level 10
    return
  - 'take-level 1'
test:
  - return all perm craftorithm.perm.example && level >= 100 && papi %player_name% == YufiriaMazenta

recipes/example_shaped.yml

type: 'shaped'
result: 'items:example_item:example_item'
multiple: true
shape:
  - - 'aaa'
    - 'bbb'
    - 'ccc'
  - - 'dd'
    - 'ee'
source:
  a: 'bedrock'
  b: 'command_block'
  c: 'items:example_item:example_item'
  d: 'diamond'
  e: 'iron_ingot'
unlock: true

condition: 'test'
actions:
  - 'example'
上一页进阶下一页物品提供源

最后更新于1年前