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

Better obfuscate tasks; use Java 8 for MC < 1.17; fix pets #542

Merged
merged 3 commits into from
Jul 30, 2021
Merged

Better obfuscate tasks; use Java 8 for MC < 1.17; fix pets #542

merged 3 commits into from
Jul 30, 2021

Conversation

datatags
Copy link
Collaborator

@datatags datatags commented Jul 28, 2021

What is the purpose of this pull request?

  1. Rewrites obfuscate task in preparation for v1_17_R2/v1_18_R1
  2. Fixes issue described here: Add 1.17(.1) support #540 (comment)
  3. Subprojects that do not have a Java version set in gradle.properties will be built with Java 8 by default instead of Java 16, meaning you won't need to install Java 16 just to run the plugin on your 1.8.8 server.
  4. Fixes pets no longer following the player

How do your changes address the purpose?

  1. A VersionedObfTask is generated for each project that needs to be remapped. All are triggered when using gradlew obfuscate
  2. Replace semicolon path separator with File.pathSeparator which returns ; or : depending on the current platform.
  3. A bit of task configuration
  4. In the original v1_17_R1 module, I rewrote one of the methods that removes pathfinders to use a new thing in Spigot 1.17 API thinking it did close enough to the same thing to work, but it didn't. I've reverted the change and re-optimized the reflection.

Changes

  • Rewrote obfuscation task
  • Use File.pathSeparator
  • Set required Java version in v1_17_R1/gradle.properties
  • Added Java-version-checking logic
  • Fixed pets in PathfinderUtil.java

Notes

  • Remapping is still only performed on the file at the default jar location and with the default name, so if you attempt to build a jar for only MC 1.17, for example, you'll have to remap it manually or tweak the tasks. I'm not sure of a good solution to this.
  • Removed fullJar task because it seems redundant to the default jar task.
  • When a subproject for a new MC version is created, you'll need to set the minimum Java version required and the MC version it should be remapped as using a gradle.properties file in the subproject. See file at v1_17_R1/gradle.properties for an example.
  • Currently, the code in EntityUtil#clearPathfinders() and PathfinderUtil#removePathfinders() is the same, so one of them should probably be removed.

@datatags datatags changed the title Better obfuscate tasks; use Java 8 for MC < 1.17 Better obfuscate tasks; use Java 8 for MC < 1.17; fix pets Jul 29, 2021
@iSach iSach merged commit 3feda54 into iSach:master Jul 30, 2021
@iSach
Copy link
Owner

iSach commented Jul 30, 2021

Thanks again! I was quite confused about how to fix the pets not following

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.

2 participants