Skip to content

Commit f3cb902

Browse files
committed
Port to fabric
1 parent 01b7613 commit f3cb902

File tree

63 files changed

+1163
-1196
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+1163
-1196
lines changed

build.gradle

+71-145
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,12 @@
1-
buildscript {
2-
repositories {
3-
maven { url 'https://maven.minecraftforge.net' }
4-
maven { url 'https://maven.parchmentmc.org' }
5-
//maven { url 'https://repo.spongepowered.org/repository/maven-public/' }
6-
mavenCentral()
7-
maven {
8-
name = "sonatype"
9-
url = "https://oss.sonatype.org/content/repositories/snapshots/"
10-
}
11-
maven {
12-
url "https://plugins.gradle.org/m2/"
13-
}
14-
}
15-
dependencies {
16-
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.+', changing: true
17-
classpath 'org.parchmentmc:librarian:1.+'
18-
classpath 'io.freefair.gradle:lombok-plugin:6.3.0'
19-
//classpath group: 'org.spongepowered', name: 'mixingradle', version: '0.7-SNAPSHOT'
20-
}
21-
}
221
// Only edit below this line, the above code adds and enables the necessary things for Forge to be setup.
232
plugins {
3+
id "fabric-loom" version "1.0-SNAPSHOT"
244
id 'eclipse'
255
id 'maven-publish'
266
}
27-
apply plugin: 'net.minecraftforge.gradle'
28-
apply plugin: 'org.parchmentmc.librarian.forgegradle'
297
apply plugin: 'eclipse'
308
apply plugin: 'maven-publish'
31-
apply plugin: "io.freefair.lombok"
9+
//apply plugin: "io.freefair.lombok"
3210
//apply plugin: 'org.spongepowered.mixin'
3311

3412
/*mixin {
@@ -43,118 +21,27 @@ archivesBaseName = 'materialis'
4321
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
4422

4523
println "Java: ${System.getProperty 'java.version'}, JVM: ${System.getProperty 'java.vm.version'} (${System.getProperty 'java.vendor'}), Arch: ${System.getProperty 'os.arch'}"
46-
minecraft {
47-
// The mappings can be changed at any time, and must be in the following format.
48-
// Channel: Version:
49-
// snapshot YYYYMMDD Snapshot are built nightly.
50-
// stable # Stables are built at the discretion of the MCP team.
51-
// official MCVersion Official field/method names from Mojang mapping files
52-
//
53-
// You must be aware of the Mojang license when using the 'official' mappings.
54-
// See more information here: https://github.com/MinecraftForge/MCPConfig/blob/master/Mojang.md
55-
//
56-
// Use non-default mappings at your own risk. they may not always work.
57-
// Simply re-run your setup task after changing the mappings to update your workspace.
58-
mappings channel: 'parchment', version: "${mappings_version}-${minecraft_version}"
59-
// makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.
60-
61-
// accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
62-
63-
// Default run configurations.
64-
// These can be tweaked, removed, or duplicated as needed.
65-
runs {
66-
client {
67-
workingDirectory project.file('run')
68-
69-
// Recommended logging data for a userdev environment
70-
// The markers can be added/remove as needed separated by commas.
71-
// "SCAN": For mods scan.
72-
// "REGISTRIES": For firing of registry events.
73-
// "REGISTRYDUMP": For getting the contents of all registries.
74-
property 'forge.logging.markers', 'REGISTRIES'
75-
76-
// Recommended logging level for the console
77-
// You can set various levels here.
78-
// Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels
79-
property 'forge.logging.console.level', 'debug'
80-
81-
// Comma-separated list of namespaces to load gametests from. Empty = all namespaces.
82-
property 'forge.enabledGameTestNamespaces', 'materialis'
83-
84-
mods {
85-
materialis {
86-
source sourceSets.main
87-
}
88-
}
89-
}
90-
91-
server {
92-
workingDirectory project.file('run')
93-
94-
property 'forge.logging.markers', 'REGISTRIES'
95-
96-
property 'forge.logging.console.level', 'debug'
97-
98-
// Comma-separated list of namespaces to load gametests from. Empty = all namespaces.
99-
property 'forge.enabledGameTestNamespaces', 'materialis'
100-
101-
mods {
102-
materialis {
103-
source sourceSets.main
104-
}
105-
}
106-
}
107-
108-
// This run config launches GameTestServer and runs all registered gametests, then exits.
109-
// By default, the server will crash when no gametests are provided.
110-
// The gametest system is also enabled by default for other run configs under the /test command.
111-
gameTestServer {
112-
workingDirectory project.file('run')
113-
114-
// Recommended logging data for a userdev environment
115-
// The markers can be added/remove as needed separated by commas.
116-
// "SCAN": For mods scan.
117-
// "REGISTRIES": For firing of registry events.
118-
// "REGISTRYDUMP": For getting the contents of all registries.
119-
property 'forge.logging.markers', 'REGISTRIES'
120-
121-
// Recommended logging level for the console
122-
// You can set various levels here.
123-
// Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels
124-
property 'forge.logging.console.level', 'debug'
125-
126-
// Comma-separated list of namespaces to load gametests from. Empty = all namespaces.
127-
property 'forge.enabledGameTestNamespaces', 'materialis'
128-
129-
mods {
130-
materialis {
131-
source sourceSets.main
132-
}
133-
}
134-
}
13524

136-
data {
137-
workingDirectory project.file('run')
138-
139-
property 'forge.logging.markers', 'REGISTRIES'
25+
// Include resources generated by data generators.
26+
sourceSets.main.resources { srcDir 'src/generated/resources' }
14027

141-
property 'forge.logging.console.level', 'debug'
28+
loom {
29+
runs {
30+
datagen {
31+
client()
14232

143-
// Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources.
144-
args '--mod', 'materialis', '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/'), '--existing-mod', 'tconstruct'
33+
name "Data Generation"
34+
vmArg "-Dfabric-api.datagen"
35+
vmArg "-Dfabric-api.datagen.output-dir=${file("src/generated/resources")}"
36+
vmArg "-Dfabric-api.datagen.modid=materialis"
37+
// from ae2
38+
property "com.rcx.materialis.existingData", file("src/main/resources").absolutePath
14539

146-
mods {
147-
materialis {
148-
source sourceSets.main
149-
}
150-
}
40+
runDir "build/datagen"
15141
}
15242
}
15343
}
15444

155-
// Include resources generated by data generators.
156-
sourceSets.main.resources { srcDir 'src/generated/resources' }
157-
15845
repositories {
15946
mavenLocal()
16047
maven { // SlimeKnights and JEI
@@ -176,34 +63,62 @@ repositories {
17663
name = "jared maven"
17764
url = "https://maven.blamejared.com/"
17865
}
66+
maven { url = "https://maven.jamieswhiteshirt.com/libs-release" }
67+
maven { url = "https://ladysnake.jfrog.io/artifactory/mods" }
68+
maven { url = "https://maven.terraformersmc.com/releases/" }
69+
maven { url = "https://mvn.devos.one/snapshots/" }
70+
maven { url = "https://api.modrinth.com/maven" }
71+
maven { url = "https://maven.shedaniel.me/" }
72+
maven { url = "https://maven.wispforest.io" }
73+
maven { url = "https://maven.cafeteria.dev" }
74+
maven { url = "https://www.cursemaven.com" }
75+
maven { url = "https://jitpack.io" }
17976
}
18077

18178
dependencies {
182-
// Specify the version of Minecraft to use, If this is any group other then 'net.minecraft' it is assumed
183-
// that the dep is a ForgeGradle 'patcher' dependency. And it's patches will be applied.
184-
// The userdev artifact is a special name and will get all sorts of transformations applied to it.
185-
minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}"
79+
implementation 'org.projectlombok:lombok:1.18.22'
80+
minecraft "com.mojang:minecraft:${minecraft_version}"
81+
82+
mappings loom.officialMojangMappings()
83+
84+
// dev environment
85+
modImplementation("net.fabricmc:fabric-loader:${project.loader_version}")
86+
include(modImplementation(fabricApi.module("fabric-data-generation-api-v1", project.fabric_version)))
87+
88+
modImplementation("net.fabricmc.fabric-api:fabric-api:${project.fabric_version}")
89+
modImplementation(include("io.github.fabricators_of_create:Porting-Lib:${project.port_lib_version}+${project.minecraft_version}-stable"))
90+
modImplementation(include("curse.maven:forge-config-api-port-fabric-547434:${forge_config_version}"))
91+
modImplementation("com.github.AlphaMode:fakeconfig:master-SNAPSHOT") { exclude(group: "net.fabricmc.fabric-api") }
92+
modImplementation("com.github.AlphaMode:fakeconfigtoml:master-SNAPSHOT") { exclude(group: "net.fabricmc.fabric-api") }
93+
include("io.github.tropheusj:serialization-hooks:0.3.23")
94+
95+
// lombok
96+
compileOnly("org.projectlombok:lombok:1.18.22")
97+
annotationProcessor("org.projectlombok:lombok:1.18.22")
98+
99+
testCompileOnly("org.projectlombok:lombok:1.18.22")
100+
testAnnotationProcessor("org.projectlombok:lombok:1.18.22")
186101

187102
// Copypasted from tinkers energistics. No shame whatsoever.
188-
implementation fg.deobf("slimeknights.tconstruct:TConstruct:1.18.2-${tcon_version}")
189-
implementation fg.deobf("slimeknights.mantle:Mantle:1.18.2-${mantle_version}")
103+
modImplementation("slimeknights.tconstruct:Hephaestus:1.18.2-${tcon_version}")
104+
modImplementation("slimeknights.mantle:Mantle:1.18.2-${mantle_version}")
190105

191106
//compileOnly fg.deobf("mezz.jei:jei-${minecraft_version}:${jei_version}:api")
192-
implementation fg.deobf("mezz.jei:jei-${minecraft_version}:${jei_version}")
107+
modImplementation "mezz.jei:jei-${minecraft_version}-fabric:${jei_version}"
193108

194109
//compileOnly fg.deobf("curse.maven:eidolon-429625:3157832")
195110
//compileOnly fg.deobf("curse.maven:curios-309927:3748873")
196111
//compileOnly fg.deobf("vazkii.psi:Psi:${psi_version}")
197112
//compileOnly fg.deobf("curse.maven:magipsi-396405:3388248")
198-
compileOnly fg.deobf("vazkii.botania:Botania:${botania_version}")
199-
compileOnly fg.deobf("curse.maven:quark-243121:3740897")
200-
compileOnly fg.deobf("curse.maven:arl-250363:3642382")
201-
compileOnly fg.deobf("curse.maven:thermal-222880:3790416")
202-
compileOnly fg.deobf("curse.maven:cofhcore-69162:3793095")
203-
compileOnly fg.deobf("curse.maven:create-328085:3737418")
204-
compileOnly fg.deobf("curse.maven:immersiveengineering-231951:3755665")
205-
compileOnly fg.deobf("curse.maven:prettypipes-376737:3724800")
206-
compileOnly fg.deobf("curse.maven:arsnouveau-401955:3800858")
113+
modImplementation("vazkii.botania:Botania:${botania_version}")
114+
// modCompileOnly("curse.maven:quark-243121:3740897")
115+
// modCompileOnly("curse.maven:arl-250363:3642382")
116+
// modCompileOnly("curse.maven:thermal-222880:3790416")
117+
// modCompileOnly("curse.maven:cofhcore-69162:3793095")
118+
modImplementation("com.simibubi.create:create-fabric-${minecraft_version}:${create_version}")
119+
// modCompileOnly("curse.maven:immersiveengineering-231951:3755665")
120+
// modCompileOnly("curse.maven:prettypipes-376737:3724800")
121+
// modCompileOnly("curse.maven:arsnouveau-401955:3800858")
207122

208123
//annotationProcessor 'org.spongepowered:mixin:0.1.2-SNAPSHOT:processor'
209124

@@ -242,9 +157,20 @@ jar {
242157
}
243158
}
244159

160+
processResources {
161+
inputs.property "version", project.version
162+
163+
filesMatching("fabric.mod.json") {
164+
expand "version": project.version
165+
}
166+
167+
exclude 'META-INF/mods.toml'
168+
exclude 'pack.mcmeta'
169+
}
170+
245171
// Example configuration to allow publishing using the maven-publish plugin
246172
// This is the preferred method to reobfuscate your jar file
247-
jar.finalizedBy('reobfJar')
173+
jar.finalizedBy('remapJar')
248174
// However if you are in a multi-project build, dev time needs unobfed jar files, so you can delay the obfuscation until publishing by doing
249175
// publish.dependsOn('reobfJar')
250176

gradle.properties

+10-6
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,22 @@ minecraft_base_version=1.18
1111
minecraft_version=1.18.2
1212
minecraft_range=[1.18.2,1.19)
1313

14-
# Forge Version Information
14+
# Fabric Version Information
1515
forge_version=40.1.19
1616
mappings_version=2022.03.13
17-
loader_range=[39.0,)
17+
loader_version=0.14.9
18+
fabric_version=0.59.0+1.18.2
1819
forge_range=[40.0.41,)
1920

2021
# Build Dependencies
21-
tcon_version=3.5.0.17
22-
mantle_version=1.9.20
23-
jei_version=9.5.3.153
22+
tcon_version=3.5.2.151
23+
mantle_version=1.9.156
24+
jei_version=10.1.0.208
2425
psi_version=1.16-97.425
25-
botania_version=1.18.2-430-SNAPSHOT
26+
botania_version=1.18.2-436-FABRIC-SNAPSHOT
27+
create_version=0.5.0e-734
28+
port_lib_version=1.2.574-beta
29+
forge_config_version=3671141
2630

2731
# dependency Version Ranges
2832
tconstruct_range=[3.5.0.17,)

settings.gradle

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
pluginManagement {
2+
repositories {
3+
maven { url = 'https://maven.fabricmc.net/' }
4+
maven { url = "https://maven.quiltmc.org/repository/release" }
5+
maven { url = 'https://server.bbkr.space/artifactory/libs-release/' }
6+
jcenter()
7+
gradlePluginPortal()
8+
}
9+
}

0 commit comments

Comments
 (0)