Skip to content

Commit

Permalink
Issue/102 (#103)
Browse files Browse the repository at this point in the history
* added /.vs to gitignore (visual studio)

* expanded basic test to demonstrate issue #102

---------

Co-authored-by: Bryan Tabinas <[email protected]>
Co-authored-by: Romain Beaumont <[email protected]>
  • Loading branch information
3 people authored Jan 24, 2025
1 parent 25a3b35 commit cd29460
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
node_modules
package-lock.json
package-lock.json
/.vs
40 changes: 40 additions & 0 deletions test/basic.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,46 @@ const expect = require('expect').default

// https://minecraft.gamepedia.com/Breaking#Blocks_by_hardness
describe('Dig time', () => {
describe('1.20.5', () => {
const registry = require('prismarine-registry')('1.20.5')
const Block = require('prismarine-block')(registry)
it('dig dirt (shovel faster than hand)', () => {
const dirt = Block.fromStateId(registry.blocksByName.dirt.defaultState, 0)
const shovel = registry.itemsByName.iron_shovel
const handTime = dirt.digTime(null, false, false, false)
const shovelTime = dirt.digTime(shovel.id, false, false, false)
expect(shovelTime < handTime).toBeTruthy()
})

it('mine stone (pickaxe faster than hand)', () => {
const stone = Block.fromStateId(registry.blocksByName.stone.defaultState, 0)
const pickaxe = registry.itemsByName.iron_pickaxe
const handTime = stone.digTime(null, false, false, false)
const pickaxeTime = stone.digTime(pickaxe.id, false, false, false)
expect(pickaxeTime < handTime).toBeTruthy()
})
})

describe('1.20.4', () => {
const registry = require('prismarine-registry')('1.20.4')
const Block = require('prismarine-block')(registry)
it('dig dirt (shovel faster than hand)', () => {
const dirt = Block.fromStateId(registry.blocksByName.dirt.defaultState, 0)
const shovel = registry.itemsByName.iron_shovel
const handTime = dirt.digTime(null, false, false, false)
const shovelTime = dirt.digTime(shovel.id, false, false, false)
expect(shovelTime < handTime).toBeTruthy()
})

it('mine stone (pickaxe faster than hand)', () => {
const stone = Block.fromStateId(registry.blocksByName.stone.defaultState, 0)
const pickaxe = registry.itemsByName.iron_pickaxe
const handTime = stone.digTime(null, false, false, false)
const pickaxeTime = stone.digTime(pickaxe.id, false, false, false)
expect(pickaxeTime < handTime).toBeTruthy()
})
})

describe('1.15.2', () => {
const registry = require('prismarine-registry')('1.15.2')
const Block = require('prismarine-block')(registry)
Expand Down

0 comments on commit cd29460

Please sign in to comment.