
Lv.1
在 【教程】森林速建代码 中回复
更新的代码发一遍
async function wo(){
let start_x = 116;
let start_z = 0;
let end_x = 256;
let end_z = 256;
let jian=0;
let iii = 0;
let leaf = 'green_leaf';
for(let x = start_x;x<end_x;x++){
for(let z = start_z;z<end_z;z++){
jian++;
iii++;
if(jian == 50){
let a = Math.floor(start_x+Math.random()*(end_x-start_x));
let b = Math.floor(Math.random()*end_z);
let l = Math.floor(14+Math.random()*10);
for(let y = 9;y<l;y++){
voxels.setVoxel(a,y,b,'wood');
};
let 喵 = 9+Math.random()*9;
let nb = Math.random()*3;
let 喵 = Math.random()*2;
if(iii>1){
for(let ggg = 9; ggg < 喵; ggg++){
voxels.setVoxel(a+喵,ggg-nb,b,'wood');
voxels.setVoxel(a-喵,ggg-nb,b,'wood');
voxels.setVoxel(a,ggg-nb,b+喵,'wood');
voxels.setVoxel(a,ggg-nb,b-喵,'wood');
};
};
voxels.setVoxel(a,l,b,leaf);
let g = Math.floor(1+Math.random());
let hhhhdapple = Math.floor(1+Math.random())*(Math.random()*5);
for(let leaf_x = a;leaf_x<a+g*(Math.random()*5)+1;leaf_x++){
for(let hhhh = b;hhhh<b+1+hhhhdapple;hhhh++){
voxels.setVoxel(leaf_x+Math.floor(Math.random()*2),l,hhhh,leaf);
for(let jj =l;jj<l+Math.random()*3;jj++){
voxels.setVoxel(leaf_x+Math.floor(Math.random()*2),jj,hhhh,leaf);
};
};
for(let hhhh1 = b;hhhh1>b-1-hhhhdapple;hhhh1--){
voxels.setVoxel(leaf_x+Math.floor(Math.random()*2),l,hhhh1,leaf);
for(let jjj =l;jjj<l+Math.random()*3;jjj++){
voxels.setVoxel(leaf_x+Math.floor(Math.random()*2),jjj,hhhh1,leaf);
};
};
};
for(let leaf_x1 = a;leaf_x1>a-g*(Math.random()*5)-1;leaf_x1--){
for(let hhhh11 = b;hhhh11<b+1+hhhhdapple;hhhh11++){
voxels.setVoxel(leaf_x1-Math.floor(Math.random()*2),l,hhhh11,leaf);
for(let jjjj =l;jjjj<l+Math.random()*3;jjjj++){
voxels.setVoxel(leaf_x1-Math.floor(Math.random()*2),jjjj,hhhh11,leaf);
};
};
for(let hhhh111 = b;hhhh111>b-1-hhhhdapple;hhhh111--){
voxels.setVoxel(leaf_x1-Math.floor(Math.random()*2),l,hhhh111,leaf);
for(let jjjjj =l;jjjjj<l+Math.random()*3;jjjjj++){
voxels.setVoxel(leaf_x1-Math.floor(Math.random()*2),jjjjj,hhhh111,leaf);
};
};
};
jian = 0;
};
};
};
};
wo();2022-05-12T20:36:13 点赞:1
在 望给出攻击与回血代码感谢 中回复
//一个简单的射击PvP
world.onPlayerJoin(({ entity }) => {
entity.enableDamage = true;
entity.player.onPress(({ button, raycast:{ hitEntity, direction } }) => {
if (button !== 'action0' || !hitEntity) {
return;
}
hitEntity.velocity.x += direction.x;
hitEntity.velocity.y += 0.5;
hitEntity.velocity.z += direction.z;
hitEntity.hurt(20 * Math.random() + 5, {
attacker: entity,
});
});
});
world.onDie(({ entity, attacker }) => {
if (attacker) {
world.say(attacker.player.name + ' 喵ed ' + entity.player.name)
}
entity.player.forceRespawn();
});
world.onPlayerJoin(async({entity})=>{
while(!entity.player.dead){
if(entity.hp < entity.maxHp){
entity.hp+=10
await sleep(5000)
}else if(entity.hp >= entity.maxHp){
entity.hp = entity.maxHp
}
}
})
网站无法打开,只能写在这了(有BUG跟我说)
2022-07-01T12:25:29 点赞:0
在 请问谁会超时空对决中俯视视角的玩家位置??? 中回复
world.onPlayerJoin(({entity})=>{ entity.player.onPress(async({button})=>{ if(button==Box3ButtonType.ACTION1){ constlookTarget=newBox3Vector3(140,10,116); constlookEye=newBox3Vector3(140,330,116);(0,0,1)constlookUp=newBox3Vector3(1,0,0) entity.player.dialog({ type:Box3DialogType.TEXT, content:`俯视`, lookEye:lookEye, lookTarget:lookTarget, lookUp:lookUp}) } }) })//装载官方(懒得写了),怎么获取观看你自己调:https://docs.box3.codemao.cn(只是API,自己去找)
2022-07-01T12:34:25 点赞:0
在 【代码干货】管理系统 中回复
world.onChat(async({entity,message})=>{
if(message.startsWith('@添加管喵') && GUANLIYUAN.includes(entity.player.userKey)){
canInsert=['其他:查找名字']
canInsertuser=[]
for await(const findHave of db.sql`SELECT * FROM "admin"`){
if(findHave.isAdmin != '是' && findHave.isAuthor != '是'){
canInsert.push(findHave.name)
canInsertuser.push(findHave.userKey)
}
}
if(canInsert != ['其他:查找名字']){
const insert = await entity.player.dialog({
type:Box3DialogType.SELECT,
title:'系统',
content:'选择一个人',
options:canInsert
})
if(insert){
if(insert.value == '其他:查找名字'){
const insert_find = await entity.player.dialog({
type:Box3DialogType.INPUT,
title:'系统',
content:'请输入ta名字所包含的字符(可以全名)',
confirmText:'确定'
})
if(insert_find){
insert_findName = []
insert_findUser = []
for await(const insertSome of db.sql`SELECT * FROM "admin"`){
if(insertSome.isAdmin != '是' && insertSome.isAuthor != '是'){
insert_findName.push(insertSome.name)
insert_findUser.push(insertSome.userKey)
}
}
if(insert_findName){
const insert_find_who = await entity.player.dialog({
type:Box3DialogType.SELECT,
title:'系统',
content:'选择一个人',
options:insert_findName
})
if(insert_find_who){
const insert_find_ok = await entity.player.dialog({
type:Box3DialogType.SELECT,
title:'系统',
content:'是否将'+insert_find_who+'添加为管喵?',
options:['是','否']
})
if(insert_find_ok.value=='是'){
await db.sql`UPDATE "admin" SET "isAdmin" = '是' WHERE "userKey" = ${insert_findUser[insert_findName.indexOf(insert_find_who)]}`
world.say(insert_find_who.value+'被添加为管喵,记得不要乱用权限')
}
}
}else{
await entity.player.dialog({
type:Box3DialogType.TEXT,
title:'系统',
content:'没有名字包含'+insert_find+'的人'
})
}
}
}else{
const insertOK = await entity.player.dialog({
type:Box3DialogType.SELECT,
title:'系统',
content:'确定将'+insert.value+'添加为管喵?',
options:['是','不了']
})
if(insertOK){
if(insertOK.value=='是'){
await db.sql`UPDATE "admin" SET "isAdmin" = '是' WHERE "userKey" = ${canInsertuser[canInsert.indexOf(insert.value)-1]}`
world.say(insert.value+'被添加为管喵,记得不要乱用权限')
}
}
}
}
}else{
await entity.player.dialog({
type:Box3DialogType.TEXT,
title:'系统',
content:'没有新的人了'
})
}
}
if(message.startsWith('@删除管喵') && GUANLIYUAN.includes(entity.player.userKey)){
canInsert=['其他:查找名字']
canInsertuser=[]
for await(const findHave of db.sql`SELECT * FROM "admin"`){
if(findHave.isAdmin == '是' && findHave.isAuthor != '是'){
canInsert.push(findHave.name)
canInsertuser.push(findHave.userKey)
}
}
if(canInsert != ['其他:查找名字']){
const insert = await entity.player.dialog({
type:Box3DialogType.SELECT,
title:'系统',
content:'选择一个人',
options:canInsert
})
if(insert){
if(insert.value == '其他:查找名字'){
const insert_find = await entity.player.dialog({
type:Box3DialogType.INPUT,
title:'系统',
content:'请输入ta名字所包含的字符(可以全名)',
confirmText:'确定'
})
if(insert_find){
insert_findName = []
insert_findUser = []
for await(c喵t insertSome of db.sql`SELECT * FROM "admin"`){
if(insertSome.isAdmin == '是' && insertSome.isAuthor != '是'){
insert_findName.push(insertSome.name)
insert_findUser.push(insertSome.userKey)
}
}
if(insert_findName != ''){
c喵t insert_find_who = await entity.player.dialog({
type:Box3DialogType.SELECT,
title:'系统',
content:'选择一个人',
opti喵:insert_findName
})
if(insert_find_who){
c喵t insert_find_ok = await entity.player.dialog({
type:Box3DialogType.SELECT,
title:'系统',
content:'是否将'+insert_find_who+'从管理员列表删除?',
opti喵:['是','否']
})
if(insert_find_ok.value=='是'){
await db.sql`UPDATE "admin" SET "isAdmin" = '否' WHERE "userKey" = ${insert_findUser[insert_findName.indexOf(insert_find_who)]}`
world.say(insert_find_who.value+'被撤销管理员职位')
}
}
}else{
await entity.player.dialog({
type:Box3DialogType.TEXT,
title:'系统',
content:'没有名字包含'+insert_find+'的管理员'
})
}
}
}else{
c喵t insertOK = await entity.player.dialog({
type:Box3DialogType.SELECT,
title:'系统',
content:'确定将'+insert.value+'从管理员列表删除?',
opti喵:['是','不了']
})
if(insertOK){
if(insertOK.value=='是'){
await db.sql`UPDATE "admin" SET "isAdmin" = '否' WHERE "userKey" = ${canInsertuser[canInsert.indexOf(insert.value)-1]}`
world.say(insert.value+'被撤销管理员职位')
}
}
}
}
}else{
await entity.player.dialog({
type:Box3DialogType.TEXT,
title:'系统',
content:'你没有添加任何管理员'
})
}
}
})2022-07-20T17:47:01 点赞:0