猫史档案馆


FML饭米粒

FML饭米粒

Lv.1

半退……

获赞:464收藏:163浏览:6929作品收藏:176

签名:目标: 赞460/500 收藏168/200 再创作170/200 浏览6584/1w 粉丝792/1k 首页3/1 ✔ 称号潜力新星/进阶高手

回复帖子评论
上一页第 13 页 / 共 24 页下一页

在 【box3】神岛又双叒叕崩了啊啊啊啊 中回复

岛3唯一不出意外的就是每周日都出意外

2022-03-13T12:16:23 点赞:1

在 【岛3教程】SQL时间排行榜注释版! 中回复

改正建议:1.何必在onPlayerJoin里面套个onPlayerLeave呢?而且还不cancle,就等于每进一个人都要加一个检测 2.计时过于复杂,使用onTick更容易造成卡顿,建议改为进入时设置玩家变量startTime=newDate().valueOf()作为开始时间,结束后用newDate().valueOf()与开始时间做差即可,单位ms

2022-03-14T17:09:06 点赞:0

在 【喵】地图方块压缩代码+解码 中回复

world.say('开始保存');
let blocks = [];
function append(item) {
    if (blocks.length > 0 && blocks[blocks.length - 1][0] === item) {
        blocks[blocks.length - 1][1] += 1;
    }else {
        blocks.push([item, 1]);
    };
};
function forEach(fun) {
    for (let l of blocks) {
        for (let x = 0; x < l[1]; x++) {
            fun(l[0]);
        };
    };
};
let index = 0;
(async () => {
    for (y = 0; y < 128; y++) {
        for (x = 0; x < 128; x++) {
            for (z = 0; z < 128; z++) {
                append(voxels.getVoxel(x, y, z));
                index++;
                if (index % 20000 == 0) {
                    world.say(`保存中${index / 128 ** 3 * 100}%`);
                };
            };
        };
    };
    world.say('保存完毕');
})();
let t = [];
blocks.forEach((i) => {
    t.push([i[0], i[1]]);
});
global.saveBlocks = t;
























world.say('开始解码');
let index = 0;
let bolckIndex = 0;
let block = saveBlocks[0][0];
let lastIndex = saveBlocks[0][1];
(async () => {
    for (y = 0; y < 128; y++) {
        for (x = 0; x < 128; x++) {
            for (z = 0; z < 128; z++) {
                voxels.setVoxel(x, y, z, block);
                index++;
                if (index == lastIndex) {
                    bolckIndex++;
                    lastIndex += saveBlocks[bolckIndex][1];
                    block = saveBlocks[bolckIndex][0];
                };
                if (index % 200000 == 0){
                    world.say(`解码中${index / 128 ** 3 * 100}%`);
                }
            };
        };
    }
})();
world.say('解码完成');

2022-03-15T16:45:05 点赞:2

在 【代码岛3.0】奇葩的错误 中回复

这个嘛所有人离开地图等他个三分钟就好了

话说是不是你把他搞崩了

2022-03-18T17:29:11 点赞:0

在 代码岛又有bug了,吉吉喵快出来 中回复

说有bug三不要:

1不要不发报错内容

2不要不发报错代码

3不要不发报错链接

2022-03-18T17:30:32 点赞:0

在 【最新活动】喵啦!喵啦! 中回复

已投

2022-03-19T13:49:28 点赞:0

在 【神岛JS萌新教程】BoxJS 从入门到实战 第七期——另一种条件判断! 中回复

比如是

switch(a){

 case 1:

  world.say(1)

 case 2:

  world.say(2)

 case 3:

  world.say(3)

}

这个代码,都没有用break,当a=1时,会同时广播123,同理,为2时会广播23

也就是当表达式 case n相等时会一直运行到case n后面第一个break结束,不会继续判断

可以试试,这是个很好的例子

2022-03-21T17:16:50 点赞:1

在 关于box3建模保存后非常恼人的一些问题 中回复

确实

2022-03-25T22:01:59 点赞:0

在 【岛3】作品代码区常见的字母颜色 中回复

还有`$`中的$和'\'中的\都是红的

2022-03-28T16:49:19 点赞:0

在 【神岛JS萌新教程】BoxJS 从入门到实战 第九期——无所不能的函数(二) 中回复

注:箭头函数的格式如果是 leti=(a,b,c)=>a+b+c 不加return不会有bug 但是如果有{} leti=(a,b,c)=>{a+b+c} 不加return有时会出现解析错误(这东西我之前研究了半天,害的老惨了

2022-04-03T21:11:18 点赞:1

在 【关于神岛想要和不想要出图形化调查问卷】 中回复

4.不同意

2022-04-04T13:55:29 点赞:1

在 学习代码岛3.0 3D创作,台式电脑配置最低要怎么样的? 中回复

1.能上网

2.有Google浏览器(edge也不是不行

其他关系不大(体验感好不好的问题

2022-04-04T20:59:27 点赞:0

在 【岛三的奇妙bug】()()()()()()()()()()() 中回复

???

2022-04-05T11:51:19 点赞:0

在 kitten·43块积木计算出π 中回复

center_image

2022-04-06T16:49:01 点赞:1

在 紧急投票! 中回复

话说不清也给补偿吗

2022-04-06T16:54:05 点赞:0

在 我的无人机卡炮台底下了() 中回复

切换交互目标不会?(电脑“[”/“]”键)

2022-04-06T16:57:37 点赞:0

在 【神岛创作节】一起来二创叠buff,比赛进入倒计时~ 中回复

话说我找只因把猛鬼复制下,踢几个人不就行了嘛(bushi

2022-04-07T16:23:27 点赞:1

在 doge()()教你做动图 中回复

center_image

2022-04-11T17:20:23 点赞:0

在 求助:在文件里修改了模型后,如何应用????? 中回复

模型点开的界面的左边的最下面的那个点一下就是地图里的所有模型,也可以搜索(虽然有bug但往下还是找得到的

2022-04-14T16:56:43 点赞:0

在 吉吉你能解释一下吗…………封面哪里不合规了? 中回复

p过的就过不了审(原因:封面与内容不符),我就有过

2022-04-15T17:35:51 点赞:0

在 【装甲指挥官】晒出你的最强部队阵列 中回复

这个对新上手的很不友好。。。。。

2022-04-18T20:41:46 点赞:0

在 社区近期违规处罚公告 中回复

多发“与”Nemo端

不应该是“于”吗

2022-04-19T16:35:33 点赞:0

在 还不会把4.0变成3.0?看看这个! 中回复

但是会有些3.0不支持的代码啊

2022-04-20T17:04:43 点赞:1

在 [BOX3]Kick体验号优解 中回复

world.onPlayerJoin(({entity})=>{
    if(/^[code]+\d+\d+\d+\d+$/.test(entity.player.boxId)){ // 如果boxId格式为codexxxx(xxxx为数字)就代表是体验号
        entity.player.kick() // 再也不见
    }
})

2022-04-20T20:35:21 点赞:0

在 求做三道小学简单题) 中回复

我一个都不会是不是说明我才三年级。。。。

2022-04-22T20:06:23 点赞:1

在 【收徒学代码】 中回复

我我我我我我我我我我我我我

2022-04-27T17:01:44 点赞:0

在 【岛三】好像可以完善这些东西 中回复

建筑5,代码1.2.3好像都有了把

2022-04-28T16:34:05 点赞:0

在 求大神解答 中回复

没有区别(只是让你看着明显点而已

2022-04-30T13:11:41 点赞:0

在 【小鹰の代码课】第一期:对象的用法 中回复

建议不要用a,a1这种变量名,不利于他人理解你的代码

2022-05-02T08:04:23 点赞:1

在 【神岛教程】如何做出高空摔落 中回复

voxels.isFluid = (voxel) => { return ['water', 364, 'strawberry_juice', 412, 'lime_juice', 414, 'blueberry_juice', 416, 'lemon_juice', 418, 'grape_juice', 420, voxels.name(422), 422, voxels.name(424), 424, voxels.name(426), 426, voxels.name(428), 428, voxels.name(430), 430].includes(voxel) }
var xzCo = 0.44921875
var yCo = 1.6
world.onPlayerJoin(async ({ entity }) => {
    entity.enableDamage = true
    entity.maxHp = 100
    entity.hp = 100
    const g = voxels.getVoxel
    entity.fallHigh = 0
    entity.highY = entity.position.y
    entity.contactList = () => {
        return [
            g(entity.position.x + xzCo, entity.position.y - yCo, entity.position.z + xzCo),
            g(entity.position.x + xzCo, entity.position.y - yCo, entity.position.z - xzCo),
            g(entity.position.x - xzCo, entity.position.y - yCo, entity.position.z + xzCo),
            g(entity.position.x - xzCo, entity.position.y - yCo, entity.position.z - xzCo),
            g(entity.position.x + xzCo, entity.position.y - yCo, entity.position.z),
            g(entity.position.x - xzCo, entity.position.y - yCo, entity.position.z),
            g(entity.position.x, entity.position.y - yCo, entity.position.z + xzCo),
            g(entity.position.x, entity.position.y - yCo, entity.position.z - xzCo),
            g(entity.position.x, entity.position.y - yCo, entity.position.z)]
    }
    entity.ifContact = function () {
        for (const count of entity.
            contactList()) {
            if (count != 0) {
                if (voxels.isFluid(count)) {
                    this.fallHigh = 0
                    return false
                } return true
            }
        } return false
    }
    while (entity) {
        await sleep(64)
        if (entity.ifContact()) {
            if (voxels.isFluid(g(entity.position.x, entity.position.y - 1, entity.position.z))) continue
            if (entity.fallHigh > 6) {
                const hurt = entity.fallHigh / 3 * 18 * ~(world.gravity * 100) / 100
                entity.hurt(hurt)
                entity.player.directMessage(`你受到${hurt}点高空伤害`)
                entity.fallHigh = 0
            } else {
                entity.fallHigh = 0
            }
        } if (entity.highY > Math.floor(entity.position.y)) {
            entity.fallHigh += 1
            entity.highY = Math.floor(entity.position.y)
        } else {
            entity.highY = Math.floor(entity.position.y)
        }
    }
})
world.onFluidEnter(({ entity }) => {
    if (entity.isPlayer) entity.fallHigh = 0
})

修改了以下几点:

1.优化了格式,看起来更方便了

2.调高阈值,不然正常力度一个二段跳都能有接近10点伤害

3.稍微优化了代码

2022-05-02T20:58:11 点赞:5