How to use vec3 - 10 common examples

To help you get started, we’ve selected a few vec3 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github PrismarineJS / mineflayer / test / externalTests / plugins / testCommon.js View on Github external
function placeBlock (slot, position, cb) {
    bot.setQuickBarSlot(slot - 36)
    // always place the block on the top of the block below it, i guess.
    const referenceBlock = bot.blockAt(position.plus(new Vec3(0, -1, 0)))
    bot.placeBlock(referenceBlock, new Vec3(0, 1, 0), cb)
  }
github PrismarineJS / mineflayer / test / externalTests / plugins / testCommon.js View on Github external
function placeBlock (slot, position, cb) {
    bot.setQuickBarSlot(slot - 36)
    // always place the block on the top of the block below it, i guess.
    const referenceBlock = bot.blockAt(position.plus(new Vec3(0, -1, 0)))
    bot.placeBlock(referenceBlock, new Vec3(0, 1, 0), cb)
  }
github PrismarineJS / mineflayer / test / externalTests / digEverything.js View on Github external
(cb) => {
      // TODO: find a better way than this setTimeout(cb,200);
      bot.test.placeBlock(36, bot.entity.position.plus(new Vec3(1, 0, 0)), () => {
        setTimeout(cb, 200)
      })
    },
    bot.test.clearInventory,
github PrismarineJS / flying-squid / test / portal_detector.js View on Github external
it("generate a portal", () => {
    assert.deepEqual(generatePortal(new Vec3(2,1,1),new Vec3(1,0,0),4,5),{
      bottom:generateLine(new Vec3(3,1,1),new Vec3(1,0,0),2),
      left:generateLine(new Vec3(2,2,1),new Vec3(0,1,0),3),
      right:generateLine(new Vec3(5,2,1),new Vec3(0,1,0),3),
      top:generateLine(new Vec3(3,5,1),new Vec3(1,0,0),2),
      air:generateLine(new Vec3(3,2,1),new Vec3(0,1,0),3).concat(generateLine(new Vec3(4,2,1),new Vec3(0,1,0),3))
    })
  });
});
github PrismarineJS / flying-squid / test / portal_detector.js View on Github external
it("generate a portal", () => {
    assert.deepEqual(generatePortal(new Vec3(2,1,1),new Vec3(1,0,0),4,5),{
      bottom:generateLine(new Vec3(3,1,1),new Vec3(1,0,0),2),
      left:generateLine(new Vec3(2,2,1),new Vec3(0,1,0),3),
      right:generateLine(new Vec3(5,2,1),new Vec3(0,1,0),3),
      top:generateLine(new Vec3(3,5,1),new Vec3(1,0,0),2),
      air:generateLine(new Vec3(3,2,1),new Vec3(0,1,0),3).concat(generateLine(new Vec3(4,2,1),new Vec3(0,1,0),3))
    })
  });
});
github PrismarineJS / flying-squid / test / portal_detector.js View on Github external
it("generate a portal", () => {
    assert.deepEqual(generatePortal(new Vec3(2,1,1),new Vec3(1,0,0),4,5),{
      bottom:generateLine(new Vec3(3,1,1),new Vec3(1,0,0),2),
      left:generateLine(new Vec3(2,2,1),new Vec3(0,1,0),3),
      right:generateLine(new Vec3(5,2,1),new Vec3(0,1,0),3),
      top:generateLine(new Vec3(3,5,1),new Vec3(1,0,0),2),
      air:generateLine(new Vec3(3,2,1),new Vec3(0,1,0),3).concat(generateLine(new Vec3(4,2,1),new Vec3(0,1,0),3))
    })
  });
});
github PrismarineJS / flying-squid / test / mineflayer.js View on Github external
it("can use /setblock",async() => {
      await once(bot, 'chunkColumnLoad');
      bot.chat('/setblock 1 2 3 95 0');
      let [,newBlock]=await once(bot,'blockUpdate:'+new Vec3(1,2,3),{array:true});
      assert.equal(newBlock.type,95);
    });
    it("can use /xp",async() => {
github PrismarineJS / flying-squid / src / lib / plugins / portal.js View on Github external
parse (str) {
      const pars = str.split(' ')
      if (pars.length !== 6) { return false }
      let [x, y, z, direction, width, height] = pars;
      [x, y, z] = [x, y, z].map((val, i) => serv.posFromString(val, player.position[['x', 'y', 'z'][i]]))
      const bottomLeft = new Vec3(x, y, z)
      if (direction !== 'x' && direction !== 'z') { throw new UserError('Wrong Direction') }
      direction = direction === 'x' ? new Vec3(1, 0, 0) : new Vec3(0, 0, 1)
      return { bottomLeft, direction, width, height }
    },
    async action ({ bottomLeft, direction, width, height }) {
github PrismarineJS / mineflayer / lib / plugins / spawn_point.js View on Github external
bot._client.on('spawn_position', (packet) => {
    bot.spawnPoint = new Vec3(packet.location.x, packet.location.y, packet.location.z)
    bot.emit('game')
  })
}
github PrismarineJS / flying-squid / src / lib / plugins / portal.js View on Github external
parse (str) {
      const pars = str.split(' ')
      if (pars.length !== 6) { return false }
      let [x, y, z, direction, width, height] = pars;
      [x, y, z] = [x, y, z].map((val, i) => serv.posFromString(val, player.position[['x', 'y', 'z'][i]]))
      const bottomLeft = new Vec3(x, y, z)
      if (direction !== 'x' && direction !== 'z') { throw new UserError('Wrong Direction') }
      direction = direction === 'x' ? new Vec3(1, 0, 0) : new Vec3(0, 0, 1)
      return { bottomLeft, direction, width, height }
    },
    async action ({ bottomLeft, direction, width, height }) {

vec3

3d vector math with good unit tests

BSD
Latest version published 4 months ago

Package Health Score

68 / 100
Full package analysis

Popular vec3 functions