Forge 1.8.9-1.12.2 handshake protocol support (#144)
Adds support for connecting to Forge servers from 1.8.9 up to 1.12.2. (1.7.10 was already supported with #134 #88) Tested on: - 1.8.9 + forge 11.15.1.2318 + ironchest - 1.10.2 + forge 12.18.3.2511 + ironchest - 1.11.2 + forge 13.20.1.2588 + ironchest - 1.12.2 + forge 14.23.5.2837 + ironchest Changes: * Parse and handle FmlHs::RegistryData packet for 1.8+ * Fix RegistryData acknowledgement phase WaitingServerComplete * Fix acknowledgement phase for 1.7.10 ModIdData too, somehow it worked accidentally * Append \0FML\0 to end of server hostname if Forge mods detected https://wiki.vg/Minecraft_Forge_Handshake#Connection_to_a_forge_server
This commit is contained in:
parent
a081c73215
commit
2451e780bd
|
@ -97,7 +97,6 @@ pub enum FmlHs {
|
||||||
ModList {
|
ModList {
|
||||||
mods: LenPrefixed<VarInt, ForgeMod>,
|
mods: LenPrefixed<VarInt, ForgeMod>,
|
||||||
},
|
},
|
||||||
/* TODO: 1.8+ https://wiki.vg/Minecraft_Forge_Handshake#Differences_from_Forge_1.7.10
|
|
||||||
RegistryData {
|
RegistryData {
|
||||||
has_more: bool,
|
has_more: bool,
|
||||||
name: String,
|
name: String,
|
||||||
|
@ -105,7 +104,6 @@ pub enum FmlHs {
|
||||||
substitutions: LenPrefixed<VarInt, String>,
|
substitutions: LenPrefixed<VarInt, String>,
|
||||||
dummies: LenPrefixed<VarInt, String>,
|
dummies: LenPrefixed<VarInt, String>,
|
||||||
},
|
},
|
||||||
*/
|
|
||||||
ModIdData {
|
ModIdData {
|
||||||
mappings: LenPrefixed<VarInt, ModIdMapping>,
|
mappings: LenPrefixed<VarInt, ModIdMapping>,
|
||||||
block_substitutions: LenPrefixed<VarInt, String>,
|
block_substitutions: LenPrefixed<VarInt, String>,
|
||||||
|
@ -145,11 +143,23 @@ impl Serializable for FmlHs {
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
3 => {
|
3 => {
|
||||||
Ok(FmlHs::ModIdData {
|
let protocol_version = unsafe { crate::protocol::CURRENT_PROTOCOL_VERSION };
|
||||||
mappings: Serializable::read_from(buf)?,
|
|
||||||
block_substitutions: Serializable::read_from(buf)?,
|
if protocol_version >= 47 {
|
||||||
item_substitutions: Serializable::read_from(buf)?,
|
Ok(FmlHs::RegistryData {
|
||||||
})
|
has_more: Serializable::read_from(buf)?,
|
||||||
|
name: Serializable::read_from(buf)?,
|
||||||
|
ids: Serializable::read_from(buf)?,
|
||||||
|
substitutions: Serializable::read_from(buf)?,
|
||||||
|
dummies: Serializable::read_from(buf)?,
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
Ok(FmlHs::ModIdData {
|
||||||
|
mappings: Serializable::read_from(buf)?,
|
||||||
|
block_substitutions: Serializable::read_from(buf)?,
|
||||||
|
item_substitutions: Serializable::read_from(buf)?,
|
||||||
|
})
|
||||||
|
}
|
||||||
},
|
},
|
||||||
255 => {
|
255 => {
|
||||||
Ok(FmlHs::HandshakeAck {
|
Ok(FmlHs::HandshakeAck {
|
||||||
|
|
Loading…
Reference in New Issue