Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file.
25 changes: 25 additions & 0 deletions fg7-obf-with-deps/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# eclipse
bin
*.launch
.settings
.metadata
.classpath
.project

# idea
out
*.ipr
*.iws
*.iml
.idea

# gradle
build
.gradle

# other
eclipse
run

# Files from Forge MDK
forge*changelog.txt
84 changes: 84 additions & 0 deletions fg7-obf-with-deps/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
plugins {
id("java")
id("idea")
id("eclipse")
id("net.minecraftforge.gradle") version "[7.0.15,8.0)"
id("net.minecraftforge.renamer")
}

version = "1.0"
group = "com.example"
base.archivesName = "fg7-obf-with-deps"

java.toolchain.languageVersion = JavaLanguageVersion.of(17)

minecraft {
mappings("official", "1.20.1")
runs {
configureEach {
workingDir.convention(layout.projectDirectory.dir("run"))

//systemProperty("forge.logging.markers", "REGISTRIES")

systemProperty("forge.logging.console.level", "debug")

systemProperty("eventbus.api.strictRuntimeChecks", "true")

//args("-mixin.config=test.mixins.json")
}

register("client") {
systemProperty("forge.enabledGameTestNamespaces", "test")
}
}
}

repositories {
minecraft.mavenizer(it)
maven(fg.forgeMaven)
maven(fg.minecraftLibsMaven)
maven {
// location of the maven that hosts JEI files before January 2023
name = "Progwml6's maven"
url = "https://dvs1.progwml6.com/files/maven/"
}
maven {
// location of the maven that hosts JEI files since January 2023
name = "Jared's maven"
url = "https://maven.blamejared.com/"
}
maven {
// location of a maven mirror for JEI files, as a fallback
name = "ModMaven"
url = "https://modmaven.dev"
}
}

dependencies {
var mcDep= minecraft.dependency("net.minecraftforge:forge:1.20.1-47.4.16")
implementation(mcDep)

var fromSrg = renamer.convert("reverse", minecraft.dependency.toSrgFile) {
reverse = true
format = "srg"
}

compileOnly(renamer.dependency("mezz.jei:jei-1.20.1-forge-api:15.20.0.129") {
map.from(fromSrg)
libraries.from(configurations.detachedConfiguration(mcDep.asProvider().get()).resolve())
})
runtimeOnly(renamer.dependency("mezz.jei:jei-1.20.1-forge:15.20.0.129") {
map.from(fromSrg)
libraries.from(configurations.detachedConfiguration(mcDep.asProvider().get()).resolve())
})
}

// Creates a task named 'renameJar'
renamer.classes(jar) {
// You need to point to the mappings you wish to apply, typically this is the Mapped names to SRG for older versions.
// ForgeGradle/Mavenizer generate these files for the dependencies you declare. So you can use the helper.
// Or you can specify the file or dependency if you host them yourself.
map.from(minecraft.dependency.toSrgFile)
// This is publishable task so you can specify things such as the classifier
archiveClassifier = "srg"
}
9 changes: 9 additions & 0 deletions fg7-obf-with-deps/build.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
org.gradle.caching=true
org.gradle.parallel=true
org.gradle.configureondemand=true

org.gradle.configuration-cache=true
org.gradle.configuration-cache.parallel=true
org.gradle.configuration-cache.problems=warn

net.minecraftforge.gradle.merge-source-sets=true
Empty file added fg7-obf-with-deps/gradlew
Empty file.
Empty file added fg7-obf-with-deps/gradlew.bat
Empty file.
16 changes: 16 additions & 0 deletions fg7-obf-with-deps/settings.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
pluginManagement {
includeBuild("../renamer-gradle")

repositories {
mavenCentral()
gradlePluginPortal()
maven { url = 'https://maven.minecraftforge.net' }
//mavenLocal()
}
}

plugins {
id("org.gradle.toolchains.foojay-resolver-convention") version "1.0.0"
}

rootProject.name = "fg7-obf-with-deps"
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.example.examplemod;

import com.mojang.logging.LogUtils;
import net.minecraft.world.level.block.Blocks;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import org.slf4j.Logger;

@Mod("test")
public final class ExampleMod {
private static final Logger LOGGER = LogUtils.getLogger();

public ExampleMod(FMLJavaModLoadingContext context) {
LOGGER.info("If this shows up we can reference obfuscated code: " + Blocks.DIRT.getDescriptionId());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.example.examplemod;

import mezz.jei.api.IModPlugin;
import mezz.jei.api.JeiPlugin;
import net.minecraft.resources.ResourceLocation;
import org.jetbrains.annotations.NotNull;

@JeiPlugin
public class TestJEIPlugin implements IModPlugin {
@Override
public @NotNull ResourceLocation getPluginUid() {
return ResourceLocation.fromNamespaceAndPath("examplemod", "test");
}
}
29 changes: 29 additions & 0 deletions fg7-obf-with-deps/src/main/resources/META-INF/mods.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
modLoader = "javafml"
loaderVersion = "*"
license = "Example"

[[mods]]
modId = "test"
version = "1.0"
displayName = "FG7 Obfuscation With Dependencies"

[[dependencies.test]]
modId = "forge"
mandatory = true
versionRange = "[46,)"
ordering = "NONE"
side = "BOTH"

[[dependencies.test]]
modId = "minecraft"
mandatory = true
versionRange = "[1.20.1]"
ordering = "NONE"
side = "BOTH"

[[dependencies.test]]
modId = "jei"
mandatory = true
versionRange = "[15.20.0.129]"
ordering = "AFTER"
side = "BOTH"
6 changes: 6 additions & 0 deletions fg7-obf-with-deps/src/main/resources/pack.mcmeta
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"pack": {
"description": "resources",
"pack_format": 12
}
}
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-9.3.0-rc-2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.3.0-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
1 change: 1 addition & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ rootProject.name = 'renamer'

includeBuild 'renamer-gradle'
includeBuild 'renamer-gradle-demo'
includeBuild 'fg7-obf-with-deps'

// Applying plugins causes them to not have any IDE support when also applied to any build.gradle files
// The workaround for now is to use this listener here so that it can stay in settings.gradle
Expand Down