-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Realized a nice way that I liked, to structure the project module-wise. I'm thinking about if `@thing/thing` paths could be nice for a project like this :) Going to bring some of these other nice things over to NBTify, I got them working in jsmediatags today :D Man, Marco Minnemann's solo work gets better every time I listen. Listening through from HWD&2K: Part I, and now I'm listening to Mouth of God. Music days are the best, listened to a bunch of Mike Keneally this morning too. Gonna try 'You Must Be This Tall' again, after this. Oh yeah! Just discovered 'Thank You Scientist' the other day, WOW. They are super cool too. Going to buy their latest release, at the same time as when Marco releases his new solo album this Friday. Bandcamp Friday for both :)
- Loading branch information
1 parent
9372efd
commit 37bb380
Showing
11 changed files
with
171 additions
and
100 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,18 @@ | ||
{ | ||
"name": "region-types", | ||
"private": true, | ||
"type": "module", | ||
"main": "./dist/index.js", | ||
"types": "./dist/index.d.ts", | ||
"scripts": { | ||
"build": "tsc --project ./tsconfig.build.json", | ||
"dev": "tsc -w" | ||
}, | ||
"dependencies": { | ||
"nbtify": "^1.20.1" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^18.16.2" | ||
"@types/node": "^18.16.2", | ||
"typescript": "^5.0.4" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { Region, Chunk, World } from "../index.js"; | ||
import type { JavaWorld } from "../java/index.js"; | ||
import type { LegacyConsoleWorld } from "../legacy-console/index.js"; | ||
|
||
export declare class BedrockChunk extends Chunk { | ||
readonly kind = "bedrock"; | ||
|
||
/** | ||
* The version the chunk was written in; Ex: `1.19.20` | ||
*/ | ||
readonly Version: string; | ||
} | ||
|
||
export declare class BedrockRegion extends Region { | ||
readonly kind = "bedrock"; | ||
|
||
[Symbol.iterator](): IterableIterator<BedrockChunk>; | ||
} | ||
|
||
export declare class BedrockWorld extends World { | ||
readonly kind: "bedrock"; | ||
|
||
[Symbol.iterator](): IterableIterator<BedrockRegion>; | ||
|
||
toBedrock(): Promise<BedrockWorld>; | ||
toJava(): Promise<JavaWorld>; | ||
toLegacyConsole(): Promise<LegacyConsoleWorld>; | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
export * from "./bedrock/index.js"; | ||
export * from "./java/index.js"; | ||
export * from "./legacy-console/index.js"; | ||
|
||
import type { BedrockWorld } from "./bedrock/index.js"; | ||
import type { JavaWorld } from "./java/index.js"; | ||
import type { LegacyConsoleWorld } from "./legacy-console/index.js"; | ||
|
||
export type Kind = "bedrock" | "java" | "legacy-console"; | ||
|
||
export abstract class Chunk { | ||
abstract readonly kind: Kind; | ||
} | ||
|
||
export abstract class Region { | ||
abstract readonly kind: Kind; | ||
abstract [Symbol.iterator](): IterableIterator<Chunk>; | ||
} | ||
|
||
export abstract class World { | ||
abstract readonly kind: Kind; | ||
abstract [Symbol.iterator](): IterableIterator<Region>; | ||
|
||
abstract toBedrock(): Promise<BedrockWorld>; | ||
abstract toJava(): Promise<JavaWorld>; | ||
abstract toLegacyConsole(): Promise<LegacyConsoleWorld>; | ||
} | ||
|
||
/** | ||
* Reads a world from a single source file, like `.zip` or `.mcworld`. | ||
*/ | ||
export declare function readWorld<T extends World = World>(file: Uint8Array | ArrayBufferLike): Promise<T>; | ||
export declare function readWorld(file: Uint8Array | ArrayBufferLike): Promise<World>; | ||
|
||
/** | ||
* Reads the world from the given directory in the file system. | ||
* Returns a World object which can manipulate properties of the world from a high level. | ||
*/ | ||
export declare function openWorld<T extends World = World>(path: string): Promise<T>; | ||
export declare function openWorld(path: string): Promise<World>; | ||
|
||
/** | ||
* Saves a world back to a given directory in the file system. | ||
*/ | ||
export declare function saveWorld(path: string, world: World): Promise<void>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { Chunk, Region, World } from "../index.js"; | ||
import type { BedrockWorld } from "../bedrock/index.js"; | ||
import type { LegacyConsoleWorld } from "../legacy-console/index.js"; | ||
|
||
export class JavaChunk extends Chunk { | ||
readonly kind = "java"; | ||
} | ||
|
||
export declare class JavaRegion extends Region { | ||
readonly kind = "java"; | ||
|
||
[Symbol.iterator](): IterableIterator<JavaChunk>; | ||
} | ||
|
||
export declare class JavaWorld extends World { | ||
readonly kind = "java"; | ||
|
||
[Symbol.iterator](): IterableIterator<JavaRegion>; | ||
|
||
toBedrock(): Promise<BedrockWorld>; | ||
toJava(): Promise<JavaWorld>; | ||
toLegacyConsole(): Promise<LegacyConsoleWorld>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { Chunk, Region, World } from "../index.js"; | ||
import type { BedrockWorld } from "../bedrock/index.js"; | ||
import type { JavaWorld } from "../java/index.js"; | ||
|
||
export declare class LegacyConsoleChunk extends Chunk { | ||
readonly kind = "legacy-console"; | ||
} | ||
|
||
export declare class LegacyConsoleRegion extends Region { | ||
readonly kind = "legacy-console"; | ||
|
||
[Symbol.iterator](): IterableIterator<LegacyConsoleChunk>; | ||
} | ||
|
||
export declare class LegacyConsoleWorld extends World { | ||
readonly kind = "legacy-console"; | ||
|
||
[Symbol.iterator](): IterableIterator<LegacyConsoleRegion>; | ||
|
||
toBedrock(): Promise<BedrockWorld>; | ||
toJava(): Promise<JavaWorld>; | ||
toLegacyConsole(): Promise<LegacyConsoleWorld>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"extends": "./tsconfig.json", | ||
"compilerOptions": { | ||
"rootDir": "./src", | ||
"outDir": "./dist", | ||
"noEmit": false, | ||
"declaration": false, | ||
"sourceMap": false | ||
}, | ||
"include": [ | ||
"./src/**/*" | ||
], | ||
"exclude": [ | ||
"./test" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters