finish failed experiment & w t

This commit is contained in:
Vitaly Turovsky 2024-02-17 03:23:25 +03:00
commit a8bd2e5dd5
6 changed files with 21 additions and 5 deletions

View file

@ -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('<!-- inject script -->', '<script src="index.js"></script>'), 'utf8')
fs.writeFileSync('dist/index.html', fs.readFileSync('index.html', 'utf8').replace('<!-- inject script -->', '<script type="module" src="index.js"></script>'), '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',

View file

@ -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',
},
},
})

View file

@ -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$/,
}, () => {

View file

@ -31,6 +31,6 @@
</style>
</head>
<body>
<script type="text/javascript" src="playground.js"></script>
<script type="module" src="playground.js"></script>
</body>
</html>

View file

@ -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)

View file

@ -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