diff --git a/.gitpod.yml b/.gitpod.yml index 38fc373b5..5a22d17a3 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -1,2 +1,3 @@ tasks: +- command: sdk install java < /dev/null # install java v20 - command: npm install diff --git a/docs/api.md b/docs/api.md index 0e09d2da7..9a14d5387 100644 --- a/docs/api.md +++ b/docs/api.md @@ -1354,6 +1354,12 @@ comparison. Note that `oldBlock` may be `null`. +#### "dimensionChange" (dimension) + +Emitted after the dimension the bot is in has changed. + + * `dimension` - The dimension that was switched to + #### "blockPlaced" (oldBlock, newBlock) Fires when bot places block. Both `oldBlock` and `newBlock` provided for diff --git a/index.d.ts b/index.d.ts index 36885d720..0a134cbc0 100644 --- a/index.d.ts +++ b/index.d.ts @@ -114,6 +114,7 @@ export interface BotEvents { playerLeft: (entity: Player) => Promise | void blockUpdate: (oldBlock: Block | null, newBlock: Block) => Promise | void 'blockUpdate:(x, y, z)': (oldBlock: Block | null, newBlock: Block | null) => Promise | void + dimensionChange: (dimension: Dimension) => Promise | void chunkColumnLoad: (entity: Vec3) => Promise | void chunkColumnUnload: (entity: Vec3) => Promise | void soundEffectHeard: ( diff --git a/lib/plugins/blocks.js b/lib/plugins/blocks.js index a92e7f858..91bc2bd5f 100644 --- a/lib/plugins/blocks.js +++ b/lib/plugins/blocks.js @@ -14,10 +14,10 @@ const paintingFaceToVec = [ new Vec3(1, 0, 0) ] -const dimensionNames = { - '-1': 'minecraft:nether', +const dimensionIdentifiers = { + '-1': 'minecraft:the_nether', 0: 'minecraft:overworld', - 1: 'minecraft:end' + 1: 'minecraft:the_end' } function inject (bot, { version, storageBuilder, hideErrors }) { @@ -493,7 +493,7 @@ function inject (bot, { version, storageBuilder, hideErrors }) { let worldName function dimensionToFolderName (dimension) { if (bot.supportFeature('dimensionIsAnInt')) { - return dimensionNames[dimension] + return dimensionIdentifiers[dimension] } else if (bot.supportFeature('dimensionIsAString') || bot.supportFeature('dimensionIsAWorld')) { return worldName } @@ -525,6 +525,8 @@ function inject (bot, { version, storageBuilder, hideErrors }) { bot.world = new World(null, storageBuilder ? storageBuilder({ version: bot.version, worldName: dimensionToFolderName(dimension) }) : null).sync startListenerProxy() } + console.log('[blocks] Emitting dim change', worldName) + bot.emit('dimensionChange', worldName.replace('minecraft:', '')) } bot._client.on('login', (packet) => { @@ -535,6 +537,7 @@ function inject (bot, { version, storageBuilder, hideErrors }) { dimension = packet.dimension worldName = /^minecraft:.+/.test(packet.worldName) ? packet.worldName : `minecraft:${packet.worldName}` } + console.log('[blocks] login', packet) switchWorld() }) @@ -542,6 +545,7 @@ function inject (bot, { version, storageBuilder, hideErrors }) { if (bot.supportFeature('dimensionIsAnInt')) { // <=1.15.2 if (dimension === packet.dimension) return dimension = packet.dimension + worldName = dimensionToFolderName(dimension) } else { // >= 1.15.2 if (dimension === packet.dimension) return if (worldName === packet.worldName && packet.copyMetadata === true) return // don't unload chunks if in same world and metaData is true @@ -549,6 +553,7 @@ function inject (bot, { version, storageBuilder, hideErrors }) { dimension = packet.dimension worldName = packet.worldName } + console.log('[blocks] respawn', packet) switchWorld() }) diff --git a/test/externalTest.js b/test/externalTest.js index 02cdbe44e..58044f4ce 100644 --- a/test/externalTest.js +++ b/test/externalTest.js @@ -94,8 +94,8 @@ for (const supportedVersion of mineflayer.testedVersions) { }, (err, results) => { if (err) return done(err) console.log('pong') - assert.ok(results.latency >= 0) - assert.ok(results.latency <= 1000) + assert.ok(results.latency >= 0, results.latency) + assert.ok(results.latency <= 1000, results.latency) begin() }) }) diff --git a/test/externalTests/bed.js b/test/externalTests/bed.js index 3f1e56267..6e12a1dea 100644 --- a/test/externalTests/bed.js +++ b/test/externalTests/bed.js @@ -22,7 +22,7 @@ module.exports = () => async (bot) => { await bot.test.wait(1000) console.log(bot.time.timeOfDay, bot.blockAt(bedPos1).name, bot.blockAt(bedPos2).name) - assert(bot.time.timeOfDay >= midnight) + assert(bot.time.timeOfDay >= midnight, `${bot.time.timeOfDay} >= ${midnight}`) assert(bot.blockAt(bedPos1).name.endsWith('bed')) assert(bot.blockAt(bedPos2).name.endsWith('bed')) diff --git a/test/externalTests/chat.js b/test/externalTests/chat.js index 0d41a9102..bafe0336f 100644 --- a/test/externalTests/chat.js +++ b/test/externalTests/chat.js @@ -69,7 +69,7 @@ module.exports = () => { bot.once('chat:test', listener) bot.chat('/tellraw @p {"translate":"chat.type.text", "with":["U9G", "Hello"]}') await once(bot, 'message') - assert.ok(triggered === false) + assert.strictEqual(triggered, false) bot.off('chat:test', listener) }) diff --git a/test/externalTests/commandBlock.js b/test/externalTests/commandBlock.js index 3004605fb..762430685 100644 --- a/test/externalTests/commandBlock.js +++ b/test/externalTests/commandBlock.js @@ -17,5 +17,5 @@ module.exports = () => async (bot) => { timeout: 5000, checkCondition: (message) => message.json.with[0] === command }) - assert(message.json.translate === 'advMode.setCommand.success') + assert.strictEqual(message.json.translate, 'advMode.setCommand.success') } diff --git a/test/externalTests/creative.js b/test/externalTests/creative.js index cb4c5f0e9..dd6a44e43 100644 --- a/test/externalTests/creative.js +++ b/test/externalTests/creative.js @@ -14,13 +14,13 @@ module.exports = () => async (bot) => { bot.creative.setInventorySlot(SLOT, item1) } catch (err) { assert.ok(err instanceof Error, 'The error has not been passed') - assert.ok(bot.inventory.slots[SLOT] == null) + assert.equal(bot.inventory.slots[SLOT], null) } // setting a slot once works await promise assert.ok(bot.inventory.slots[SLOT] != null) - assert.ok(bot.inventory.slots[SLOT].type === item2.type) + assert.strictEqual(bot.inventory.slots[SLOT].type, item2.type) // set the same item in the same slot again to ensure we don't hang const returnValue = await Promise.race([ bot.creative.setInventorySlot(SLOT, item2), diff --git a/test/externalTests/elytra.js b/test/externalTests/elytra.js index b79cc85b6..6e30120ed 100644 --- a/test/externalTests/elytra.js +++ b/test/externalTests/elytra.js @@ -10,7 +10,7 @@ module.exports = () => async (bot) => { await bot.test.setInventorySlot(6, new Item(bot.registry.itemsByName.elytra.id, 1)) if (supportsFireworkRockets) { const fireworkItem = bot.registry.itemsArray.find(item => item.displayName === 'Firework Rocket') - assert.ok(fireworkItem !== undefined) + assert.notStrictEqual(fireworkItem, undefined) await bot.test.setInventorySlot(36, new Item(fireworkItem.id, 64)) } await bot.test.teleport(bot.entity.position.offset(0, 100, 0)) @@ -35,7 +35,7 @@ module.exports = () => async (bot) => { } await bot.waitForTicks(3) let lateActivations = 0 - assert.ok(bot.fireworkRocketDuration > 0) + assert.ok(bot.fireworkRocketDuration > 0, `${bot.fireworkRocketDuration} > 0`) for (let i = bot.fireworkRocketDuration; i > 0; --i) { await bot.waitForTicks(1) assert.ok(bot.entity.elytraFlying) @@ -45,5 +45,5 @@ module.exports = () => async (bot) => { } assert.ok(lateActivations <= activationTicks) } - assert.ok(bot.fireworkRocketDuration === 0) + assert.strictEqual(bot.fireworkRocketDuration, 0) } diff --git a/test/externalTests/furnace.js b/test/externalTests/furnace.js index 37f32e685..6ac1746c8 100644 --- a/test/externalTests/furnace.js +++ b/test/externalTests/furnace.js @@ -44,8 +44,8 @@ module.exports = () => async (bot) => { // Wait and take the output and inputs await bot.test.wait(500) - assert(furnace.fuel > 0 && furnace.fuel < 1) - assert(furnace.progress > 0 && furnace.progress < 1) + assert(furnace.fuel > 0 && furnace.fuel < 1, furnace.fuel) + assert(furnace.progress > 0 && furnace.progress < 1, furnace.progress) await bot.test.wait(furnace.progressSeconds * 1000 + 500) assert.strictEqual(furnace.outputItem(), furnace.slots[2]) diff --git a/test/externalTests/nether.js b/test/externalTests/nether.js index c2560b302..0888924c9 100644 --- a/test/externalTests/nether.js +++ b/test/externalTests/nether.js @@ -1,52 +1,97 @@ const assert = require('assert') -const Vec3 = require('vec3') -const { once } = require('../../lib/promise_utils') +const { onceWithCleanup, sleep } = require('../../lib/promise_utils') +const { Vec3 } = require('vec3') -module.exports = () => async (bot) => { - // Test spawn event on death - const Item = require('prismarine-item')(bot.registry) +module.exports = (version) => { + async function runTest (bot, testFunction) { + await testFunction(bot) + } + + const tests = [] - let signItem = null - for (const name in bot.registry.itemsByName) { - if (name.includes('sign') && !name.includes('hanging')) signItem = bot.registry.itemsByName[name] + function addTest (name, f) { + tests[name] = bot => runTest(bot, f) } - assert.notStrictEqual(signItem, null) - - const p = new Promise((resolve, reject) => { - bot._client.on('open_sign_entity', (packet) => { - const sign = bot.blockAt(new Vec3(packet.location)) - bot.updateSign(sign, '1\n2\n3\n') - - setTimeout(() => { - // Get updated sign - const sign = bot.blockAt(bot.entity.position) - - assert.strictEqual(sign.signText.trimEnd(), '1\n2\n3') - - if (sign.blockEntity) { - // Check block update - bot.activateBlock(sign) - assert.notStrictEqual(sign.blockEntity, undefined) - } - - bot.test.sayEverywhere('/setblock ~ ~ ~ portal') - bot.test.sayEverywhere('/setblock ~ ~ ~ nether_portal') - once(bot, 'spawn').then(resolve) - }, 500) - }) + + addTest('spawn event on death and nether sign', async (bot) => { + // Test spawn event on death + const Item = require('prismarine-item')(bot.registry) + + let signItem = null + for (const name in bot.registry.itemsByName) { + if (name.includes('sign') && !name.includes('hanging')) signItem = bot.registry.itemsByName[name] + } + assert.notStrictEqual(signItem, null, 'Could not find sign item') + + await bot.waitForChunksToLoad() + bot.test.sayEverywhere('/setblock ~2 ~ ~ nether_portal') + bot.test.sayEverywhere('/setblock ~2 ~ ~ portal') + bot.test.sayEverywhere('/tp ~2 ~ ~') + await onceWithCleanup(bot, 'spawn') + + await bot.test.resetNetherRoofToBedrock() + bot.test.sayEverywhere('/tp ~ 128 ~') + await onceWithCleanup(bot, 'forcedMove') + await bot.waitForChunksToLoad() + + const lowerBlock = bot.blockAt(bot.entity.position.offset(0, -1, 0)) + await bot.lookAt(lowerBlock.position.offset(0.5, 0.5, 0.5), true) + + await bot.test.setInventorySlot(36, new Item(signItem.id, 1, 0)) + bot.placeBlock(lowerBlock, new Vec3(0, 1, 0)).catch(err => assert.rejects(err)) + + const [packet] = await onceWithCleanup(bot._client, 'open_sign_entity') + + console.log('[test/nether] Open Sign Packet', packet) + const sign = bot.blockAt(new Vec3(packet.location.x, packet.location.y, packet.location.z)) + bot.updateSign(sign, '1\n2\n3\n') + + await sleep(500) + // Get updated sign + const newSign = bot.blockAt(bot.entity.position) + + assert.strictEqual(newSign.signText.trimEnd(), '1\n2\n3') + + if (newSign.blockEntity) { + // Check block update + bot.activateBlock(newSign) + assert.notStrictEqual(newSign.blockEntity, undefined) + } + + // Get back to the overworld + bot.test.sayEverywhere('/tp ~ 128 ~') + await onceWithCleanup(bot, 'forcedMove') + await sleep(1000) + bot.test.sayEverywhere('/setblock ~ ~ ~ portal') + bot.test.sayEverywhere('/setblock ~ ~ ~ nether_portal') + await onceWithCleanup(bot, 'spawn') + await sleep(1000) }) - bot.test.sayEverywhere('/setblock ~ ~ ~ nether_portal') - bot.test.sayEverywhere('/setblock ~ ~ ~ portal') - await once(bot, 'spawn') - bot.test.sayEverywhere('/tp 0 128 0') + addTest('nether dimension change event', async (bot) => { + // Test dimension change event + const DimensionChangeTimeout = 10000 + bot.test.sayEverywhere('/setblock ~ ~ ~ nether_portal') + bot.test.sayEverywhere('/setblock ~ ~ ~ portal') + // Start listening for dimension change event + const dimensionChange = onceWithCleanup(bot, 'dimensionChange', { timeout: DimensionChangeTimeout }) + await onceWithCleanup(bot, 'spawn') - await once(bot, 'forcedMove') - await bot.waitForChunksToLoad() + const [dimensionName] = await dimensionChange + assert.equal(dimensionName, 'the_nether') + + // Get back to the overworld + await bot.test.resetNetherRoofToBedrock() + bot.test.sayEverywhere('/tp ~ 128 ~') + await onceWithCleanup(bot, 'forcedMove') + await sleep(1000) + bot.test.sayEverywhere('/setblock ~ ~ ~ portal') + bot.test.sayEverywhere('/setblock ~ ~ ~ nether_portal') + // Check that the dimension change event is fired again + const [dimensionName2] = await onceWithCleanup(bot, 'dimensionChange', { timeout: DimensionChangeTimeout }) + assert.equal(dimensionName2, 'overworld') + await sleep(1000) + }) - const lowerBlock = bot.blockAt(bot.entity.position.offset(0, -1, 0)) - await bot.lookAt(lowerBlock.position, true) - await bot.test.setInventorySlot(36, new Item(signItem.id, 1, 0)) - await bot.placeBlock(lowerBlock, new Vec3(0, 1, 0)) - return p + return tests } diff --git a/test/externalTests/placeEntity.js b/test/externalTests/placeEntity.js index c88b92a9f..7e63cd8c0 100644 --- a/test/externalTests/placeEntity.js +++ b/test/externalTests/placeEntity.js @@ -18,7 +18,7 @@ module.exports = (version) => { await bot.test.setBlock({ z: 1, relative: true, blockName: 'obsidian' }) await bot.test.awaitItemRecieved(`/give ${bot.username} end_crystal`) const crystal = await bot.placeEntity(bot.blockAt(bot.entity.position.offset(0, 0, 1)), new Vec3(0, 1, 0)) - assert(crystal !== null) + assert.ok(crystal) let name = 'EnderCrystal' if (bot.supportFeature('enderCrystalNameEndsInErNoCaps')) { name = 'ender_crystal' @@ -28,7 +28,7 @@ module.exports = (version) => { name = 'end_crystal' } const entity = bot.nearestEntity(o => o.name === name) - assert(entity?.name === name) + assert.strictEqual(entity?.name, name) bot.attack(entity) await once(bot, 'entityGone') await bot.test.setBlock({ z: 1, blockName: 'air', relative: true }) @@ -47,10 +47,10 @@ module.exports = (version) => { await placeBlocksForTest('water') await bot.test.awaitItemRecieved(`/give ${bot.username} ${bot.registry.oak_boat ? 'oak_boat' : 'boat'}`) const boat = await bot.placeEntity(bot.blockAt(bot.entity.position.offset(0, -1, -2)), new Vec3(0, -1, 0)) - assert(boat !== null) + assert.ok(boat) const name = bot.supportFeature('entityNameUpperCaseNoUnderscore') ? 'Boat' : 'boat' const entity = bot.nearestEntity(o => o.name === name) - assert(entity?.name === name) + assert.strictEqual(entity?.name, name) await placeBlocksForTest('air') bot.attack(entity) await once(bot, 'entityGone') @@ -71,10 +71,10 @@ module.exports = (version) => { } await bot.test.awaitItemRecieved(command) const zombie = await bot.placeEntity(bot.blockAt(bot.entity.position.offset(0, 0, 1)), new Vec3(0, 1, 0)) - assert(zombie !== null) + assert.ok(zombie) const name = bot.supportFeature('entityNameUpperCaseNoUnderscore') ? 'Zombie' : 'zombie' const entity = bot.nearestEntity(o => o.name === name) - assert(entity?.name === name) + assert.strictEqual(entity?.name, name) bot.chat(`/kill @e[type=${name}]`) // use /kill instead of bot.attack() because it takes more than one hit to kill await once(bot, 'entityGone') }) @@ -82,7 +82,7 @@ module.exports = (version) => { addTest('place armor stand', async (bot) => { await bot.test.awaitItemRecieved(`/give ${bot.username} armor_stand`) const armorStand = await bot.placeEntity(bot.blockAt(bot.entity.position.offset(0, 0, 1)), new Vec3(0, 1, 0)) - assert(armorStand !== null) + assert.ok(armorStand) let name if (bot.supportFeature('entityNameUpperCaseNoUnderscore')) { name = 'ArmorStand' @@ -92,7 +92,7 @@ module.exports = (version) => { name = 'armor_stand' } const entity = bot.nearestEntity(o => o.name === name) - assert(entity?.name === name) + assert.strictEqual(entity?.name, name) bot.attack(entity) await once(bot, 'entityGone') }) diff --git a/test/externalTests/plugins/testCommon.js b/test/externalTests/plugins/testCommon.js index c93b3547f..795701803 100644 --- a/test/externalTests/plugins/testCommon.js +++ b/test/externalTests/plugins/testCommon.js @@ -20,6 +20,7 @@ function inject (bot) { bot.test.fly = fly bot.test.teleport = teleport bot.test.resetState = resetState + bot.test.resetNetherRoofToBedrock = resetNetherRoofToBedrock bot.test.setInventorySlot = setInventorySlot bot.test.placeBlock = placeBlock bot.test.runExample = runExample @@ -74,6 +75,14 @@ function inject (bot) { await bot.test.wait(100) } + async function resetNetherRoofToBedrock () { + bot.chat('/fill ~-5 127 ~-5 ~5 127 ~5 bedrock') + for (let y = 128; y < 131; y++) { + bot.chat(`/fill ~-5 ${y} ~-5 ~5 ${y} ~5 air`) + } + await bot.test.wait(100) + } + async function placeBlock (slot, position) { bot.setQuickBarSlot(slot - 36) // always place the block on the top of the block below it, i guess. @@ -132,7 +141,8 @@ function inject (bot) { // you need to be in creative mode for this to work async function setInventorySlot (targetSlot, item) { - assert(item === null || item.name !== 'unknown', `item should not be unknown ${JSON.stringify(item)}`) + assert.ok(item) + assert.notEqual(item.name, 'unknown', `item should not be unknown ${JSON.stringify(item)}`) return bot.creative.setInventorySlot(targetSlot, item) } diff --git a/test/externalTests/trade.js b/test/externalTests/trade.js index 7651a0dfc..0416566d3 100644 --- a/test/externalTests/trade.js +++ b/test/externalTests/trade.js @@ -28,7 +28,7 @@ module.exports = () => async (bot) => { bot.test.sayEverywhere(`/setblock ${redstoneBlockPos.toArray().join(' ')} redstone_block`) // Activate the command block const [entity] = await once(bot, 'entitySpawn') - assert(entity.name === villagerType) + assert.strictEqual(entity.name, villagerType) const villager = await bot.openVillager(entity) diff --git a/test/externalTests/useChests.js b/test/externalTests/useChests.js index 16526e1cf..ca6215dbb 100644 --- a/test/externalTests/useChests.js +++ b/test/externalTests/useChests.js @@ -38,8 +38,8 @@ module.exports = () => async (bot) => { async function depositBones (chestLocation, count) { const chest = await bot.openContainer(bot.blockAt(chestLocation)) - assert(chest.containerItems().length === 0) - assert(chest.items().length > 0) + assert.strictEqual(chest.containerItems().length, 0) + assert(chest.items().length > 0, `${chest.items().length} > ${0}`) const name = 'bone' const item = itemByName(chest.items(), name) if (!item) { @@ -59,8 +59,8 @@ module.exports = () => async (bot) => { throw new Error(`unknown item ${name}`) } await chest.withdraw(item.type, null, count) - assert(chest.containerItems().length === 0) - assert(chest.items().length > 0) + assert.strictEqual(chest.containerItems().length, 0) + assert(chest.items().length > 0, `${chest.items().length} > ${0}`) chest.close() } @@ -114,7 +114,7 @@ module.exports = () => async (bot) => { await depositBones(smallChestLocation, 1) await depositBones(largeChestLocations[0], 2) - assert(bot.inventory.items().length === 0) + assert.strictEqual(bot.inventory.items().length, 0) await withdrawBones(smallChestLocation, 1) await withdrawBones(largeChestLocations[0], 2) @@ -122,7 +122,7 @@ module.exports = () => async (bot) => { await depositBones(smallTrappedChestLocation, 1) await depositBones(largeTrappedChestLocations[0], 2) - assert(bot.inventory.items().length === 0) + assert.strictEqual(bot.inventory.items().length, 0) await withdrawBones(smallTrappedChestLocation, 1) await withdrawBones(largeTrappedChestLocations[0], 2) @@ -152,7 +152,6 @@ module.exports = () => async (bot) => { if (Math.random() < slotPopulationFactor) { const randomItem = getRandomStackableItem() const item = bot.registry.itemsByName[randomItem] - console.log('createRandomLayout', randomItem, bot.registry.itemsByName) bot.chat(`/give ${bot.username} ${item.name} ${Math.ceil(Math.random() * item.stackSize)}`) await onceWithCleanup(window, 'updateSlot', { checkCondition: (slot, oldItem, newItem) => slot === window.hotbarStart && newItem?.name === item.name }) diff --git a/test/internalTest.js b/test/internalTest.js index a8d917bfa..943908eb3 100644 --- a/test/internalTest.js +++ b/test/internalTest.js @@ -292,21 +292,21 @@ for (const supportedVersion of mineflayer.testedVersions) { const packetName = meta.name switch (packetName) { case 'teleport_confirm': { - assert.ok(basePosition.teleportId === data.teleportId) + assert.strictEqual(basePosition.teleportId, data.teleportId) break } case 'position_look': { if (!check) return if (absolute) { - assert.ok(bot.entity.velocity.y === 0) + assert.strictEqual(bot.entity.velocity.y, 0) } else { - assert.ok(bot.entity.velocity.y !== 0) + assert.notStrictEqual(bot.entity.velocity.y, 0) } - assert.ok(basePosition.x === data.x) - assert.ok(basePosition.y === data.y) - assert.ok(basePosition.z === data.z) - assert.ok(basePosition.yaw === data.yaw) - assert.ok(basePosition.pitch === data.pitch) + assert.strictEqual(basePosition.x, data.x) + assert.strictEqual(basePosition.y, data.y) + assert.strictEqual(basePosition.z, data.z) + assert.strictEqual(basePosition.yaw, data.yaw) + assert.strictEqual(basePosition.pitch, data.pitch) check = false break } @@ -380,8 +380,8 @@ for (const supportedVersion of mineflayer.testedVersions) { let landed = false bot.on('move', () => { if (landed) return - assert.ok(bot.entity.position.y <= y) - assert.ok(bot.entity.position.y >= pos.y) + assert.ok(bot.entity.position.y <= y, bot.entity.position.y) + assert.ok(bot.entity.position.y >= pos.y, bot.entity.position.y) y = bot.entity.position.y if (bot.entity.position.y <= pos.y + 1) { assert.strictEqual(bot.entity.position.y, pos.y + 1) @@ -462,12 +462,12 @@ for (const supportedVersion of mineflayer.testedVersions) { } server.on('playerJoin', async (client) => { bot.once('respawn', () => { - assert.ok(bot.world.getColumn(0, 0) !== undefined) + assert.ok(bot.world.getColumn(0, 0)) bot.once('respawn', () => { - assert.ok(bot.world.getColumn(0, 0) === undefined) + assert.strictEqual(bot.world.getColumn(0, 0), undefined) done() }) - respawnPacket.worldName = 'minecraft:nether' + respawnPacket.worldName = 'minecraft:the_nether' if (bot.supportFeature('usesLoginPacket')) { respawnPacket.dimension.name = 'e' } else { @@ -495,15 +495,15 @@ for (const supportedVersion of mineflayer.testedVersions) { if (bot.supportFeature('transactionPacketExists')) { const transactionPacket = { windowId: 0, action: 42, accepted: false } client.once('transaction', (data, meta) => { - assert.ok(meta.name === 'transaction') - assert.ok(data.action === 42) - assert.ok(data.accepted === true) + assert.strictEqual(meta.name, 'transaction') + assert.strictEqual(data.action, 42) + assert.strictEqual(data.accepted, true) done() }) client.write('transaction', transactionPacket) } else { client.once('pong', (data) => { - assert(data.id === 42) + assert.strictEqual(data.id, 42) done() }) client.write('ping', { id: 42 }) @@ -521,10 +521,10 @@ for (const supportedVersion of mineflayer.testedVersions) { } client.write('login', loginPacket) bot.once('login', () => { - assert.ok(bot.entity.id === 0) + assert.strictEqual(bot.entity.id, 0) loginPacket.entityId = 42 bot.once('login', () => { - assert.ok(bot.entity.id === 42) + assert.strictEqual(bot.entity.id, 42) done() }) client.write('login', loginPacket)