现代模型格式

现代模型格式

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

github banner github issues

借助黑魔法,允许在旧版本中使用 1.21.11 模型格式,具体而言,允许所有三个轴(XYZ)旋转,支持大于或小于 22.5° 的增量,此外还移除了 3x3x3 的尺寸限制。

示例

展示模组的图片,其中有一个带有三轴旋转的钻石块

模型

文件: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"}
      }
    }
  ]
}

支持两种旋转类型:

全轴旋转

  "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>'
}

版本通常由“<mod_version>_<game_version_range>”组成 例如:“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 $