Lv.1
在 如何按E打开背包 中回复
world.onPlayerJoin(async({entity})=>{
var playerbag=world.querySelector('#背包')
playerbag.enableInteract = true
playerbag.interactHint = ''
playerbag.interactRadius = 1000
playerbag.onInteract(async ({entity}) => {
var bagst = await entity.player.dialog({
type: Box3DialogType.SELECT,
title: `背包`,
titleTextColor: new Box3RGBAColor(0, 0, 0, 1),
titleBackgroundColor: new Box3RGBAColor(0, 0.3, 1, 1),
content: `坐标:${Math.round(entity.position.x)},${Math.round(entity.position.y)},${Math.round(entity.position.z)}
血量:${entity.maxHp}/${entity.hp}
饱食度:20/20
护甲值:0
盔甲韧性:0
效果`,
contentTextColor: new Box3RGBAColor(0, 0, 0, 1),
contentBackgroundColor: new Box3RGBAColor(1, 1, 1, 1),
options: ['快捷栏','物品栏','护甲'],
})
if(!bagst||bagst==null){
return
}
if(bagst.index==0){
var shortcut = await entity.player.dialog({
type: Box3DialogType.SELECT,
title: `快捷栏`,
titleTextColor: new Box3RGBAColor(0, 0, 0, 1),
titleBackgroundColor: new Box3RGBAColor(0, 0.3, 1, 1),
contentTextColor: new Box3RGBAColor(0, 0, 0, 1),
contentBackgroundColor: new Box3RGBAColor(1, 1, 1, 1),
options: [],
})
if(!shortcut||shortcut==null){
return
}
}else if(bagst.index==1){
var thing = await entity.player.dialog({
type: Box3DialogType.SELECT,
title: `物品栏`,
titleTextColor: new Box3RGBAColor(0, 0, 0, 1),
titleBackgroundColor: new Box3RGBAColor(0, 0.3, 1, 1),
contentTextColor: new Box3RGBAColor(0, 0, 0, 1),
contentBackgroundColor: new Box3RGBAColor(1, 1, 1, 1),
options: [],
})
if(!thing||thing==null){
return
}
}else if(bagst.index==2){
var armor = await entity.player.dialog({
type: Box3DialogType.SELECT,
title: `护甲`,
titleTextColor: new Box3RGBAColor(0, 0, 0, 1),
titleBackgroundColor: new Box3RGBAColor(0, 0.3, 1, 1),
contentTextColor: new Box3RGBAColor(0, 0, 0, 1),
contentBackgroundColor: new Box3RGBAColor(1, 1, 1, 1),
options: [],
})
if(!armor||armor==null){
return
}
}
})
})
这里你需要在地图里放一个模型,然后把这一行#后面的内容改为你模型的名字。比如你模型叫菜单就改为
var playerbag=world.querySelector('#菜单')
后面可以自己调参数
2023-02-06T17:03:02 点赞:0
在 吉吉旧版本活动你还出吗 中回复
编程猫社区自古以喵历了很多事。从MCmod到Dao3;从sciencescratch到kn……每年,社区都会有成百上千的帖顶上又沉下,有数以万计的作品和地图上首又下首。这是所有人共同造就的盛世,但古老的故事正在渐渐被遗忘……诚邀你加入‘编程猫社区历史记录计划’,守护我们共同的记忆。了解更多☞bcm.fandom.com/zh 1天前
2023-11-17T14:07:27 点赞:0