Skip to content

Commit ad9c883

Browse files
Merge branch 'Dev/1.20' into Dev/1.19.2
# Conflicts: # common/src/main/java/me/pandamods/pandalib/client/render/ModelRenderer.java # common/src/main/java/me/pandamods/pandalib/resource/AssimpResources.java
2 parents 10e5eec + 1ceb859 commit ad9c883

File tree

93 files changed

+1648
-1771
lines changed

Some content is hidden

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

93 files changed

+1648
-1771
lines changed

.github/workflows/gradle-publish.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Gradle Package
2+
3+
on:
4+
push:
5+
branches:
6+
- "**"
7+
8+
jobs:
9+
build:
10+
11+
runs-on: ubuntu-latest
12+
permissions:
13+
contents: read
14+
packages: write
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
- name: Set up JDK 21
19+
uses: actions/setup-java@v4
20+
with:
21+
java-version: '21'
22+
distribution: 'temurin'
23+
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
24+
settings-path: ${{ github.workspace }} # location for the settings.xml file
25+
26+
- name: Setup Gradle
27+
uses: gradle/actions/setup-gradle@af1da67850ed9a4cedd57bfd976089dd991e2582 # v4.0.0
28+
29+
- name: Grant execute permission for gradlew
30+
run: chmod +x ./gradlew
31+
32+
- name: Build with Gradle
33+
run: ./gradlew build
34+
35+
# The USERNAME and TOKEN need to correspond to the credentials environment variables used in
36+
# the publishing section of your build.gradle
37+
- name: Publish to GitHub Packages
38+
run: ./gradlew publish -PbuildNumber=${{ github.run_number }}
39+
env:
40+
USERNAME: ${{ github.actor }}
41+
TOKEN: ${{ secrets.GITHUB_TOKEN }}

build.gradle.kts

Lines changed: 1 addition & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,7 @@ allprojects {
2525
}
2626

2727
subprojects {
28-
val isMinecraftSubProject = findProject(":common") != project && findProject(":testmod-common") != project
29-
val isFabric = findProject(":fabric") == project || findProject(":testmod-fabric") == project
30-
val isForge = findProject(":forge") == project || findProject(":testmod-forge") == project
31-
val isNeoForge = findProject(":neoforge") == project || findProject(":testmod-neoforge") == project
28+
val isMinecraftSubProject = findProject(":common") != project && findProject(":common-testmod") != project
3229

3330
apply(plugin = "architectury-plugin")
3431
apply(plugin = "dev.architectury.loom")
@@ -107,25 +104,6 @@ subprojects {
107104
parchment("org.parchmentmc.data:parchment-${properties["parchment_minecraft_version"]}:${properties["parchment_version"]}@zip")
108105
})
109106

110-
// Assimp Library
111-
"jarShadow"("org.lwjgl:lwjgl-assimp:${properties["deps_lwjgl_version"]}") {
112-
exclude(group = "org.lwjgl", module = "lwjgl")
113-
}
114-
if (isMinecraftSubProject) {
115-
// Assimp natives
116-
"jarShadow"("org.lwjgl:lwjgl-assimp:${properties["deps_lwjgl_version"]}:natives-windows") {
117-
exclude(group = "org.lwjgl", module = "lwjgl")
118-
}
119-
120-
"jarShadow"("org.lwjgl:lwjgl-assimp:${properties["deps_lwjgl_version"]}:natives-linux") {
121-
exclude(group = "org.lwjgl", module = "lwjgl")
122-
}
123-
124-
"jarShadow"("org.lwjgl:lwjgl-assimp:${properties["deps_lwjgl_version"]}:natives-macos") {
125-
exclude(group = "org.lwjgl", module = "lwjgl")
126-
}
127-
}
128-
129107
// Embed joml
130108
"jarShadow"("org.joml:joml:${properties["deps_joml_version"]}")
131109

@@ -142,24 +120,6 @@ subprojects {
142120
configurations = listOf(project.configurations.getByName("shadowBundle"), project.configurations.getByName("jarShadow"))
143121
archiveClassifier.set("dev-shadow")
144122

145-
// Relocate assimp so it will not cause any conflicts with other mods also using it.
146-
relocate("org.lwjgl.assimp", "${properties["maven_group"]}.assimp")
147-
// Relocate natives
148-
relocate("windows.x64.org.lwjgl.assimp", "windows.x64.${properties["maven_group"]}.assimp")
149-
relocate("linux.x64.org.lwjgl.assimp", "linux.x64.${properties["maven_group"]}.assimp")
150-
relocate("macos.x64.org.lwjgl.assimp", "macos.x64.${properties["maven_group"]}.assimp")
151-
152-
relocate("META-INF.windows.arm64.org.lwjgl.assimp", "META-INF.windows.arm64.${properties["maven_group"]}.assimp")
153-
relocate("META-INF.windows.x64.org.lwjgl.assimp", "META-INF.windows.x64.${properties["maven_group"]}.assimp")
154-
relocate("META-INF.windows.x86.org.lwjgl.assimp", "META-INF.windows.x86.${properties["maven_group"]}.assimp")
155-
156-
relocate("META-INF.linux.arm32.org.lwjgl.assimp", "META-INF.linux.arm32.${properties["maven_group"]}.assimp")
157-
relocate("META-INF.linux.arm64.org.lwjgl.assimp", "META-INF.linux.arm64.${properties["maven_group"]}.assimp")
158-
relocate("META-INF.linux.x64.org.lwjgl.assimp", "META-INF.linux.x64.${properties["maven_group"]}.assimp")
159-
160-
relocate("META-INF.macos.arm64.org.lwjgl.assimp", "META-INF.macos.arm64.${properties["maven_group"]}.assimp")
161-
relocate("META-INF.macos.x64.org.lwjgl.assimp", "META-INF.macos.x64.${properties["maven_group"]}.assimp")
162-
163123
// Relocate joml as to not cause issues with Minecraft
164124
relocate("org.joml", "${properties["maven_group"]}.joml")
165125
}
@@ -218,30 +178,6 @@ subprojects {
218178
java {
219179
withSourcesJar()
220180
}
221-
222-
// Maven Publishing
223-
publishing {
224-
publications {
225-
register("mavenJava", MavenPublication::class) {
226-
groupId = properties["maven_group"] as String
227-
artifactId = "${properties["mod_id"]}-${project.name}"
228-
version = project.version as String
229-
230-
from(components["java"])
231-
}
232-
233-
register("mavenJavaDev", MavenPublication::class) {
234-
groupId = properties["maven_group"] as String
235-
artifactId = "${properties["mod_id"]}-${project.name}"
236-
version = "${project.version}+dev.${properties["dev_version"]}"
237-
238-
from(components["java"])
239-
}
240-
}
241-
242-
repositories {
243-
}
244-
}
245181
}
246182

247183
// Mod Publishing

common-testmod/build.gradle.kts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
2+
import net.fabricmc.loom.task.RemapJarTask
3+
4+
architectury {
5+
common(properties["supported_mod_loaders"].toString().split(","))
6+
}
7+
8+
//loom.accessWidenerPath.set(file("src/main/resources/${properties["mod_id"]}.accesswidener"))
9+
10+
dependencies {
11+
// We depend on fabric loader here to use the fabric @Environment annotations and get the mixin dependencies
12+
// Do NOT use other classes from fabric loader
13+
modImplementation("net.fabricmc:fabric-loader:${properties["fabric_version"]}")
14+
15+
modApi("dev.architectury:architectury:${properties["deps_architectury_version"]}")
16+
17+
implementation(project(":common", "namedElements"))
18+
}
19+
20+
tasks.withType<RemapJarTask> {
21+
val shadowJar = tasks.getByName<ShadowJar>("shadowJar")
22+
inputFile.set(shadowJar.archiveFile)
23+
}
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
/*
2+
* Copyright (C) 2024 Oliver Froberg (The Panda Oliver)
3+
*
4+
* This program is free software: you can redistribute it and/or modify
5+
* it under the terms of the GNU Lesser General Public License as published by
6+
* the Free Software Foundation, either version 3 of the License, or
7+
* any later version.
8+
*
9+
* You should have received a copy of the GNU Lesser General Public License
10+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
11+
*/
12+
13+
package me.pandamods.test;
14+
15+
import com.mojang.serialization.Lifecycle;
16+
import dev.architectury.event.events.client.ClientLifecycleEvent;
17+
import me.pandamods.pandalib.config.PandaLibConfig;
18+
import me.pandamods.pandalib.config.holders.ClientConfigHolder;
19+
import me.pandamods.pandalib.config.holders.CommonConfigHolder;
20+
import me.pandamods.pandalib.registry.DeferredObject;
21+
import me.pandamods.pandalib.registry.DeferredRegister;
22+
import me.pandamods.pandalib.registry.RegistryRegister;
23+
import me.pandamods.test.config.ClientTestConfig;
24+
import me.pandamods.test.config.CommonTestConfig;
25+
import net.minecraft.core.MappedRegistry;
26+
import net.minecraft.core.Registry;
27+
import net.minecraft.resources.ResourceKey;
28+
import net.minecraft.resources.ResourceLocation;
29+
30+
public class TestMod {
31+
public static final String MOD_ID = "testmod";
32+
private static TestMod instance;
33+
34+
private static final CommonConfigHolder<CommonTestConfig> COMMON_TEST_CONFIG = PandaLibConfig.registerCommon(CommonTestConfig.class);
35+
private static final ClientConfigHolder<ClientTestConfig> CLIENT_TEST_CONFIG = PandaLibConfig.registerClient(ClientTestConfig.class);
36+
37+
public static final ResourceKey<Registry<TestRegistry>> TEST_REGISTRY_KEY = ResourceKey.createRegistryKey(TestMod.resourceLocation("test_registry"));
38+
public static final Registry<TestRegistry> TEST_REGISTRY = RegistryRegister.register(new MappedRegistry<>(TEST_REGISTRY_KEY, Lifecycle.stable()));
39+
40+
public static final DeferredRegister<TestRegistry> TEST_REGISTER = DeferredRegister.create(MOD_ID, TEST_REGISTRY);
41+
public static final DeferredObject<TestRegistry> TEST1 = TEST_REGISTER.register("test1", TestRegistry::new);
42+
public static final DeferredObject<TestRegistry> TEST2 = TEST_REGISTER.register("test2", TestRegistry::new);
43+
44+
public TestMod() {
45+
instance = this;
46+
TEST_REGISTER.register();
47+
}
48+
49+
public static ResourceLocation resourceLocation(String path) {
50+
return new ResourceLocation(MOD_ID, path);
51+
}
52+
53+
public static TestMod getInstance() {
54+
return instance;
55+
}
56+
57+
public static class TestRegistry { }
58+
}

common/src/main/java/me/pandamods/pandalib/client/animation/Animatable.java renamed to common-testmod/src/main/java/me/pandamods/test/client/TestModClient.java

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,13 @@
1010
* along with this program. If not, see <https://www.gnu.org/licenses/>.
1111
*/
1212

13-
package me.pandamods.pandalib.client.animation;
13+
package me.pandamods.test.client;
1414

15-
public interface Animatable {
16-
AnimatableInstance getAnimatableInstance();
17-
float getTick();
18-
}
15+
import net.fabricmc.api.EnvType;
16+
import net.fabricmc.api.Environment;
17+
18+
@Environment(EnvType.CLIENT)
19+
public class TestModClient {
20+
public TestModClient() {
21+
}
22+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/*
2+
* Copyright (C) 2024 Oliver Froberg (The Panda Oliver)
3+
*
4+
* This program is free software: you can redistribute it and/or modify
5+
* it under the terms of the GNU Lesser General Public License as published by
6+
* the Free Software Foundation, either version 3 of the License, or
7+
* any later version.
8+
*
9+
* You should have received a copy of the GNU Lesser General Public License
10+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
11+
*/
12+
13+
package me.pandamods.test.config;
14+
15+
import me.pandamods.pandalib.config.Config;
16+
import me.pandamods.test.TestMod;
17+
18+
@Config(modId = TestMod.MOD_ID, synchronize = true, name = "test_client")
19+
public class ClientTestConfig extends TestConfig {
20+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/*
2+
* Copyright (C) 2024 Oliver Froberg (The Panda Oliver)
3+
*
4+
* This program is free software: you can redistribute it and/or modify
5+
* it under the terms of the GNU Lesser General Public License as published by
6+
* the Free Software Foundation, either version 3 of the License, or
7+
* any later version.
8+
*
9+
* You should have received a copy of the GNU Lesser General Public License
10+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
11+
*/
12+
13+
package me.pandamods.test.config;
14+
15+
import me.pandamods.pandalib.config.Config;
16+
import me.pandamods.test.TestMod;
17+
18+
@Config(modId = TestMod.MOD_ID, synchronize = true, name = "test_common")
19+
public class CommonTestConfig extends TestConfig {
20+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/*
2+
* Copyright (C) 2024 Oliver Froberg (The Panda Oliver)
3+
*
4+
* This program is free software: you can redistribute it and/or modify
5+
* it under the terms of the GNU Lesser General Public License as published by
6+
* the Free Software Foundation, either version 3 of the License, or
7+
* any later version.
8+
*
9+
* You should have received a copy of the GNU Lesser General Public License
10+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
11+
*/
12+
13+
package me.pandamods.test.config;
14+
15+
import me.pandamods.pandalib.config.ConfigData;
16+
17+
public class TestConfig implements ConfigData {
18+
public String aString = "Hello World!";
19+
public float aFloat = 1.0f;
20+
public int anInt = 1;
21+
public boolean aBoolean = true;
22+
}

common/build.gradle.kts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,27 @@ dependencies {
1818
tasks.withType<RemapJarTask> {
1919
val shadowJar = tasks.getByName<ShadowJar>("shadowJar")
2020
inputFile.set(shadowJar.archiveFile)
21+
}
22+
23+
publishing {
24+
publications {
25+
register("mavenJava", MavenPublication::class) {
26+
groupId = properties["maven_group"] as String
27+
artifactId = "${properties["mod_id"]}-${project.name}"
28+
version = "${project.version}-build.${project.findProperty("buildNumber") ?: "-1"}"
29+
30+
from(components["java"])
31+
}
32+
}
33+
34+
repositories {
35+
maven {
36+
name = "GitHubPackages"
37+
url = uri("https://maven.pkg.github.com/PandaMods-Dev/PandaLib")
38+
credentials {
39+
username = project.findProperty("gpr.user") as String? ?: System.getenv("USERNAME")
40+
password = project.findProperty("gpr.key") as String? ?: System.getenv("TOKEN")
41+
}
42+
}
43+
}
2144
}

common/src/main/java/me/pandamods/pandalib/PandaLib.java

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -12,29 +12,16 @@
1212

1313
package me.pandamods.pandalib;
1414

15-
import me.pandamods.pandalib.config.Config;
16-
import me.pandamods.pandalib.config.ConfigData;
17-
import me.pandamods.pandalib.config.PandaLibConfig;
18-
import me.pandamods.pandalib.config.holders.ClientConfigHolder;
19-
import me.pandamods.pandalib.config.holders.CommonConfigHolder;
2015
import me.pandamods.pandalib.core.event.EventHandler;
2116
import me.pandamods.pandalib.core.network.ConfigNetworking;
2217
import me.pandamods.pandalib.event.events.NetworkingEvents;
23-
import me.pandamods.pandalib.networking.IPacketDistributor;
24-
import me.pandamods.pandalib.networking.PacketDistributor;
2518
import net.minecraft.resources.ResourceLocation;
2619

2720
public class PandaLib {
2821
public static final String MOD_ID = "pandalib";
2922
private static PandaLib instance;
3023

31-
public final IPacketDistributor packetDistributor;
32-
33-
private static final CommonConfigHolder<TestConfig> TEST_CONFIG = PandaLibConfig.registerCommon(TestConfig.class);
34-
// private static final ClientConfigHolder<TestConfig> TEST_CONFIG = PandaLibConfig.registerClient(TestConfig.class);
35-
36-
public PandaLib(IPacketDistributor packetDistributor) {
37-
this.packetDistributor = packetDistributor;
24+
public PandaLib() {
3825
NetworkingEvents.PACKET_PAYLOAD_REGISTRY.register(ConfigNetworking::registerPackets);
3926

4027
EventHandler.init();
@@ -48,12 +35,4 @@ public static ResourceLocation resourceLocation(String path) {
4835
public static PandaLib getInstance() {
4936
return instance;
5037
}
51-
52-
@Config(modId = MOD_ID, synchronize = true, name = "test")
53-
public static class TestConfig implements ConfigData {
54-
public String aString = "Hello World!";
55-
public float aFloat = 1.0f;
56-
public int anInt = 1;
57-
public boolean aBoolean = true;
58-
}
5938
}

0 commit comments

Comments
 (0)