Skip to content

Commit

Permalink
more testmod shenanigans
Browse files Browse the repository at this point in the history
  • Loading branch information
UpcraftLP committed Feb 15, 2024
1 parent f4b4f34 commit 6ad4dc5
Show file tree
Hide file tree
Showing 11 changed files with 95 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

public class SparkweaveTestmod {

public static final String MODID = "sparkweave-testmod";
public static final String MODID = "sparkweave_testmod";

public static void init() {
var registryService = RegistryService.get();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class TestCreativeTabs {
public static final RegistryHandler<CreativeModeTab> TABS = RegistryHandler.create(Registries.CREATIVE_MODE_TAB, SparkweaveTestmod.MODID);

public static final RegistrySupplier<CreativeModeTab> ITEMS = TABS.register("items", () -> CreativeTabHelper.newBuilder()
.title(Component.translatable("itemGroup.sparkweave-testmod.items"))
.title(Component.translatable("itemGroup.sparkweave_testmod.items"))
.icon(() -> TestItems.TEST_ITEM.get().getDefaultInstance())
.displayItems((itemDisplayParameters, output) -> CreativeTabHelper.addRegistryEntries(output, TestItems.ITEMS))
.build()
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"itemGroup.sparkweave_testmod.items": "TestMod Items",
"item.sparkweave_testmod.test_item": "Test Item"
}
31 changes: 27 additions & 4 deletions NeoForge/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,14 @@ runs {
systemProperty 'forge.logging.markers', 'REGISTRIES'
systemProperty 'forge.logging.console.level', 'debug'

workingDirectory project.file('run')

modSource project.sourceSets.main

dependencies {
runtime(libs.appdirs.get())
}
}

client {
modSource project.sourceSets.main
workingDirectory project.file('run')
systemProperty 'neoforge.enabledGameTestNamespaces', project.mod_id

if (project.hasProperty('mc_uuid')) {
Expand All @@ -82,11 +81,35 @@ runs {
}

server {
modSource project.sourceSets.main
workingDirectory project.file('run')

programArguments.add('nogui')
systemProperty 'neoforge.enabledGameTestNamespaces', project.mod_id
}

testmodClient {
configure runTypes.client
modSource project.sourceSets.testmod
workingDirectory project.file('run/testmod')
systemProperty 'neoforge.enabledGameTestNamespaces', "${project.mod_id}_testmod"

if (project.hasProperty('mc_uuid')) {
programArguments.add("--uuid=${project.findProperty('mc_uuid')}")
}

if (project.hasProperty('mc_username')) {
programArguments.add("--username=${project.findProperty('mc_username')}")
}

if (project.hasProperty('mc_java_agent_path')) {
jvmArgument("-javaagent:${project.findProperty('mc_java_agent_path')}")
}
}

data {
modSource project.sourceSets.main
workingDirectory project.file('run')
// this must be strings ONLY, or neogradle will not generate run configs at all!
programArguments.addAll('--mod', project.mod_id, '--all', '--output', file('src/generated/resources/').absolutePath, '--existing', file('src/main/resources/').absolutePath)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package dev.upcraft.sparkweave.testmod.neoforge.entrypoint;

import dev.upcraft.sparkweave.testmod.SparkweaveTestmod;
import net.neoforged.fml.common.Mod;

@Mod(SparkweaveTestmod.MODID)
public class Main {

public Main() {
SparkweaveTestmod.init();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@Mod.Context(SparkweaveTestmod.MODID)
package dev.upcraft.sparkweave.testmod.neoforge;

import dev.upcraft.sparkweave.api.annotation.Mod;
import dev.upcraft.sparkweave.testmod.SparkweaveTestmod;
30 changes: 30 additions & 0 deletions NeoForge/src/testmod/resources/META-INF/mods.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
modLoader = "javafml" #mandatory
loaderVersion = "*" #mandatory
license = "${license_url}" # Review your options at https://choosealicense.com/.
issueTrackerURL = "${issues_url}" #optional
sourcesUrl = "${sources_url}" # custom property that we parse ourselves

[[mods]] #mandatory
modId = "${mod_id}_testmod" #mandatory
version = "${version}" #mandatory
displayName = "${mod_display_name} Testmod" #mandatory
displayURL = "${homepage_url}" #optional (displayed in the mod UI)
logoFile = "assets/${mod_id}_testmod/icon.png" #optional
#credits = "" #optional
authors = "Up" #optional
description = '''Testmod for ${mod_display_name}''' #mandatory (Supports multiline text)

# https://docs.neoforged.net/docs/gettingstarted/modfiles#dependency-configurations
[dependencies]
"${mod_id}_testmod" = [
{ modId = "neoforge", mandatory = true, versionRange = "*", ordering = "NONE", side = "BOTH", mc-publish = { ignore = true } },
{ modId = "minecraft", mandatory = true, versionRange = "[${minecraft_version}]", ordering = "NONE", side = "BOTH" },
{ modid = "${mod_id}", mandatory = true, versionRange = "[${version}]" },
{ modId = "resourcefulconfig", mandatory = true, versionRange = "*", ordering = "NONE", side = "BOTH", mc-publish = { curseforge = "714059", modrinth = "M1953qlQ" } },
]

# Features are specific properties of the game environment, that you may want to declare you require. This example declares
# that your mod requires GL version 3.2 or higher. Other features will be added. They are side aware so declaring this won't
# stop your mod loading on the server for example.
#[features.${mod_id}_testmod]
#openGLVersion="[3.2,)"
8 changes: 8 additions & 0 deletions NeoForge/src/testmod/resources/pack.mcmeta
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"pack": {
"description": {
"text": "${mod_display_name} TestMod resources"
},
"pack_format": 15
}
}
2 changes: 1 addition & 1 deletion Quilt/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ loom {
sourceSet("main")
}

"${mod_id}-testmod" {
"${mod_id}_testmod" {
sourceSet("testmod")
}
}
Expand Down
8 changes: 6 additions & 2 deletions Quilt/src/testmod/resources/quilt.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"schema_version": 1,
"quilt_loader": {
"group": "${maven_group_id}",
"id": "${mod_id}-testmod",
"id": "${mod_id}_testmod",
"version": "${version}",
"metadata": {
"name": "${mod_display_name} TestMod",
Expand All @@ -20,7 +20,7 @@
"name": "Custom License",
"url": "${license_url}"
},
"icon": "assets/${mod_id}-testmod/icon.png"
"icon": "assets/${mod_id}_testmod/icon.png"
},
"entrypoints": {
"init": [
Expand All @@ -39,6 +39,10 @@
"id": "quilt_loader",
"versions": ">=${quilt_loader_version}"
},
{
"id": "${mod_id}",
"versions": "=${version}"
},
{
"id": "quilted_fabric_api",
"mc-publish": {
Expand Down

0 comments on commit 6ad4dc5

Please sign in to comment.