#click on a block to open a form
1 messages · Page 1 of 1 (latest)
const form = new ActionFormData()
.title("Test")
.body("Description")
.button("§aHola");
world.events.entityHit.subscribe(({hitBlock, entity}) => {
if (hitBlock.typeId === "minecraft:block") {
form.show(entity)//...
}
});```
I tested it wasn't
I do it in two ways: the 1st is the one that is sampled, the top the 2nd is to add an event when interacting with the block, this event adds a tag to those who interact with the block, the API script detects and removes the tag and opens the form;
"minecraft:on_interact":{
"event" : "modedrna:open_window",
"target": "self"
}
},
"events": {
"modedrna:open_window": {
"run_command": {
"command": ["tag @p[tag=!window_open,tag=!open_window,r=5] add open_window"]
}
}
}```
system.runInterval(data=>{
for(const player of world.getPlayers()) {
if (player.hasTag('open_window')){
player.removeTag('open_window');
ModernaLoja(player,'','j');
break
}
}
},3)```
@rain mountain
what exactly did you test?