Skip to content
This repository has been archived by the owner on Jun 29, 2023. It is now read-only.

Add 1.17(.1) support #540

Merged
merged 5 commits into from
Jul 26, 2021
Merged

Add 1.17(.1) support #540

merged 5 commits into from
Jul 26, 2021

Conversation

datatags
Copy link
Collaborator

@datatags datatags commented Jul 8, 2021

What is the purpose of this pull request?

This PR adds 1.17.1 support.

How do your changes address the purpose?

Adds a module (or whatever it's called) for NMS v1_17_R1 and some other changes

Changes

  • Create v1_17_R1 NMS module
  • Updated gradlew to 6.9 since it can at least support building with Java 16
  • Update supported server versions
  • Add gradle obfuscate task (see notes)
  • Test in-game

Notes (important)

  1. Since the Mojang mappings are now supported and Spigot NMS is now mostly obfuscated again, I've built the v1_17_R1 module for the Mojang mappings. To build it, you need to first build the 1.17.1 jar with BuildTools, but make sure you add the --remapped flag so the mapped jars also get created. Next, download SpecialSource, rename it to SpecialSource.jar, and drop it in the tooling/specialsource/ folder. Then, you should be able to use ./gradlew obfuscate, which will generate <jarname>-obf.jar, and <jarname>-remapped.jar. To run on Spigot, you'd use the <jarname>-remapped.jar. I've written the obfuscate task for Windows, so it will need to be adjusted if you aren't on Windows. (maybe a separate task needs to be created?) The obfuscate task will also need to be adjusted when we have another NMS module that needs to be obfuscated for a different version of MC.

  2. Also, since Java 16 is required for MC 1.17 development, I'm not sure what to do about the NMS modules for MC versions that don't support Java 16. I'm hoping someone more familiar with Gradle can come up with a solution for that. For now, I've set the languageVersion to Java 16 for all projects and that works for compiling a 1.17 build.

  3. I've only tested this on Spigot. It looks like Paper has not completely followed Spigot in mapping changes, so more adjustments would need to be made for UC to work there. Specifically, net.minecraft.world.entity.ai.navigation.NavigationAbstract has methods that are obfuscated on Spigot but not on Paper.

  4. I removed the maven.elmakers.com repository since it didn't seem to be working and the project seemed to build fine without it.

  5. I rewrote a bunch of the copy-pasted code in the build.gradle by creating a custom task type and having it find all projects that match the MC version it's looking for, and the tasks for each MC version are generated using a loop.

(might add more things as I think of them)

Thanks!

@iSach iSach merged commit 0ba2401 into iSach:master Jul 26, 2021
@iSach
Copy link
Owner

iSach commented Jul 26, 2021

Hello, sorry for the delay. I really really appreciate the huge help you provided here, both for gradle for which help was really needed, and also for the work on 1.17 support! I'll mention you in the update release, thanks a lot.

@iSach
Copy link
Owner

iSach commented Jul 27, 2021

@datatags
I've been trying to build and try it on my own but am having some difficulties with the 1.17 jar and the obfuscate task. How did you set up specialsource? I've got it set at the place mentioned in the command executed by the task, but somehow it keeps telling me:
Error: Could not find or load main class net.md_5.specialsource.SpecialSource
Did you do anything special?

@datatags
Copy link
Collaborator Author

I don't think so, you could try printing out the command it's running to make sure it looks right by adding println getCommandLine() at the end of each exec block in the obfuscate task. Mine looks like this:

[java, -cp, C:\Users\datatags\eclipse-workspace\UltraCosmetics\tooling\specialsource\SpecialSource.jar;C:\Users\datatags\.m2\repository\org\spigotmc\spigot\1.17.1-R0.1-SNAPSHOT\spigot-1.17.1-R0.1-SNAPSHOT-remapped-mojang.jar, net.md_5.specialsource.SpecialSource, --live, --only, be/isach/ultracosmetics/v1_17_R1, -q, -i, libs\UltraCosmetics-2.5.10-RELEASE.jar, -o, libs\UltraCosmetics-2.5.10-RELEASE-obf.jar, -m, C:\Users\datatags\.m2\repository\org\spigotmc\minecraft-server\1.17.1-R0.1-SNAPSHOT\minecraft-server-1.17.1-R0.1-SNAPSHOT-maps-mojang.txt, --reverse]
[java, -cp, C:\Users\datatags\eclipse-workspace\UltraCosmetics\tooling\specialsource\SpecialSource.jar;C:\Users\datatags\.m2\repository\org\spigotmc\spigot\1.17.1-R0.1-SNAPSHOT\spigot-1.17.1-R0.1-SNAPSHOT-remapped-obf.jar, net.md_5.specialsource.SpecialSource, --live, --only, be/isach/ultracosmetics/v1_17_R1, -q, -i, libs\UltraCosmetics-2.5.10-RELEASE-obf.jar, -o, libs\UltraCosmetics-2.5.10-RELEASE-remapped.jar, -m, C:\Users\datatags\.m2\repository\org\spigotmc\minecraft-server\1.17.1-R0.1-SNAPSHOT\minecraft-server-1.17.1-R0.1-SNAPSHOT-maps-spigot.csrg]

You've built 1.17.1 with BuildTools with the --remapped flag, right?

@iSach
Copy link
Owner

iSach commented Jul 27, 2021

I don't think so, you could try printing out the command it's running to make sure it looks right by adding println getCommandLine() at the end of each exec block in the obfuscate task. Mine looks like this:

[java, -cp, C:\Users\datatags\eclipse-workspace\UltraCosmetics\tooling\specialsource\SpecialSource.jar;C:\Users\datatags\.m2\repository\org\spigotmc\spigot\1.17.1-R0.1-SNAPSHOT\spigot-1.17.1-R0.1-SNAPSHOT-remapped-mojang.jar, net.md_5.specialsource.SpecialSource, --live, --only, be/isach/ultracosmetics/v1_17_R1, -q, -i, libs\UltraCosmetics-2.5.10-RELEASE.jar, -o, libs\UltraCosmetics-2.5.10-RELEASE-obf.jar, -m, C:\Users\datatags\.m2\repository\org\spigotmc\minecraft-server\1.17.1-R0.1-SNAPSHOT\minecraft-server-1.17.1-R0.1-SNAPSHOT-maps-mojang.txt, --reverse]
[java, -cp, C:\Users\datatags\eclipse-workspace\UltraCosmetics\tooling\specialsource\SpecialSource.jar;C:\Users\datatags\.m2\repository\org\spigotmc\spigot\1.17.1-R0.1-SNAPSHOT\spigot-1.17.1-R0.1-SNAPSHOT-remapped-obf.jar, net.md_5.specialsource.SpecialSource, --live, --only, be/isach/ultracosmetics/v1_17_R1, -q, -i, libs\UltraCosmetics-2.5.10-RELEASE-obf.jar, -o, libs\UltraCosmetics-2.5.10-RELEASE-remapped.jar, -m, C:\Users\datatags\.m2\repository\org\spigotmc\minecraft-server\1.17.1-R0.1-SNAPSHOT\minecraft-server-1.17.1-R0.1-SNAPSHOT-maps-spigot.csrg]

You've built 1.17.1 with BuildTools with the --remapped flag, right?

Yeah, I've got the good 1.17.1 jars with remapped. Does SpecialSource needs anything else? I built it from md5's repo but maybe I'm doing somehting wrong with it.

EDIT: SpecialJar -> SpecialSource typo

@datatags
Copy link
Collaborator Author

Not that I know of, I downloaded it from the 1.17 announcement on Spigot and it just worked.

@iSach
Copy link
Owner

iSach commented Jul 27, 2021

Tried with the jar from the announcement, same results despite the command looking right:

[java, -cp, /Users/sacha/Development/Java/UltraCosmetics/tooling/specialsource/SpecialSource.jar;/Users/sacha/.m2/repository/org/spigotmc/spigot/1.17.1-R0.1-SNAPSHOT/spigot-1.17.1-R0.1-SNAPSHOT-remapped-mojang.jar, net.md_5.specialsource.SpecialSource, --live, --only, be/isach/ultracosmetics/v1_17_R1, -q, -i, libs/UltraCosmetics-2.5.11-RELEASE.jar, -o, libs/UltraCosmetics-2.5.11-RELEASE-obf.jar, -m, /Users/sacha/.m2/repository/org/spigotmc/minecraft-server/1.17.1-R0.1-SNAPSHOT/minecraft-server-1.17.1-R0.1-SNAPSHOT-maps-mojang.txt, --reverse]

Makes no sense, the class is in the SpecialSource jar which exists in the specified folder.

@iSach
Copy link
Owner

iSach commented Jul 27, 2021

Well, my mistake was simply keeping the ";" seperator between the two jars instead of ":" on macOS. So much time for just that lol thanks for the help

@datatags
Copy link
Collaborator Author

Glad you got it figured out! :D

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants