Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update to the latest forgegradle #245

Draft
wants to merge 1 commit into
base: 1.12
Choose a base branch
from
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
102 changes: 68 additions & 34 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,32 @@ buildscript
repositories
{
jcenter()
maven { url = "http://files.minecraftforge.net/maven" }
maven { url = 'https://maven.minecraftforge.net/' }
}

dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT'
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.+', changing: true
classpath 'org.yaml:snakeyaml:1.18'
}
}

apply plugin: 'net.minecraftforge.gradle.forge'
apply plugin: 'net.minecraftforge.gradle'

repositories {
maven {
url "https://cursemaven.com"
content {
includeGroup "curse.maven"
}
}
}

if (project.hasProperty("dev"))
{
version += "-dev" + dev
}

version = project.version
group = "mchorse.blockbuster"
archivesBaseName = "blockbuster"
sourceCompatibility = targetCompatibility = "1.8"
Expand All @@ -35,27 +45,28 @@ compileJava

minecraft
{
version = "${mc_version}-${forge_version}"
runDir = "run"
mappings = snapshot

clientJvmArgs = ["-Xmx5G", "-Dfml.coreMods.load=" + coremodPath]
serverJvmArgs = ["-Xmx5G"]

replace "%VERSION%", project.version
replace "%METAMORPH%", project.metamorph
replace "%MCLIB%", project.mclib
replace "%APERTURE%", project.aperture
replace "%EMOTICONS%", project.emoticons
replace "%MINEMA%", project.minema
mappings channel: 'snapshot', version: project.snapshot

runs {
client {
workingDirectory project.file('run')
jvmArgs(["-Dfml.coreMods.load=" + coremodPath])
}

server {

}
}

}

dependencies
{
compile files("run/libs/mclib-${mclib}-${project.minecraft.version}-dev.jar")
compile files("run/libs/metamorph-${metamorph}-${project.minecraft.version}-dev.jar")
compile files("run/libs/aperture-${aperture}-${project.minecraft.version}-dev.jar")
compile files("run/libs/Minema-${minema}-${project.minecraft.version}-dev.jar")
minecraft "net.minecraftforge:forge:${project.mc_version}-${project.forge_version}"
implementation fg.deobf("curse.maven:mclib-304750:4044267")
implementation fg.deobf("curse.maven:metamorph-256932:4044182")
implementation fg.deobf("curse.maven:aperture-271561:4044181")
implementation fg.deobf("curse.maven:Minema-645749:3884808")
}

jar {
Expand All @@ -64,17 +75,17 @@ jar {
}
}

eclipse
/*eclipse
{
classpath
{
file
{
whenMerged
{ classpath ->
def ver = project.minecraft.version
/* Fucking gradle 2.14 doesn't have fileReference() method,
* screw you piece of shit */
{ classpath ->
def ver = project.mc_version
*//* Fucking gradle 2.14 doesn't have fileReference() method,
* screw you piece of shit *//*
def getMeReference = { File file ->
return [
getFile: { return file },
Expand All @@ -83,38 +94,61 @@ eclipse
isRelativeToPathVariable: { return false }
] as org.gradle.plugins.ide.eclipse.model.FileReference
}

def lib = entries.find { it.path.contains "metamorph-${metamorph}" }
lib.sourcePath = getMeReference(file("run/libs/metamorph-${metamorph}-${ver}-sources.jar"))
lib = entries.find { it.path.contains "aperture-${aperture}" }

lib = entries.find { it.path.contains "aperture-${aperture}" }
lib.sourcePath = getMeReference(file("run/libs/aperture-${aperture}-${ver}-sources.jar"))
lib = entries.find { it.path.contains "mclib-${mclib}" }

lib = entries.find { it.path.contains "mclib-${mclib}" }
lib.sourcePath = getMeReference(file("run/libs/mclib-${mclib}-${ver}-sources.jar"))
}
}
}
}
}*/

processResources
{
inputs.property "version", project.version
inputs.property "mcversion", project.minecraft.version
inputs.property "mcversion", project.mc_version

project.version += "-" + project.minecraft.version
project.version += "-" + project.mc_version

from(sourceSets.main.resources.srcDirs) {
include 'mcmod.info'

expand 'version':project.version, 'mcversion':project.minecraft.version
expand 'version':project.version, 'mcversion':project.mc_version
}

from(sourceSets.main.resources.srcDirs) {
exclude 'mcmod.info'
}
}


import org.apache.tools.ant.filters.ReplaceTokens
def copyDir = "$compileJava.temporaryDir/replaced"

task tokenReplace(type:Copy){
var test = sourceSets.main.java.sourceDirectories;
from(sourceSets.main.java.sourceDirectories)
into copyDir
filter(ReplaceTokens, tokens: [
VERSION: project.version,
METAMORPH: project.metamorph,
MCLIB: project.mclib,
APERTURE: project.aperture,
EMOTICONS: project.emoticons,
MINEMA: project.minema
])
}

compileJava.setSource(copyDir)

compileJava.dependsOn(tokenReplace)


/* Dev build */
task deobfJar(type: Jar) {
from sourceSets.main.output
Expand Down
5 changes: 3 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ minema=3.7

coremodPath=mchorse.blockbuster.core.BBCoreMod
mc_version=1.12.2
forge_version=14.23.5.2799
snapshot=snapshot_20171003
forge_version=14.23.5.2860
snapshot=20171003-1.12
vendor=McHorse
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
3 changes: 1 addition & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#Fri Jul 31 22:56:16 CEST 2020
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14-all.zip
2 changes: 1 addition & 1 deletion src/main/java/mchorse/blockbuster/Blockbuster.java
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
* of custom models)</li>
* </ul>
*/
@Mod(modid = Blockbuster.MOD_ID, name = Blockbuster.MODNAME, version = Blockbuster.VERSION, dependencies = "after:minema@[%MINEMA%,);before:aperture@[%APERTURE%,);before:emoticons@[%EMOTICONS%,);required-after:metamorph@[%METAMORPH%,);required-after:mclib@[%MCLIB%,);required-after:forge@[14.23.2.2638,)", updateJSON = "https://raw.githubusercontent.com/mchorse/blockbuster/1.12/version.json")
@Mod(modid = Blockbuster.MOD_ID, name = Blockbuster.MODNAME, version = Blockbuster.VERSION, dependencies = "after:minema@[@MINEMA@,);before:aperture@[@APERTURE@,);before:emoticons@[@EMOTICONS@,);required-after:metamorph@[@METAMORPH@,);required-after:mclib@[%MCLIB%,);required-after:forge@[14.23.2.2638,)", updateJSON = "https://raw.githubusercontent.com/mchorse/blockbuster/1.12/version.json")
public class Blockbuster
{
/* Mod info */
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/mchorse/blockbuster/core/BBCoreModInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ public Object getMod()
@Override
public String getVersion()
{
return "%VERSION%";
return "@VERSION@";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public String getMessage(EntityLivingBase actor)

if (!prefix.isEmpty())
{
message = prefix.replace("%NAME%", actor == null ? "Player" : actor.getName()) + message;
message = prefix.replace("@NAME@", actor == null ? "Player" : actor.getName()) + message;
}

return TextUtils.processColoredText(message);
Expand Down