-
-
Notifications
You must be signed in to change notification settings - Fork 238
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pc1.20.2 #1265
Pc1.20.2 #1265
Conversation
@@ -45,6 +45,7 @@ function createServer (options = {}) { | |||
server.onlineModeExceptions = Object.create(null) | |||
server.favicon = favicon | |||
server.options = options | |||
options.registryCodec = options.registryCodec || mcData.registryCodec || mcData.loginPacket?.dimensionCodec |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The dimensionCodec is no longer in loginPacket. So it it needs to be dumped and put into mcdata seperately. It's required before clients are able to join (to exit configuration state)
src/datatypes/minecraft.js
Outdated
@@ -43,35 +43,36 @@ function writeUUID (value, buffer, offset) { | |||
return offset + 16 | |||
} | |||
|
|||
function readNbt (buffer, offset) { | |||
return nbt.proto.read(buffer, offset, 'nbt') | |||
function readNbt (buffer, offset, { tagType } = { tagType: 'nbt' }) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we confident this is only useful for the network serialization?
Would there be any drawback to put this in prismarine-nbt ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is already just directly calling prismarine-nbt so it should be possible to just import the prismarine-nbt types directly into the protocol. But the optionalNBT type may actually require a custom type as there is a special case with zero.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would require importing all the custom types also https://github.com/PrismarineJS/prismarine-nbt/blob/master/nbt.js#L11C1-L20C48
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems to me that would be much cleaner as all nbt stuff would then live in prismarine-nbt
Also important if other stuff than nmp use the same format, for example anvil
src/server/login.js
Outdated
client.state = states.PLAY | ||
server.emit('playerJoin', client) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, problem seems due to not waiting for client to send back a finish_config
ok, tests are now passing, but looks like there may be an issue with
Currently chunk batch start looks like "packet_chunk_batch_start": [
"container",
[
{
"name": "batchSize",
"type": "varint"
}
]
], But it seems chunk batch start in 1.20.2 has no fields https://github.com/extremeheat/extracted_minecraft_data/blob/client1.20.2/client/net/minecraft/network/protocol/game/ClientboundChunkBatchStartPacket.java but finish retains the varint |
Actually, |
Looks like that may have been a dumb copy paste error on my part when doing all the packet changes in 1.20.2. As all my work was based on info from wiki.vg (Probably should have sanity checked it from source at some point) |
Ok, tests are passing now. Validator issue is fixed, just need to check over the protocol.json now. But anyway I think this can be merged before that, would just need to be checking before working on mineflayer |
@@ -16,8 +16,6 @@ module.exports = { | |||
size: buffer.length - offset | |||
} | |||
}], | |||
nbt: ['native', minecraft.nbt[0]], | |||
optionalNbt: ['native', minecraft.optionalNbt[0]], | |||
compressedNbt: ['native', minecraft.compressedNbt[0]], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe we could also move compressedNbt but not a big deal
client.once('login_acknowledged', onClientLoginAck) | ||
} else { | ||
client.state = states.PLAY | ||
server.emit('playerJoin', client) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this new event should be documented.
It would be breaking for flying-squid (and other users), why do we change from 'login' ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The server sets the mode to from LOGIN to CONFIG after receiving a login_ack
from the client. The server emits login
right after the ack, but the state is still in CONFIG so sending PLAY packets (like previous login
event would let you do) would fail, so in 1.20.2+ now need to either listen for state
event for it to turn to PLAY or use the added playerJoin
event before sending game packets
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok makes sense
looks good, I'm glad we could solve the nbt change with no hack and actually even improving the code, nice work @extremeheat I think it would be good to fix @wgaylord do you want to check the packets you added against the source? that way you can learn to do it for 1.20.2 and then apply the same method for 1.20.3 |
Yeah, I am going to go thru all the packets I touched and double check them some time tomorrow. |
No value for type soundSource , packedChunkedPos in packet tests |
does seem to work fully except for this one, no error anymore for 1.20.2 |
I think it's good now, merging |
/makerelease |
Fix #1258
The configuration state introduces lots of small problems in server/client expectations so there remain some errors in the test due to state desync. Will need to be investigated furtherNeeds audit of protocol.json for 1.20.2 against vanilla source code diff. Also, node-protodef-validator is not working.
After PrismarineJS/prismarine-nbt#81 and PrismarineJS/minecraft-data#810