+ return <>
{/* apply scaling */}
+ >
+}
+
+const App = () => {
+ return
}
diff --git a/src/screens.css b/src/screens.css
new file mode 100644
index 00000000..ebf37c96
--- /dev/null
+++ b/src/screens.css
@@ -0,0 +1,43 @@
+/* screen styles eg main menu and options are screens */
+
+.title, .screen-title {
+ font-size: 10px;
+ color: white;
+ text-align: center;
+ text-shadow: 1px 1px #222;
+}
+
+.screen-title {
+ margin-bottom: 10px;
+}
+
+.backdrop {
+ position: fixed;
+ inset: 0;
+ background: rgba(0, 0, 0, 0.75);
+}
+
+.fullscreen {
+ position: fixed;
+ inset: 0;
+ display: flex;
+ justify-content: center;
+}
+
+.screen-content {
+ display: flex;
+ flex-direction: column;
+ margin-top: 10px;
+ /* todo I'm not sure about it */
+ /* margin-top: calc(100% / 6 - 16px); */
+ width: 310px;
+ align-items: center;
+
+ gap: 10px;
+}
+
+.screen-items {
+ display: grid;
+ grid-template-columns: repeat(2, 1fr);
+ gap: 4px 10px;
+}
diff --git a/src/styles.css b/src/styles.css
index c2b6f972..472e022d 100644
--- a/src/styles.css
+++ b/src/styles.css
@@ -1,3 +1,5 @@
+@import url(./screens.css);
+
:root {
--guiScaleFactor: 3;
--guiScale: 3;
@@ -21,6 +23,7 @@ html {
height: 100vh;
overflow: hidden;
--widgets-gui-atlas: url('minecraft-assets/minecraft-assets/data/1.17.1/gui/widgets.png');
+ --title-gui: url('minecraft-assets/minecraft-assets/data/1.17.1/gui/title/minecraft.png');
color: white;
}
@@ -121,7 +124,7 @@ body {
}
}
-@media only screen and (max-width: 561px) {
+@media only screen and (max-width: 590px) {
#ui-root {
transform: scale(1);
width: calc(100% / 1);
diff --git a/src/texturePack.ts b/src/texturePack.ts
index 805c9a05..81f75043 100644
--- a/src/texturePack.ts
+++ b/src/texturePack.ts
@@ -5,10 +5,10 @@ import type { Viewer } from 'prismarine-viewer/viewer/lib/viewer'
import { subscribeKey } from 'valtio/utils'
import { proxy, ref } from 'valtio'
import blocksFileNames from '../generated/blocks.json'
-import { showNotification } from './menus/notification'
import type { BlockStates } from './inventory'
import { removeFileRecursiveAsync } from './browserfs'
import { setLoadingScreenStatus } from './utils'
+import { showNotification } from './globalState'
export const resourcePackState = proxy({
resourcePackInstalled: false,
diff --git a/src/utils.ts b/src/utils.ts
index 5a08ce88..26891ef6 100644
--- a/src/utils.ts
+++ b/src/utils.ts
@@ -1,7 +1,4 @@
-import * as crypto from 'crypto'
-import UUID from 'uuid-1345'
-import { activeModalStack, hideModal, miscUiState, showModal } from './globalState'
-import { notification } from './menus/notification'
+import { activeModalStack, hideModal, miscUiState, notification, showModal } from './globalState'
import { options } from './optionsStorage'
import { saveWorld } from './builtinCommands'
import { openWorldZip } from './browserfs'
@@ -118,20 +115,6 @@ export const isCypress = () => {
return localStorage.cypress === 'true'
}
-// https://github.com/PrismarineJS/node-minecraft-protocol/blob/cf1f67117d586b5e6e21f0d9602da12e9fcf46b6/src/server/login.js#L170
-function javaUUID (s: string) {
- const hash = crypto.createHash('md5')
- hash.update(s, 'utf8')
- const buffer = hash.digest()
- buffer[6] = (buffer[6] & 0x0f) | 0x30
- buffer[8] = (buffer[8] & 0x3f) | 0x80
- return buffer
-}
-
-export function nameToMcOfflineUUID (name) {
- return (new UUID(javaUUID('OfflinePlayer:' + name))).toString()
-}
-
export const setLoadingScreenStatus = function (status: string | undefined, isError = false, hideDots = false) {
const loadingScreen = document.getElementById('loading-error-screen')
@@ -179,10 +162,10 @@ export const setRenderDistance = () => {
}
prevRenderDistance = options.renderDistance
}
-export const reloadChunks = () => {
+export const reloadChunks = async () => {
if (!worldView) return
setRenderDistance()
- worldView.updatePosition(bot.entity.position, true)
+ await worldView.updatePosition(bot.entity.position, true)
}
export const openFilePicker = (specificCase?: 'resourcepack') => {
diff --git a/src/watchOptions.ts b/src/watchOptions.ts
index 026c43cb..1d505952 100644
--- a/src/watchOptions.ts
+++ b/src/watchOptions.ts
@@ -6,6 +6,13 @@ import { reloadChunks } from './utils'
subscribeKey(options, 'renderDistance', reloadChunks)
+watchValue(options, o => {
+ document.documentElement.style.setProperty('--chatScale', `${o.chatScale / 100}`)
+ document.documentElement.style.setProperty('--chatWidth', `${o.chatWidth}px`)
+ document.documentElement.style.setProperty('--chatHeight', `${o.chatHeight}px`)
+ document.documentElement.style.setProperty('--guiScale', `${o.guiScale}`)
+})
+
export const watchOptionsAfterViewerInit = () => {
watchValue(options, o => {
viewer.world.showChunkBorders = o.showChunkBorders
diff --git a/tsconfig.json b/tsconfig.json
index 1665bf34..68f59ef0 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -7,7 +7,7 @@
"jsx": "react-jsx",
"allowSyntheticDefaultImports": true,
"noEmit": true,
- "resolveJsonModule": true,
+ "resolveJsonModule": false,
"strictFunctionTypes": true,
"noImplicitAny": false,
"noFallthroughCasesInSwitch": true,
@@ -22,6 +22,7 @@
},
"include": [
"src",
- "cypress"
+ "cypress",
+ "prismarine-viewer/viewer"
]
}