diff --git a/esbuild.mjs b/esbuild.mjs index 46283bb1..7c0f093d 100644 --- a/esbuild.mjs +++ b/esbuild.mjs @@ -11,7 +11,7 @@ import { build } from 'esbuild' //@ts-ignore try { await import('./localSettings.mjs') } catch { } -fs.writeFileSync('dist/index.html', fs.readFileSync('index.html', 'utf8').replace('', ''), 'utf8') +fs.writeFileSync('dist/index.html', fs.readFileSync('index.html', 'utf8').replace('', ''), 'utf8') const watch = process.argv.includes('--watch') || process.argv.includes('-w') const prod = process.argv.includes('--prod') @@ -30,8 +30,9 @@ const buildingVersion = new Date().toISOString().split(':')[0] /** @type {import('esbuild').BuildOptions} */ const buildOptions = { bundle: true, + format: 'esm', entryPoints: ['src/index.ts'], - target: ['es2020'], + // target: ['es2020'], jsx: 'automatic', jsxDev: dev, // logLevel: 'debug', diff --git a/experiments/vite.config.ts b/experiments/vite.config.ts index e0a30bef..c1cd95eb 100644 --- a/experiments/vite.config.ts +++ b/experiments/vite.config.ts @@ -2,4 +2,16 @@ import { defineConfig } from 'vite'; export default defineConfig({ root: 'experiments', + // set latest target + esbuild: { + target: 'esnext', + }, + build: { + target: 'esnext', + }, + optimizeDeps: { + esbuildOptions: { + target: 'esnext', + }, + }, }) diff --git a/prismarine-viewer/esbuild.mjs b/prismarine-viewer/esbuild.mjs index 91b787db..773226b2 100644 --- a/prismarine-viewer/esbuild.mjs +++ b/prismarine-viewer/esbuild.mjs @@ -30,6 +30,7 @@ const buildOptions = { // logLevel: 'debug', logLevel: 'info', platform: 'browser', + format: 'esm', sourcemap: dev ? 'inline' : false, minify: !dev, outfile: join(__dirname, 'public/playground.js'), @@ -47,6 +48,7 @@ const buildOptions = { http: 'http-browserify', stream: 'stream-browserify', net: 'net-browserify', + // three: 'three-latest' }, inject: [], metafile: true, @@ -56,7 +58,7 @@ const buildOptions = { plugins: [ { name: 'minecraft-data', - setup (build) { + setup(build) { build.onLoad({ filter: /minecraft-data[\/\\]data.js$/, }, () => { diff --git a/prismarine-viewer/playground.html b/prismarine-viewer/playground.html index fd92009a..f571c986 100644 --- a/prismarine-viewer/playground.html +++ b/prismarine-viewer/playground.html @@ -31,6 +31,6 @@ - + diff --git a/prismarine-viewer/viewer/lib/worldrenderer.ts b/prismarine-viewer/viewer/lib/worldrenderer.ts index 40e257aa..3b5fb349 100644 --- a/prismarine-viewer/viewer/lib/worldrenderer.ts +++ b/prismarine-viewer/viewer/lib/worldrenderer.ts @@ -94,7 +94,6 @@ export class WorldRenderer { mesh.name = 'mesh' object = new THREE.Group() object.add(mesh) - mesh.occlusionTest = true const boxHelper = new THREE.BoxHelper(mesh, 0xffff00) boxHelper.name = 'helper' object.add(boxHelper) diff --git a/src/worldInteractions.ts b/src/worldInteractions.ts index 9353670c..9777d8f0 100644 --- a/src/worldInteractions.ts +++ b/src/worldInteractions.ts @@ -114,6 +114,7 @@ class WorldInteraction { }) const upLineMaterial = () => { + return const inCreative = bot.game.gameMode === 'creative' const pixelRatio = viewer.renderer.getPixelRatio() this.lineMaterial = new LineMaterial({ @@ -129,6 +130,7 @@ class WorldInteraction { } updateBlockInteractionLines (blockPos: Vec3 | null, shapePositions?: Array<{ position; width; height; depth }>) { + return assertDefined(viewer) if (blockPos && this.interactionLines && blockPos.equals(this.interactionLines.blockPos)) { return