import { system, world, ItemStack} from "@minecraft/server";
import { ModalFormData, ActionFormData } from "@minecraft/server-ui";
let world = world.getDimension("overworld")
//gr_lab
system.runInterval(() =>{
for(let player of world.getPlayers()){
if(player.hasTag("gr_lab_interact")){
gr_lab_interact(player)
player.removeTag("gr_lab_interact")
}
}
function gr_lab_interact (player) {
const gui = new ActionFormData();
gui.button('Jump Up!', 'textures/gui/menu/jump_up_icon')
gui.button('Exit!', 'textures/gui/menu/exit_icon')
gui.show(player).then(result => {
if (result.selection === 1) {
jump_up(player)
}
if (result.selection === 4) {
exit(player)
}
}
)
}
function jump_up(player) {
player.runCommandAsync("event entity @e [family=wolf,c=1,r=5] gr_lab:to_jump_up");
}
function exit(player) {
player.runCommandAsync;
}
})
#entity interact not opening
1 messages · Page 1 of 1 (latest)
sorry... What?
This doesn't make sense.
The world is already a property of the server why make another variable that overwrites that? That ain't got.
that's bad...
now when I added more it stopped working
Why put function inside of a runtInterval?
¿
system.runInterval(() => {
for (const player of world.getPlayers()) {
if (player.hasTag('gr_lab_interact')) {
player.removeTag('gr_lab_interact');
gr_lab_interact(player);
}
}
});
function gr_lab_interact(player) {
const gui = new ActionFormData()
.button('Jump Up')
.button('Exit!');
gui.show(player).then(({ selection }) => {
switch (selection) {
case 1:
jump_up(player);
break;
case 4:
exit(player);
break;
default: break;
}
});
}
no errors but doesn't work