door_handler: type: world debug: false events: on player enters cuboid: - if !: - stop - announce "note name: " - define door_ent ]||null> - announce "door_ent: <[door_ent]>" # If the door is not already open, open it: - if <[door_ent].flag[door.opened]||false> || <[door_ent]> == null: - stop - flag <[door_ent]> door.opened:true - adjust <[door_ent]> interpolation_duration:<[door_ent].flag[door.speed]> - adjust <[door_ent]> interpolation_start:3t - wait 0.1s - announce "side: <[door_ent].flag[door.side]> width: <[door_ent].flag[door.width]>" # - adjust <[door_ent]> translation:].left[<[door_ent].flag[door.width]>]> if:<[door_ent].flag[door.side].equals[left]> # - adjust <[door_ent]> translation:].right[<[door_ent].flag[door.width]>]> if:<[door_ent].flag[door.side].equals[right]> # - adjust <[door_ent]> translation:].up[<[door_ent].flag[door.height]>]> if:<[door_ent].flag[door.side].equals[up]> # - adjust <[door_ent]> translation:].down[<[door_ent].flag[door.height]>]> if:<[door_ent].flag[door.side].equals[down]> - adjust <[door_ent]> translation:].left[<[door_ent].flag[door.width].mul[1.01]>]> if:<[door_ent].flag[door.side].equals[left]> - adjust <[door_ent]> translation:].right[<[door_ent].flag[door.width].mul[1.01]>]> if:<[door_ent].flag[door.side].equals[right]> - adjust <[door_ent]> translation:].up[<[door_ent].flag[door.height].mul[1.01]>]> if:<[door_ent].flag[door.side].equals[up]> - adjust <[door_ent]> translation:].down[<[door_ent].flag[door.height].mul[1.01]>]> if:<[door_ent].flag[door.side].equals[down]> - wait <[door_ent].flag[door.speed].sub[0.1]> #- teleport <[door_ent]> <[door_ent].add[<[door_ent].translation>]> #- adjust <[door_ent]> translation: - ~modifyblock <[door_ent].flag[door.barrier_area].blocks[barrier]> air - announce "finished" on player exits cuboid: - if !: - stop - define door_ent ]||null> - announce "exit door area" # If the door is not already open, open it: - if !<[door_ent].flag[door.opened]||true> || <[door_ent]> == null: - stop - wait 2t - if !: - stop - flag <[door_ent]> door.opened:false - adjust <[door_ent]> interpolation_duration:<[door_ent].flag[door.speed]> - adjust <[door_ent]> interpolation_start:3t - wait 0.1s - adjust <[door_ent]> translation: - wait <[door_ent].flag[door.speed].sub[0.1]> - ~modifyblock <[door_ent].flag[door.barrier_area].blocks[air]> barrier - announce "finished"