import { world, system, Dimension } from "@minecraft/server"
import { ActionFormData } from "@minecraft/server-ui"


let ui
let customUi;

world.afterEvents.worldLoad.subscribe(() => {
  ui = new ActionFormData()
    .title("Form")
    .body("")
    .button("Balls")


  customUi = new ActionFormData()
    .title("Skibidi")
    .body("")
    .button("Grip")
});

world.afterEvents.itemUse.subscribe(({ source, itemStack }) => {
  switch (itemStack.typeId) {
    case 'ssia:attachment': customUi.show(source).then(({ canceled, Selection }) => {
      if (canceled) return;
      switch (r.selection) {
        case 0:
          openGripMenu(source)
          break;
      }
    })

  }
});

function openGripMenu(source) {
}

world.afterEvents.worldLoad.subscribe(() => {
  const overworld = world.getDimension('overworld');
  openGripMenu('overworld');
});