Skip to content

Commit

Permalink
add light test utils
Browse files Browse the repository at this point in the history
  • Loading branch information
zardoy committed May 11, 2024
1 parent b7d3178 commit 54a7e52
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions prismarine-viewer/viewer/lib/mesher/test/mesherTester.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,22 @@ export const setup = (version, initialBlocks: [number[], string][]) => {
}
reload()

const getLights = () => {
return Object.fromEntries(getGeometry().faces.map(({ face, light }) => ([face, light * 15 - 2])))
}

const setLight = (x: number, y: number, z: number, val = 0) => {
// create columns first
chunk1.setBlockLight(pos.offset(x, y, z), 15)
chunk1.setSkyLight(pos.offset(x, y, z), 15)
chunk1.setBlockLight(pos.offset(x, y, z), val)
chunk1.setSkyLight(pos.offset(x, y, z), 0)
}

return {
mesherWorld,
setLight,
getLights,
getGeometry,
pos,
mcData,
Expand Down

0 comments on commit 54a7e52

Please sign in to comment.