Skip to content

Commit 975c6f2

Browse files
committed
Moved API to its own module
1 parent 0894051 commit 975c6f2

7 files changed

Lines changed: 54 additions & 79 deletions

File tree

build.gradle

Lines changed: 35 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -3,88 +3,83 @@ plugins {
33
id 'maven-publish'
44
}
55

6-
version = project.mod_version
76
group = project.maven_group
8-
9-
base {
10-
archivesName = project.archives_base_name
11-
}
7+
version = project.mod_version
8+
base.archivesName = project.archives_base_name
129

1310
repositories {
14-
// Add repositories to retrieve artifacts from in here.
15-
// You should only use this when depending on other mods because
16-
// Loom adds the essential maven repositories to download Minecraft and libraries from automatically.
17-
// See https://docs.gradle.org/current/userguide/declaring_repositories.html
18-
// for more information about repositories.
11+
mavenCentral()
12+
maven { url = 'https://maven.fabricmc.net/' }
1913
}
2014

2115
loom {
2216
splitEnvironmentSourceSets()
2317

2418
mods {
25-
"manifold" {
19+
manifold {
2620
sourceSet sourceSets.main
2721
sourceSet sourceSets.client
2822
}
2923
}
24+
}
3025

26+
sourceSets {
27+
main {
28+
java.srcDirs = ['src/main/java', 'src/api/java']
29+
resources.srcDirs = ['src/main/resources']
30+
}
31+
client {
32+
java.srcDirs = ['src/client/java']
33+
resources.srcDirs = ['src/client/resources']
34+
compileClasspath += main.output
35+
runtimeClasspath += main.output
36+
}
3137
}
3238

3339
dependencies {
34-
// To change the versions see the gradle.properties file
35-
minecraft "com.mojang:minecraft:${project.minecraft_version}"
40+
minecraft "com.mojang:minecraft:${minecraft_version}"
3641
mappings loom.officialMojangMappings()
37-
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
38-
39-
// Fabric API. This is technically optional, but you probably want it anyway.
40-
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
41-
42+
modImplementation "net.fabricmc:fabric-loader:${loader_version}"
43+
modImplementation "net.fabricmc.fabric-api:fabric-api:${fabric_version}"
4244
}
4345

4446
processResources {
4547
inputs.property "version", project.version
46-
4748
filesMatching("fabric.mod.json") {
48-
expand "version": inputs.properties.version
49+
expand version: project.version
4950
}
5051
}
5152

52-
tasks.withType(JavaCompile).configureEach {
53-
it.options.release = 21
54-
}
55-
5653
java {
57-
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
58-
// if it is present.
59-
// If you remove this line, sources will not be generated.
6054
withSourcesJar()
61-
6255
sourceCompatibility = JavaVersion.VERSION_21
6356
targetCompatibility = JavaVersion.VERSION_21
6457
}
6558

66-
jar {
67-
inputs.property "archivesName", project.base.archivesName
59+
tasks.withType(JavaCompile).configureEach {
60+
it.options.release = 21
61+
}
6862

63+
jar {
6964
from("LICENSE") {
70-
rename { "${it}_${inputs.properties.archivesName}"}
65+
rename { "${it}_${base.archivesName}" }
7166
}
7267
}
7368

74-
// configure the maven publication
7569
publishing {
7670
publications {
77-
create("mavenJava", MavenPublication) {
78-
artifactId = project.archives_base_name
71+
mavenJava(MavenPublication) {
7972
from components.java
8073
}
8174
}
82-
83-
// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
8475
repositories {
85-
// Add repositories to publish to here.
86-
// Notice: This block does NOT have the same function as the block in the top level.
87-
// The repositories here will be used for publishing your artifact, not for
88-
// retrieving dependencies.
76+
maven {
77+
name = "GitHubPackages"
78+
url = uri("https://maven.pkg.github.com/maxryan008/ManifoldAPI") //todo make this a modrinth maven instead for other mods to utilise
79+
credentials {
80+
username = project.findProperty("gpr.user") ?: ""
81+
password = project.findProperty("gpr.key") ?: ""
82+
}
83+
}
8984
}
9085
}

gradle.properties

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,11 @@
1-
# Done to increase the memory available to gradle.
2-
org.gradle.jvmargs=-Xmx1G
1+
org.gradle.jvmargs=-Xmx2G
32
org.gradle.parallel=true
43

5-
# Fabric Properties
6-
# check these on https://fabricmc.net/develop
74
minecraft_version=1.21.1
85
yarn_mappings=1.21.1+build.3
96
loader_version=0.16.5
7+
fabric_version=0.110.0+1.21.1
108

11-
# Mod Properties
129
mod_version=1.0.0
1310
maven_group=dev.manifold
14-
archives_base_name=manifold
15-
16-
# Dependencies
17-
fabric_version=0.110.0+1.21.1
11+
archives_base_name=manifold

settings.gradle

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
pluginManagement {
2-
repositories {
3-
maven {
4-
name = 'Fabric'
5-
url = 'https://maven.fabricmc.net/'
6-
}
7-
mavenCentral()
8-
gradlePluginPortal()
9-
}
10-
}
2+
repositories {
3+
maven { url = 'https://maven.fabricmc.net/' }
4+
gradlePluginPortal()
5+
mavenCentral()
6+
}
7+
}
8+
9+
rootProject.name = 'manifold'
File renamed without changes.

src/main/java/dev/manifold/api/MassAPI.java renamed to src/main/java/dev/manifold/mass/MassAPI.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
package dev.manifold.api;
1+
package dev.manifold.mass;
22

3+
import dev.manifold.api.MassApiEntrypoint;
34
import net.fabricmc.loader.api.FabricLoader;
45
import net.minecraft.world.item.Item;
56
import net.minecraft.world.item.Items;

src/main/java/dev/manifold/mass/MassManager.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import com.google.gson.*;
44
import dev.manifold.ConstructManager;
55
import dev.manifold.Manifold;
6-
import dev.manifold.api.MassAPI;
76
import dev.manifold.network.packets.MassGuiDataRefreshS2CPacket;
87
import net.fabricmc.fabric.api.networking.v1.ServerPlayNetworking;
98
import net.minecraft.core.Registry;

src/main/resources/fabric.mod.json

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,16 @@
33
"id": "manifold",
44
"version": "${version}",
55
"name": "Manifold",
6-
"description": "This is an example description! Tell everyone what your mod is about!",
7-
"authors": [
8-
"Me!"
9-
],
10-
"contact": {
11-
"homepage": "https://fabricmc.net/",
12-
"sources": "https://github.com/FabricMC/fabric-example-mod"
13-
},
14-
"license": "CC0-1.0",
6+
"description": "Physics api and client",
7+
"authors": ["maxryan008"],
8+
"license": "MIT",
159
"icon": "assets/manifold/icon.png",
1610
"environment": "*",
1711
"entrypoints": {
18-
"main": [
19-
"dev.manifold.Manifold"
20-
],
21-
"client": [
22-
"dev.manifold.ManifoldClient"
23-
],
12+
"main": ["dev.manifold.Manifold"],
13+
"client": ["dev.manifold.ManifoldClient"],
2414
"manifold:mass": [
25-
"dev.manifold.api.MassAPI"
15+
"dev.manifold.mass.MassAPI"
2616
]
2717
},
2818
"mixins": [
@@ -37,8 +27,5 @@
3727
"minecraft": "~1.21.1",
3828
"java": ">=21",
3929
"fabric-api": "*"
40-
},
41-
"suggests": {
42-
"another-mod": "*"
4330
}
4431
}

0 commit comments

Comments
 (0)