-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for dynamic registry creation across platforms
Introduced a mechanism to register new registries dynamically for both NeoForge and Fabric platforms. This includes implementing `registerNewRegistry` in `RegistrationHelper` and integrating registry registration logic in `common` and platform-specific code. Also added a Fabric test mod module and updated the existing configurations for consistency.
- Loading branch information
1 parent
99ec183
commit 0c2d774
Showing
14 changed files
with
211 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
common/src/main/java/me/pandamods/pandalib/registry/RegistryRegister.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/* | ||
* Copyright (C) 2024 Oliver Froberg (The Panda Oliver) | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* any later version. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package me.pandamods.pandalib.registry; | ||
|
||
import me.pandamods.pandalib.platform.Services; | ||
import net.minecraft.core.Registry; | ||
|
||
@SuppressWarnings("unused") | ||
public class RegistryRegister<T> { | ||
@SuppressWarnings({ "unchecked", "rawtypes" }) | ||
public static <T> Registry<T> register(Registry<T> registry) { | ||
Services.REGISTRATION.registerNewRegistry(registry); | ||
return registry; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar | ||
import net.fabricmc.loom.task.RemapJarTask | ||
|
||
architectury { | ||
platformSetupLoomIde() | ||
fabric() | ||
} | ||
|
||
//loom.accessWidenerPath.set(project(":common").loom.accessWidenerPath) | ||
|
||
configurations { | ||
getByName("developmentFabric").extendsFrom(configurations["common"]) | ||
} | ||
|
||
repositories { | ||
maven("https://maven.terraformersmc.com/releases/") | ||
} | ||
|
||
dependencies { | ||
modImplementation("net.fabricmc:fabric-loader:${properties["fabric_version"]}") | ||
modApi("net.fabricmc.fabric-api:fabric-api:${properties["fabric_api_version"]}") | ||
|
||
modApi("dev.architectury:architectury-fabric:${properties["deps_architectury_version"]}") | ||
modApi("com.terraformersmc:modmenu:${properties["deps_modmenu_version"]}") | ||
|
||
implementation(project(":fabric", "namedElements")) { isTransitive = false } | ||
common(project(":common", "namedElements")) { isTransitive = false } | ||
common(project(":common-testmod", "namedElements")) { isTransitive = false } | ||
} | ||
|
||
tasks.remapJar { | ||
injectAccessWidener.set(true) | ||
} | ||
|
||
tasks.withType<RemapJarTask> { | ||
val shadowJar = tasks.getByName<ShadowJar>("shadowJar") | ||
inputFile.set(shadowJar.archiveFile) | ||
} | ||
|
||
publishing { | ||
publications { | ||
register("mavenJava", MavenPublication::class) { | ||
groupId = properties["maven_group"] as String | ||
artifactId = "${properties["mod_id"]}-${project.name}" | ||
version = "${project.version}-build.${project.findProperty("buildNumber") ?: "-1"}" | ||
|
||
from(components["java"]) | ||
} | ||
} | ||
|
||
repositories { | ||
maven { | ||
name = "GitHubPackages" | ||
url = uri("https://maven.pkg.github.com/PandaMods-Dev/PandaLib") | ||
credentials { | ||
username = project.findProperty("gpr.user") as String? ?: System.getenv("USERNAME") | ||
password = project.findProperty("gpr.key") as String? ?: System.getenv("TOKEN") | ||
} | ||
} | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
fabric-testmod/src/main/java/me/pandamods/testmod/fabric/TestModFabric.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* | ||
* Copyright (C) 2024 Oliver Froberg (The Panda Oliver) | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* any later version. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package me.pandamods.testmod.fabric; | ||
|
||
import me.pandamods.test.TestMod; | ||
import net.fabricmc.api.ModInitializer; | ||
|
||
public class TestModFabric implements ModInitializer { | ||
@Override | ||
public void onInitialize() { | ||
new TestMod(); | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
fabric-testmod/src/main/java/me/pandamods/testmod/fabric/client/TestModClientFabric.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* | ||
* Copyright (C) 2024 Oliver Froberg (The Panda Oliver) | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* any later version. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package me.pandamods.testmod.fabric.client; | ||
|
||
import me.pandamods.test.client.TestModClient; | ||
import net.fabricmc.api.ClientModInitializer; | ||
|
||
public class TestModClientFabric implements ClientModInitializer { | ||
@Override | ||
public void onInitializeClient() { | ||
new TestModClient(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{ | ||
"schemaVersion": 1, | ||
"id": "testmod", | ||
"version": "${mod_version}", | ||
"name": "Test Mod", | ||
"description": "Testing environment for mod development and testing purposes", | ||
"authors": [ | ||
"${mod_author}" | ||
], | ||
"contact": {}, | ||
"license": "${mod_license}", | ||
"icon": "assets/${mod_id}/icon.png", | ||
"environment": "*", | ||
"entrypoints": { | ||
"main": [ | ||
"me.pandamods.testmod.fabric.TestModFabric" | ||
], | ||
"client": [ | ||
"me.pandamods.testmod.fabric.client.TestModClientFabric" | ||
] | ||
}, | ||
"mixins": [], | ||
"depends": { | ||
"fabric": "*", | ||
"minecraft": "${fabric_version_range}" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters