Skip to content

Commit

Permalink
Revert to static
Browse files Browse the repository at this point in the history
  • Loading branch information
Dianliang233 committed Dec 19, 2023
1 parent 2d1e33e commit 42dbd15
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions src/tools/blockDistribution/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -705,25 +705,22 @@ export interface Block {
color: string
}

export const overworldBlockMap = generateBlockMap(overworldRaw, -64)
export const netherBlockMap = generateBlockMap(netherRaw, 0)
export const endBlockMap = generateBlockMap(endRaw, 0)
export const overworldBlockMap = generateBlockMap(
overworldRaw,
-64,
overworldRaw['minecraft:bedrock'][0],
)
export const netherBlockMap = generateBlockMap(netherRaw, 0, netherRaw['minecraft:bedrock'][0])
export const endBlockMap = generateBlockMap(endRaw, 0, endRaw['minecraft:air'][0])

function generateBlockMap(data: Record<string, number[]>, offset: number) {
function generateBlockMap(data: Record<string, number[]>, offset: number, totalBlocks: number) {
const blockMap: Block[] = []
const totalBlocks: number[] = new Array(320).fill(0)
for (const key in data) {
for (const [index, count] of data[key].entries()) {
totalBlocks[index] += count
}
}
console.log(totalBlocks)
for (const key in data) {
for (const [index, count] of data[key].entries()) {
blockMap.push({
block: key,
// number of X found in 100,000 blocks
count: count,
count: count === 0 ? 0.0001 : (count / totalBlocks) * 100000,
pos: index + offset,
color: getColor(key),
})
Expand Down

0 comments on commit 42dbd15

Please sign in to comment.