forked from PrismarineJS/prismarine-web-client
-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
33 changed files
with
1,730 additions
and
103 deletions.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -168,7 +168,8 @@ | |
"ignoreDependencies": [] | ||
}, | ||
"patchedDependencies": { | ||
"[email protected]": "patches/[email protected]" | ||
"[email protected]": "patches/[email protected]", | ||
"[email protected]": "patches/[email protected]" | ||
} | ||
}, | ||
"packageManager": "[email protected]" | ||
|
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 @@ | ||
diff --git a/examples/jsm/webxr/VRButton.js b/examples/jsm/webxr/VRButton.js | ||
index 6856a21b17aa45d7922bbf776fd2d7e63c7a9b4e..0925b706f7629bd52f0bb5af469536af8f5fce2c 100644 | ||
--- a/examples/jsm/webxr/VRButton.js | ||
+++ b/examples/jsm/webxr/VRButton.js | ||
@@ -62,7 +62,10 @@ class VRButton { | ||
// ('local' is always available for immersive sessions and doesn't need to | ||
// be requested separately.) | ||
|
||
- const sessionInit = { optionalFeatures: [ 'local-floor', 'bounded-floor', 'hand-tracking', 'layers' ] }; | ||
+ const sessionInit = { | ||
+ optionalFeatures: ['local-floor', 'bounded-floor', 'layers'], | ||
+ domOverlay: { root: document.body }, | ||
+ }; | ||
navigator.xr.requestSession( 'immersive-vr', sessionInit ).then( onSessionStarted ); | ||
|
||
} else { |
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
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,58 @@ | ||
export function createWorkerProxy<T extends Record<string, (...args: any[]) => void>> (handlers: T): { __workerProxy: T } { | ||
addEventListener('message', (event) => { | ||
const { type, args } = event.data | ||
if (handlers[type]) { | ||
handlers[type](...args) | ||
} | ||
}) | ||
return null as any | ||
} | ||
|
||
/** | ||
* in main thread | ||
* ```ts | ||
* // either: | ||
* import type { importedTypeWorkerProxy } from './worker' | ||
* // or: | ||
* type importedTypeWorkerProxy = import('./worker').importedTypeWorkerProxy | ||
* | ||
* const workerChannel = useWorkerProxy<typeof importedTypeWorkerProxy>(worker) | ||
* ``` | ||
*/ | ||
export const useWorkerProxy = <T extends { __workerProxy: Record<string, (...args: any[]) => void> }> (worker: Worker, autoTransfer = true): T['__workerProxy'] & { | ||
transfer: (...args: Transferable[]) => T['__workerProxy'] | ||
} => { | ||
// in main thread | ||
return new Proxy({} as any, { | ||
get: (target, prop) => { | ||
if (prop === 'transfer') return (...transferable: Transferable[]) => { | ||
return new Proxy({}, { | ||
get: (target, prop) => { | ||
return (...args: any[]) => { | ||
worker.postMessage({ | ||
type: prop, | ||
args, | ||
}, transferable) | ||
} | ||
} | ||
}) | ||
} | ||
return (...args: any[]) => { | ||
const transfer = autoTransfer ? args.filter(arg => arg instanceof ArrayBuffer || arg instanceof MessagePort || arg instanceof ImageBitmap || arg instanceof OffscreenCanvas) : [] | ||
worker.postMessage({ | ||
type: prop, | ||
args, | ||
}, transfer) | ||
} | ||
} | ||
}) | ||
} | ||
|
||
// const workerProxy = createWorkerProxy({ | ||
// startRender (canvas: HTMLCanvasElement) { | ||
// }, | ||
// }) | ||
|
||
// const worker = useWorkerProxy(null, workerProxy) | ||
|
||
// worker. |
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
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,41 @@ | ||
//@ts-check | ||
// tsx ./scripts/getMissingRecipes.mjs | ||
import MinecraftData from 'minecraft-data' | ||
import supportedVersions from '../src/supportedVersions.mjs' | ||
import fs from 'fs' | ||
|
||
console.time('import-data') | ||
const { descriptionGenerators } = await import('../src/itemsDescriptions') | ||
console.timeEnd('import-data') | ||
|
||
const data = MinecraftData(supportedVersions.at(-1)) | ||
|
||
const hasDescription = name => { | ||
for (const [key, value] of descriptionGenerators) { | ||
if (Array.isArray(key) && key.includes(name)) { | ||
return true | ||
} | ||
if (key instanceof RegExp && key.test(name)) { | ||
return true | ||
} | ||
} | ||
return false | ||
} | ||
|
||
const result = [] | ||
for (const item of data.itemsArray) { | ||
const recipes = data.recipes[item.id] | ||
if (!recipes) { | ||
if (item.name.endsWith('_slab') || item.name.endsWith('_stairs') || item.name.endsWith('_wall')) { | ||
console.warn('Must have recipe!', item.name) | ||
continue | ||
} | ||
if (hasDescription(item.name)) { | ||
continue | ||
} | ||
|
||
result.push(item.name) | ||
} | ||
} | ||
|
||
fs.writeFileSync('./generated/noRecipies.json', JSON.stringify(result, null, 2)) |
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,12 @@ | ||
export const guessProblem = (errorMessage: string) => { | ||
if (errorMessage.endsWith('Socket error: ECONNREFUSED')) { | ||
return 'Most probably the server is not running.' | ||
} | ||
} | ||
|
||
export const loadingTexts = [ | ||
'Like the project? Give us a star on GitHub or rate us on AlternativeTo!', | ||
'To stay updated with the latest changes, go to the GitHub page, click on "Watch", choose "Custom", and then opt for "Releases"!', | ||
'Upvote features on GitHub issues to help us prioritize them!', | ||
'Want to contribute to the project? Check out Contributing.md on GitHub!', | ||
] |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.