From 9160ff33c2576228bd3750ea10ef0a15089466d0 Mon Sep 17 00:00:00 2001 From: Vitaly Turovsky Date: Sat, 7 Sep 2024 17:46:34 +0300 Subject: [PATCH 01/15] fix: fix joining to some popular servers (since dns was resovle was incorrectly used) fix: fix some auth issues when starting the app locally --- src/inventoryWindows.ts | 6 +++++- src/microsoftAuthflow.ts | 9 +++++---- src/shims/dns.js | 1 + 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/inventoryWindows.ts b/src/inventoryWindows.ts index b23c88faf..23e898a5a 100644 --- a/src/inventoryWindows.ts +++ b/src/inventoryWindows.ts @@ -54,7 +54,6 @@ export const onGameLoad = (onLoad) => { bot.on('windowOpen', (win) => { if (implementedContainersGuiMap[win.type]) { - // todo also render title! openWindow(implementedContainersGuiMap[win.type]) } else if (options.unimplementedContainers) { openWindow('ChestWin') @@ -385,6 +384,11 @@ const openWindow = (type: string | undefined) => { lastWindow = inv const upWindowItems = () => { + if (!lastWindow && bot.currentWindow) { + // edge case: might happen due to high ping, inventory should be closed soon! + // openWindow(implementedContainersGuiMap[bot.currentWindow.type]) + return + } void Promise.resolve().then(() => upInventoryItems(type === undefined)) } upWindowItems() diff --git a/src/microsoftAuthflow.ts b/src/microsoftAuthflow.ts index 18b3eb0b6..2e7c3a00d 100644 --- a/src/microsoftAuthflow.ts +++ b/src/microsoftAuthflow.ts @@ -93,8 +93,8 @@ export default async ({ tokenCaches, proxyBaseUrl, setProgressText = (text) => { } } -function isPageSecure () { - return window.location.protocol === 'https:' +function isPageSecure (url = window.location.href) { + return !url.startsWith('http:') } // restore dates from strings @@ -161,9 +161,10 @@ function pemToArrayBuffer (pem) { } const urlWithBase = (url: string, base: string) => { - if (!base.startsWith('http')) base = `https://${base}` + const defaultBase = isPageSecure() ? 'https' : 'http' + if (!base.startsWith('http')) base = `${defaultBase}://${base}` const urlObj = new URL(url, base) base = base.replace(/^https?:\/\//, '') - urlObj.host = base.includes(':') ? base : `${base}:${isPageSecure() ? '443' : '80'}` + urlObj.host = base.includes(':') ? base : `${base}:${isPageSecure(base) ? '443' : '80'}` return urlObj } diff --git a/src/shims/dns.js b/src/shims/dns.js index 0bbe5320d..22160ff33 100644 --- a/src/shims/dns.js +++ b/src/shims/dns.js @@ -26,6 +26,7 @@ module.exports.resolveSrv = function (hostname, callback) { const willreturn = [] for (const object of response.Answer) { const data = object.data.split(' ') + if (data[3] === undefined || data[2] === undefined) continue willreturn.push({ priority: data[0], weight: data[1], From a30106342ed82687dd60cdd417596021deac8bd6 Mon Sep 17 00:00:00 2001 From: Vitaly Turovsky Date: Sat, 7 Sep 2024 18:37:57 +0300 Subject: [PATCH 02/15] feat: add a way to disable some of the UI parts in settings (for testing and other use cases) feat: re-add bossbars, but it's still disabled by default --- src/globals.d.ts | 1 + src/optionsGuiScheme.tsx | 51 +++++++++++++++++++++++++- src/optionsStorage.ts | 2 + src/react/BossBarOverlayProvider.tsx | 6 +-- src/react/DebugOverlay.tsx | 18 ++++++++- src/react/IndicatorEffectsProvider.tsx | 2 + src/react/ScoreboardProvider.tsx | 1 + src/reactUi.tsx | 30 ++++++++------- 8 files changed, 91 insertions(+), 20 deletions(-) diff --git a/src/globals.d.ts b/src/globals.d.ts index 0f9a36f07..7fc9baecc 100644 --- a/src/globals.d.ts +++ b/src/globals.d.ts @@ -13,6 +13,7 @@ declare const bot: Omit & { declare const __type_bot: typeof bot declare const viewer: import('prismarine-viewer/viewer/lib/viewer').Viewer declare const worldView: import('prismarine-viewer/viewer/lib/worldDataEmitter').WorldDataEmitter | undefined +declare const addStatPerSec: (name: string) => void declare const localServer: import('flying-squid/dist/index').FullServer & { options } | undefined /** all currently loaded mc data */ declare const mcData: Record diff --git a/src/optionsGuiScheme.tsx b/src/optionsGuiScheme.tsx index 2082acdb0..fc9e347ea 100644 --- a/src/optionsGuiScheme.tsx +++ b/src/optionsGuiScheme.tsx @@ -1,6 +1,8 @@ import { useState } from 'react' import { useSnapshot } from 'valtio' import { openURL } from 'prismarine-viewer/viewer/lib/simpleUtils' +import { noCase } from 'change-case' +import { titleCase } from 'title-case' import { loadedGameState, miscUiState, openOptionsMenu, showModal } from './globalState' import { AppOptions, options } from './optionsStorage' import Button from './react/Button' @@ -228,7 +230,40 @@ export const guiOptionsScheme: { 'never' ], }, - } + }, + { + custom () { + return Experimental + }, + displayBossBars: { + text: 'Boss Bars', + }, + }, + { + custom () { + return + }, + }, + { + custom () { + return + }, + }, + { + custom () { + return + }, + }, + { + custom () { + return + }, + }, + { + custom () { + return + }, + }, ], controls: [ { @@ -391,6 +426,20 @@ const Category = ({ children }) =>
{children}
+const UiToggleButton = ({ name, addUiText = false, label = noCase(name) }) => { + const { disabledUiParts } = useSnapshot(options) + + const currentlyEnabled = disabledUiParts.includes(name) + if (addUiText) label = `${label} UI` + return +} + export const tryFindOptionConfig = (option: keyof AppOptions) => { for (const group of Object.values(guiOptionsScheme)) { for (const optionConfig of group) { diff --git a/src/optionsStorage.ts b/src/optionsStorage.ts index b7bf4abed..936d5bfc3 100644 --- a/src/optionsStorage.ts +++ b/src/optionsStorage.ts @@ -82,6 +82,8 @@ const defaultOptions = { /** Wether to popup sign editor on server action */ autoSignEditor: true, wysiwygSignEditor: 'auto' as 'auto' | 'always' | 'never', + displayBossBars: false, // boss bar overlay was removed for some reason, enable safely + disabledUiParts: [] as string[], } function getDefaultTouchControlsPositions () { diff --git a/src/react/BossBarOverlayProvider.tsx b/src/react/BossBarOverlayProvider.tsx index 9bb7d9480..5cac3c8ac 100644 --- a/src/react/BossBarOverlayProvider.tsx +++ b/src/react/BossBarOverlayProvider.tsx @@ -1,5 +1,4 @@ import { useState, useEffect } from 'react' -import { BotEvents } from 'mineflayer' import BossBar, { BossBarType } from './BossBarOverlay' import './BossBarOverlay.css' @@ -8,9 +7,8 @@ export default () => { const [bossBars, setBossBars] = useState(new Map()) useEffect(() => { - // typescript error: no bossBarCreated in BotEvents. Why?? - bot.on('bossBarCreated' as keyof BotEvents, (bossBar) => { - setBossBars(prevBossBars => new Map(prevBossBars.set(bossBar.entityUUID, bossBar))) + bot.on('bossBarCreated', (bossBar) => { + setBossBars(prevBossBars => new Map(prevBossBars.set(bossBar.entityUUID, bossBar as any))) }) bot.on('bossBarUpdated', (bossBar) => { setBossBars(prevBossBars => new Map(prevBossBars.set(bossBar.entityUUID, bossBar as BossBarType))) diff --git a/src/react/DebugOverlay.tsx b/src/react/DebugOverlay.tsx index 9315d8a49..23f0d7db1 100644 --- a/src/react/DebugOverlay.tsx +++ b/src/react/DebugOverlay.tsx @@ -14,10 +14,17 @@ export default () => { received: {} as { [key: string]: number }, sent: {} as { [key: string]: number } }) + window.packetsCountByNamePerSec = packetsCountByNamePerSec + const packetsCountByNamePer10Sec = useRef({ + received: {} as { [key: string]: number }, + sent: {} as { [key: string]: number } + }) + window.packetsCountByNamePer10Sec = packetsCountByNamePer10Sec const packetsCountByName = useRef({ received: {} as { [key: string]: number }, sent: {} as { [key: string]: number } }) + window.packetsCountByName = packetsCountByName const ignoredPackets = useRef(new Set([] as any[])) const [packetsString, setPacketsString] = useState('') const [showDebug, setShowDebug] = useState(false) @@ -62,9 +69,11 @@ export default () => { const managePackets = (type, name, data) => { packetsCountByName.current[type][name] ??= 0 packetsCountByName.current[type][name]++ + packetsCountByNamePerSec.current[type][name] ??= 0 + packetsCountByNamePerSec.current[type][name]++ + packetsCountByNamePer10Sec.current[type][name] ??= 0 + packetsCountByNamePer10Sec.current[type][name]++ if (options.debugLogNotFrequentPackets && !ignoredPackets.current.has(name) && !hardcodedListOfDebugPacketsToIgnore[type].includes(name)) { - packetsCountByNamePerSec.current[type][name] ??= 0 - packetsCountByNamePerSec.current[type][name]++ if (packetsCountByNamePerSec.current[type][name] > 5 || packetsCountByName.current[type][name] > 100) { // todo think of tracking the count within 10s console.info(`[packet ${name} was ${type} too frequent] Ignoring...`) ignoredPackets.current.add(name) @@ -76,12 +85,17 @@ export default () => { useEffect(() => { document.addEventListener('keydown', handleF3) + let update = 0 const packetsUpdateInterval = setInterval(() => { setPacketsString(`↓ ${received.current.count} (${(received.current.size / 1024).toFixed(2)} KB/s, ${getFixedFilesize(receivedTotal.current)}) ↑ ${sent.current.count}`) received.current = { ...defaultPacketsCount } sent.current = { ...defaultPacketsCount } packetsCountByNamePerSec.current.received = {} packetsCountByNamePerSec.current.sent = {} + if (update++ % 10 === 0) { + packetsCountByNamePer10Sec.current.received = {} + packetsCountByNamePer10Sec.current.sent = {} + } }, 1000) const freqUpdateInterval = setInterval(() => { diff --git a/src/react/IndicatorEffectsProvider.tsx b/src/react/IndicatorEffectsProvider.tsx index 00b78d8a1..b82782e66 100644 --- a/src/react/IndicatorEffectsProvider.tsx +++ b/src/react/IndicatorEffectsProvider.tsx @@ -3,6 +3,7 @@ import { useEffect, useMemo } from 'react' import { inGameError } from '../utils' import { fsState } from '../loadSave' import { miscUiState } from '../globalState' +import { options } from '../optionsStorage' import IndicatorEffects, { EffectType, defaultIndicatorsState } from './IndicatorEffects' import { images } from './effectsImages' @@ -52,6 +53,7 @@ const getEffectIndex = (newEffect: EffectType) => { export default () => { const stateIndicators = useSnapshot(state.indicators) const { hasErrors } = useSnapshot(miscUiState) + const { disabledUiParts } = useSnapshot(options) const { isReadonly, openReadOperations, openWriteOperations } = useSnapshot(fsState) const allIndicators: typeof defaultIndicatorsState = { readonlyFiles: isReadonly, diff --git a/src/react/ScoreboardProvider.tsx b/src/react/ScoreboardProvider.tsx index bcae99079..cb67b9416 100644 --- a/src/react/ScoreboardProvider.tsx +++ b/src/react/ScoreboardProvider.tsx @@ -10,6 +10,7 @@ export default function ScoreboardProvider () { useMemo(() => { // useMemo instead of useEffect to register them asap and not after the initial dom render const updateSidebarScoreboard = () => { + addStatPerSec('scoreboard') if (bot.scoreboard.sidebar) { setTitle(bot.scoreboard.sidebar.title) setItems([...bot.scoreboard.sidebar.items]) diff --git a/src/reactUi.tsx b/src/reactUi.tsx index 029b24934..599a18f7c 100644 --- a/src/reactUi.tsx +++ b/src/reactUi.tsx @@ -42,6 +42,8 @@ import BedTime from './react/BedTime' import NoModalFoundProvider from './react/NoModalFoundProvider' import SignInMessageProvider from './react/SignInMessageProvider' import BookProvider from './react/BookProvider' +import { options } from './optionsStorage' +import BossBarOverlayProvider from './react/BossBarOverlayProvider' const RobustPortal = ({ children, to }) => { return createPortal({children}, to) @@ -99,6 +101,7 @@ const InGameComponent = ({ children }) => { const InGameUi = () => { const { gameLoaded, showUI: showUIRaw } = useSnapshot(miscUiState) + const { disabledUiParts, displayBossBars } = useSnapshot(options) const hasModals = useSnapshot(activeModalStack).length > 0 const showUI = showUIRaw || hasModals if (!gameLoaded || !bot) return @@ -107,26 +110,27 @@ const InGameUi = () => { {/* apply scaling */}
- - - - - + {!disabledUiParts.includes('death-screen') && } + {!disabledUiParts.includes('debug-overlay') && } + {!disabledUiParts.includes('mobile-top-buttons') && } + {!disabledUiParts.includes('players-list') && } + {!disabledUiParts.includes('chat') && } - - - - - + {!disabledUiParts.includes('title') && } + {!disabledUiParts.includes('scoreboard') && } + {!disabledUiParts.includes('effects-indicators') && } + {!disabledUiParts.includes('crosshair') && } + {!disabledUiParts.includes('books') && } + {!disabledUiParts.includes('bossbars') && displayBossBars && }
- - + {!disabledUiParts.includes('xp-bar') && } + {!disabledUiParts.includes('hud-bars') && }
- {showUI && } + {showUI && !disabledUiParts.includes('hotbar') && }
From 1c7fdc21a6b3c997a2cece632bf40184a02e57d7 Mon Sep 17 00:00:00 2001 From: Vitaly Turovsky Date: Sat, 7 Sep 2024 19:33:16 +0300 Subject: [PATCH 03/15] add a way to to disable neighbor chunk updates and all the UI (needed for perf testing) --- .../viewer/lib/worldrendererCommon.ts | 17 ++++++++++------- src/optionsGuiScheme.tsx | 7 ++++--- src/optionsStorage.ts | 1 + src/reactUi.tsx | 2 +- src/watchOptions.ts | 4 ++++ 5 files changed, 20 insertions(+), 11 deletions(-) diff --git a/prismarine-viewer/viewer/lib/worldrendererCommon.ts b/prismarine-viewer/viewer/lib/worldrendererCommon.ts index 49de2ca01..92fc96819 100644 --- a/prismarine-viewer/viewer/lib/worldrendererCommon.ts +++ b/prismarine-viewer/viewer/lib/worldrendererCommon.ts @@ -100,6 +100,7 @@ export abstract class WorldRendererCommon x: number z: number } + neighborChunkUpdates = true abstract outputFormat: 'threeJs' | 'webgpu' @@ -321,7 +322,7 @@ export abstract class WorldRendererCommon for (let y = this.worldConfig.minY; y < this.worldConfig.worldHeight; y += 16) { const loc = new Vec3(x, y, z) this.setSectionDirty(loc) - if (!isLightUpdate || this.mesherConfig.smoothLighting) { + if (this.neighborChunkUpdates && (!isLightUpdate || this.mesherConfig.smoothLighting)) { this.setSectionDirty(loc.offset(-16, 0, 0)) this.setSectionDirty(loc.offset(16, 0, 0)) this.setSectionDirty(loc.offset(0, 0, -16)) @@ -357,12 +358,14 @@ export abstract class WorldRendererCommon worker.postMessage({ type: 'blockUpdate', pos, stateId }) } this.setSectionDirty(pos) - if ((pos.x & 15) === 0) this.setSectionDirty(pos.offset(-16, 0, 0)) - if ((pos.x & 15) === 15) this.setSectionDirty(pos.offset(16, 0, 0)) - if ((pos.y & 15) === 0) this.setSectionDirty(pos.offset(0, -16, 0)) - if ((pos.y & 15) === 15) this.setSectionDirty(pos.offset(0, 16, 0)) - if ((pos.z & 15) === 0) this.setSectionDirty(pos.offset(0, 0, -16)) - if ((pos.z & 15) === 15) this.setSectionDirty(pos.offset(0, 0, 16)) + if (this.neighborChunkUpdates) { + if ((pos.x & 15) === 0) this.setSectionDirty(pos.offset(-16, 0, 0)) + if ((pos.x & 15) === 15) this.setSectionDirty(pos.offset(16, 0, 0)) + if ((pos.y & 15) === 0) this.setSectionDirty(pos.offset(0, -16, 0)) + if ((pos.y & 15) === 15) this.setSectionDirty(pos.offset(0, 16, 0)) + if ((pos.z & 15) === 0) this.setSectionDirty(pos.offset(0, 0, -16)) + if ((pos.z & 15) === 15) this.setSectionDirty(pos.offset(0, 0, 16)) + } } queueAwaited = false diff --git a/src/optionsGuiScheme.tsx b/src/optionsGuiScheme.tsx index fc9e347ea..015013d15 100644 --- a/src/optionsGuiScheme.tsx +++ b/src/optionsGuiScheme.tsx @@ -91,6 +91,7 @@ export const guiOptionsScheme: { tooltip: 'Additional distance to keep the chunks loading before unloading them by marking them as too far', }, handDisplay: {}, + neighborChunkUpdates: {}, }, ], main: [ @@ -429,15 +430,15 @@ const Category = ({ children }) =>
{ const { disabledUiParts } = useSnapshot(options) - const currentlyEnabled = disabledUiParts.includes(name) + const currentlyDisabled = disabledUiParts.includes(name) if (addUiText) label = `${label} UI` return + >{currentlyDisabled ? 'Enable' : 'Disable'} {label} } export const tryFindOptionConfig = (option: keyof AppOptions) => { diff --git a/src/optionsStorage.ts b/src/optionsStorage.ts index 936d5bfc3..d5a9e5aa8 100644 --- a/src/optionsStorage.ts +++ b/src/optionsStorage.ts @@ -84,6 +84,7 @@ const defaultOptions = { wysiwygSignEditor: 'auto' as 'auto' | 'always' | 'never', displayBossBars: false, // boss bar overlay was removed for some reason, enable safely disabledUiParts: [] as string[], + neighborChunkUpdates: true } function getDefaultTouchControlsPositions () { diff --git a/src/reactUi.tsx b/src/reactUi.tsx index 599a18f7c..2fb63c197 100644 --- a/src/reactUi.tsx +++ b/src/reactUi.tsx @@ -104,7 +104,7 @@ const InGameUi = () => { const { disabledUiParts, displayBossBars } = useSnapshot(options) const hasModals = useSnapshot(activeModalStack).length > 0 const showUI = showUIRaw || hasModals - if (!gameLoaded || !bot) return + if (!gameLoaded || !bot || disabledUiParts.includes('*')) return return <> diff --git a/src/watchOptions.ts b/src/watchOptions.ts index d26d2b90d..926c6be1d 100644 --- a/src/watchOptions.ts +++ b/src/watchOptions.ts @@ -62,6 +62,10 @@ export const watchOptionsAfterViewerInit = () => { if (!(viewer.world instanceof WorldRendererThree)) return viewer.world.starField.enabled = o.starfieldRendering }) + + watchValue(options, o => { + viewer.world.neighborChunkUpdates = o.neighborChunkUpdates + }) } let viewWatched = false From a063a0d75b58ecca6d692581aaf47bbc7f051966 Mon Sep 17 00:00:00 2001 From: Vitaly Turovsky Date: Sat, 7 Sep 2024 19:42:50 +0300 Subject: [PATCH 04/15] fix: fix cobblestone_wall and player head (skull) rendering in preflat versions --- prismarine-viewer/viewer/lib/mesher/models.ts | 23 +++++++++++++++--- src/preflatMap.json | 24 +++++++++---------- 2 files changed, 32 insertions(+), 15 deletions(-) diff --git a/prismarine-viewer/viewer/lib/mesher/models.ts b/prismarine-viewer/viewer/lib/mesher/models.ts index 8b9115e79..c7bce0c0d 100644 --- a/prismarine-viewer/viewer/lib/mesher/models.ts +++ b/prismarine-viewer/viewer/lib/mesher/models.ts @@ -479,15 +479,32 @@ export function getSectionGeometry (sx, sy, sz, world: World) { // cache let { models } = block if (block.models === undefined) { + const props = block.getProperties() try { + // fixme + if (world.preflat) { + if (block.name === 'cobblestone_wall') { + props.up = 'true' + for (const key of ['north', 'south', 'east', 'west']) { + const val = props[key] + if (val === 'false' || val === 'true') { + props[key] = val === 'true' ? 'low' : 'none' + } + } + } + } + models = blockProvider.getAllResolvedModels0_1({ name: block.name, - properties: block.getProperties(), + properties: props, })! - if (!models.length) models = null + if (!models.length) { + console.debug('[mesher] block to render not found', block.name, props) + models = null + } } catch (err) { models ??= erroredBlockModel - console.error(`Critical assets error. Unable to get block model for ${block.name}[${JSON.stringify(block.getProperties())}]: ` + err.message, err.stack) + console.error(`Critical assets error. Unable to get block model for ${block.name}[${JSON.stringify(props)}]: ` + err.message, err.stack) attr.hadErrors = true } } diff --git a/src/preflatMap.json b/src/preflatMap.json index fdf2640ff..81c2a20a4 100644 --- a/src/preflatMap.json +++ b/src/preflatMap.json @@ -925,18 +925,18 @@ "143:11": "oak_button[face=wall,facing=south,powered=true]", "143:12": "oak_button[face=wall,facing=north,powered=true]", "143:13": "oak_button[face=floor,facing=north,powered=true]", - "144:0": "undefined[facing=down,nodrop=false]", - "144:1": "undefined[facing=up,nodrop=false]", - "144:2": "undefined[facing=north,nodrop=false]", - "144:3": "undefined[facing=south,nodrop=false]", - "144:4": "undefined[facing=west,nodrop=false]", - "144:5": "undefined[facing=east,nodrop=false]", - "144:8": "undefined[facing=down,nodrop=true]", - "144:9": "undefined[facing=up,nodrop=true]", - "144:10": "undefined[facing=north,nodrop=true]", - "144:11": "undefined[facing=south,nodrop=true]", - "144:12": "undefined[facing=west,nodrop=true]", - "144:13": "undefined[facing=east,nodrop=true]", + "144:0": "player_head[facing=down]", + "144:1": "player_head[facing=up]", + "144:2": "player_head[facing=north]", + "144:3": "player_head[facing=south]", + "144:4": "player_head[facing=west]", + "144:5": "player_head[facing=east]", + "144:8": "player_head[facing=down]", + "144:9": "player_head[facing=up]", + "144:10": "player_head[facing=north]", + "144:11": "player_head[facing=south]", + "144:12": "player_head[facing=west]", + "144:13": "player_head[facing=east]", "145:0": "anvil[facing=south]", "145:1": "anvil[facing=west]", "145:2": "anvil[facing=north]", From fad9fd6e3a6052e8fe8b291d187e103f5e0b205d Mon Sep 17 00:00:00 2001 From: Vitaly Turovsky Date: Sat, 7 Sep 2024 19:48:08 +0300 Subject: [PATCH 05/15] fix: provide a hack to just render blocks all the blocks even with unknown states for preflat versions --- prismarine-viewer/viewer/lib/mesher/models.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/prismarine-viewer/viewer/lib/mesher/models.ts b/prismarine-viewer/viewer/lib/mesher/models.ts index c7bce0c0d..e63a92ea4 100644 --- a/prismarine-viewer/viewer/lib/mesher/models.ts +++ b/prismarine-viewer/viewer/lib/mesher/models.ts @@ -497,7 +497,7 @@ export function getSectionGeometry (sx, sy, sz, world: World) { models = blockProvider.getAllResolvedModels0_1({ name: block.name, properties: props, - })! + }, world.preflat)! // fixme! this is a hack (also need a setting for all versions) if (!models.length) { console.debug('[mesher] block to render not found', block.name, props) models = null From d743981fc24f8d6f451c940f2b896b9ddb9e2ae9 Mon Sep 17 00:00:00 2001 From: Vitaly Turovsky Date: Sun, 8 Sep 2024 18:20:34 +0300 Subject: [PATCH 06/15] up workflow files: new commands --- .github/workflows/ci.yml | 2 +- .github/workflows/fix-lint.yml | 23 +++++++++++++++++++++++ .github/workflows/merge-next.yml | 24 ++++++++++++++++++++++++ 3 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/fix-lint.yml create mode 100644 .github/workflows/merge-next.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b1882914d..3649e89e7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -37,6 +37,6 @@ jobs: name: cypress-images path: cypress/integration/__image_snapshots__/ - run: node scripts/outdatedGitPackages.mjs - if: github.ref == 'refs/heads/next' + if: ${{ github.ref == 'refs/heads/next' }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/fix-lint.yml b/.github/workflows/fix-lint.yml new file mode 100644 index 000000000..990de3faf --- /dev/null +++ b/.github/workflows/fix-lint.yml @@ -0,0 +1,23 @@ +name: Fix Lint Command +on: + issue_comment: + types: [created] +jobs: + deploy: + runs-on: ubuntu-latest + if: >- + github.event.issue.pull_request != '' && + ( + contains(github.event.comment.body, '/fix') + ) + permissions: + pull-requests: write + steps: + - uses: actions/checkout@v2 + with: + ref: refs/pull/${{ github.event.issue.number }}/head + - run: pnpm lint --fix + - name: Push Changes + uses: ad-m/github-push-action@master + with: + github_token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/merge-next.yml b/.github/workflows/merge-next.yml new file mode 100644 index 000000000..c7a66454c --- /dev/null +++ b/.github/workflows/merge-next.yml @@ -0,0 +1,24 @@ +name: Update Base Branch Command +on: + issue_comment: + types: [created] +jobs: + deploy: + runs-on: ubuntu-latest + if: >- + github.event.issue.pull_request != '' && + ( + contains(github.event.comment.body, '/update') + ) + permissions: + pull-requests: write + steps: + - uses: actions/checkout@v2 + with: + ref: refs/pull/${{ github.event.issue.number }}/head + - name: Merge From Next + run: git merge next --strategy-option=theirs + - name: Push Changes + uses: ad-m/github-push-action@master + with: + github_token: ${{ secrets.GITHUB_TOKEN }} From f9a4960c3182e523e5492172b699691c128e1898 Mon Sep 17 00:00:00 2001 From: Vitaly Turovsky Date: Sun, 8 Sep 2024 18:28:55 +0300 Subject: [PATCH 07/15] ci: try to fix the commands --- .github/workflows/ci.yml | 2 ++ .github/workflows/merge-next.yml | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3649e89e7..a57a16462 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -36,6 +36,8 @@ jobs: with: name: cypress-images path: cypress/integration/__image_snapshots__/ + - name: print current ref + run: echo ${{ github.ref }} - run: node scripts/outdatedGitPackages.mjs if: ${{ github.ref == 'refs/heads/next' }} env: diff --git a/.github/workflows/merge-next.yml b/.github/workflows/merge-next.yml index c7a66454c..8bc34607a 100644 --- a/.github/workflows/merge-next.yml +++ b/.github/workflows/merge-next.yml @@ -15,9 +15,11 @@ jobs: steps: - uses: actions/checkout@v2 with: - ref: refs/pull/${{ github.event.issue.number }}/head + fetch-depth: 0 # Fetch all history so we can merge branches + - name: Fetch All Branches + run: git fetch --all - name: Merge From Next - run: git merge next --strategy-option=theirs + run: git merge origin/next --strategy-option=theirs - name: Push Changes uses: ad-m/github-push-action@master with: From e89196041e6eb9d7e998de603fc100619f47811f Mon Sep 17 00:00:00 2001 From: Vitaly Turovsky Date: Sun, 8 Sep 2024 18:37:06 +0300 Subject: [PATCH 08/15] ci: update commands --- .github/workflows/ci.yml | 4 ++-- .github/workflows/merge-next.yml | 4 +--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a57a16462..29b2f2d55 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -37,8 +37,8 @@ jobs: name: cypress-images path: cypress/integration/__image_snapshots__/ - name: print current ref - run: echo ${{ github.ref }} + run: echo ${{ github.event.pull_request.base.ref }} - run: node scripts/outdatedGitPackages.mjs - if: ${{ github.ref == 'refs/heads/next' }} + if: ${{ github.event.pull_request.base.ref == 'next' }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/merge-next.yml b/.github/workflows/merge-next.yml index 8bc34607a..c2e5ddf3c 100644 --- a/.github/workflows/merge-next.yml +++ b/.github/workflows/merge-next.yml @@ -21,6 +21,4 @@ jobs: - name: Merge From Next run: git merge origin/next --strategy-option=theirs - name: Push Changes - uses: ad-m/github-push-action@master - with: - github_token: ${{ secrets.GITHUB_TOKEN }} + run: git push From f518dce04d0588d7fc580a37846f810a53bdb2eb Mon Sep 17 00:00:00 2001 From: Vitaly Turovsky Date: Sun, 8 Sep 2024 18:39:13 +0300 Subject: [PATCH 09/15] ci: checkout pr before merge --- .github/workflows/merge-next.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/merge-next.yml b/.github/workflows/merge-next.yml index c2e5ddf3c..0b95e51e7 100644 --- a/.github/workflows/merge-next.yml +++ b/.github/workflows/merge-next.yml @@ -18,6 +18,8 @@ jobs: fetch-depth: 0 # Fetch all history so we can merge branches - name: Fetch All Branches run: git fetch --all + - name: Checkout PR + run: git checkout ${{ refs/pull/${{ github.event.issue.number }}/head }} - name: Merge From Next run: git merge origin/next --strategy-option=theirs - name: Push Changes From a3ef16a81a5b385135ddd98ea458773547125c3f Mon Sep 17 00:00:00 2001 From: Vitaly Turovsky Date: Sun, 8 Sep 2024 18:40:37 +0300 Subject: [PATCH 10/15] ci: checkout pr before merge --- .github/workflows/merge-next.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/merge-next.yml b/.github/workflows/merge-next.yml index 0b95e51e7..bd84fb024 100644 --- a/.github/workflows/merge-next.yml +++ b/.github/workflows/merge-next.yml @@ -19,7 +19,7 @@ jobs: - name: Fetch All Branches run: git fetch --all - name: Checkout PR - run: git checkout ${{ refs/pull/${{ github.event.issue.number }}/head }} + run: git checkout ${{ github.event.issue.pull_request.head.ref }} - name: Merge From Next run: git merge origin/next --strategy-option=theirs - name: Push Changes From ad8dc1a21a64880d6f6900d4201a460d53d129aa Mon Sep 17 00:00:00 2001 From: Vitaly Turovsky Date: Sun, 8 Sep 2024 21:03:11 +0300 Subject: [PATCH 11/15] fix: fix compatibility with some versions of new region format files --- pnpm-lock.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 84ea8fa16..bb94a5694 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -160,7 +160,7 @@ importers: version: 6.1.1 prismarine-provider-anvil: specifier: github:zardoy/prismarine-provider-anvil#everything - version: https://codeload.github.com/zardoy/prismarine-provider-anvil/tar.gz/0228b5252f48a0d6ad7f36d7189851c427fbe8c4(minecraft-data@3.65.0) + version: https://codeload.github.com/zardoy/prismarine-provider-anvil/tar.gz/a3f462dc81ded5b46e88e3442f99aadf35f7f699(minecraft-data@3.65.0) prosemirror-example-setup: specifier: ^1.2.2 version: 1.2.2 @@ -7514,8 +7514,8 @@ packages: prismarine-physics@1.8.0: resolution: {integrity: sha512-gbM+S+bmVtOKVv+Z0WGaHMeEeBHISIDsRDRlv8sr0dex3ZJRhuq8djA02CBreguXtI18ZKh6q3TSj2qDr45NHA==} - prismarine-provider-anvil@https://codeload.github.com/zardoy/prismarine-provider-anvil/tar.gz/0228b5252f48a0d6ad7f36d7189851c427fbe8c4: - resolution: {tarball: https://codeload.github.com/zardoy/prismarine-provider-anvil/tar.gz/0228b5252f48a0d6ad7f36d7189851c427fbe8c4} + prismarine-provider-anvil@https://codeload.github.com/zardoy/prismarine-provider-anvil/tar.gz/a3f462dc81ded5b46e88e3442f99aadf35f7f699: + resolution: {tarball: https://codeload.github.com/zardoy/prismarine-provider-anvil/tar.gz/a3f462dc81ded5b46e88e3442f99aadf35f7f699} version: 2.8.0 prismarine-realms@1.3.2: @@ -13385,7 +13385,7 @@ snapshots: prismarine-entity: 2.3.1 prismarine-item: 1.14.0 prismarine-nbt: 2.5.0 - prismarine-provider-anvil: https://codeload.github.com/zardoy/prismarine-provider-anvil/tar.gz/0228b5252f48a0d6ad7f36d7189851c427fbe8c4(minecraft-data@3.65.0) + prismarine-provider-anvil: https://codeload.github.com/zardoy/prismarine-provider-anvil/tar.gz/a3f462dc81ded5b46e88e3442f99aadf35f7f699(minecraft-data@3.65.0) prismarine-windows: 2.9.0 prismarine-world: https://codeload.github.com/zardoy/prismarine-world/tar.gz/187a87f6d71cba12881a7bbaa510ed9085bf6da7 rambda: 9.2.0 @@ -18623,7 +18623,7 @@ snapshots: prismarine-nbt: 2.5.0 vec3: 0.1.8 - prismarine-provider-anvil@https://codeload.github.com/zardoy/prismarine-provider-anvil/tar.gz/0228b5252f48a0d6ad7f36d7189851c427fbe8c4(minecraft-data@3.65.0): + prismarine-provider-anvil@https://codeload.github.com/zardoy/prismarine-provider-anvil/tar.gz/a3f462dc81ded5b46e88e3442f99aadf35f7f699(minecraft-data@3.65.0): dependencies: prismarine-block: https://codeload.github.com/zardoy/prismarine-block/tar.gz/a69b66ab1e4be6b67f25a5a6db15e0ad39e11819 prismarine-chunk: https://codeload.github.com/zardoy/prismarine-chunk/tar.gz/cea0b6c792d7dcbb69dfd20fa48be5fd60ce83ef(minecraft-data@3.65.0) From 3fb872129ed98b677cc4190e332237309f53f771 Mon Sep 17 00:00:00 2001 From: Vitaly Turovsky Date: Tue, 10 Sep 2024 00:29:30 +0300 Subject: [PATCH 12/15] fix: update autojump module --- .github/workflows/merge-next.yml | 1 + package.json | 2 +- pnpm-lock.yaml | 10 +++++----- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/merge-next.yml b/.github/workflows/merge-next.yml index bd84fb024..9bed1b3d7 100644 --- a/.github/workflows/merge-next.yml +++ b/.github/workflows/merge-next.yml @@ -12,6 +12,7 @@ jobs: ) permissions: pull-requests: write + contents: write steps: - uses: actions/checkout@v2 with: diff --git a/package.json b/package.json index 80c6fdac2..0f72fefc6 100644 --- a/package.json +++ b/package.json @@ -44,7 +44,7 @@ "@dimaka/interface": "0.0.3-alpha.0", "@floating-ui/react": "^0.26.1", "@mui/base": "5.0.0-beta.40", - "@nxg-org/mineflayer-auto-jump": "^0.7.7", + "@nxg-org/mineflayer-auto-jump": "^0.7.8", "@nxg-org/mineflayer-tracker": "^1.2.1", "@react-oauth/google": "^0.12.1", "@stylistic/eslint-plugin": "^2.6.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index bb94a5694..987a9dd38 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -45,8 +45,8 @@ importers: specifier: 5.0.0-beta.40 version: 5.0.0-beta.40(@types/react@18.2.20)(react-dom@18.2.0(react@18.2.0))(react@18.2.0) '@nxg-org/mineflayer-auto-jump': - specifier: ^0.7.7 - version: 0.7.7 + specifier: ^0.7.8 + version: 0.7.8 '@nxg-org/mineflayer-tracker': specifier: ^1.2.1 version: 1.2.1 @@ -2110,8 +2110,8 @@ packages: engines: {node: ^12.13.0 || ^14.15.0 || >=16.0.0} deprecated: This functionality has been moved to @npmcli/fs - '@nxg-org/mineflayer-auto-jump@0.7.7': - resolution: {integrity: sha512-50FYsz5rxBuLzOh7wqmg9iN9zdVGD+QjuaPcw/mD7q8Bq6Bq+o1/DfXfpoNGIHaDag80q6FJSpc73MI3Scid8g==} + '@nxg-org/mineflayer-auto-jump@0.7.8': + resolution: {integrity: sha512-o3XVruz2siApRvJKMe9EjQYTMANTMhStM3mRUKpZ1ar/2QqJ6sgyqEZTD9sE/zNA7bcjr49sZfuB8bX4t07Hww==} '@nxg-org/mineflayer-physics-util@1.5.8': resolution: {integrity: sha512-KmCkAqpUo8BbuRdIBs6+V2hWHehz++PRz3lRwIsb47CuG0u4sgLYh37RY3ifAznC6uWvmPK+q3B4ZXwJzPy1MQ==} @@ -11514,7 +11514,7 @@ snapshots: rimraf: 3.0.2 optional: true - '@nxg-org/mineflayer-auto-jump@0.7.7': + '@nxg-org/mineflayer-auto-jump@0.7.8': dependencies: '@nxg-org/mineflayer-physics-util': 1.5.8 strict-event-emitter-types: 2.0.0 From c6c25a7bb94d9c20e48f9852c77831a860c1fc15 Mon Sep 17 00:00:00 2001 From: Vitaly Turovsky Date: Tue, 10 Sep 2024 00:52:39 +0300 Subject: [PATCH 13/15] up again --- package.json | 2 +- pnpm-lock.yaml | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 0f72fefc6..dce998243 100644 --- a/package.json +++ b/package.json @@ -44,7 +44,7 @@ "@dimaka/interface": "0.0.3-alpha.0", "@floating-ui/react": "^0.26.1", "@mui/base": "5.0.0-beta.40", - "@nxg-org/mineflayer-auto-jump": "^0.7.8", + "@nxg-org/mineflayer-auto-jump": "^0.7.11", "@nxg-org/mineflayer-tracker": "^1.2.1", "@react-oauth/google": "^0.12.1", "@stylistic/eslint-plugin": "^2.6.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 987a9dd38..df10d754d 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -45,8 +45,8 @@ importers: specifier: 5.0.0-beta.40 version: 5.0.0-beta.40(@types/react@18.2.20)(react-dom@18.2.0(react@18.2.0))(react@18.2.0) '@nxg-org/mineflayer-auto-jump': - specifier: ^0.7.8 - version: 0.7.8 + specifier: ^0.7.11 + version: 0.7.11 '@nxg-org/mineflayer-tracker': specifier: ^1.2.1 version: 1.2.1 @@ -2110,8 +2110,8 @@ packages: engines: {node: ^12.13.0 || ^14.15.0 || >=16.0.0} deprecated: This functionality has been moved to @npmcli/fs - '@nxg-org/mineflayer-auto-jump@0.7.8': - resolution: {integrity: sha512-o3XVruz2siApRvJKMe9EjQYTMANTMhStM3mRUKpZ1ar/2QqJ6sgyqEZTD9sE/zNA7bcjr49sZfuB8bX4t07Hww==} + '@nxg-org/mineflayer-auto-jump@0.7.11': + resolution: {integrity: sha512-ex6lYch+YXXZKs/TGIMkspZqWTZ3pkteX4ZZHnrx1D3Yw8xfLaeU/lZ4O/8lH2uInuZbsx5pLKtwChOwKmJTlg==} '@nxg-org/mineflayer-physics-util@1.5.8': resolution: {integrity: sha512-KmCkAqpUo8BbuRdIBs6+V2hWHehz++PRz3lRwIsb47CuG0u4sgLYh37RY3ifAznC6uWvmPK+q3B4ZXwJzPy1MQ==} @@ -11514,7 +11514,7 @@ snapshots: rimraf: 3.0.2 optional: true - '@nxg-org/mineflayer-auto-jump@0.7.8': + '@nxg-org/mineflayer-auto-jump@0.7.11': dependencies: '@nxg-org/mineflayer-physics-util': 1.5.8 strict-event-emitter-types: 2.0.0 From a5dddfaad53ee94769a102ae662e1d2449254768 Mon Sep 17 00:00:00 2001 From: Vitaly Turovsky Date: Tue, 10 Sep 2024 01:20:39 +0300 Subject: [PATCH 14/15] up mineflayer-auto-jump --- package.json | 2 +- pnpm-lock.yaml | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index dce998243..0eb733fbb 100644 --- a/package.json +++ b/package.json @@ -44,7 +44,7 @@ "@dimaka/interface": "0.0.3-alpha.0", "@floating-ui/react": "^0.26.1", "@mui/base": "5.0.0-beta.40", - "@nxg-org/mineflayer-auto-jump": "^0.7.11", + "@nxg-org/mineflayer-auto-jump": "^0.7.12", "@nxg-org/mineflayer-tracker": "^1.2.1", "@react-oauth/google": "^0.12.1", "@stylistic/eslint-plugin": "^2.6.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index df10d754d..31adde17e 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -45,8 +45,8 @@ importers: specifier: 5.0.0-beta.40 version: 5.0.0-beta.40(@types/react@18.2.20)(react-dom@18.2.0(react@18.2.0))(react@18.2.0) '@nxg-org/mineflayer-auto-jump': - specifier: ^0.7.11 - version: 0.7.11 + specifier: ^0.7.12 + version: 0.7.12 '@nxg-org/mineflayer-tracker': specifier: ^1.2.1 version: 1.2.1 @@ -2110,8 +2110,8 @@ packages: engines: {node: ^12.13.0 || ^14.15.0 || >=16.0.0} deprecated: This functionality has been moved to @npmcli/fs - '@nxg-org/mineflayer-auto-jump@0.7.11': - resolution: {integrity: sha512-ex6lYch+YXXZKs/TGIMkspZqWTZ3pkteX4ZZHnrx1D3Yw8xfLaeU/lZ4O/8lH2uInuZbsx5pLKtwChOwKmJTlg==} + '@nxg-org/mineflayer-auto-jump@0.7.12': + resolution: {integrity: sha512-F5vX/lerlWx/5HVlkDNbvrtQ19PL6iG8i4ItPTIRtjGiFzusDefP7DI226zSFR8Wlaw45qHv0jn814p/4/qVdQ==} '@nxg-org/mineflayer-physics-util@1.5.8': resolution: {integrity: sha512-KmCkAqpUo8BbuRdIBs6+V2hWHehz++PRz3lRwIsb47CuG0u4sgLYh37RY3ifAznC6uWvmPK+q3B4ZXwJzPy1MQ==} @@ -11514,7 +11514,7 @@ snapshots: rimraf: 3.0.2 optional: true - '@nxg-org/mineflayer-auto-jump@0.7.11': + '@nxg-org/mineflayer-auto-jump@0.7.12': dependencies: '@nxg-org/mineflayer-physics-util': 1.5.8 strict-event-emitter-types: 2.0.0 From 2c971f331ed61c194ec6adf3b3c76025e63d62ab Mon Sep 17 00:00:00 2001 From: Vitaly Turovsky Date: Tue, 10 Sep 2024 01:34:26 +0300 Subject: [PATCH 15/15] fix: update entities tracker which should fix playing walking animations when players are standing still --- package.json | 2 +- pnpm-lock.yaml | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 0eb733fbb..c0ac0cc1a 100644 --- a/package.json +++ b/package.json @@ -45,7 +45,7 @@ "@floating-ui/react": "^0.26.1", "@mui/base": "5.0.0-beta.40", "@nxg-org/mineflayer-auto-jump": "^0.7.12", - "@nxg-org/mineflayer-tracker": "^1.2.1", + "@nxg-org/mineflayer-tracker": "^1.2.3", "@react-oauth/google": "^0.12.1", "@stylistic/eslint-plugin": "^2.6.1", "@types/gapi": "^0.0.47", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 31adde17e..05b83f3cf 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -48,8 +48,8 @@ importers: specifier: ^0.7.12 version: 0.7.12 '@nxg-org/mineflayer-tracker': - specifier: ^1.2.1 - version: 1.2.1 + specifier: ^1.2.3 + version: 1.2.3 '@react-oauth/google': specifier: ^0.12.1 version: 0.12.1(react-dom@18.2.0(react@18.2.0))(react@18.2.0) @@ -2116,8 +2116,8 @@ packages: '@nxg-org/mineflayer-physics-util@1.5.8': resolution: {integrity: sha512-KmCkAqpUo8BbuRdIBs6+V2hWHehz++PRz3lRwIsb47CuG0u4sgLYh37RY3ifAznC6uWvmPK+q3B4ZXwJzPy1MQ==} - '@nxg-org/mineflayer-tracker@1.2.1': - resolution: {integrity: sha512-SI1ffF8zvg3/ZNE021Ja2W0FZPN+WbQDZf8yFqOcXtPRXAtM9W6HvoACdzXep8BZid7WYgYLIgjKpB+9RqvCNQ==} + '@nxg-org/mineflayer-tracker@1.2.3': + resolution: {integrity: sha512-E7Ik/scU117Rr6kQUHHMBk8qOGh63YlTCGN33jMfeP7L8xmLeSHN3JtV/fbog8Y+R+HgO99yfZiRAaV7z1T6gQ==} '@nxg-org/mineflayer-trajectories@1.1.1': resolution: {integrity: sha512-X103KXlX8+L3uMeK4jQxMUdTizv01sQRSfBizAF/iOAdfQZehRLXr3CYKeJzfwPYGLN0X0JCl++cMEcZVn4vbg==} @@ -11523,7 +11523,7 @@ snapshots: dependencies: '@nxg-org/mineflayer-util-plugin': 1.8.3 - '@nxg-org/mineflayer-tracker@1.2.1': + '@nxg-org/mineflayer-tracker@1.2.3': dependencies: '@nxg-org/mineflayer-trajectories': 1.1.1 '@nxg-org/mineflayer-util-plugin': 1.8.3