用户:
LOUISQII查看:13 回复:3 评论:13 创建时间:2022-11-15T08:28:21
到了冬天,我想把我的跑酷地面的水都弄成冰。用了代码之后,我以前的跑酷代码师碰到液体水才返回,现在的固体方块冰不行了。我在碰水喵的基础上改了一些: world.onPlayerJoin(({entity})=>{ world.onVoxelContact(({x,y,z,voxel})=>{ constvoxelName=voxels.name(voxel); if(voxelName==='ice'){ entity.position.copy(entity.player.spawnPoint) entity.position.y+=4 entity.player.directMessage('落冰回到最近的保存点') } }); }) 然后发布。结果,我发现地图的人多了好多。发布后我才知道(因为我这个图没有合作者),我这个代码一个人碰到了冰,其他人也跟着回到保存点。我试着这样: world.onPlayerJoin(({entity})=>{ if(!TEST_PLAYER.includes(entity.player.name))return world.onVoxelContact(({x,y,z,voxel})=>{ constvoxelName=voxels.name(voxel); if(voxelName==='ice'){ entity.position.copy(entity.player.spawnPoint) entity.position.y+=4 entity.player.directMessage('落冰回到最近的保存点') } }); }) 我不用发布都知道,这样肯定是不行的。 所以,我搞不出来和水一样效果的代码,请哪位大佬帮帮我。 被我用上的人我会给他所有的作品点赞,收藏;关注他的点猫和神岛账号 岛名:萌新代码师
LOUISQII又双叒叕被吃格式了。
代码如下:
第一次代码:
world.onPlayerJoin(({ entity }) => {
world.onVoxelContact(({ x, y, z, voxel }) => {
const voxelName = voxels.name(voxel);
if (voxelName === 'ice'){
entity.position.copy(entity.player.spawnPoint)
entity.position.y += 4
entity.player.directMessage('落冰回到最近的保存点')
}
});
})
第二次代码:
world.onPlayerJoin(({ entity }) => {
if (!TEST_PLAYER.includes(entity.player.name)) return
world.onVoxelContact(({ x, y, z, voxel }) => {
const voxelName = voxels.name(voxel);
if (voxelName === 'ice'){
entity.position.copy(entity.player.spawnPoint)
entity.position.y += 4
entity.player.directMessage('落冰回到最近的保存点')
}
});
})
点赞0
评论