Comments (9)
the error is saying you're sending the packet with data that does not make sense
This was when running the example verbatim (except changing the version, obviously). This is definitely a bug.
Update: the login packet data has changed. The following code now produces some new errors, but the old ones are gone and I'm able to pass login:
import { createServer } from "minecraft-protocol";
import fs from 'fs/promises';
import sharp from "sharp";
const mcVersion = "1.20.2";
const mcData = require("minecraft-data")(mcVersion);
const server = createServer({
// Host settings
host: "0.0.0.0",
port: 25565,
socketType: "tcp",
// Server settings
kickTimeout: 10000,
checkTimeoutInterval: 1000,
"online-mode": true,
keepAlive: true,
version: false,
hideErrors: false,
validateChannelProtocol: true,
enforceSecureProfile: false,
enableChatPreview: false,
// Configuration options
motd: "A Minecraft Server TESTING",
favicon: (await sharp(await fs.readFile("./assets/favicon.png")).resize({ width: 64, height: 64, fit: 'fill' }).png().toBuffer()).toString("base64"),
});
server.on('login', function(client) {
const loginPacket = mcData.loginPacket
console.log(`TEST 0`)
client.write('login', {
entityId: client.id,
isHardcore: false,
worldNames: loginPacket.worldNames,
maxPlayers: server.maxPlayers,
viewDistance: 10,
simulationDistance: 10,
reducedDebugInfo: false,
enableRespawnScreen: true,
doLimitedCrafting: false,
worldType: loginPacket.worldType,
worldName: 'minecraft:overworld',
hashedSeed: [0, 0],
gameMode: 0,
previousGameMode: 255,
isDebug: false,
isFlat: false,
death: {
dimensionName: 'minecraft:overworld',
location: {
x: 0,
y: 255,
z: 0
},
},
portalCooldown: 0,
});
console.log(`TEST 1`)
client.write('position', {
x: 0,
y: 255,
z: 0,
yaw: 0,
pitch: 0,
flags: 0x00
});
const msg = {
translate: 'chat.type.announcement',
"with": [
'Server',
'Hello, world!'
]
};
console.log(`TEST 2`)
client.write("chat", { message: JSON.stringify(msg), position: 0, sender: '0' });
console.log(`TEST 3`)
});
There needs to be WAY better documentation and compatibility here!
from node-minecraft-protocol.
笑死
from node-minecraft-protocol.
thank you that help a lot
from node-minecraft-protocol.
笑死
from node-minecraft-protocol.
“log”
from node-minecraft-protocol.
有沒有總可能她不識來開MC SERVER嗎
from node-minecraft-protocol.
Any updates? Having the same issue
from node-minecraft-protocol.
Can repro for minecraft versions >=1.19 and was not able to repro for <=1.18.2
from node-minecraft-protocol.
the error is saying you're sending the packet with data that does not make sense
from node-minecraft-protocol.
Related Issues (20)
- Chat commands do not support chat previewing HOT 1
- Translation string crash
- Ping is not a recognized export HOT 5
- Chunk size is 23 but only 15 was read ; partial packet : {"name":"entity_sound_effect","params":{"soundId":526,"soundCategory":2,"entityId":52724,"volume":16,"pitch":1}}; buffer :5c8e0402f49b03418000003f800000fb8f631a089c6c66 HOT 8
- custom_payload packet won't encode properly. HOT 8
- support 1.20.2 HOT 13
- How can I login to a server with custom yggdrasil endpoint? HOT 1
- Chat Signing is Forced for Commands HOT 3
- Separate lint in tests
- Add packet dump for all supported versions HOT 1
- Automatically check all supported version in version.js are mentioned in the readme HOT 1
- support 1.20.3 and .4 HOT 7
- Cannot read properties of undefined (reading 'overworld') HOT 1
- "Chunk size is 42 but only 2 was read" error HOT 7
- Inconsistent `playerChat` event data
- undefined nbt value HOT 2
- Some event handlers end up being called multiple times after going thru configuration state. HOT 1
- 1.20.4 Login event never triggered on Node 18 HOT 19
- versionChecking.js Bug HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from node-minecraft-protocol.