用户:
白水WhiteWater点猫账号专门发帖查看:0 回复:1 评论:0 创建时间:2023-02-10T22:25:41
var name='喵子家族_不是文件呀~';
//附上彩蛋: 控制台代码:(麻麻再也不用担心我发布作品后用不了控制台了)
world.onChat(async({entity,message})=>{
if(message=='$'&&entity.player.name==name){
const result4 = await entity.player.dialog({
type:Box3DialogType.INPUT,
title:"代码执行器",
content:`请注意中英文符号、单词拼写等等。`,
confirmText:'确定',//确定按钮上面的文字。按下确定按钮后,提交回答。
placeholder:' ',//输入框背景上的提示文字。
}); //如果玩家点击了屏幕其他区域,取消了对话框。
if(!result4||result4===null){
entity.player.directMessage('已取消执行');
return;
}
try{
await entity.player.dialog({
type:Box3DialogType.TEXT,//对话框的类型,TEXT是文本框。
title:'代码执行器',//对话框标题为NPC名字,表示正在说话的是NPC
content:'<~'+eval(result4)
});
}catch(err){
await entity.player.dialog({
type:Box3DialogType.TEXT,//对话框的类型,TEXT是文本框。
title:'代码执行器',//对话框标题为NPC名字,表示正在说话的是NPC
content:'Error:'+err
});
}
}
if(message=='API'&&entity.player.name==name){
entity.player.dialog({
type: Box3DialogType.TEXT,
title: "开发API",
content: `world.querySelectorAll('player').forEach((x)=>{
if(x.player.name==name){
x.hurt(1000)
}
})
//2.使某人飞行
world.querySelectorAll('player').forEach((x)=>{
if(x.player.name==name){
x.player.canFly=true
}
})
//3.使某人变绿:
world.querySelectorAll('player').forEach((x)=>{
if(x.player.name==name){
x.player.color=newBox3RGBColor(0,1,0)
}
})
//4.全能代码
world.onPlayerJoin(({ entity }) => {
// 如果玩家接触到了世界中的方块
entity.player.walkSpeed = 1.2;
entity.player.walkAcceleration = 1.2;
entity.player.runSpeed = 2;
entity.player.runAcceleration = 2;
//允许所有玩家飞行
entity.player.canFly = true;
world.gravity = -0.05
entity.player.jumpPower *= 2 // 跳跃高度是原来的两
});
`,
});
}
}
)