Bedrock Snippets

Custom Trees

View Source

custom_trees > bp > blocks > custom_stripped_log.json

{
  "format_version": "1.20.30",
  "minecraft:block": {
    "description": {
      "identifier": "wiki:custom_stripped_log",
      "menu_category": {
        "category": "nature",
        "group": "itemGroup.name.log"
      },
      "states": {
        // Log direction state
        "wiki:axis": [0, 1, 2]
      }
    },
    "components": {
      "tag:log": {},
      "minecraft:unit_cube": {},
      // Sets different textures for sides and top/bottom of log
      "minecraft:material_instances": {
        "*": {
          "texture": "custom_stripped_log"
        },
        "ends": {
          "texture": "custom_stripped_log_top"
        },
        "up": "ends",
        "down": "ends"
      },
      "minecraft:destructible_by_mining": {
        "seconds_to_destroy": 1
      },
      // Sets log rotation on player placing
      "minecraft:on_player_placing": {
        "event": "wiki:set_axis"
      }
    },
    "events": {
      "wiki:set_axis": {
        "set_block_state": {
          "wiki:axis": "Math.floor(q.block_face / 2)"
        }
      }
    },
    "permutations": [
      {
        "condition": "q.block_state('wiki:axis') == 0",
        "components": {
          "minecraft:transformation": { "rotation": [0, 0, 0] }
        }
      },
      {
        "condition": "q.block_state('wiki:axis') == 1",
        "components": {
          "minecraft:transformation": { "rotation": [90, 0, 0] }
        }
      },
      {
        "condition": "q.block_state('wiki:axis') == 2",
        "components": {
          "minecraft:transformation": { "rotation": [0, 0, 90] }
        }
      }
    ]
  }
}
Copied to Clipboard