Featured image of post Minecraft BE Addons 开发文档(更新中)

Minecraft BE Addons 开发文档(更新中)

没想到还是干回来老本行了啊……

配置 VSC 开发环境

游戏加载包路径

以 windows 系统为例,游戏加载的包在 %localappdata%\Packages\Microsoft.MinecraftUWP_8wekyb3d8bbwe\LocalState\games\com.mojang 路径下。

其中在这个路径下的 development_resource_packsdevelopment_behavior_packs 中的文件夹在每次重启存档的时候都会重新加载

使用 Visual Studio Code 和 npm

使用 VSC 和 npm 开发

  1. 前往这个网站下载模板包 Minecraft Creator Tools
  2. 解压缩此安装包到当前路径下
  3. 在当前路径运行 powershell 等命令行终端工具
  4. 运行 npm i 来安装所需要的节点工具和库
  5. 然后可以使用 code . 来快捷打开VSC
  6. 可以使用 npm run local-deploy 快速将写好的文件转移到游戏开发目录下

npm 其他命令

  • 扫描代码错误可以使用 npx just-scripts lint
  • 自动修复错误 npx just-scripts lint --fix
  • 生成 .mcaddon 文件 npx just-scripts mcaddon

更多开发说明 Minecraft 开发者工具 |Microsoft 学习

方块

description

"identifier"

  • 用于定义方块的标识符, : 前面为命名空间,不能为 minecraft; 后半为方块名

components

"minecraft:breathability" 透气性

  • 值类型 String
    • solid 不可呼吸
    • air 可呼吸

设定方块是否可以呼吸,如果省略默认为不可呼吸

"minecraft:crafting_table" 将方块变为合成台

  • 值类型 Object
    • crafting_tags
    • table_name 映射?

此组件仅支持 recipe_shaped 和 recipe_shapeless 类型的配方,而不支持 recipe_furnace 或 recipe_brewing_mix 等其他配方

"minecraft:geometry" 方块模型

  • 值类型 String

    • "minecraft:geometry.full_block" 默认的完全方块
    • "minecraft:geometry.cross" 交叉方块?
  • 值类型 Object

    • bone_visibilty object,包含列表。用于指定模型文件中的骨骼/块是否可见
    • culling String,渲染方块时候要使用的 block_culling.json 文件
    • culliing_layer String,?
    • identifier String,模型标识符
    • uv_lock Boolean / String Array,?

"minecraft:item_visual" 手持样式

  • 值类型 Object
    • geometry"minecraft:geometry"
    • material_instances"minecraft:material_instances"

该组件用于设定手持该方块时的贴图以及模型

"minecraft:flammable" 可燃性

  • 值类型 Boolean

    • true 使用默认值,可燃
    • false 方块不可燃
  • 值类型 Object

    • catch_chance_modifier Integer,默认值为5 影响该方块在岩浆等附近着火的概率。越大月容易着火
    • destroy_chance_modifier Integer,默认为20 影响该方块在着火时被火焰摧毁的概率。越大越容易被火烧毁

若省略此组件,则火焰无法从附近方块传导,但是可以直接被点燃

"minecraft:friction" 摩擦力

  • 值类型 十进制 默认值为0.4,可设定范围(0.0, 0.9)

影响实体在方块上的移动速度,值越大,摩擦力越大

"minecraft:display_name" 显示名

  • 值类型 String

方块的显示名称,即方块的默认名

"minecraft:destructible_by_explosion" 抗暴性

  • 值类型 Boolean / Object
    • explosin_resistance 十进制数字,默认值为0 (该值越大抗暴能力越强)

"minecraft:collision_box" 碰撞箱

  • 值类型 Boolean

    • true 可碰撞
    • false 不可碰撞
  • 值类型 Object

    • origin 类型为 Vector[a, b, c] 默认值为 [-8.0, 0,0, -8.0]
    • size 类型为 Vector[a, b, c] 默认值为 [16.0, 16,0, 16.0]

关于 originsize

  1. Minimal position of the bounds of the collision box. “origin” is specified as [x, y, z] and must be in the range (-8, 0, -8) to (8, 16, 8), inclusive.
  2. Size of each side of the collision box. Size is specified as [x, y, z]. “origin” + “size” must be in the range (-8, 0, -8) to (8, 16, 8), inclusive.

"minecraft:selection_box" 选中箱

  • 值类型 Boolean

    • true 可碰撞
    • false 不可碰撞
  • 值类型Object

    • origin 类型为 Vector[a, b, c] 默认值为 [-8.0, 0,0, -8.0]

    • size 类型为 Vector[a, b, c] 默认值为 [16.0, 16,0, 16.0]

关于 originsize

  1. Minimal position of the bounds of the collision box. “origin” is specified as [x, y, z] and must be in the range (-8, 0, -8) to (8, 16, 8), inclusive.
  2. Size of each side of the collision box. Size is specified as [x, y, z]. “origin” + “size” must be in the range (-8, 0, -8) to (8, 16, 8), inclusive.

"minecraft:map_color" 地图渲染色

  • 值类型 Object
    • color#RRGGBB 格式的十六进制值或者是 (0, 255) 的 [R, G, B] 数组
    • tint_method 可选值,色调乘以颜色
  • 若省略该组件,则该方块将不会显示在地图上
  • 关于 tint_method often refers to the “rain” and “temperature” of the biome the block is placed in to compute the tint. Supported tint methods are “none”, “default_foliage”, “birch_foliage”, “evergreen_foliage”, “dry_foliage”, “grass” and “water”

"minecraft:movable" 可移动

  • 值类型 Object

    • movement_type 方块被活塞等另一个方块推动时的反应 (必填)

      • "push_pull" 默认值,该方块将会被活塞推拉

      • "push" 只会被活塞拉动

      • "popped" 被活塞移动时会被摧毁

      • "immovable" 不受活塞影响

  • sticky 当被活塞等另一个方块推动时,此方块周围的方块

    • "same" 移动时将移动与此方块相邻快

    • "none" 默认值,不会移动相邻的方块

"minecraft:placement_filter" 放置方块规则

  • 值类型 Object
    • allowed_faces 类型 Array,描述此方块可以放置在下面属性指定的方块的那些面
    • block_filter 类型 Array,描述可以在那些方块上放置此方块的列表
      • "name" 方块名称
      • "states" 方块状态
      • "tags" 使用 Molang 查询的条件

可以指定 “up”, “down”, “north”, “south”, “east”, “west”, “side”, “all”. Limited to 6 faces.

"minecraft:light_dampening" 透光性

  • 值类型 Integer 默认值 15

用于表示光线穿过方块时候的阻尼。值越大透光性越弱

"minecraft:light_emission" 亮度

  • 值类型 Integer 默认值 0

方块所发出的亮度,范围 (0, 15)

"minecraft:material_instances" 材质渲染

  • 值类型 Object

可以通过材质实例对象分配给以下任何面:

"up", "down", "north", "south", "east", "west", "*"

"*" 为方块所有面

材质实例

  • ambient_occlusion 是否启用环境光遮挡。若为 true 则在方块周围和旁边创建阴影。也可以使用浮点数来控制
  • face_dimming Should this material be dimmed by the direction it’s facing? 布尔值
  • isotropic 是否需要随机化UV?
  • render_method 值类型 String
    • "opaque" 默认值,不允许透明度以及半透明
    • "double_sided" 完全禁用背面删除?
    • "blend" 用于彩色玻璃方块等,允许透明度和半透明
    • "alpha_test"用于向原版玻璃这样的方块。不允许半透明,仅允许完全不透明或者完全透明的纹理。还会禁用背面删除
  • texture 材质名称,在资源包 texture/terrain_texture.json 中定义
  • tint_method 方块色调

方块色调有

“none”, “default_foliage”, “birch_foliage”, “evergreen_foliage”, “dry_foliage”, “grass” and “water”

默认值 none

"minecraft:liquid_detection" 检测液体

  • 值类型 Object
    • can_contain_liquid 检测方块是否可以含有液体。默认值 false
    • liquid_type 可以含液体的类型,默认为 water
    • on_liquid_touches 方块对流水的反应
      • blocking 默认值,会阻止液体流动
      • broken 方块会被液体摧毁
      • popped 方块被摧毁并生成其物品状态
      • no_reaction 方块不受影响(液体穿过方块)
      • stops_liquid_folowing_from_direction 当方块含有液体时控制液体不能从哪个方向流出

if no_reaction is set for the on_liquid_touches field. Can be a list of the following directions: "up", "down", "north", "south", "east", "west". The default is an empty list; this means that liquid can flow out of all directions by default.

"minecraft:loot" 战利品/掉落

  • 值类型 Path_String

战利品定义文件相对于行为包的路径

"minecraft:destructible_by_mining" 挖掘速度

  • 值类型 Boolean

    • true 花费默认时间可以摧毁
    • false 不可摧毁
  • 值类型 Object

    • item_specific_speeds 用于描述特定工具等针对该方块摧毁速度的项目组 类型为 Array
      • destroy_speed 必填,使用对应工具等对方块的破坏速度
      • item 必填,针对项目的筛选
      • seconds_to_destory 十进制数字,默认为0 数值越高挖掘时间越长

"minecraft:destruction_particles" 破坏粒子

  • 值类型 Object

"minecraft:transformation" 变形

  • 值类型 Object

"minecraft:redstone_conductivity" 红石属性

  • 值类型 Object
    • allows_wire_to_step_down 指定红石线路是否可以在方块上下阶梯。默认为 true
    • redstone_conductor 是否可以由红石提供动力,默认为 false

"minecraft:custom_components" 脚本事件列表

  • 值类型 Array

设定自定义脚本名称的列表。以绑定到方块上方便执行

物品

配方

战利品

生态系

description

"identifier"

  • 用于定义方块的标识符, : 前面为命名空间,不能为 minecraft ; 后半为生态名

components

"minecraft:replace_biomes" 替换生态系

  • 值类型 Object

"minecraft:climate" 气候

  • 值类型 Object

"minecraft:overworld_generation_rules" 实例化

  • 值类型 Object

"minecraft:overworld_height" 地形高度噪点参数

  • 值类型 Object

"minecraft:surface_builder" 地形材质

  • 值类型 Object

"minecraft:tags" 标签

  • 值类型 Object

地物

特征

Licensed under CC BY-NC-SA 4.0
不向焦虑与抑郁投降 这个世界终会有我们存在的地方
使用 Hugo 构建
主题 StackJimmy 设计
本博客已稳定运行
发表了10篇文章 · 总计55.01k字