Skip to content

mcutils:cross_collision

Fence, Iron bars, and glass pane like behavior.

Registering

Before you can use this component you need to register it.

js
import { system } from "@minecraft/server";
import { CrossCollisionComponent } from "@lpsmods/mc-utils";

system.beforeEvents.startup.subscribe((event) => {
  event.blockComponentRegistry.registerCustomComponent(CrossCollisionComponent.typeId, new CrossCollisionComponent());
});

Requirements

Component

Options

NameTypeDefaultDescription
north_statestringmcutils:north
east_statestringmcutils:east
south_statestringmcutils:south
west_statestringmcutils:west

Examples

Fence

json
{
  "format_version": "1.21.100",
  "minecraft:block": {
    "description": {
      "identifier": "wiki:custom_fence",
      "states": {
        "mcutils:north": [false, true],
        "mcutils:south": [false, true],
        "mcutils:east": [false, true],
        "mcutils:west": [false, true]
      }
    },
    "components": {
      "minecraft:tick": {
        "interval_range": [0, 0],
        "looping": true
      },
      "mcutils:cross_collision": {
        "north_state": "mcutils:north",
        "east_state": "mcutils:east",
        "south_state": "mcutils:south",
        "west_state": "mcutils:west"
      }
    }
  }
}

Glass Pane

json
{
  "format_version": "1.21.100",
  "minecraft:block": {
    "description": {
      "identifier": "wiki:custom_glass_pane",
      "states": {
        "mcutils:north": [false, true],
        "mcutils:south": [false, true],
        "mcutils:east": [false, true],
        "mcutils:west": [false, true]
      }
    },
    "components": {
      "minecraft:tick": {
        "interval_range": [0, 0],
        "looping": true
      },
      "mcutils:cross_collision": {
        "north_state": "mcutils:north",
        "east_state": "mcutils:east",
        "south_state": "mcutils:south",
        "west_state": "mcutils:west"
      }
    }
  }
}

Not associated with or approved by Mojang Studios or Microsoft