自定义釉面陶瓦
easy
格式要求 & 最低引擎版本 1.21.70
本教程假设您已掌握方块基础知识。 开始前请先阅读方块指南。
简介
釉面陶瓦拥有独特的旋转机制,玩家可用其打造墙面、地板和天花板的精美图案。本指南将指导您创建类似釉面陶瓦的自定义方块。
自定义釉面陶瓦
以下代码将创建具有原版特性的自定义釉面陶瓦。
BP/blocks/custom_glazed_terracotta.json
json
{
"format_version": "1.21.70",
"minecraft:block": {
"description": {
"identifier": "wiki:glazed_terracotta_template",
"menu_category": {
"category": "construction",
"group": "minecraft:itemGroup.name.glazedTerracotta"
},
"traits": {
"minecraft:placement_direction": {
"enabled_states": ["minecraft:cardinal_direction"]
}
}
},
"permutations": [
{
"condition": "q.block_state('minecraft:cardinal_direction') == 'north'",
"components": {
"minecraft:transformation": { "rotation": [0, 0, 0] },
"minecraft:geometry": {
"identifier": "geometry.glazed_terracotta",
"bone_visibility": {
"bottom_1": false,
"bottom_2": false,
"bottom_3": false,
"bottom_4": true
}
}
}
},
{
"condition": "q.block_state('minecraft:cardinal_direction') == 'west'",
"components": {
"minecraft:transformation": { "rotation": [0, 90, 0] },
"minecraft:geometry": {
"identifier": "geometry.glazed_terracotta",
"bone_visibility": {
"bottom_1": false,
"bottom_2": false,
"bottom_3": true,
"bottom_4": false
}
}
}
},
{
"condition": "q.block_state('minecraft:cardinal_direction') == 'south'",
"components": {
"minecraft:transformation": { "rotation": [0, 180, 0] },
"minecraft:geometry": {
"identifier": "geometry.glazed_terracotta",
"bone_visibility": {
"bottom_1": false,
"bottom_2": true,
"bottom_3": false,
"bottom_4": false
}
}
}
},
{
"condition": "q.block_state('minecraft:cardinal_direction') == 'east'",
"components": {
"minecraft:transformation": { "rotation": [0, -90, 0] },
"minecraft:geometry": {
"identifier": "geometry.glazed_terracotta",
"bone_visibility": {
"bottom_1": true,
"bottom_2": false,
"bottom_3": false,
"bottom_4": false
}
}
}
}
],
"components": {
"minecraft:geometry": {
"identifier": "geometry.glazed_terracotta"
},
"minecraft:material_instances": {
"*": {
"texture": "wiki:custom_glazed_terracotta",
"render_method": "opaque"
}
}
}
}
}几何模型
原版釉面陶瓦通过特定数值旋转方块的某些面,从而产生独特效果。使用以下几何模型可复现该特性。
几何模型JSON
RP/models/blocks/glazed_terracotta.geo.json
json
{
"format_version": "1.21.70",
"minecraft:geometry": [
{
"description": {
"identifier": "geometry.glazed_terracotta",
"texture_width": 16,
"texture_height": 16
},
"bones": [
{
"name": "glazed_terracotta",
"pivot": [0, 0, 0]
},
{
"name": "top",
"parent": "glazed_terracotta",
"pivot": [0, 0, 0],
"cubes": [
{
"origin": [-8, 0, -8],
"size": [16, 16, 16],
"uv": {
"up": { "uv": [16, 16], "uv_size": [-16, -16] }
}
}
]
},
{
"name": "north",
"parent": "glazed_terracotta",
"pivot": [0, 8, 0],
"cubes": [
{
"origin": [-8, 0, -8],
"size": [16, 16, 0],
"pivot": [0, 8, 0],
"rotation": [180, 0, 90],
"uv": {
"north": { "uv": [16, 16], "uv_size": [-16, -16] }
}
}
]
},
{
"name": "south",
"parent": "glazed_terracotta",
"pivot": [0, 0, 0],
"cubes": [
{
"origin": [0, -8, 8],
"size": [16, 16, 0],
"pivot": [0, 0, 0],
"rotation": [180, 0, 270],
"uv": {
"south": { "uv": [0, 0], "uv_size": [16, 16] }
}
}
]
},
{
"name": "east",
"parent": "glazed_terracotta",
"pivot": [0, 0, 0],
"cubes": [
{
"origin": [-8, -16, -8],
"size": [0, 16, 16],
"pivot": [0, 0, 0],
"rotation": [0, 0, -180],
"uv": {
"east": { "uv": [16, 16], "uv_size": [-16, -16] }
}
}
]
},
{
"name": "west",
"parent": "glazed_terracotta",
"pivot": [-16, 0, 0],
"cubes": [
{
"origin": [-24, 0, -8],
"size": [0, 16, 16],
"pivot": [-16, 0, 0],
"rotation": [0, 180, 0],
"uv": {
"west": { "uv": [16, 16], "uv_size": [-16, -16] }
}
}
]
},
{
"name": "bottom",
"parent": "glazed_terracotta",
"pivot": [0, 0, 0]
},
{
"name": "bottom_1",
"parent": "bottom",
"pivot": [0, 0, 0],
"cubes": [
{
"origin": [-8, 0, -8],
"size": [16, 0, 16],
"uv": {
"down": { "uv": [0, 0], "uv_size": [16, 16] }
}
}
]
},
{
"name": "bottom_2",
"parent": "bottom",
"pivot": [0, 0, 0],
"cubes": [
{
"origin": [-8, 0, -8],
"size": [16, 0, 16],
"uv": {
"down": { "uv": [16, 16], "uv_size": [-16, -16] }
}
}
]
},
{
"name": "bottom_3",
"parent": "bottom",
"pivot": [0, 0, 0],
"cubes": [
{
"origin": [-8, 0, -8],
"size": [16, 0, 16],
"uv": {
"down": { "uv": [0, 0], "uv_size": [16, 16] }
}
}
]
},
{
"name": "bottom_4",
"parent": "bottom",
"pivot": [0, 0, 0],
"cubes": [
{
"origin": [-8, 0, -8],
"size": [16, 0, 16],
"uv": {
"down": { "uv": [16, 16], "uv_size": [-16, -16] }
}
}
]
}
]
}
]
}
