本站文本內容除另有聲明外,均在知識共享 署名-非商業性使用-相同方式共享 3.0 協議下提供。(詳細信息…

模型

来自Minecraft Wiki
(重定向自方块模型
跳转至: 导航搜索
此页面的(部分)内容需要被翻译。
你可以帮助我们来翻译此页面

方块模型 用于显示游戏里的所有方块,而 物品模型 用于显示在玩家手上、头上(头盔栏)、地上、物品栏里、物品展示框中和盔甲架上的物品。 因为某些方块有不同的变种, 方块状态 用作连接对应状态的模型。每个模型和方块状态拥有各自的 .json 格式文件。用在物品栏的显示状态也在这些文件中定义。

方块状态[编辑 | 编辑源代码]

某些方块拥有不同的变种(例如可以开关的),因此每个方块有各自的方块状态文件来列出所有存在的变种并连接到对应的模型。方块也可以同时由不同的模型组合,称为“multipart”。然后模型会根据当前方块的状态而被调用。 这些文件储存在assets/minecraft/blockstates 中。这些文件会根据名称来直接使用, 因此不同名字的方块状态文件不会影响其他的方块状态文件。


  • 根标签

    •  variants:变种列表,列出此方块的所有变种。

      •  A variant:变种的名字,由逗号分隔相关的方块状态组成。只有一个变种的方块状态使用"normal"为变种名。每个变种可以拥有单个模型或者模型数组以及它的属性。如果被设置为数组,将会通过选项在组内随机选择一个模型,每个选项都被指定了不同的
        标签。

        •  A model: 包含模型的属性,如果不止一个模型用于同一个变种。替代所有在游戏中指定的模型。

          •  model:指定模型文件的路径,起始于assets/minecraft/models/block

          •  x:模型相对于x轴的旋转,90度增量。

          •  y:模型相对于y轴的旋转,90度增量。

          •  uvlock:可为truefalse(默认)。设置为true将锁定方块贴图的旋转。这样贴图将不会在使用上面的
             x
             y标签时跟着方块旋转。

          •  weight:设置模型在游戏中被选用的几率,默认为1(=100%)。如果多于一个模型被用作同一个变种,每个模型被选中的几率将会为此模型的weight除以所有模型weight的总和。(例如,三个weight分别为1,1和2的模型。他们weight的总和为4(1+1+2)。这三个模型被调用的几率则分别为1/4,1/4和2/4,也可以说为25%,25%和50%。)

        •  model:指定模型文件的路径,起始于assets/minecraft/models/block

        •  x:模型相对于x轴的旋转,90度增量。

        •  y:模型相对于y轴的旋转,90度增量。

        •  uvlock:可为truefalse(默认)。设置为true将锁定方块贴图的旋转。这样贴图将不会在使用上面的
           x
           y标签时跟着方块旋转。

    •  multipart:取代了
       variants,基于方块状态属性以来组合模型。

      •  A case确定一种情况,并决定应用在这种情况下的模型。

        •  when:为了使模型被应用而必须满足的情况的列表。当未设置时,模型总是应用的。

          •  OR:如果该标签包含了的情况中的任意一个情况返回true时匹配。不能同时设定其他情况。

            •  A condition当方块必须匹配为返回true时的情况列表。

              •  A case在单一情况下方块匹需配的方块状态。它可以设为一个列表,由|来分隔,以便允许多个值匹配。

          •  A case在单一情况下方块匹需配的方块状态。它可以设为一个列表,由|来分隔,以便允许多个值匹配。不能和
             OR标签同时设定。

        •  apply:决定了模型的应用及其属性。可以拥有单一模型或者模型数组以及它的属性。如果被设置为数组,将通过给出的选项随机选择一个模型,每个选项都被指定了不同的
          标签。

          •  A model:包含模型的属性,如果不止一个模型用于同一个变种。替代所有在游戏中指定的模型。

            •  model:指定模型文件的路径,起始于assets/minecraft/models/block

            •  x:模型相对于x轴的旋转,90度增量。

            •  y:模型相对于y轴的旋转,90度增量。

            •  uvlock:可为truefalse(默认)。设置为true将锁定方块贴图的旋转。这样贴图将不会在使用上面的
               x
               y标签时跟着方块旋转。

            •  weight:设置模型在游戏中被选用的几率,默认为1(=100%)。如果多于一个模型被用作同一个变种,每个模型被选中的几率将会为此模型的weight除以所有模型weight的总和。(例如,三个weight分别为1,1和2的模型。他们weight的总和为4(1+1+2)。这三个模型被调用的几率则分别为1/4,1/4和2/4,也可以说为25%,25%和50%。)

          •  model:指定模型文件的路径,起始于assets/minecraft/models/block

          •  x:模型相对于x轴的旋转,90度增量。

          •  y:模型相对于y轴的旋转,90度增量。

          •  uvlock:可为truefalse(默认)。设置为true将锁定方块贴图的旋转。这样贴图将不会在使用上面的
             x
             y标签时跟着方块旋转。
"uvlock": true "uvlock": false
Uvlock true.png Uvlock false.png

示例:火把[编辑 | 编辑源代码]

火把有若干个变种: 它能被插在地上或墙上,而在墙上时火把还能朝向四个不同方向。以下这个示例取自文件 torch.json,你能在assets/minecraft/blockstates路径下找到该文件。

File: torch.json

{
    "variants": {
        "facing=up": { "model": "normal_torch" },
        "facing=east": { "model": "normal_torch_wall" },
        "facing=south": { "model": "normal_torch_wall", "y": 90 },
        "facing=west": { "model": "normal_torch_wall", "y": 180 },
        "facing=north": { "model": "normal_torch_wall", "y": 270 }
    }
}

"facing=up" 指的是火把立在地上的那个变种,该变种连接到与它对应的模型 "normal_torch"。而火把又能被插在方块的四个侧面上,所以自然又需要四个不同的变种,每个侧面都得有一个变种。这四个变种分别叫作"facing=east""facing=west""facing=south" 以及 "facing=north".。四个变种的模型都用的是 "normal_torch_wall" , 但这个模型因 "y" 设置的数值而在y轴方向上旋转了几个90度,这样被插在不同侧面上的火把看起来才都十分协调。

示例:草方块[编辑 | 编辑源代码]

草方块有两个变种,第一个变种有四个不同的模型。以下这个示例取自文件 grass.json,你能在 assets/minecraft/blockstates路径下找到该文件。

File: grass.json

{
    "variants": {
        "snowy=false": [
            { "model": "grass_normal" },
            { "model": "grass_normal", "y": 90 },
            { "model": "grass_normal", "y": 180 },
            { "model": "grass_normal", "y": 270 }
        ],
        "snowy=true":  { "model": "grass_snowed" }
    }
}

不被雪所覆盖的草方块 ("snowy=false") 拥有四个模型, 这四个模型都使用的是同一个方块模型,但模型被旋转了几个90度。因为有四个模型而其中任何一个都没用上 weight标签,所以在你放置一个(无雪的)草方块的时候,每个模型都有25%的几率被使用,也就是说这个草方块朝向东南西北任何一个方向都有可能。

示例:橡木栅栏[编辑 | 编辑源代码]

橡木栅栏使用了 multipart 这个格式.。以下这个示例取自 assets/minecraft/blockstates路径下的文件 fence.json

{
    "multipart": [
        {   "apply": { "model": "oak_fence_post" }},
        {   "when": { "north": "true" },
            "apply": { "model": "oak_fence_side", "uvlock": true }
        },
        {   "when": { "east": "true" },
            "apply": { "model": "oak_fence_side", "y": 90, "uvlock": true }
        },
        {   "when": { "south": "true" },
            "apply": { "model": "oak_fence_side", "y": 180, "uvlock": true }
        },
        {   "when": { "west": "true" },
            "apply": { "model": "oak_fence_side", "y": 270, "uvlock": true }
        }
    ]
}

第一个模型,栅栏桩(the fence post),是一直使用着的,而其他模型只在某些情况下使用。栅栏边( the sides of the fence)只有在其他方块与该栅栏相邻时才出现 。 可栅栏边是有朝向的,于是栅栏边的模型就被旋转了几个90度来用,这样的话所需的模型数量就能减至两个了,一个是栅栏桩,一个是栅栏边。与在1.8中用到的5个模型、16个变种相比,这算是个相当大的改进了。

示例:红石线[编辑 | 编辑源代码]

红石线模型也使用了 multipart这个格式。以下这个示例取自 assets/minecraft/blockstates路径下的文件 redstone_wire.json

{
    "multipart": [
        {   "when": { "OR": [
                {"north": "none", "east": "none", "south": "none", "west": "none"},
                {"north": "side|up", "east": "side|up" },
                {"east": "side|up", "south": "side|up" },
                {"south": "side|up", "west": "side|up"},
                {"west": "side|up", "north": "side|up"}
            ]},
            "apply": { "model": "redstone_dot" }
        },
        {   "when": { "OR": [
                { "north": "side|up" },
                { "north": "none", "east": "none", "south": "side|up", "west": "none" }
            ]},
            "apply": { "model": "redstone_side0" }
        },
        {   "when": { "OR": [
                { "south": "side|up" },
                { "north": "side|up", "east": "none", "south": "none", "west": "none" }
            ]},
            "apply": { "model": "redstone_side_alt0" }
        },
        {   "when": { "OR": [
                { "east": "side|up" },
                { "north": "none", "east": "none", "south": "none", "west": "side|up" }
            ]},
            "apply": { "model": "redstone_side_alt1", "y": 270 }
        },
        {   "when": { "OR": [
                { "west": "side|up" },
                { "north": "none", "east": "side|up", "south": "none", "west": "none" }
            ]},
            "apply": { "model": "redstone_side1", "y": 270 }
        },
        {   "when": { "north": "up" },
            "apply": { "model": "redstone_up" }
        },
        {   "when": { "east": "up" },
            "apply": { "model": "redstone_up", "y": 90 }
        },
        {   "when": { "south": "up" },
            "apply": { "model": "redstone_up", "y": 180 }
        },
        {   "when": { "west": "up" },
            "apply": { "model": "redstone_up", "y": 270 }
        }
    ]
}

红石粉的模型是动态创建的。第一个条件决定了红石粉东、南、西、北四个方向都不被连接时,或当两个不相对的面为upside时,redstone_dot模型才被使用。

最后一种情况只检查一个条件,它检查west是否为up,如果是,则应用模型 redstone_up

方块模型[编辑 | 编辑源代码]

文件夹assets/minecraft/models/block保存所有变种指定的模型文件。 可以更改文件的名称,但必须对应于方块状态文件中使用的名称。


  • 根标签

    •  parent:assets/minecraft/models引用其他模型。如果同时设置了"parent""elements",此模型的"elements" 标签将覆盖父类模型""parent下的"elements"标签。
      • 可以设置为"builtin/generated"以使用从指定图标创建的模型。请注意,仅支持一层,且只能通过方块状态文件来实现旋转。

    •  ambientocclusion:是否使用环境遮挡,默认为 true

    •  display: 保存物品模型于不同位置下的显示设置。

      •  thirdperson_righthand, thirdperson_lefthand, firstperson_righthand, firstperson_lefthand, gui, head, ground, or fixed: 物品模型于不同位置下的显示设置。设置分别为旋转,位移和缩放。 fixed 指的是当被摆放在物品展示框上时,其他的显示位置如同其名。值得注意的是位移比旋转优先应用模型。

        •  rotation: 根据 [x, y, z] 格式,使模型相对于对应轴进行旋转。

        •  translation: 根据 [x, y, z] 格式,使模型相对于对应轴进行移动。若数值大于80,数值则为80。若数值小于-80,数值则为-80。

        •  scale: 根据 [x, y, z] 格式,使模型相对于对应轴进行缩放。若数值大于4,数值则为4。

    •  textures: 模型材质的路径,起始于assets/minecraft/textures,也可以是另一个材质变量。

      •  particle: 模型的粒子材质。如果你在下界传送门,将会使用此材质。注意:所有非模型的方块的粒子破坏效果为硬编码。

      •  A texture variable: 定义一个贴图的名字和此贴图的文件路径。

    •  elements: 包含模型的所有"An element",这些元素只能为立方体形态。如果同时设置了"parent""elements",此模型的"elements" 标签将覆盖父类模型""parent下的"elements"标签。

      •  An element

        •  from: 根据 [x, y, z] 格式,指定一个方块的起始点。数值必须为-16到32之间。

        •  to: 根据 [x, y, z] 格式,指定一个方块的结束点。数值必须为-16到32之间。

        •  rotation:"element"的旋转设置。

          •  origin: [x, y, z]所旋转的原点/中心点,默认为[8, 8, 8]

          •  axis: 旋转的一个且只能为一个轴,可以为"x""y""z"

          •  angle: 旋转的角度。可以为45到-45度,以22.5度为增量。默认为0。

          •  rescale: 是否缩放为整块。可以为"true""false"。默认为"false"

        •  shade: 是否渲染阴影。可以为"true""false"。默认为"true"

        •  faces: 包含单个"element"的所有面。若有一个面没有定义,则不渲染此面。

          •  down, up, north, south, west or east: 包含指定面的所有属性。

            •  uv: 根据 [x1, y1, x2, y2] 格式,指定所使用的贴图区域。如果没指定,则默认根据此element的xyz坐标设置。若此element低于0或高于16,则指定的默认贴图将会不一致。若x1x2坐标对调,贴图也将会被翻转(例:从原本的0, 0, 16, 16变为16, 0, 0, 16)。UV为可设置项,若未指定,则会自动根据element的位置生成。

            •  texture: 指定所使用的贴图变量,变量前加上#。贴图变量于"A texture variable"定义。

            •  cullface: 指定当前面在指定的面被方块接触时,是否不渲染。指定的面可以为:down, up, north, south, west, 或 east。同时当前面的亮度计算等同于指定的面,若未设置,默认为side。

            •  rotation: 根据特定的角度旋转贴图。可以为0,90,180或270。默认为0。旋转不会影响到uv所指定的贴图部分,而是此部分的旋转角度。

            •  tintindex: 是否使用硬编码着色贴图。默认不使用着色和任何着色数值。注意只有特定方块可以着色,其他方块设置此项无效。

示例:直立的火把[编辑 | 编辑源代码]

为简单起见,此示例只介绍直立的火把,代码由储存于assets/minecraft/models/block中的文件torch.jsonnormal_torch.json定义。

File: torch.json

{
    "ambientocclusion": false,
    "textures": {
        "particle": "#torch"
    },
    "elements": [
        {   "from": [ 7, 0, 7 ],
            "to": [ 9, 10, 9 ],
            "shade": false,
            "faces": {
                "down": { "uv": [ 7, 13, 9, 15 ], "texture": "#torch" },
                "up":   { "uv": [ 7,  6, 9,  8 ], "texture": "#torch" }
            }
        },
        {   "from": [ 7, 0, 0 ],
            "to": [ 9, 16, 16 ],
            "shade": false,
            "faces": {
                "west": { "uv": [ 0, 0, 16, 16 ], "texture": "#torch" },
                "east": { "uv": [ 0, 0, 16, 16 ], "texture": "#torch" }
            }
        },
        {   "from": [ 0, 0, 7 ],
            "to": [ 16, 16, 9 ],
            "shade": false,
            "faces": {
                "north": { "uv": [ 0, 0, 16, 16 ], "texture": "#torch" },
                "south": { "uv": [ 0, 0, 16, 16 ], "texture": "#torch" }
            }
        }
    ]
}

此文档被用于创建火把的模型,此模型被普通火把和红石火把使用。因此"elements"标签下创建了三个element,或者说立方体。因为只定义了两个面,所以每个立方体只有两个面会在游戏里被渲染。"uv"指定了材质所使用的区域。材质变量"#torch"用于指定方块的粒子贴图和立方体定义的材质,虽然这里的"#torch"还未定义路径。

File: normal_torch.json

{
    "parent": "block/torch",
    "textures": {
        "torch": "blocks/torch_on"
    }
}

此文件为普通火把的地上摆放模型。会先读取并继承其父类文件"parent"(torch.json)下的定义。然后给予父类文件下材质路径定义,定义为普通火把的材质路径(定义路径时不需要#)。自此,这个普通火把的模型就为父类定义的模型,而材质和粒子贴图则为自己定义的路径材质。

示例: 标准方块[编辑 | 编辑源代码]

此示例为Minecraft里大部分方块的基本结构。这部分方块使用同一个基本模型,以此模型定义他们的材质,如上例子。此cube.json示例取自assets/minecraft/models/block

File: cube.json

{
    "elements": [
        {   "from": [ 0, 0, 0 ],
            "to": [ 16, 16, 16 ],
            "faces": {
                "down":  { "texture": "#down", "cullface": "down" },
                "up":    { "texture": "#up", "cullface": "up" },
                "north": { "texture": "#north", "cullface": "north" },
                "south": { "texture": "#south", "cullface": "south" },
                "west":  { "texture": "#west", "cullface": "west" },
                "east":  { "texture": "#east", "cullface": "east" }
            }
        }
    ]
}

上文中提到过的将不会再复述。使用"cullface": "down"会在方块底面有相邻方块时,不渲染此面。其他几个面同理。

示例:树苗[编辑 | 编辑源代码]

此示例为所有树苗使用的基本结构(无需为树苗指定材质)。此模型为cross.json,材质(假设)就会在oak_sapling.json里被定义。这两个文件都存放在assets/minecraft/models/block文件夹下。

File: cross.json

{
    "ambientocclusion": false,
    "textures": {
        "particle": "#cross"
    },
    "elements": [
        {   "from": [ 0.8, 0, 8 ],
            "to": [ 15.2, 16, 8 ],
            "rotation": { "origin": [ 8, 8, 8 ], "axis": "y", "angle": 45, "rescale": true },
            "shade": false,
            "faces": {
                "north": { "uv": [ 0, 0, 16, 16 ], "texture": "#cross" },
                "south": { "uv": [ 0, 0, 16, 16 ], "texture": "#cross" }
            }
        },
        {   "from": [ 8, 0, 0.8 ],
            "to": [ 8, 16, 15.2 ],
            "rotation": { "origin": [ 8, 8, 8 ], "axis": "y", "angle": 45, "rescale": true },
            "shade": false,
            "faces": {
                "west": { "uv": [ 0, 0, 16, 16 ], "texture": "#cross" },
                "east": { "uv": [ 0, 0, 16, 16 ], "texture": "#cross" }
            }
        }
    ]
}

一个普通的树苗形状,为两个element片旋转45度。因此要把原点和指定的旋转轴设置为对应的数值,然后角度设为45,并把"rescale"设置为true"rescale": true的作用是让旋转之后的贴图拉伸为旋转前的宽度(见下图)。

"rescale": true "rescale": false
Block model rescale true.png Block model rescale false.png

物品模型[编辑 | 编辑源代码]

因为物品模型没有变种,所以没有设置变种的必要。文件路径assets/minecraft/models/item下存放着所有的物品模型文件。文件的名字为硬编码,因此不应修改文件名。

  • 根标签

    •  parent:assets/minecraft/models引用其他模型。如果同时设置了"parent""elements",此模型的"elements" 标签将覆盖父类模型""parent下的"elements"标签。
      • 可以设置为"builtin/generated"以使用从指定图标创建的模型。
      • 可以设置为"builtin/entity"以加载实体模型。你不可以指定使用的实体模型,同时并不适用于所有物品(仅适用于箱子末影箱生物头颅盾牌旗帜)。
      • 设置为"builtin/compass""builtin/clock"用于指南针

    •  textures: 模型材质的路径,起始于assets/minecraft/textures,也可以是另一个材质变量。

      •  layer#: Only used to specify the icon of the item used in the inventory. There can be more than just one layer (e.g. for spawn eggs), but the amount of possible layers is hardcoded for each item. Only works in combination with "builtin/generated".

      •  particle: What texture to load particles from. Used to determine the "crumb" particles generated by food items, as well as to determine the barrier particle (but it always uses items/barrier.png as blockbreaking particle), which otherwise will use "layer0".

      •  A texture variable: Defines a texture variable and assigns it a texture.

    •  elements: Contains all the elements of the model. They can only have cubic forms. Cannot be set along side "parent".

      •  An element

        •  from: 根据 [x, y, z] 格式,指定一个方块的起始点。数值必须为-16到32之间。

        •  to: 根据 [x, y, z] 格式,指定一个方块的结束点。数值必须为-16到32之间。

        •  rotation: Defines the rotation of an element.

          •  origin: Sets the center of the rotation according to the scheme [x, y, z], defaults to [8, 8, 8].

          •  axis: Specifies the direction of rotation, can be "x", "y" or "z".

          •  angle: Specifies the angle of rotation. Can be 45 through -45 degrees in 22.5 degree increments. Defaults to 0.

        •  faces: Holds all the faces of the cube. If a face is left out, it will not be rendered.

          •  down, up, north, south, west or east: Contains the properties of the specified face.

            •  uv: Defines the area of the texture to use according to the scheme [x1, y1, x2, y2]. If unset, it defaults to values equal to xyz position of the element. The texture behavior will be inconsistent if UV extends below 0 or above 16. If the x or y number are swapped, the texture will be flipped in that direction. UV is optional, and if not supplied it will automatically generate based on the element's position.

            •  texture: Specifies the texture in form of the texture variable prepended with a #.

            •  cullface: Specifies whether a face does not need to be rendered when there is a block touching it in the specified position. The position can be: down, up, north, south, west, or east. It will also determine which side of the block to use the light level from for lighting the face, and if unset, defaults to the side.

            •  rotation: Rotates the texture in increments of 90 degrees.

            •  tintindex: Determines whether to tint the texture using a hardcoded tint index. The default is not using the tint, and any number causes it to use tint (except for spawn eggs, where 0 causes it to use the first color, and 1 causes it to use the second color). Note that only certain items or certain layers of items (e.g. potions) have a tint index, all others will be unaffected.

    •  display: Holds the different places where item models are displayed.

      •  thirdperson_righthand, thirdperson_lefthand, firstperson_righthand, firstperson_lefthand, gui, head, ground, or fixed: Place where an item model is displayed. Holds its rotation, translation and scale for the specified situation. fixed refers to item frames, while the rest are as their name states.

        •  rotation: Specifies the rotation of the model according to the scheme [x, y, z].

        •  translation: Specifies the position of the model according to the scheme [x, y, z]. If the value is greater than 80, it is displayed as 80. If the value is less then -80, it is displayed as -80.

        •  scale: Specifies the scale of the model according to the scheme [x, y, z]. If the value is greater than 4, it is displayed as 4.

    •  overrides: Determines cases which a different model should be used based on item tags.

      •  a case A single case.

        •  predicate: Holds the cases.

          •  a case A single case tag. See item tags for a full list of available tags.

        •  model: The path to the model to use if the case is met, starting in assets/minecraft/models/

物品标签[编辑 | 编辑源代码]

Some items support additional tags for model overrides. Below is a full list of available tags.

  • "angle": Used on compasses to determine the current angle, expressed in a decimal value of less than one.
  • "blocking": Used on shields to determine if currently blocking. If 1, the player is blocking.
  • "broken": Used on Elytra to determine if broken. If 1, the Elytra is broken.
  • "cast": Used on fishing rods to determine if the fishing rod has been cast. If 1, the fishing rod has been cast.
  • "cooldown": Used on ender pearls and chorus fruit to determine the remaining cooldown, expressed in a decimal value between 0 and 1.
  • "damage": Used on items with durability to determine the amount of damage, expressed in a decimal value between 0 and 1.
  • "damaged": Used on items with durability to determine if it is damaged. If 1, the item is damaged. Note that if an item has the unbreakable tag, this may be 0 while the item has a non-zero "damage" tag.
  • "lefthanded": Determines the model used by left handed players. It will affect the item they see in inventories, along with the item players see them holding or wearing.
  • "pull": Determines the amount a bow has been pulled, expressed in a decimal value of less than one.
  • "pulling": Used on bows to determine if the bow is being pulled. If 1, the bow is currently being pulled.
  • "time": Used on clocks to determine the current time, expressed in a decimal value of less than one.

Example: Torch[编辑 | 编辑源代码]

This example describes the torch as an item. The model can be found in the torch.json, which is stored in the folder assets/minecraft/models/item.

File: torch.json

{
    "parent": "builtin/generated",
    "textures": {
        "layer0": "blocks/torch_on"
    },
    "display": {
        "thirdperson": {
            "rotation": [ -90, 0, 0 ],
            "translation": [ 0, 1, -3 ],
            "scale": [ 0.55, 0.55, 0.55 ]
        },
        "firstperson": {
            "rotation": [ 0, -135, 25 ],
            "translation": [ 0, 4, 2 ],
            "scale": [ 1.7, 1.7, 1.7 ]
        }
    }
}

The "parent"-tag uses "builtin/generated", so that game uses the standard model of the torch, which has been generated out of the 2D graphic used for the item icon. The icon is specified with the "layer0"-tag and the texture, that has already been used for the block model, is used for the icon as well. As there is just one layer hard coded for the torch, there cannot be any more layers added. Furthermore, the display properties for the torch are specified, so that it will be displayed correctly in every possible situation. The torch cannot be placed on a players head and uses the specified icon in the inventory, so there is no need to adjust the model for these situations. To line the model up with the players hand in first and third person view, the model needs to be rotated, moved and scaled, which is done for each of the two situation separately.

示例:钓鱼杆[编辑 | 编辑源代码]

此处以1.9钓鱼竿为例。 The model can be found in the fishing_rod.json, which is stored in the folder assets/minecraft/models/item.

{
    "parent": "item/handheld_rod",
    "textures": {
        "layer0": "items/fishing_rod_uncast"
    },
    "overrides": [
        {
            "predicate": {
                "cast": 1
            },
            "model": "item/fishing_rod_cast"
        }
    ]
}

In this model, the normal model is overridden if the fishing rod is cast, causing it to instead display the model "item/fishing_rod_cast"

History[编辑 | 编辑源代码]

正式版本
1.7.2 13w36a Flowers are now discentered like tall grass.
1.8 14w06a Added custom block models.
14w07a Rewrote the model format. Instead of having just "planes", it now has "planes" and "cubes". The rotation of objects was also limited to one directional rotation per object in increments of 22.5 degrees.
14w11a Lighting on solid block no longer makes inner sections completely black.
14w11b Generic blocks now load models instead of pre-defined shapes.
April 12, 2014 TheMogMiner posts about upcoming changes to the model format.
14w17a Converted most of the remaining static blocks to the model format.
Added "rotateVariantTextures" to preserve uv details through rotation.
14w25a Removed the directional attribute from the uv definition and replaced it with explicit texture references. "textureFacing" was replaced with "texture" parameter which is prepended with the hash symbol (#).
"useAmbientOcclusion" renamed to "ambientocclusion"
"rotateVariantTextures" renamed to "UV lock"
"cull" renamed to "cullface", specifies the opposite of which neighboring face causes culling to occur
Rotation made more verbose, it is now more clear that it can only occur on a single axis. Example, the rotation for one of the two faces of the "cross" model is now: "rotation": { "origin": [ 8, 8, 8 ], "axis": "y", "angle": 45, "rescale": true },
The folder models/blocks/meshes was removed and model files are now stored in models/block.
The folder blockstates was added and stores the model selection files previously found in models/block.
The model format now supports custom item models.
14w27a Replaced block state names with data which better reflects the internal data. Does not yet reflect all data for some blocks. Will switch to using the actual stored data in a future version when numerical data values are completely dropped in favor of block states.
14w27b The block state files now support an array of models allowing for random models.
14w30a Added the item model "builtin/entity".
1.8.2 pre5 The tag "translation" is now limited to the range of -24 to 24.
The tag "scale" is now limited to 4 or less.
1.9 15w31a UV is now optional, and if not supplied it will automatically generate based on the element's position.
Different models/textures for different damage values, item states, and whether the player is left handed. This works on compasses, clocks, and anything that can have a durability bar. It also contains additional tags for bows and fishing rods.
Models can be put together based on block state attributes, such as fences. As a result, the vanilla set of block models was reduced by almost 300 models.
Block model JSON is now strict, comments and quoteless identifiers are not allowed.
"display" tag defaults have changed, and the "thirdperson" and "firstperson" tags were replaced with "thirdperson_righthand", "thirdperson_lefthand", "firstperson_righthand", and "firstperson_lefthand".
"parent" and "elements" tags can coexist now, though the top level elements tag overwrites all former ones.
Removed the option to disable alternate block models.