Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"@dimaka/interface": "0.0.3-alpha.0",
"@floating-ui/react": "^0.26.1",
"@monaco-editor/react": "^4.7.0",
"@nxg-org/mineflayer-auto-jump": "^0.7.18",
"@nxg-org/mineflayer-auto-jump": "^0.8.0",
"@nxg-org/mineflayer-tracker": "1.3.0",
"@react-oauth/google": "^0.12.1",
"@stylistic/eslint-plugin": "^2.6.1",
Expand Down Expand Up @@ -76,6 +76,7 @@
"flying-squid": "npm:@zardoy/flying-squid@^0.0.122",
"framer-motion": "^12.9.2",
"fs-extra": "^11.1.1",
"glob": "^10.4.5",
"google-drive-browserfs": "github:zardoy/browserfs#google-drive",
"jszip": "^3.10.1",
"lil-gui": "^0.21.0",
Expand All @@ -84,7 +85,7 @@
"minecraft-data": "0.0.0",
"minecraft-inventory": "^0.1.47",
"minecraft-protocol": "github:PrismarineJS/node-minecraft-protocol#master",
"minecraft-renderer": "^0.1.91",
"minecraft-renderer": "^0.1.96",
"mineflayer-item-map-downloader": "github:zardoy/mineflayer-item-map-downloader",
"mojangson": "^2.0.4",
"net-browserify": "github:zardoy/prismarinejs-net-browserify",
Expand Down Expand Up @@ -116,7 +117,8 @@
"valtio": "^1.11.1",
"vec3": "^0.1.7",
"wait-on": "^7.2.0",
"workbox-build": "^7.0.0"
"workbox-build": "^7.0.0",
"ws": "^8.18.1"
},
"devDependencies": {
"@rsbuild/core": "1.3.5",
Expand Down Expand Up @@ -192,7 +194,7 @@
"pnpm": {
"overrides": {
"mineflayer": "github:zardoy/mineflayer#gen-the-master",
"@nxg-org/mineflayer-physics-util": "1.8.19",
"@nxg-org/mineflayer-physics-util": "https://github.com/zardoy/mineflayer-physics-utils",
"buffer": "^6.0.3",
"vec3": "0.1.10",
"three": "0.184.0",
Expand Down
64 changes: 0 additions & 64 deletions patches/minecraft-protocol@1.66.0.patch
Original file line number Diff line number Diff line change
Expand Up @@ -73,70 +73,6 @@ index 63cc2bd9615100bd2fd63dfe14c094aa6b8cd1c9..36df57d1196af9761d920fa285ac48f8
}

function onJoinServerResponse (err) {
diff --git a/src/client/play.js b/src/client/play.js
index 71ad739f118306b741908817851b0322db6f17e5..881abc9faf4dcf85127935b320e1a83786894330 100644
--- a/src/client/play.js
+++ b/src/client/play.js
@@ -31,11 +31,37 @@ module.exports = function (client, options) {

client.once('success', onLogin)

+ function pickLocale () {
+ const locales = [
+ ['en_US', 0.60],
+ ['en_GB', 0.10],
+ ['de_DE', 0.12],
+ ['id_ID', 0.10],
+ ['fr_FR', 0.04],
+ ['es_ES', 0.04]
+ ]
+ const roll = Math.random()
+ let cumulative = 0
+ for (const [locale, weight] of locales) {
+ cumulative += weight
+ if (roll < cumulative) return locale
+ }
+ return 'en_US'
+ }
+
function onLogin (packet) {
const mcData = require('minecraft-data')(client.version)
client.uuid = packet.uuid
client.username = packet.username

+ const resolvedProfile = {
+ locale: options.clientProfile?.locale ?? pickLocale(),
+ viewDistance: options.clientProfile?.viewDistance ?? 10,
+ mainHand: options.clientProfile?.mainHand !== undefined
+ ? options.clientProfile.mainHand
+ : (Math.random() < 0.75 ? 1 : 0)
+ }
+
if (mcData.supportFeature('hasConfigurationState')) {
client.write('login_acknowledged', {})
enterConfigState(onReady)
@@ -53,6 +79,21 @@ module.exports = function (client, options) {
client.write('configuration_acknowledged', {})
}
client.state = states.CONFIGURATION
+
+ // Send client information immediately on entering config phase.
+ // Some servers *cough cough hypixel* require this before they will proceed past
+ // configuration state. Without it, you get the socketClosed error.
+ client.write('settings', {
+ locale: resolvedProfile.locale,
+ viewDistance: resolvedProfile.viewDistance,
+ chatFlags: 0,
+ chatColors: true,
+ skinParts: 127,
+ mainHand: resolvedProfile.mainHand,
+ enableTextFiltering: false,
+ enableServerListing: true
+ })
+
client.once('select_known_packs', () => {
client.write('select_known_packs', { packs: [] })
})
diff --git a/src/client/pluginChannels.js b/src/client/pluginChannels.js
index 671eb452f31e6b5fcd57d715f1009d010160c65f..7f69f511c8fb97d431ec5125c851b49be8e2ab76 100644
--- a/src/client/pluginChannels.js
Expand Down
77 changes: 42 additions & 35 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions rsbuild.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ const appConfig = defineConfig({
'process.env.COOKIE_STORAGE_PREFIX': JSON.stringify(process.env.COOKIE_STORAGE_PREFIX || ''),
'process.env.WS_PORT': JSON.stringify(enableMetrics ? 8081 : false),
'process.env.MINECRAFT_RENDERER_VERSION': JSON.stringify(minecraftRendererVersion),
'process.env.BOAT_PHYS_DEBUG': JSON.stringify(process.env.BOAT_PHYS_DEBUG),
},
},
server: {
Expand Down
Loading
Loading