#i need help fixing my custom item

1 messages · Page 1 of 1 (latest)

hoary mango
#

I need help with this:

#

@long sandal

long sandal
#

This is not needed here

hoary mango
#

thats the custom item

#

i want a custom item that activates it

#

all i did was make a blank item then i started coding the gui

#

idrk how to format it right

#

and i got confused making the gui bc i need the buttons to open other guis

#

my brain started hurting after the first button

long sandal
#

The item shouldn’t be in the script, it should be in its own item file

hoary mango
#

oh

#

should i move the script somewhere else?

long sandal
#

It’s a custom item

hoary mango
#

okay

#

where should i make the script then?

long sandal
#

BP/items

hoary mango
#

sorry im really bad with bridge

#

so should i just make a script in it?

#

im guessing a gametest script?

long sandal
#

An item file, nothing to do with scripts

hoary mango
#

oh?

#

wym

#

im confused

#

@long sandal

long sandal
#

That code is for a custom item behavior. It has nothing to do with script api

hoary mango
#

okay

#

so what do i make

idle dune
#

move the item json to a json file in the BP/items directory

hoary mango
#

whats items directory

#

i dont have that

#

just items then the arsenal_gui.json

warm obsidian
#

so u have the item.json then...

hoary mango
#

nothing

#

thats all

idle dune
hoary mango
#

i changed it to this

#

{
"format_version": "1.16.100",
"minecraft:item": {
"description": {
"identifier": "bridge:arsenal_gui",
"category": "nature"
},
"components": {
"minecraft:icon": {
"texture": "bridge_arsenal_gui"
}
}

warm obsidian
#
BP
  items//folder
    arsenal_item.json//those json format

  scripts//folder
    main.js//the filre we should work on

  manifest.json
hoary mango
#

ok

#

so i make a folder in the item.json called scripts and in that folder a script called main.js

idle dune
#

wait wot

warm obsidian
#

name it however u like

#

?manifest script

lucid jewelBOT
#
Script API manifest.json

v1.19.50.21+

{
    "format_version": 2,
    "header": {
        "name": "Bedrock Addons",
        "description": "Script API Template",
        "uuid": "bf67828b-e511-4c72-9922-b6dc179926f4",
        "version": [ 0, 1, 0 ],
        "min_engine_version": [ 1, 19, 50 ]
    },
    "modules": [
        {
            "type": "script",
            "language": "javascript",
            "uuid": "b7055392-4154-4aa8-813f-afa6291f1056",
            "entry": "scripts/server/script.js",
            "version": [ 0, 1, 0 ]
        }
    ],
    
    // to use eval() and Function()
    "capabilities": [ "script_eval" ],

    "dependencies": [
        {
            "module_name": "@minecraft/server",
            "version": "1.1.0-beta"
        },
        {
            "module_name": "@minecraft/server-ui",
            "version": "1.0.0-beta"
        }
    ]
}

?uuids in #bot-usage for the complete list of uuids

warm obsidian
#

then

"entry": "scripts/main.js",
hoary mango
#

what

#

im confused

warm obsidian
hoary mango
#

so i change that to the manifest?

warm obsidian
#

that's what ur manifest should look like

#

yes

hoary mango
#

ok

warm obsidian
#

idk why theres no data module there

hoary mango
#

{
"format_version": 2,
"header": {
"name": "Arsenal Prisons",
"description": "Arsenal Prisons GUI",
"uuid": "bf67828b-e511-4c72-9922-b6dc179926f4",
"version": [
0,
1,
0
],
"min_engine_version": [
1,
19,
50
]
},
"modules": [
{
"type": "script",
"language": "javascript",
"uuid": "b7055392-4154-4aa8-813f-afa6291f1056",
"entry": "scripts/server/script.js",
"version": [
0,
1,
0
]
}
],
"capabilities": [
"script_eval"
],
"dependencies": [
{
"module_name": "@royal vortex",
"version": "1.1.0-beta"
},
{
"module_name": "@sour meadow",
"version": "1.0.0-beta"
}
]
}

#

there

#

thats my manifest

warm obsidian
#
{
   "format_version": 2,
   "header": {
      "name": "Arsenal Prisons",
      "description": "Arsenal Prisons GUI",
      "uuid": "bf67828b-e511-4c72-9922-b6dc179926f4",
      "version": [
         0,
         1,
         0
      ],
      "min_engine_version": [
         1,
         19,
         50
      ]
   },
   "modules": [
      {
         "type": "data",
         "uuid": "9a233564-3117-44a9-894c-c1572c0d865c",
         "version": [
            0,
            1,
            0
         ]
      },
      {
         "type": "script",
         "language": "javascript",
         "uuid": "9a233564-3217-44a9-894c-c1572c0d865c",
         "entry": "scripts/main.js",
         "version": [
            0,
            1,
            0
         ]
      }
   ],
   "capabilities": [
      "script_eval"
   ],
   "dependencies": [
      {
         "module_name": "@minecraft/server",
         "version": "1.1.0-beta"
      },
      {
         "module_name": "@minecraft/server-ui",
         "version": "1.0.0-beta"
      }
   ]
}```
hoary mango
#

i changed it to what u sent

#

sorry about it not being in the right format btw, i dont know how to get the right upper commas

warm obsidian
#

dont worry

#

now, what does ur item.json look like

hoary mango
#

{
"format_version": "1.16.100",
"minecraft:item": {
"description": {
"identifier": "bridge:arsenal_gui",
"category": "nature"
},
"components": {
"minecraft:icon": {
"texture": "bridge_arsenal_gui"
}
}

warm obsidian
#
{
  "format_version": "1.16.100",
  "minecraft:item": {
    "description": {
      "identifier": "bridge:arsenal_gui",
      "category": "nature"
    },
    "components": {
      "minecraft:icon": {
        "texture": "bridge_arsenal_gui"
      }
    }
  }
}```
hoary mango
#

i changed it to what u sent

#

but bridge changed it a bit

#

{
"format_version": "1.16.100",
"minecraft:item": {
"description": {
"identifier": "bridge:arsenal_gui",
"category": "nature"
},
"components": {
"minecraft:icon": {
"texture": "bridge_arsenal_gui"
}
}
}
}

#

thats what bridge changed it to

#

oh wait

#

thats the same

#

well it looks different in bridge

#

like the "}"s are spaced out

warm obsidian
#

wierd

hoary mango
#

i think its just discords formatting system

warm obsidian
#

¯_(ツ)_/¯

#

alr, so now test it out

hoary mango
#

but where does the script go?

warm obsidian
#

in ur main.js file

hoary mango
#

so like this?

#

@warm obsidian

#

is that right

warm obsidian
#

add ) on end

#

and try it out

#

w8

hoary mango
warm obsidian
#

do 'bridge:arsenal_gui'

#

not minecraft:

hoary mango
#

where

warm obsidian
#

if item.typeId

hoary mango
#

oh i see

warm obsidian
#

yeh

hoary mango
#

ok

#

how do i get it to minecraft again?

#

i havent used bridge in ages

#

cause last time i used it, it didnt work

#

like first time it was working but it stopped updating the files

warm obsidian
#

u on pc?

hoary mango
#

laptop

#

i have 3 laptops set up next to each other for coding lol

#

this ones windows 8

warm obsidian
#

i forgot how to setup with bridge, cus i didnt like using it

#

try exporting that pack

hoary mango
#

whats that error?

warm obsidian
#

idk

#

find it

hoary mango
#

oh its an old error

#

so if i go into game it will have a custom item that opens a gui?

warm obsidian
#

is it in mc's folder?

hoary mango
#

item worked but the gui didnt even show

warm obsidian
#

nice

hoary mango
#

?

warm obsidian
#

did u enable beta api experiment?

hoary mango
#

yes

#

ill try again to make sure

#

just gimmi a bit cuz this laptop is sh!t

warm obsidian
#

"bridge:arsenal_gui"

hoary mango
#

still nothing and i had all these on

hoary mango
#

also where does one form end bc i need to add the other forms into the one form

warm obsidian
#

use " ' `

#

any of these

hoary mango
#

thats why i said my brain is hurting

warm obsidian
#
if (item.typeId == "'bridge:arsenal_gui'") {
#

needs to be

if (item.typeId == "bridge:arsenal_gui") {
hoary mango
#

oh ok

warm obsidian
#

do /reload in-game when u workin with scripts so its faster to test

hoary mango
#

ok

#

i need to readd the packs

#

1 sec

warm obsidian
#

can u edit it in dev folder?

hoary mango
#

alr the gui works but now i needa finish it

#

can u tell me where it ends bc all the brackets and sh!t are confusing me

#

cause i needa do all the other buttons

#

@warm obsidian

warm obsidian
#

Use

function openForm(source) {}
hoary mango
#

whats that

warm obsidian
#

Just like mcfuntion

hoary mango
#

okay

#

how do i use it

warm obsidian
#

Jumping from function to other function

hoary mango
#

can u just make it open a form so i can just fill the buttons please

#

cause im really confused

warm obsidian
#
import * as ui from "@minecraft/server-ui";
import { world, system } from "@minecraft/server";

let formTag = 'openForm'
world.events.beforeItemUseOn.subscribe(useOn=>{
    let {blockLocation,source: player} = useOn;
    let {dimension} = player;
    let block = dimension.getBlock(blockLocation);
    if (block.typeId !== 'minecraft:dirt' || player.hasTag(formTag)) return;
    player.addTag(formTag)
    form1(player)
    let timer = 1
    let sched_id = system.runSchedule(()=>{
        if (timer-- > 0) return;
        player.removeTag(formTag)
        system.clearRunSchedule(sched_id)
    },10)
})

function form1(player) {
    let form = new ui.ActionFormData()
    form.button('open 0')
    form.show(player).then(({selection})=>{
        switch (selection) {
            case 0:
                form2(player)
                break;
            default:
                break;
        }
    })
};

function form2(player) {
    let form = new ui.ActionFormData()
    form.button('open this form')
    form.button('return')
    form.show(player).then(({selection})=>{
        switch (selection) {
            case 0:
                form2(player)
                break;
            case 1:
                form1(player)
                break;
            default:
                break;
        }
    })
};
hoary mango
#

my brain just died

warm obsidian
#

It's old one,

#

Lol

hoary mango
#

okay

#

im guessing that dont work

warm obsidian
#

Basically jumping to the function is just

form1(player)
#

Something like that

#

U can use

if(selecttion == 1) form1(player)
hoary mango
#

can u make the 4 forms kinda like this

#

if (item.typeId == "bridge:arsenal_gui") {
form1.show(player).then(result => {
let selection = result.selection
if (selection == 0) {
form2.show(player).then(result => {
let selection = result.selection
if (selection == 0) {
player.runCommandAsync(
"tp @s SHOPCORDS"
)
player.sendMessage('§eTeleported To The Shop§f!')
}
if (selection == 1) {
player.runCommandAsync(
"tp @s MINECORDS"
)
player.sendMessage('§eTeleported To The Mines§f!')
}
if (selection == 2) {
player.runCommandAsync(
"tp @s -102 -41 -56"
)
player.sendMessage('§eTeleported To Spawn§f!')
}
})
}
})
}
})

#

bc idk how to do it bc i dont understand the brackets and sh!t

#

idk what ends where

#

or just do one atleast

#

so i can copy and paste that

#

please

#

just make button 2 of form 1 open form 3

#

and also close it

#

please and thank u

#

bc i really dont understand this tbh

vital halo
#

Time to learn

warm obsidian
#

Ig ima pull up some json style then

hoary mango
#

okay

hoary mango
#

also how can i put a lore on it and make it so you can only have one of it?

warm obsidian
#

Wdym only have one?

hoary mango
#

of the custom item

warm obsidian
#

Tag them...

hoary mango
#

what?

hoary mango
#

like how do i make the item be a max stack of 1

#

and how do i set a lore

warm obsidian
#

In item.json

hoary mango
#

ye ik

#

idk how to

warm obsidian
#

Lore prob in script

#

W8

hoary mango
#

{
"format_version": "1.16.100",
"minecraft:item": {
"description": {
"identifier": "bridge:arsenal_gui",
"category": "nature"
},
"components": {
"minecraft:icon": {
"texture": "bridge_arsenal_gui"
}
}
}
}

warm obsidian
#

I'm cookin mah chicken eggs

hoary mango
#

theres no lore here?

hoary mango
warm obsidian
#
{
    "format_version": "1.16.100",
    "minecraft:item": {
        "description": {
            "identifier": "bridge:arsenal_gui",
            "category": "nature"
        },
        "components": {
            "minecraft:hand_equipped": true,
            "minecraft:max_stack_size": 1,
            "minecraft:icon": {
                "texture": "bridge_arsenal_gui"
            }
        }
    }
}```
hoary mango
#

ty

#

wheres the lore?

#

@warm obsidian

warm obsidian
#

uhhh

hoary mango
#

but how do i do the lore?

#

please help

#

@warm obsidian

warm obsidian
#
if (item.typeId == "bridge:arsenal_gui") {
    if(item.getLore().length == 0) item.setLore(['whatev'])
hoary mango
#

where do i put that

#

done

#

finallly

warm obsidian
#
const Forms = {
    form1: {
        buttons: {//do stuff here
            "Warps": function (player) {
                player.sendMessage('Warps ')
                Forms.warpForm.show(player)
            },
            "Credits": function (player) {

            },
            "Close GUI": function (player) {

            }
        },
        show: function (player) {
            const pressed = []
            const form = new ui.ActionFormData()
                .title("Arsenal Prisons GUI")
                .body("Select The Option Youd Like To View")//dont add button here
                
                
            for (const key in this.buttons) {
                pressed.push(key)
                form.button(key)
            }
            form.show(player).then(res => {
                const { canceled, selection } = res;
                const key = pressed[selection]
                this.buttons[key](player)
            })
        }
    },
    warpForm: {
        buttons: {
            
        },
        show: function (player) {
            const pressed = []
            const form = new ui.ActionFormData()
                .title("Arsenal Prisons GUI")
                .body("Select The Option Youd Like To View")//dont add button here
                
                
            for (const key in this.buttons) {
                pressed.push(key)
                form.button(key)
            }
            form.show(player).then(res => {
                const { canceled, selection } = res;
                const key = pressed[selection]
                this.buttons[key](player)
            })
        }
    }
}
hoary mango
#

huh?

warm obsidian
#
world.events.beforeItemUse.subscribe(eventData => {
    let player = eventData.source
    let item = eventData.item

    if (item.typeId == "bridge:arsenal_gui") {
        if (item.getLore().length == 0) item.setLore(['whatev'])
        Forms.form1.show(player)
    }
})
hoary mango
#

what is that?

#

im so confused rn

warm obsidian
#

try it out, idk

#

@hoary mango thry this one

hoary mango
#

done

warm obsidian
#

welp, idk if u 'd get confused with lots of switch stuff

warm obsidian
hoary mango
#

brooo

#

i just put it in my realm

#

nothing happened

#

the item aint even in the creative menu

#

wtf

#

whys that??!

#

@warm obsidian

#

if even the item doesnt show then i just wasted so much time for nothing

warm obsidian
#

first time?

hoary mango
#

wym

warm obsidian
#
world.events.beforeItemUse.subscribe(eventData => {
    let player = eventData.source
    let item = eventData.item

    if (item.typeId == "bridge:arsenal_gui") {
        if (item.getLore().length == 0) item.setLore(['whatev'])
        Forms.form1.show(player)
    }
})
#

what did u use tho

hoary mango
#

where

warm obsidian
#

anyway

#

add

dropdownUI()
```at the bottom
#

or below the imports

hoary mango
#

wait what

#

where

warm obsidian
#
import * as ui from "@minecraft/server-ui";
import { world } from "@minecraft/server";

dropdownUI()
export function dropdownUI() {
...
hoary mango
#

like that?

warm obsidian
#

try it

hoary mango
#

okay

#

i needa generate new uuids

warm obsidian
#

bruh

#

i recommend using vscode

#

remaking the mcpack everytime u change it is just not good

#

too much waste of time

hoary mango
#

what is vscode

#

also it didnt work

echo depot
#

visual studio code

#

Download it

hoary mango
#

after this

#

bc ive already made everything in bridge

#

i aint gonna switch mid project

#

anyways heres the code

warm obsidian
#

Which folder/pack r u editing btw

hoary mango
#

whys the item not showing in my realm

#

wym

hoary mango
# hoary mango anyways heres the code

{
"format_version": "1.16.100",
"minecraft:item": {
"description": {
"identifier": "bridge:arsenal_gui",
"category": "nature"
},
"components": {
"minecraft:hand_equipped": true,
"minecraft:max_stack_size": 1,
"minecraft:icon": {
"texture": "bridge_arsenal_gui"
}
}
}
}

#

thats the item data

#

so how do i make it show in the realm

#

bc it aint showing

#

and idk why

echo depot
#

Don't put it in the js file

#

It's json not js

hoary mango
#

what

#

the item?

warm obsidian
#

U had that already set up

#

Oh

#

That should be in arsenal. Json

hoary mango
warm obsidian
#

W8

hoary mango
#

it is

#

i had that open

#

just it showed dif on the left bc i clicked on the script

warm obsidian
#

Where is that pack located?

hoary mango
#

in my minecraft files?

warm obsidian
#

U use that to import, right?

#

And not remaking the pack...

hoary mango
#

what?

#

i changed the uuids and deleted the old pack

#

then i saved everything and imported that

warm obsidian
#

Different pack name?

hoary mango
hoary mango
#

alr i changed the name and uuids

#

now i delete the old pack and import this

warm obsidian
#

Why still doing imports, when the pack is already in the folder...

hoary mango
#

wym

#

idk

warm obsidian
#

Anyway, what's the results now

hoary mango
#

testing

#

1 sec

#

wtf

#

bp is in the game but resource pack aint here

warm obsidian
#

:/

hoary mango
#

im so confused

hoary mango
#

should the rp and bp have same uuids or na

#

just making sure

#

i think its cause i never changed the rp uuids

#

@warm obsidian

warm obsidian
#

Doesn't matter

hoary mango
#

no it does

warm obsidian
#

But the rp should work if ur using it

hoary mango
#

bc if u dont change it the game thinks its the same pack and it doesnt update

#

should the uuids be dif or the same

warm obsidian
#

Ehh, I'd just use unique ones

#

That's why they're called uuid

hoary mango
#

so all different?

warm obsidian
#

Ye

hoary mango
#

Yo i just got it into game but it has no picture and the name is "item.bridge:arsenal_gui"

#

whys it doing that??

#

@warm obsidian

#

i need help fixing my custom item

#

{
"format_version": "1.16.100",
"minecraft:item": {
"description": {
"identifier": "bridge:arsenal_gui",
"category": "nature"
},
"components": {
"minecraft:icon": {
"texture": "bridge_arsenal_gui"
}
}
}
}

#

imma set the item code to that and see if it works

#

also is my bp manifest supposed to look like this?

#

{
"format_version": 2,
"header": {
"name": "ArsenalP B",
"description": "Arsenal Prisons GUI",
"uuid": "771a3d0d-86f3-402f-b63d-0110bddd8354",
"version": [
0,
1,
0
],
"min_engine_version": [
1,
19,
50
]
},
"modules": [
{
"type": "data",
"uuid": "b638d1cf-2223-4f76-aa38-7d2e2c76ded9",
"version": [
0,
1,
0
]
},
{
"type": "script",
"language": "javascript",
"uuid": "02c054a1-698e-4ba3-826a-315234e8b51e",
"entry": "scripts/main.js",
"version": [
0,
1,
0
]
}
],
"capabilities": [
"script_eval"
],
"dependencies": [
{
"module_name": "@royal vortex",
"version": "1.1.0-beta"
},
{
"module_name": "@sour meadow",
"version": "1.0.0-beta"
}
]
}

warm obsidian
#

whats in ur rp

hoary mango
#

{
"format_version": 2,
"metadata": {
"authors": [
"D4RKMODZZZ"
],
"generated_with": {
"bridge": [
"2.6.0"
],
"dash": [
"0.10.8"
]
}
},
"header": {
"name": "ArsenalP R",
"description": "",
"min_engine_version": [
1,
19,
60
],
"uuid": "8dd4b24e-df66-4b54-a487-b2184c5cf67b",
"version": [
1,
0,
0
]
},
"modules": [
{
"type": "resources",
"uuid": "5d6c5bfe-3b7a-4a02-a999-5fff960abcd8",
"version": [
1,
0,
0
]
}
],
"dependencies": [
{
"uuid": "95a98bed-ff57-4898-9937-1792756791b5",
"version": [
1,
0,
0
]
}
]
}

#

i really dont know what to do bro

#

nothing im trying is working

#

@warm obsidian

warm obsidian
#

Try depending the rp to bp

#

I'm just tryna help, even tho idk much abt this issue

hoary mango
warm obsidian
#

Copy the bp's uuid to Rp's dependency

#

Same with version

hoary mango
#

im confused

#

which uuid

#

to what

hoary mango
#

the bp*

warm obsidian
#

Put it there

#

In the rp's dependency

hoary mango
#

its still not working, heres the rp manifest

#

{
"format_version": 2,
"metadata": {
"authors": [
"D4RKMODZZZ"
],
"generated_with": {
"bridge": [
"2.6.0"
],
"dash": [
"0.10.8"
]
}
},
"header": {
"name": "ArsenalP GUI R",
"description": "D4RKMODZZZ",
"min_engine_version": [
1,
19,
60
],
"uuid": "6f239c34-23c8-4527-85e0-5317dd500f0e",
"version": [
0,
1,
0
]
},
"modules": [
{
"type": "resources",
"uuid": "765f5fd1-b817-415b-b95f-d87192324670",
"version": [
0,
1,
0
]
}
],
"dependencies": [
{
"uuid": "771a3d0d-86f3-402f-b63d-0110bddd8354",
"version": [
0,
1,
0
]
}
]
}

#

and heres the bp manifest

#

{
"format_version": 2,
"header": {
"name": "ArsenalP B",
"description": "Arsenal Prisons GUI",
"uuid": "771a3d0d-86f3-402f-b63d-0110bddd8354",
"version": [
0,
1,
0
],
"min_engine_version": [
1,
19,
50
]
},
"modules": [
{
"type": "data",
"uuid": "b638d1cf-2223-4f76-aa38-7d2e2c76ded9",
"version": [
0,
1,
0
]
},
{
"type": "script",
"language": "javascript",
"uuid": "02c054a1-698e-4ba3-826a-315234e8b51e",
"entry": "scripts/main.js",
"version": [
0,
1,
0
]
}
],
"capabilities": [
"script_eval"
],
"dependencies": [
{
"module_name": "@royal vortex",
"version": "1.1.0-beta"
},
{
"module_name": "@sour meadow",
"version": "1.0.0-beta"
}
]
}

#

@warm obsidian

warm obsidian
#

Fine

#

Remove the dependencies of rp

hoary mango
#

?

#

why?

warm obsidian
#

Idk

hoary mango
#

would that not break it?

warm obsidian
#

It won't

hoary mango
#

but then the item wont have a picture

#

and the name will be fucked

warm obsidian
#

U have to manually add both packs

hoary mango
#

i always do that

#

are u sure that would work?

warm obsidian
#

Idk

#

How about make a new pack

hoary mango
#

okay...

#

do i just copy all the code?

warm obsidian
#

Yes

#

Except the manifest

#

Make new ones for each of em

hoary mango
#

alr it works

#

but how do i get rid of the nature thing

#

it says nature when u hover over it

warm obsidian
#

Edit the item's category in item.json

hoary mango
#

ik

#

do i just change it to the text i want?

hoary mango
#

nvm its not working

hoary mango
#

still saying missing dependency