From d754593849d8f9ff411ced69db3337a533d21cb1 Mon Sep 17 00:00:00 2001 From: Vitaly Turovsky Date: Fri, 20 Dec 2024 22:37:16 +0300 Subject: [PATCH] add christmas textures, update docs, fix singleplayer initial gamemode --- README.MD | 8 +++++--- package.json | 4 ++-- pnpm-lock.yaml | 20 +++++++++---------- .../viewer/lib/worldrendererCommon.ts | 11 ++++++++-- src/react/GlobalSearchInput.tsx | 1 - 5 files changed, 26 insertions(+), 18 deletions(-) diff --git a/README.MD b/README.MD index 34f9f2720..b7494cdb1 100644 --- a/README.MD +++ b/README.MD @@ -14,13 +14,15 @@ For building the project yourself / contributing, see [Development, Debugging & - Open any zip world file or even folder in read-write mode! - Connect to Java servers running in both offline (cracked) and online mode* (it's possible because of proxy servers, see below) +- Integrated JS server capable of opening Java world saves in any way (folders, zip, web streaming, etc) - Singleplayer mode with simple world generations! -- Google Drive support for reading / saving worlds back to the cloud - Works offline -- Play with friends over internet! (P2P is powered by Peer.js discovery servers) - First-class touch (mobile) & controller support +- First-class keybindings configuration - Basic Resource pack support: Custom GUI, all textures. Server resource packs are not supported yet. -- Builtin JEI with recipes & guides for every item (also replaces creative inventory) +- Builtin JEI with recipes & descriptions for every item (JEI is creative inventory replacement) +- Play with friends over internet! (P2P is powered by Peer.js discovery servers) +- ~~Google Drive support for reading / saving worlds back to the cloud~~ - even even more! All components that are in [Storybook](https://mcraft.fun/storybook) are published as npm module and can be used in other projects: [`minecraft-react`](https://npmjs.com/minecraft-react) diff --git a/package.json b/package.json index 15b27b15e..af5aaa296 100644 --- a/package.json +++ b/package.json @@ -68,7 +68,7 @@ "esbuild-plugin-polyfill-node": "^0.3.0", "express": "^4.18.2", "filesize": "^10.0.12", - "flying-squid": "npm:@zardoy/flying-squid@^0.0.49", + "flying-squid": "npm:@zardoy/flying-squid@^0.0.51", "fs-extra": "^11.1.1", "google-drive-browserfs": "github:zardoy/browserfs#google-drive", "jszip": "^3.10.1", @@ -142,7 +142,7 @@ "http-browserify": "^1.7.0", "http-server": "^14.1.1", "https-browserify": "^1.0.0", - "mc-assets": "^0.2.25", + "mc-assets": "^0.2.26", "minecraft-inventory-gui": "github:zardoy/minecraft-inventory-gui#next", "mineflayer": "github:zardoy/mineflayer", "mineflayer-pathfinder": "^2.4.4", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c5ad3115f..64c2333dc 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -119,8 +119,8 @@ importers: specifier: ^10.0.12 version: 10.0.12 flying-squid: - specifier: npm:@zardoy/flying-squid@^0.0.49 - version: '@zardoy/flying-squid@0.0.49(encoding@0.1.13)' + specifier: npm:@zardoy/flying-squid@^0.0.51 + version: '@zardoy/flying-squid@0.0.51(encoding@0.1.13)' fs-extra: specifier: ^11.1.1 version: 11.1.1 @@ -346,8 +346,8 @@ importers: specifier: ^1.0.0 version: 1.0.0 mc-assets: - specifier: ^0.2.25 - version: 0.2.25 + specifier: ^0.2.26 + version: 0.2.26 minecraft-inventory-gui: specifier: github:zardoy/minecraft-inventory-gui#next version: https://codeload.github.com/zardoy/minecraft-inventory-gui/tar.gz/75e940a4cd50d89e0ba03db3733d5d704917a3c8(@types/react@18.2.20)(react@18.2.0) @@ -3401,8 +3401,8 @@ packages: resolution: {integrity: sha512-6xm38yGVIa6mKm/DUCF2zFFJhERh/QWp1ufm4cNUvxsONBmfPg8uZ9pZBdOmF6qFGr/HlT6ABBkCSx/dlEtvWg==} engines: {node: '>=12 <14 || 14.2 - 14.9 || >14.10.0'} - '@zardoy/flying-squid@0.0.49': - resolution: {integrity: sha512-Kt4wr5/R+44tcLU9gjuNG2an9weWeKEpIoKXfsgJN2GGQqdnbd5nBpxfGDdgZ9aMdFugsVW8BsyPZNhj9vbMXA==} + '@zardoy/flying-squid@0.0.51': + resolution: {integrity: sha512-HHZ79H9NkS44lL9vk6gVEuJDJqj88gpiBt9Ihh5p4rHXTVbRid95riiNK5dD0kHI94P5/DXdtNalvmJDPU86oQ==} engines: {node: '>=8'} hasBin: true @@ -6582,8 +6582,8 @@ packages: peerDependencies: react: ^18.2.0 - mc-assets@0.2.25: - resolution: {integrity: sha512-MdtncPBC6kwIkYXsBsSEJGP+q2e+7Q4Wnb4j3FjS7gmafz50Vjp4E/S3MsM7H8R3FoDrjVIx6qR24l/rneW/Lw==} + mc-assets@0.2.26: + resolution: {integrity: sha512-BDrdD/kAMuVvD18nnvukE9StddL1VokParxSlFSRQdAAQmqTuYZlC19rho/SjYb+dBGZSVxwC+e0hZnSuyP9hA==} engines: {node: '>=18.0.0'} md5-file@4.0.0: @@ -13431,7 +13431,7 @@ snapshots: '@types/emscripten': 1.39.8 tslib: 1.14.1 - '@zardoy/flying-squid@0.0.49(encoding@0.1.13)': + '@zardoy/flying-squid@0.0.51(encoding@0.1.13)': dependencies: '@tootallnate/once': 2.0.0 chalk: 5.3.0 @@ -17453,7 +17453,7 @@ snapshots: dependencies: react: 18.2.0 - mc-assets@0.2.25: {} + mc-assets@0.2.26: {} md5-file@4.0.0: {} diff --git a/prismarine-viewer/viewer/lib/worldrendererCommon.ts b/prismarine-viewer/viewer/lib/worldrendererCommon.ts index 4dc1ff90d..eb0c7f4de 100644 --- a/prismarine-viewer/viewer/lib/worldrendererCommon.ts +++ b/prismarine-viewer/viewer/lib/worldrendererCommon.ts @@ -12,6 +12,7 @@ import itemsAtlasLegacy from 'mc-assets/dist/itemsAtlasLegacy.png' import { AtlasParser } from 'mc-assets' import TypedEmitter from 'typed-emitter' import { LineMaterial } from 'three-stdlib' +import christmasPack from 'mc-assets/dist/textureReplacements/christmas' import { dynamicMcDataFiles } from '../../buildMesherConfig.mjs' import { toMajorVersion } from '../../../src/utils' import { buildCleanupDecorator } from './cleanupDecorator' @@ -316,11 +317,17 @@ export abstract class WorldRendererCommon async updateTexturesData (resourcePackUpdate = false, prioritizeBlockTextures?: string[]) { const blocksAssetsParser = new AtlasParser(this.blocksAtlases, blocksAtlasLatest, blocksAtlasLegacy) const itemsAssetsParser = new AtlasParser(this.itemsAtlases, itemsAtlasLatest, itemsAtlasLegacy) + + const blockTexturesChanges = {} as Record + const date = new Date() + if ((date.getMonth() === 11 && date.getDate() >= 24) || (date.getMonth() === 0 && date.getDate() <= 6)) { + Object.assign(blockTexturesChanges, christmasPack) + } + const customBlockTextures = Object.keys(this.customTextures.blocks?.textures ?? {}).filter(x => x.includes('/')) const { atlas: blocksAtlas, canvas: blocksCanvas } = await blocksAssetsParser.makeNewAtlas(this.texturesVersion ?? this.version ?? 'latest', (textureName) => { const texture = this.customTextures?.blocks?.textures[textureName] - if (!texture) return - return texture + return blockTexturesChanges[textureName] ?? texture }, /* this.customTextures?.blocks?.tileSize */undefined, prioritizeBlockTextures, customBlockTextures) const { atlas: itemsAtlas, canvas: itemsCanvas } = await itemsAssetsParser.makeNewAtlas(this.texturesVersion ?? this.version ?? 'latest', (textureName) => { const texture = this.customTextures?.items?.textures[textureName] diff --git a/src/react/GlobalSearchInput.tsx b/src/react/GlobalSearchInput.tsx index 6f2d56d12..05b102ac9 100644 --- a/src/react/GlobalSearchInput.tsx +++ b/src/react/GlobalSearchInput.tsx @@ -17,7 +17,6 @@ function InnerSearch () { > { customEvents.emit('search', value)