Skip to content
This repository has been archived by the owner on Apr 16, 2022. It is now read-only.

Commit

Permalink
Changed block.json to blocks.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
PMK744 committed Jul 9, 2021
1 parent dc2141f commit 137cdd9
Show file tree
Hide file tree
Showing 2 changed files with 2,683 additions and 832 deletions.
10 changes: 1 addition & 9 deletions src/bewss/world/worldManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ import {
commandResponse, gettopsolidblockCommand, SlashCommandExecutedConsole, testforblockCommand, topBlockData,
} from "../@interface/bewss.i"
import bewss from "../bewss"
import fs from "fs"
import path from "path"
import { blocks } from '../../data/1.17/blocks'

class worldManager {
private bewss: bewss
Expand Down Expand Up @@ -68,7 +67,6 @@ class worldManager {
},
}

const blocks = await this.getBlockData()
const blockName = response.body.statusMessage.match(/(?<=is )(.*?)(?= \()/)[0]
const block = blocks.find(e => e.displayName == blockName) as blockData

Expand All @@ -77,12 +75,6 @@ class worldManager {
return block
}

async getBlockData(): Promise<Array<{ id: number, displayName: string, name: string, hardness: number, resistance: number, minStateId: number, maxStateId: number, drops: Array<unknown>, diggable: boolean, transparent: boolean, filterLight: number, emitLight: number, boundingBox: string, stackSize: number, defaultState: number }>> {
const jsonPath = path.join(__dirname, '..', '..', 'data', '1.17', 'blocks.json')
const response = fs.readFileSync(jsonPath, 'utf-8')

return JSON.parse(response)
}

sendMessage(message: string): void {
this.bewss.getCommandManager().executeCommand(`/tellraw @a {"rawtext":[{"text":"${message}"}]}`)
Expand Down
Loading

0 comments on commit 137cdd9

Please sign in to comment.