Skip to content

Conversation

@iceiix
Copy link
Owner

@iceiix iceiix commented May 11, 2019

#134 #88 added Forge 1.7.10 handshake support, but 1.8.9 and later uses slightly different handshakes

@iceiix iceiix added the enhancement New feature or request label May 11, 2019
@iceiix
Copy link
Owner Author

iceiix commented May 11, 2019

RegistryData packets parse without error:

FML|HS ServerHello: fml_protocol_version=2, override_dimension=Some(0)
FML|HS msg=ServerHello { fml_protocol_version: 2, override_dimension: Some(0) }
Received FML|HS ServerHello 2 Some(0)
FML|HS msg=ModList { mods: [ForgeMod { modid: "FML", version: "8.0.99.99" }, ForgeMod { modid: "Forge", version: "11.15.1.2318" }, ForgeMod { modid: "mcp", version: "9.19" }] }
Received FML|HS ModList: [ForgeMod { modid: "FML", version: "8.0.99.99" }, ForgeMod { modid: "Forge", version: "11.15.1.2318" }, ForgeMod { modid: "mcp", version: "9.19" }]
FML|HS msg=RegistryData { has_more: true, name: "minecraft:potions",...
FML|HS msg=RegistryData { has_more: true, name: "minecraft:villagerprofessions...
FML|HS msg=RegistryData { has_more: true, name: "minecraft:blocks",...
FML|HS msg=RegistryData { has_more: false, name: "minecraft:items", ...

but then the connection drops after complete:

FML|HS msg=HandshakeAck { phase: WaitingCAck }
FML|HS msg=HandshakeAck { phase: Complete }
FML|HS handshake complete!
thread 'main' panicked at 'Err: IOError(Os { code: 54, kind: ConnectionReset, message: "Connection reset by peer" })', src/server/mod.rs:448:33

The server logs:

[16:19:45] [Netty Server IO 2/INFO] [FML]: Client attempting to join with 3 mods : [email protected],[email protected],[email protected]
[16:19:45] [Netty Server IO 2/ERROR] [FML]: Attempt to double complete the network connection!
[16:19:45] [Netty Server IO 2/ERROR] [FML]: HandshakeCompletionHandler exception
net.minecraftforge.fml.common.network.FMLNetworkException: Attempt to double complete!
at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.completeHandshake(NetworkDispatcher.java:534) ~[NetworkDispatcher.class:?]

https://github.com/MinecraftForge/MinecraftForge/blob/1.8.9/src/main/java/net/minecraftforge/fml/common/network/handshake/NetworkDispatcher.java#L533

@iceiix
Copy link
Owner Author

iceiix commented May 11, 2019

https://wiki.vg/Minecraft_Forge_Handshake#Forge_handshake

  • S→C: A series of RegistryData packets is sent, with hasMore being true for all packets except the last.
  • Client reads and stores each RegistryData, continuing reading until hasMore is false. Once hasMore is false, it checks whether it has all of the needed blocks/items. If it does not, it disconnects. Otherwise, continue.
  • C→S: A HandshakeAck packet is sent with phase being WAITINGSERVERCOMPLETE (3).

but I was sending WaitingServerData in reply to RegistryData (and ModIdData)... was that wrong for ModIdData too? ModList is supposed to be replied with WaitingServerData. Changing to WaitingServerComplete works (for 1.8.9, test 1.7.10).

@iceiix
Copy link
Owner Author

iceiix commented May 12, 2019

Tested with:

  • 1.8.9 (forge 11.15.1.2318)
  • 1.10.2 (forge 12.18.3.2511)
  • 1.11.2 (forge 13.20.1.2588)
  • 1.1.12 (forge 14.23.5.2837)

but with no mods on the server. Retested with http://files.minecraftforge.net/maven/cpw/mods/ironchest/index_1.8.9.html installed on the server, then fails:

Screen Shot 2019-05-11 at 5 04 36 PM

Explanation at: https://wiki.vg/Minecraft_Forge_Handshake#Connection_to_a_forge_server
Omitting \0FML\0 on the end of the server address didn't matter for 1.7.10 for some reason.

@iceiix
Copy link
Owner Author

iceiix commented May 12, 2019

After adding \0FML\0, able to connect to:

  • 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

http://files.minecraftforge.net/maven/cpw/mods/ironchest/ only goes up to release 1.12.2 (and snapshot 13w02b, which is protocol 53 = a few weeks after 1.4.7, not supported pre-1.7.10).

http://files.minecraftforge.net/maven/net/minecraftforge/forge/index_1.13.2.html has Forge 1.13.2 but would need a 1.13.2 mod. https://bot.notenoughmods.com/1.13.2.html lists 18 mods, including ironchests as dev-only but can't find the 1.13.2 download on the link given.

https://bot.notenoughmods.com/1.14.html has 3 mods and there is also https://fabricmc.net but Forge doesn't have a 1.14 release yet on http://files.minecraftforge.net/maven/net/minecraftforge/forge.

@iceiix
Copy link
Owner Author

iceiix commented May 12, 2019

@iceiix
Copy link
Owner Author

iceiix commented May 12, 2019

1.13.2 + forge 25.0.198 + ironchest

changed the ping packet data, kicked:

packet = Some(StatusResponse(StatusResponse { status: "{"description":{"text":"A Minecraft Server"},"players":{"max":20,"online":0},"version":{"name":"1.13.2","protocol":404},"forgeData":{"channels":[{"res":"ironchest:main_channel","version":"1","required":false}],"mods":[{"modId":"forge","modmarker":"ANY"},{"modId":"ironchest","modmarker":"1.13.2-8.0.2"}],"fmlNetworkVersion":2}}" }))
about to parse id=1, dir=Clientbound state=Status
packet = Some(StatusPong(StatusPong { ping: 42 }))
[main.rs:95][INFO] Detected server protocol version 404
about to parse id=0, dir=Clientbound state=Login
packet = Some(LoginDisconnect(LoginDisconnect { reason: Text(TextComponent { text: "This server has mods that require Forge to be installed on the client. Contact your server admin for more details.", modifier: Modifier { extra: None, bold: None, italic: None, underlined: None, strikethrough: None, obfuscated: None, color: None } }) }))

Screen Shot 2019-05-11 at 6 01 32 PM

{
  "description": {
    "text": "A Minecraft Server"
  },
  "players": {
    "max": 20,
    "online": 0
  },
  "version": {
    "name": "1.13.2",
    "protocol": 404
  },
  "forgeData": {
    "channels": [
      {
        "res": "ironchest:main_channel",
        "version": "1",
        "required": false
      }
    ],
    "mods": [
      {
        "modId": "forge",
        "modmarker": "ANY"
      },
      {
        "modId": "ironchest",
        "modmarker": "1.13.2-8.0.2"
      }
    ],
    "fmlNetworkVersion": 2
  }
}

@iceiix
Copy link
Owner Author

iceiix commented May 12, 2019

[main.rs:95][INFO] Detected server protocol version 404
about to parse id=1b, dir=Clientbound state=Login
thread '' panicked at 'bad packet id 0x1b in Clientbound Login', src/protocol/versions/v1_13_2.rs:1:1

@iceiix
Copy link
Owner Author

iceiix commented May 12, 2019

Since it evolves more drastic changes, keeping this PR for up to 1.12.2 splitting off 1.13.2+

@iceiix iceiix changed the title Forge 1.8.9+ handshake protocol support Forge 1.8.9-1.12.2 handshake protocol support May 12, 2019
@iceiix
Copy link
Owner Author

iceiix commented May 12, 2019

Testing with top Forge modpacks:

https://www.feed-the-beast.com/modpacks?filter-sort=5
https://minecraft.curseforge.com/modpacks?filter-sort=5

Project_Ozone_2-Server-v.2.4.0 (1.7.10, Curseforge top 1)
stevenarella Project Ozone 2

Agrarian Skies AS2-1.1.14-Server (1.7.10, Curseforge top 2)
stevenarella Agrarian Skies 2

SevTech_Ages_Server_3.1.1 (1.12.2, Curseforge top 3)
crash #146 1.12.2 Forge: SevTech: Ages crashes: error: StringError("failed to fill whole buffer") / java.util.zip.DataFormatException: incorrect header check

@iceiix
Copy link
Owner Author

iceiix commented May 12, 2019

FTBPresentsSkyfactory3Server_3.0.15 (1.10.2, FTB top 1)
same crash as #146, failed to fill whole buffer on ModList + io.netty.handler.codec.DecoderException: java.util.zip.DataFormatException: incorrect header check on server

FTBInfinityServer_3.0.2 (1.7.10, FTB top 2)
Screen Shot 2019-05-12 at 7 34 08 AM

FTBBeyondServer_1.11.0 (1.10.2, FTB top 3)
again same #146 crash

iceiix added a commit that referenced this pull request May 15, 2019
The first in support for modded content, a simple custom block: "rockwool" from the Thermal Expansion and Thermal Foundation mods for Forge:

https://ftb.gamepedia.com/Rockwool_(Thermal_Expansion_3)

This makes use of the Forge handshake (#88 #134 #144), matching the mod block names from the negotiation to numeric identifiers in the world to steven_blocks. Rockwool was chosen due to ease of implementation, it looks like wool from vanilla (except is fire-proof), and by supporting it the groundwork necessary is laid for more sophisticated mod support.

Tested with Thermal Expansion on 1.7.10, 1.10.2 (FTB Beyond), and 1.12.2 Forge servers.

* Add `modid` macro token, skipped from vanilla mappings

* Add ThermalExpansionRockwool block (1.7.10)

* Register modded blocks by modid->[data], and lookup block metadata

* Save block IDs from ModIdData/RegistryData to World modded_block_ids

* Add namespaced mod ids for ModIdData, \u{1}=block \u{2}=item

* Add ThermalFoundation's Rockwool (1.12.2)
iceiix added a commit that referenced this pull request May 15, 2019
The first in support for modded content, a simple custom block: "rockwool" from the Thermal Expansion and Thermal Foundation mods for Forge:

https://ftb.gamepedia.com/Rockwool_(Thermal_Expansion_3)

This makes use of the Forge handshake (#88 #134 #144), matching the mod block names from the negotiation to numeric identifiers in the world to steven_blocks. Rockwool was chosen due to ease of implementation, it looks like wool from vanilla (except is fire-proof), and by supporting it the groundwork necessary is laid for more sophisticated mod support.

Tested with Thermal Expansion on 1.7.10, 1.10.2 (FTB Beyond), and 1.12.2 Forge servers.

* Add `modid` macro token, skipped from vanilla mappings

* Add ThermalExpansionRockwool block (1.7.10)

* Register modded blocks by modid->[data], and lookup block metadata

* Save block IDs from ModIdData/RegistryData to World modded_block_ids

* Add namespaced mod ids for ModIdData, \u{1}=block \u{2}=item

* Add ThermalFoundation's Rockwool (1.12.2)
iceiix added a commit that referenced this pull request Feb 1, 2020
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
iceiix added a commit that referenced this pull request Feb 1, 2020
The first in support for modded content, a simple custom block: "rockwool" from the Thermal Expansion and Thermal Foundation mods for Forge:

https://ftb.gamepedia.com/Rockwool_(Thermal_Expansion_3)

This makes use of the Forge handshake (#88 #134 #144), matching the mod block names from the negotiation to numeric identifiers in the world to steven_blocks. Rockwool was chosen due to ease of implementation, it looks like wool from vanilla (except is fire-proof), and by supporting it the groundwork necessary is laid for more sophisticated mod support.

Tested with Thermal Expansion on 1.7.10, 1.10.2 (FTB Beyond), and 1.12.2 Forge servers.

* Add `modid` macro token, skipped from vanilla mappings

* Add ThermalExpansionRockwool block (1.7.10)

* Register modded blocks by modid->[data], and lookup block metadata

* Save block IDs from ModIdData/RegistryData to World modded_block_ids

* Add namespaced mod ids for ModIdData, \u{1}=block \u{2}=item

* Add ThermalFoundation's Rockwool (1.12.2)
iceiix added a commit that referenced this pull request Feb 1, 2020
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
iceiix added a commit that referenced this pull request Feb 1, 2020
The first in support for modded content, a simple custom block: "rockwool" from the Thermal Expansion and Thermal Foundation mods for Forge:

https://ftb.gamepedia.com/Rockwool_(Thermal_Expansion_3)

This makes use of the Forge handshake (#88 #134 #144), matching the mod block names from the negotiation to numeric identifiers in the world to steven_blocks. Rockwool was chosen due to ease of implementation, it looks like wool from vanilla (except is fire-proof), and by supporting it the groundwork necessary is laid for more sophisticated mod support.

Tested with Thermal Expansion on 1.7.10, 1.10.2 (FTB Beyond), and 1.12.2 Forge servers.

* Add `modid` macro token, skipped from vanilla mappings

* Add ThermalExpansionRockwool block (1.7.10)

* Register modded blocks by modid->[data], and lookup block metadata

* Save block IDs from ModIdData/RegistryData to World modded_block_ids

* Add namespaced mod ids for ModIdData, \u{1}=block \u{2}=item

* Add ThermalFoundation's Rockwool (1.12.2)
iceiix added a commit that referenced this pull request Feb 1, 2020
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
iceiix added a commit that referenced this pull request Feb 1, 2020
The first in support for modded content, a simple custom block: "rockwool" from the Thermal Expansion and Thermal Foundation mods for Forge:

https://ftb.gamepedia.com/Rockwool_(Thermal_Expansion_3)

This makes use of the Forge handshake (#88 #134 #144), matching the mod block names from the negotiation to numeric identifiers in the world to steven_blocks. Rockwool was chosen due to ease of implementation, it looks like wool from vanilla (except is fire-proof), and by supporting it the groundwork necessary is laid for more sophisticated mod support.

Tested with Thermal Expansion on 1.7.10, 1.10.2 (FTB Beyond), and 1.12.2 Forge servers.

* Add `modid` macro token, skipped from vanilla mappings

* Add ThermalExpansionRockwool block (1.7.10)

* Register modded blocks by modid->[data], and lookup block metadata

* Save block IDs from ModIdData/RegistryData to World modded_block_ids

* Add namespaced mod ids for ModIdData, \u{1}=block \u{2}=item

* Add ThermalFoundation's Rockwool (1.12.2)
iceiix added a commit that referenced this pull request Feb 2, 2020
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
iceiix added a commit that referenced this pull request Feb 2, 2020
The first in support for modded content, a simple custom block: "rockwool" from the Thermal Expansion and Thermal Foundation mods for Forge:

https://ftb.gamepedia.com/Rockwool_(Thermal_Expansion_3)

This makes use of the Forge handshake (#88 #134 #144), matching the mod block names from the negotiation to numeric identifiers in the world to steven_blocks. Rockwool was chosen due to ease of implementation, it looks like wool from vanilla (except is fire-proof), and by supporting it the groundwork necessary is laid for more sophisticated mod support.

Tested with Thermal Expansion on 1.7.10, 1.10.2 (FTB Beyond), and 1.12.2 Forge servers.

* Add `modid` macro token, skipped from vanilla mappings

* Add ThermalExpansionRockwool block (1.7.10)

* Register modded blocks by modid->[data], and lookup block metadata

* Save block IDs from ModIdData/RegistryData to World modded_block_ids

* Add namespaced mod ids for ModIdData, \u{1}=block \u{2}=item

* Add ThermalFoundation's Rockwool (1.12.2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants