itzg / docker-minecraft-server

Docker image that provides a Minecraft Server that will automatically download selected version at startup
https://docker-minecraft-server.readthedocs.io/
Apache License 2.0
9.15k stars 1.52k forks source link

Add SPONGEFORGE as docker environment variables #245

Open RoSulek1 opened 6 years ago

RoSulek1 commented 6 years ago

SPONGEVANILLA is added as allowed type. (Invalid type: 'SPONGEFORGE')
Must be: VANILLA, FORGE, BUKKIT, SPIGOT, PAPER, FTB, SPONGEVANILLA .

Please add this type (SPONGEFORGE) to variables if its possible, thanks

itzg commented 6 years ago

Builds upon the solution for #78

itzg commented 6 years ago

Hmm, it's a little bit trickier than I expected. I had made the change locally and encountered

--------------------------------------------------------------------------------

  Oops! You attempted to run the Sponge Forge Mod directly!

  This jar file is a mod for Minecraft Forge. You can run this file as a Forge
  mod by installing Minecraft Forge and simply dropping the jar file into the
  Forge "mods" directory. You can get Minecraft Forge from:

    http://files.minecraftforge.net/

  Once you have downloaded and installed Forge, you can load Sponge as a mod.

  If you need more help, you should check out our forums:

    http://forums.spongepowered.org/

--------------------------------------------------------------------------------2018/08/31 01:33:15 Done

which means the startup script will have to switch to TYPE=FORGE and install the spongeforge mod into that.

itzg commented 6 years ago

...made that change and now I notice Forge reports:

[01:51:39] [Server thread/INFO] [FML]: FML has found a non-mod file spongeforge-1.12.2-2705-7.1.0-BETA-3422.jar in your mods directory. It will now be injected into your classpath. This could severe stability issues, it should be removed if possible.

@RoSulek1 what's a good way to test that SpongeForge was actually successful?

RoSulek1 commented 6 years ago

No, This is when version of spongeforge is different of Forge

My Steps: 1/ Create minecraft container (on qnap docker) with env: FORGEVERSION 14.23.4.2705, MODPACK http://127.0.0.1/minecraft/mods/mods12_2_sponge.zip TYPE FORGE VERSION 1.12.2

where mods12_2_sponge.zip contains: spongeforge-1.12.2-2705-7.1.0-BETA-3361.jar

2/ run server 3/ response from server: `
[09:34:07] [main/INFO] [FML]: Forge Mod Loader version 14.23.4.2705 for Minecraft 1.12.2 loading
[09:34:08] [main/INFO] [FML]: Searching /data/./mods for mods
[09:34:09] [main/INFO] [FML]: Loading tweaker org.spongepowered.asm.launch.MixinTweaker from spongeforge-1.12.2-2705-7.1.0-BETA-3361.jar
[09:34:11] [main/INFO] [mixin]: SpongePowered MIXIN Subsystem Version=0.7.11 Source=file:/data/./mods/spongeforge-1.12.2-2705-7.1.0-BETA-3361.jar Service=LaunchWrapper Env=SERVER

[09:36:52] [Server thread/INFO] [net.minecraft.server.dedicated.DedicatedServer]: Starting minecraft server version 1.12.2
[09:36:52] [Server thread/INFO] [FML]: MinecraftForge v14.23.4.2705 Initialized
[09:36:55] [Server thread/INFO] [Sponge]: Found mcmod.info at jar:file:/data/./mods/spongeforge-1.12.2-2705-7.1.0-BETA-3361.jar!/mcmod.info
[09:36:56] [Server thread/INFO] [Sponge]: Creating injector in stage 'PRODUCTION'

[09:36:52] [Server thread/INFO] [FML]: MinecraftForge v14.23.4.2705 Initialized
[09:39:48] [Server thread/INFO] [FML]: Attempting connection with missing mods [minecraft, mcp, FML, forge, spongeapi, sponge] at CLIENT
[09:39:48] [Server thread/INFO] [FML]: Attempting connection with missing mods [minecraft, mcp, FML, forge, spongeapi, sponge] at SERVER

[09:39:59] [Forge Version Check/INFO] [forge.VersionCheck]: [sponge] Starting version check at https://files.minecraftforge.net/maven/org/spongepowered/spongeforge/promotions_slim.json
[09:40:08] [Forge Version Check/INFO] [forge.VersionCheck]: [sponge] Found status: OUTDATED Target: 7.1.0-BETA-3361
[10:15:20] [User Authenticator #1/INFO] [net.minecraft.server.network.NetHandlerLoginServer]: UUID of player RoSulek is bd5a0a9c-2a23-42d4-8a58-b65519aa3e2a
[10:15:24] [Netty Epoll Server IO #3/INFO] [FML]: Client protocol version 2 [10:15:24] [Netty Epoll Server IO #3/INFO] [FML]: Client attempting to join with 6 mods : minecraft@1.12.2,sponge@1.12.2-2705-7.1.0-BETA-3361,FML@8.0.99.99,spongeapi@7.1.0-SNAPSHOT-7105dfc,forge@14.23.4.2705,mcp@9.42
[10:15:24] [Server thread/INFO] [FML]: [Server thread] Server side modded connection established
[10:15:25] [Server thread/INFO] [net.minecraft.server.management.PlayerList]: RoSulek[/217.74.64.220:53484] logged in with entity id 1841 in world(0) at (216.5, 67.0, 257.5)

[10:15:26] [Server thread/INFO] [net.minecraft.server.dedicated.DedicatedServer]: RoSulek joined the game`

4/ result on client: http://rnd.pm/!!/spongeforge.jpg

ghost commented 5 years ago

Got something working.

Update to this, common misconception but SpongeForge is just an API compatibility mod that is itself a forge mod. Using the Forge version of the current system works just fine. Install the SpongeForge jar file as if it were a Forge mod.

SpongeForge will NOT use the /data/plugins folder. You need to create a directory named "plugins" inside of the mod folder. Path in the container is /data/mods/plugins. Place your Sponge mods in here and it should work!

Created pull request https://github.com/itzg/dockerfiles/pull/280 which adds most of what you need for a functional SpongeForge server in a docker-compose file. Find it in /examples.

itzg commented 5 years ago

@L3vi47h4N thanks for the info and the examples cleanup. To confirm, the TYPE=FORGE should be sufficient, right? If so, I'll revert the TYPE=SPONGEFORGE to avoid confusion.

ghost commented 5 years ago

@iztg that is correct. SpongeForge is just itself a forge mod. I'm running a server right now with a docker compose almost identical to the one I pushed up. ^.^ Only "gotcha" is that Sponge mods go inside /mods/plugins instead of /plugins.

ryantheleach commented 5 years ago

Just to be pedantic, (semi-retired staff member of SpongePowered)

SpongeForge will NOT use the /data/plugins folder. You need to create a directory named "plugins" inside of the mod folder. Path in the container is /data/mods/plugins. Place your Sponge mods in here and it should work!

This isn't quite accurate, or the full story.

Plugins designed as pure Sponge plugins, can be loaded from any configured directory as per https://docs.spongepowered.org/stable/en/server/getting-started/configuration/sponge-conf.html#general

plugins-dir Additional directory to search for plugins, relative to the execution root or specified as an absolute path. Note that the default: “${CANONICAL_MODS_DIR}/plugins” is going to search for a plugins folder in the mods directory. If you wish for the plugins folder to reside in the root game directory, change the value to “${CANONICAL_GAME_DIR}/plugins”.

However This comes with one huge caveat, that several 'Sponge Plugins' in the wild actually contain forge mods, and/or Core Mods.

Forge Mods can only be loaded from the mods directory not /mods/plugins, and will only work on SpongeForge and not SpongeVanilla. Sub directories in the mod folder for forge, are restricted to folders named after minecraft version numbers, and are optionally loaded depending on mc version.

I believe, but I'm not 100% certain, that some core mods may load on both SpongeForge and SpongeVanilla if they utilize SpongePowered\Mixins but not sure of the directory requirements.

This is a drawback due to compatibility with Forge, we do not want to modify Forge to load mods from an alternate plugin directory, and may be unable to do so depending on initialization order of other core mods and Sponge itself.

Placing plugins in alternate / sub directories should be restricted only to administrators that understand why, and need to do so for automation reasons. That said, several 'non pure' Sponge plugins will still need to remain in the mods folder.

TLDR; Sponges official stance, is that plugins belong in the mods folder for simplicity.

itzg commented 5 years ago

Thanks for the great clarification @ryantheleach .

Regarding the original issue, I'm still not sure if a TYPE=SPONGEFORGE is needed since technically it's a TYPE=FORGE with the Sponge Forge mod in use. I guess TYPE=SPONGEFORGE would bootstrap both forge and put the Sponge mod in place.

ghost commented 5 years ago

@ryantheleach Am I incorrect to say that Sponge does not currently load mods from /data/plugins with this docker setup? If this is not incorrect information, from a practical perspective, I don't believe it is in the best interest for the community to shoot down a working solution for the current system. We can certainly discuss what it should be, but let's not throw the baby out with the bathwater on those who want a system that works right now.

If you want to suggest a more sane solution coming from your experience working with Sponge, a pull request with a working alternative would be appreciated.

ryantheleach commented 5 years ago

By default, Sponge is configured to (additionally) load plugins (But not Forge mods or Core mods) from /data/mods/plugins .

Sponge will always load plugins and mods from /data/mods.

A common user request, was to be able to change this location, so the comments of the config provide an example of loading from /data/plugins but that must be configured by the user themselves.

However neither /data/plugins or /data/mods/plugins is recommended, as some plugins are hybrid jars and also contain Forge/Core mods.

I hope this makes it very clear, as I had some troubles interpreting your comment @L3vi47h4N .

See https://ore.spongepowered.org/Nucleus/Nucleus-Mixins for one popular example for MC 1.10

itzg commented 5 years ago

@L3vi47h4N , to further clarify, this minecraft-server image has to accommodate several different server types, so the /data/plugins directory is primarily there for Bukkit and variants thereof.