コピー
{
"format_version": "1.16.100",
"minecraft:block": {
"description": {
"identifier": "ex:block16",
"properties": {
"ex:direction": [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 ]
}
},
"permutations": [
{
"components": {
"minecraft:entity_collision": { "origin": [ -2.0, 0.0, -2.0 ], "size": [ 4.0, 16.0, 4.0 ] },
"minecraft:pick_collision": { "origin": [ -2.0, 0.0, -2.0 ], "size": [ 4.0, 16.0, 4.0 ] }
},
"condition": "q.block_property('ex:direction') == 0"
},
{
"components": {
"minecraft:entity_collision": { "origin": [ -2.0, 0.0, -8.0 ], "size": [ 4.0, 16.0, 10.0 ] },
"minecraft:pick_collision": { "origin": [ -2.0, 0.0, -8.0 ], "size": [ 4.0, 16.0, 10.0 ] }
},
"condition": "q.block_property('ex:direction') == 1"
},
{
"components": {
"minecraft:entity_collision": { "origin": [ -8.0, 0.0, -2.0 ], "size": [ 10.0, 16.0, 4.0 ] },
"minecraft:pick_collision": { "origin": [ -8.0, 0.0, -2.0 ], "size": [ 10.0, 16.0, 4.0 ] }
},
"condition": "q.block_property('ex:direction') == 2"
},
{
"components": {
"minecraft:entity_collision": { "origin": [ -8.0, 0.0, -8.0 ], "size": [ 10.0, 16.0, 10.0 ] },
"minecraft:pick_collision": { "origin": [ -8.0, 0.0, -8.0 ], "size": [ 10.0, 16.0, 10.0 ] }
},
"condition": "q.block_property('ex:direction') == 3"
},
{
"components": {
"minecraft:entity_collision": { "origin": [ -2.0, 0.0, -2.0 ], "size": [ 4.0, 16.0, 10.0 ] },
"minecraft:pick_collision": { "origin": [ -2.0, 0.0, -2.0 ], "size": [ 4.0, 16.0, 10.0 ] }
},
"condition": "q.block_property('ex:direction') == 4"
},
{
"components": {
"minecraft:entity_collision": { "origin": [ -2.0, 0.0, -8.0 ], "size": [ 4.0, 16.0, 16.0 ] },
"minecraft:pick_collision": { "origin": [ -2.0, 0.0, -8.0 ], "size": [ 4.0, 16.0, 16.0 ] }
},
"condition": "q.block_property('ex:direction') == 5"
},
{
"components": {
"minecraft:entity_collision": { "origin": [ -8.0, 0.0, -2.0 ], "size": [ 10.0, 16.0, 10.0 ] },
"minecraft:pick_collision": { "origin": [ -8.0, 0.0, -2.0 ], "size": [ 10.0, 16.0, 10.0 ] }
},
"condition": "q.block_property('ex:direction') == 6"
},
{
"components": {
"minecraft:entity_collision": { "origin": [ -8.0, 0.0, -8.0 ], "size": [ 10.0, 16.0, 16.0 ] },
"minecraft:pick_collision": { "origin": [ -8.0, 0.0, -8.0 ], "size": [ 10.0, 16.0, 16.0 ] }
},
"condition": "q.block_property('ex:direction') == 7"
},
{
"components": {
"minecraft:entity_collision": { "origin": [ -2.0, 0.0, -2.0 ], "size": [ 10.0, 16.0, 4.0 ] },
"minecraft:pick_collision": { "origin": [ -2.0, 0.0, -2.0 ], "size": [ 10.0, 16.0, 4.0 ] }
},
"condition": "q.block_property('ex:direction') == 8"
},
{
"components": {
"minecraft:entity_collision": { "origin": [ -2.0, 0.0, -8.0 ], "size": [ 10.0, 16.0, 10.0 ] },
"minecraft:pick_collision": { "origin": [ -2.0, 0.0, -8.0 ], "size": [ 10.0, 16.0, 10.0 ] }
},
"condition": "q.block_property('ex:direction') == 9"
},
{
"components": {
"minecraft:entity_collision": { "origin": [ -8.0, 0.0, -2.0 ], "size": [ 16.0, 16.0, 4.0 ] },
"minecraft:pick_collision": { "origin": [ -8.0, 0.0, -2.0 ], "size": [ 16.0, 16.0, 4.0 ] }
},
"condition": "q.block_property('ex:direction') == 10"
},
{
"components": {
"minecraft:entity_collision": { "origin": [ -8.0, 0.0, -8.0 ], "size": [ 16.0, 16.0, 10.0 ] },
"minecraft:pick_collision": { "origin": [ -8.0, 0.0, -8.0 ], "size": [ 16.0, 16.0, 10.0 ] }
},
"condition": "q.block_property('ex:direction') == 11"
},
{
"components": {
"minecraft:entity_collision": { "origin": [ -2.0, 0.0, -2.0 ], "size": [ 10.0, 16.0, 10.0 ] },
"minecraft:pick_collision": { "origin": [ -2.0, 0.0, -2.0 ], "size": [ 10.0, 16.0, 10.0 ] }
},
"condition": "q.block_property('ex:direction') == 12"
},
{
"components": {
"minecraft:entity_collision": { "origin": [ -2.0, 0.0, -8.0 ], "size": [ 10.0, 16.0, 16.0 ] },
"minecraft:pick_collision": { "origin": [ -2.0, 0.0, -8.0 ], "size": [ 10.0, 16.0, 16.0 ] }
},
"condition": "q.block_property('ex:direction') == 13"
},
{
"components": {
"minecraft:entity_collision": { "origin": [ -8.0, 0.0, -2.0 ], "size": [ 16.0, 16.0, 10.0 ] },
"minecraft:pick_collision": { "origin": [ -8.0, 0.0, -2.0 ], "size": [ 16.0, 16.0, 10.0 ] }
},
"condition": "q.block_property('ex:direction') == 14"
},
{
"components": {
"minecraft:entity_collision": { "origin": [ -8.0, 0.0, -8.0 ], "size": [ 16.0, 16.0, 16.0 ] },
"minecraft:pick_collision": { "origin": [ -8.0, 0.0, -8.0 ], "size": [ 16.0, 16.0, 16.0 ] }
},
"condition": "q.block_property('ex:direction') == 15"
}
],
"components": {
"minecraft:geometry": "geometry.fence", // 全方向に伸びていてそれぞれの腕が別のボーン
"minecraft:material_instances": { // geometryを使う場合は必須
"*": {
"texture": "planks",
"render_method": "opaque"
}
},
"minecraft:part_visibility": { // ※ "q.block_property(ex:direction)"は0~15の整数
"rules": {
"north": "math.mod(q.block_property('ex:direction'), 2)", // 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1
"east": "math.mod(math.floor(q.block_property('ex:direction')/2), 2)", // 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1
"south": "math.mod(math.floor(q.block_property('ex:direction')/4), 2)", // 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1
"west": "q.block_property('ex:direction') > 7" // 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1
}
},
"minecraft:ticking": {
"looping": true,
"range": [ 0, 0 ],
"on_tick": { "event": "checking", "target": "self" }
}
},
"events": {
"checking": {
"set_block_property": { // 北 + 2×東 + 4×南 + 8×西 (それぞれの方角からつながってる(=1)かつながっていないか(=0)が返ってくる)
"ex:direction": "q.block_neighbor_has_any_tag(0,0,-1,'my_fence')+2*q.block_neighbor_has_any_tag(1,0,0,'my_fence')+4*q.block_neighbor_has_any_tag(0,0,1,'my_fence')+8*q.block_neighbor_has_any_tag(-1,0,0,'my_fence')"
}
}
}
}
}