Skip to content

Commit

Permalink
修正新版minecraft-data支持 Resolve #55
Browse files Browse the repository at this point in the history
  • Loading branch information
bangbang93 committed Jul 8, 2022
1 parent 9359e8f commit 2024f5a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
17 changes: 10 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"got": "^11.8.5",
"ip-cidr": "^2.0.6",
"lodash": "^4.17.15",
"minecraft-data": "^2.110.0",
"minecraft-data": "^2.221.0",
"minecraft-protocol": "^1.30.0",
"reflect-metadata": "^0.1.13",
"source-map-support": "^0.5.16",
Expand Down
9 changes: 3 additions & 6 deletions src/minecraft-data.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
import {postNettyVersionsByProtocolVersion, preNettyVersionsByProtocolVersion} from 'minecraft-data'
import {Service} from 'typedi'
import {schemas} from 'minecraft-data'

@Service()
export class MinecraftData {
public protocolVersionToMcVersion(protocolVersion: number): string {
for (const schema of schemas.protocolVersions) {
if (schema.version === protocolVersion) {
return schema.minecraftVersion
}
}
return preNettyVersionsByProtocolVersion.pc[protocolVersion]?.minecraftVersion
?? postNettyVersionsByProtocolVersion.pc[protocolVersion]?.minecraftVersion
}
}

0 comments on commit 2024f5a

Please sign in to comment.