#i need help fixing my custom item
1 messages · Page 1 of 1 (latest)
This is not needed here
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
The item shouldn’t be in the script, it should be in its own item file
It’s a custom item
BP/items
sorry im really bad with bridge
so should i just make a script in it?
im guessing a gametest script?
An item file, nothing to do with scripts
That code is for a custom item behavior. It has nothing to do with script api
move the item json to a json file in the BP/items directory
so u have the item.json then...
what about the arsenal_gui.json then
thats this
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"
}
}
BP
items//folder
arsenal_item.json//those json format
scripts//folder
main.js//the filre we should work on
manifest.json
ok
so i make a folder in the item.json called scripts and in that folder a script called main.js
wait wot
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
then
"entry": "scripts/main.js",
here
so i change that to the manifest?
ok
idk why theres no data module there
{
"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
{
"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"
}
]
}```
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
{
"format_version": "1.16.100",
"minecraft:item": {
"description": {
"identifier": "bridge:arsenal_gui",
"category": "nature"
},
"components": {
"minecraft:icon": {
"texture": "bridge_arsenal_gui"
}
}
{
"format_version": "1.16.100",
"minecraft:item": {
"description": {
"identifier": "bridge:arsenal_gui",
"category": "nature"
},
"components": {
"minecraft:icon": {
"texture": "bridge_arsenal_gui"
}
}
}
}```
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
wierd
i think its just discords formatting system
but where does the script go?
in ur main.js file
like this?
where
if item.typeId
yeh
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
u on pc?
laptop
i have 3 laptops set up next to each other for coding lol
this ones windows 8
i forgot how to setup with bridge, cus i didnt like using it
try exporting that pack
oh its an old error
so if i go into game it will have a custom item that opens a gui?
is it in mc's folder?
nice
?
did u enable beta api experiment?
"bridge:arsenal_gui"
?
also where does one form end bc i need to add the other forms into the one form
thats why i said my brain is hurting
if (item.typeId == "'bridge:arsenal_gui'") {
needs to be
if (item.typeId == "bridge:arsenal_gui") {
oh ok
do /reload in-game when u workin with scripts so its faster to test
can u edit it in dev folder?
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
Use
function openForm(source) {}
whats that
Just like mcfuntion
Jumping from function to other function
can u just make it open a form so i can just fill the buttons please
cause im really confused
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;
}
})
};
my brain just died
Basically jumping to the function is just
form1(player)
Something like that
U can use
if(selecttion == 1) form1(player)
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
Time to learn
Ig ima pull up some json style then
okay
just lmk when its done, tysm
also how can i put a lore on it and make it so you can only have one of it?
Wdym only have one?
of the custom item
Tag them...
what?
wym tag them
like how do i make the item be a max stack of 1
and how do i set a lore
In item.json
{
"format_version": "1.16.100",
"minecraft:item": {
"description": {
"identifier": "bridge:arsenal_gui",
"category": "nature"
},
"components": {
"minecraft:icon": {
"texture": "bridge_arsenal_gui"
}
}
}
}
I'm cookin mah chicken eggs
theres no lore here?
nice lol
{
"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"
}
}
}
}```
uhhh
imma leave it as that for now
but how do i do the lore?
please help
@warm obsidian
if (item.typeId == "bridge:arsenal_gui") {
if(item.getLore().length == 0) item.setLore(['whatev'])
where do i put that
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)
})
}
}
}
huh?
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)
}
})
welp, idk if u 'd get confused with lots of switch stuff
with this one, u just edit what the button do
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
first time?
wym
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
where
import * as ui from "@minecraft/server-ui";
import { world } from "@minecraft/server";
dropdownUI()
export function dropdownUI() {
...
try it
bruh
i recommend using vscode
remaking the mcpack everytime u change it is just not good
too much waste of time
after this
bc ive already made everything in bridge
i aint gonna switch mid project
anyways heres the code
Which folder/pack r u editing btw
{
"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
W8
Where is that pack located?
in my minecraft files?
what?
i changed the uuids and deleted the old pack
then i saved everything and imported that
Different pack name?
i can change the name if u want
alr i changed the name and uuids
now i delete the old pack and import this
Why still doing imports, when the pack is already in the folder...
Anyway, what's the results now
:/
im so confused
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
Doesn't matter
no it does
But the rp should work if ur using it
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
so all different?
Ye
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"
}
]
}
whats in ur rp
{
"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
wym
the rp doesnt have a dependency uuid
the bp*
"uuid": "771a3d0d-86f3-402f-b63d-0110bddd8354",
"version": [
0,
1,
0
],
Put it there
In the rp's dependency
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
Idk
would that not break it?
It won't
U have to manually add both packs
alr it works
but how do i get rid of the nature thing
it says nature when u hover over it
Edit the item's category in item.json
nvm its not working
still saying missing dependency