现代模型格式

现代模型格式

允许1.21.11模型在旧版本中加载

允许在旧版本中使用 1.21.11 模型格式,借助黑魔法的力量,具体支持所有三个轴(XYZ)的旋转以及大于/小于 22.5° 的增量,同时移除 3x3x3 的尺寸限制。

示例

模组展示:一个带有三轴旋转的钻石块

<details> <summary>模型</summary>

文件:assets/minecraft/models/block/diamond_block.json

{
  "format_version": "1.21.11",
  "textures": {
    "all": "block/diamond_block"
  },
  "elements": [
    {
      "from": [0, 0, 0],
      "to": [16, 16, 16],
      "rotation": {"x": 45, "y": 45, "z": 45, "origin": [8, 8, 8]},
      "faces": {
        "north": {"uv": [0, 0, 16, 16], "texture": "#all"},
        "east": {"uv": [0, 0, 16, 16], "texture": "#all"},
        "south": {"uv": [0, 0, 16, 16], "texture": "#all"},
        "west": {"uv": [0, 0, 16, 16], "texture": "#all"},
        "up": {"uv": [0, 0, 16, 16], "texture": "#all"},
        "down": {"uv": [0, 0, 16, 16], "texture": "#all"}
      }
    }
  ]
}

</details>

支持两种旋转类型:

全轴旋转

  "rotation": {
    "x": 45,
    "y": 45,
    "z": 45,
    "origin": [
      8,
      8,
      8
    ]
  }

单轴旋转

  "rotation": {
    "angle": 45,
    "axis": "y",
    "origin": [
      8,
      8,
      8
    ]
  }

Maven

repositories {
  maven { url 'https://jitpack.io' }
}

dependencies { modImplementation 'com.github.Nico44YT:ModernModelFormat:<version>' }

版本号通常由“<模组版本>_<游戏版本范围>”组成,例如:“1.3.0-1.19.3-1.21.3”

问题反馈

如果你发现问题,请在 github 上报告,并(如果适用)附上:

  • 任何日志
  • 模型
  • 截图
  • 游戏版本
  • 模组列表

我的模型无法加载了

请检查模型文件中是否有多余的括号 {},因为现代模型格式(Modern Model Format)要求严格的 JSON 验证。

示例:

[18:30:32] [Worker-Main-2/ERROR]: Failed to load model mod_id:models/item/example_item.json
com.google.gson.JsonSyntaxException: com.google.gson.stream.MalformedJsonException: Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 506 path $