Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ function mcDataToNode (mcData) {
blockStates: mcData.blockStates, // bedrock

blockCollisionShapes: mcData.blockCollisionShapes,
blockSelectionShapes: mcData.blockSelectionShapes,

biomes: indexes.biomesById,
biomesByName: indexes.biomesByName,
Expand Down
17 changes: 17 additions & 0 deletions test/selectionShapes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/* eslint-env mocha */
const assert = require('assert')
const convert = require('../lib/loader')

describe('selection shapes', () => {
it('exports selection data independently of collision data', () => {
const collision = { blocks: { wheat: 0 }, shapes: { 0: [] } }
const selection = { blocks: { wheat: 0 }, shapes: { 0: [[0, 0, 0, 1, 0.125, 1]] } }
const data = convert({ blockCollisionShapes: collision, blockSelectionShapes: selection })
assert.strictEqual(data.blockCollisionShapes, collision)
assert.strictEqual(data.blockSelectionShapes, selection)
})

it('leaves selection data unavailable for datasets without it', () => {
assert.strictEqual(convert({}).blockSelectionShapes, undefined)
})
})
3 changes: 3 additions & 0 deletions typings/index-template.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,9 @@ export interface IndexedData {
*/
blockCollisionShapes: { blocks: { [name: string]: number | number[] }; shapes: { [id: string]: [number[]] } }

/** Java selection geometry, when available for this version. */
blockSelectionShapes?: BlockSelectionShapes

loginPacket: LoginPacket

items: { [id: number]: Item }
Expand Down
Loading