Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

Hello. For some reasons I need to make distinct jar files for server and client. And I choose to split code into two source sets (main and client). So there is my gradle.build file:

Spoiler

buildscript {
   repositories {
      mavenCentral()
      maven {
         name = "forge"
         url = "http://files.minecraftforge.net/maven"
      }
      maven {
         name = "sonatype"
         url = "https://oss.sonatype.org/content/repositories/snapshots/"
      }
   }
   dependencies {
      classpath 'net.minecraftforge.gradle:ForgeGradle:1.2-SNAPSHOT'
   }
}

apply plugin: 'forge'

sourceSets {
   client
}

configurations {
   clientCompile.extendsFrom compile
   clientRuntime.extendsFrom runtime
   reobf.dependsOn.add("jarClient");
}

version = "0.1.2"
group = "mygroup"
archivesBaseName = "mymod"

minecraft {
   version = "1.7.10-10.13.4.1614-1.7.10"
}

task jarClient(type: Jar, dependsOn: "compileClientJava") {
   classifier = "client"
   from sourceSets.client.output
}

Task dependency order seems to be correct:

Spoiler

gradle build --dry-run
:compileApiJava SKIPPED
:processApiResources SKIPPED
:apiClasses SKIPPED
:sourceMainJava SKIPPED
:compileJava SKIPPED
:processResources SKIPPED
:classes SKIPPED
:jar SKIPPED
:compileTestJava SKIPPED
:processTestResources SKIPPED
:testClasses SKIPPED
:test SKIPPED
:extractMcpData SKIPPED
:getVersionJson SKIPPED
:extractUserDev SKIPPED
:genSrgs SKIPPED
:compileClientJava SKIPPED
:processClientResources SKIPPED
:clientClasses SKIPPED
:jarClient SKIPPED
:reobf SKIPPED
:assemble SKIPPED
:check SKIPPED
:build SKIPPED

BUILD SUCCESSFUL in 2s
 

But client jar is not passed to reobf task and I can't find how to do this. Any suggestions?

  • Author

If I say about reasons, then I'm afraid I will not get an answer to the question, since the discussion will shift in a completely different area. We may discuss the reasons for this architecture later, when I get an answer to my question.

  • Author

ReobfTask have special method that add jar file to processing queue. So I simply use it in my task and work is done:

Spoiler

task jarClient(type: Jar, dependsOn: "compileClientJava") {
   classifier = "client"
   from sourceSets.client.output
   reobf.reobf(getArchivePath())
}

 

Now about reasons.

1. This mod intended to use only by sole private minecraft server. There is no problems with distribution because there is no distribution at all.

2. Mod implements anti-cheat and other security measures. There is no reasons to expose security check details to the client side.

  • Author

No. Client side collect information and send it to the server. Server side check that data and make decisions.

Pure client side checks easy to bypass and because of that I need different code on client and server.

  • Author

...and third intermediary mod with shared code :).

Differentiation by sourceSets is enough for me.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.