#New to scripts, want to make a custom gui for my realm
1 messages · Page 1 of 1 (latest)
Example:
import { world, system, Player } from "@minecraft/server";
import { ActionFormData } from "@minecraft/server-ui";
world.beforeEvents.itemUse.subscribe((e) => {
if (e.itemStack.typeId == 'minecraft:compass')
system.run(() => { main(e.source) })
});
function main(player) {
const main = new ActionFormData();
main.title('example');
main.body('example body');
main.button('button', 'textures/path/example');
main.show(player).then(({ selection, canceled }) => {
if (canceled) return;
if (selection === 0) {
player.sendMessage('you clicked a button!')
player.playSound('random.levelup')
}
})
}
I’ve got an Admin Addon I could share with ya, doesn’t do everything you want but should give you a solid starting point. Mine has an option for spectator, an option to enable an on screen tps and mspt monitor, option to kill mobs within a range, kill items within a range, toggle greifing and there’s a little settings config for setting title colours and the title name from the form itself. Made it for my server admin so they could have similar tools used by X on hermitcraft for handling lag.
You should start learning programming basics: data types, variables, functions, loops, objects, object-oriented programming
I understand the majority of the basics, just no idea how to implement them
In that case, this can help you.
The wiki has complete info, idk how that makes easier to understand, but I guess it's up to you which is easier for you.
Also I see no difference, except they run the form using function. Nothing else.