Skip to content

Commit

Permalink
Fabric test mod works. Forge one still needs work
Browse files Browse the repository at this point in the history
  • Loading branch information
Waterpicker committed Feb 14, 2022
1 parent f000c74 commit 4c491f3
Show file tree
Hide file tree
Showing 21 changed files with 256 additions and 5 deletions.
58 changes: 58 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,64 @@
"MCP_MAPPINGS": "loom.stub"
},
"projectName": "forge"
},
{
"type": "java",
"name": "Minecraft Client (:testmod-fabric)",
"request": "launch",
"cwd": "${workspaceFolder}/testmod-fabric/run",
"console": "internalConsole",
"stopOnEntry": false,
"mainClass": "dev.architectury.transformer.TransformerRuntime",
"vmArgs": "\"-Dfabric.dli.config\u003dD:\\Git\\Matrix\\testmod-fabric\\.gradle\\loom-cache\\launch.cfg\" \"-Dfabric.dli.env\u003dclient\" \"-Dfabric.dli.main\u003dnet.fabricmc.loader.impl.launch.knot.KnotClient\" \"-Darchitectury.main.class\u003dD:\\Git\\Matrix\\testmod-fabric\\.gradle\\architectury\\.main_class\" \"-Darchitectury.runtime.transformer\u003dD:\\Git\\Matrix\\testmod-fabric\\.gradle\\architectury\\.transforms\" \"-Darchitectury.properties\u003dD:\\Git\\Matrix\\testmod-fabric\\.gradle\\architectury\\.properties\" \"-Djdk.attach.allowAttachSelf\u003dtrue\" \"-javaagent:D:\\Git\\Matrix\\.gradle\\architectury\\architectury-transformer-agent.jar\"",
"args": "",
"env": {},
"projectName": "testmod-fabric"
},
{
"type": "java",
"name": "Minecraft Server (:testmod-fabric)",
"request": "launch",
"cwd": "${workspaceFolder}/testmod-fabric/run",
"console": "internalConsole",
"stopOnEntry": false,
"mainClass": "dev.architectury.transformer.TransformerRuntime",
"vmArgs": "\"-Dfabric.dli.config\u003dD:\\Git\\Matrix\\testmod-fabric\\.gradle\\loom-cache\\launch.cfg\" \"-Dfabric.dli.env\u003dserver\" \"-Dfabric.dli.main\u003dnet.fabricmc.loader.impl.launch.knot.KnotServer\" \"-Darchitectury.main.class\u003dD:\\Git\\Matrix\\testmod-fabric\\.gradle\\architectury\\.main_class\" \"-Darchitectury.runtime.transformer\u003dD:\\Git\\Matrix\\testmod-fabric\\.gradle\\architectury\\.transforms\" \"-Darchitectury.properties\u003dD:\\Git\\Matrix\\testmod-fabric\\.gradle\\architectury\\.properties\" \"-Djdk.attach.allowAttachSelf\u003dtrue\" \"-javaagent:D:\\Git\\Matrix\\.gradle\\architectury\\architectury-transformer-agent.jar\"",
"args": "\"nogui\"",
"env": {},
"projectName": "testmod-fabric"
},
{
"type": "java",
"name": "Minecraft Client (:testmod-forge)",
"request": "launch",
"cwd": "${workspaceFolder}/testmod-forge/run",
"console": "internalConsole",
"stopOnEntry": false,
"mainClass": "dev.architectury.transformer.TransformerRuntime",
"vmArgs": "\"-Dfabric.dli.config\u003dD:\\Git\\Matrix\\testmod-forge\\.gradle\\loom-cache\\launch.cfg\" \"-Dfabric.dli.env\u003dclient\" \"-p\" \"C:\\Users\\water\\.gradle\\caches\\modules-2\\files-2.1\\cpw.mods\\securejarhandler\\0.9.54\\24b670f2c026ec9777e64a2c2126ebc8635dbe8d\\securejarhandler-0.9.54.jar;C:\\Users\\water\\.gradle\\caches\\modules-2\\files-2.1\\org.ow2.asm\\asm-commons\\9.1\\8b971b182eb5cf100b9e8d4119152d83e00e0fdd\\asm-commons-9.1.jar;C:\\Users\\water\\.gradle\\caches\\modules-2\\files-2.1\\org.ow2.asm\\asm-util\\9.1\\36464a45d871779f3383a8a9aba2b26562a86729\\asm-util-9.1.jar;C:\\Users\\water\\.gradle\\caches\\modules-2\\files-2.1\\org.ow2.asm\\asm-analysis\\9.1\\4f61b83b81d8b659958f4bcc48907e93ecea55a0\\asm-analysis-9.1.jar;C:\\Users\\water\\.gradle\\caches\\modules-2\\files-2.1\\org.ow2.asm\\asm-tree\\9.1\\c333f2a855069cb8eb17a40a3eb8b1b67755d0eb\\asm-tree-9.1.jar;C:\\Users\\water\\.gradle\\caches\\modules-2\\files-2.1\\org.ow2.asm\\asm\\9.1\\a99500cf6eea30535eeac6be73899d048f8d12a8\\asm-9.1.jar\" \"--add-modules\" \"ALL-MODULE-PATH\" \"--add-opens\" \"java.base/java.util.jar\u003dcpw.mods.securejarhandler\" \"--add-exports\" \"java.base/sun.security.util\u003dcpw.mods.securejarhandler\" \"--add-exports\" \"jdk.naming.dns/com.sun.jndi.dns\u003djava.naming\" \"-Dfabric.dli.main\u003dcpw.mods.bootstraplauncher.BootstrapLauncher\" \"-Darchitectury.main.class\u003dD:\\Git\\Matrix\\testmod-forge\\.gradle\\architectury\\.main_class\" \"-Darchitectury.runtime.transformer\u003dD:\\Git\\Matrix\\testmod-forge\\.gradle\\architectury\\.transforms\" \"-Darchitectury.properties\u003dD:\\Git\\Matrix\\testmod-forge\\.gradle\\architectury\\.properties\" \"-Djdk.attach.allowAttachSelf\u003dtrue\" \"-javaagent:D:\\Git\\Matrix\\.gradle\\architectury\\architectury-transformer-agent.jar\"",
"args": "",
"env": {
"MOD_CLASSES": "forge%%D:\\Git\\Matrix\\forge\\build\\resources\\main;forge%%D:\\Git\\Matrix\\forge\\build\\classes\\java\\main;main%%D:\\Git\\Matrix\\testmod-forge\\build\\resources\\main;main%%D:\\Git\\Matrix\\testmod-forge\\build\\classes\\java\\main",
"MCP_MAPPINGS": "loom.stub"
},
"projectName": "testmod-forge"
},
{
"type": "java",
"name": "Minecraft Server (:testmod-forge)",
"request": "launch",
"cwd": "${workspaceFolder}/testmod-forge/run",
"console": "internalConsole",
"stopOnEntry": false,
"mainClass": "dev.architectury.transformer.TransformerRuntime",
"vmArgs": "\"-Dfabric.dli.config\u003dD:\\Git\\Matrix\\testmod-forge\\.gradle\\loom-cache\\launch.cfg\" \"-Dfabric.dli.env\u003dserver\" \"-p\" \"C:\\Users\\water\\.gradle\\caches\\modules-2\\files-2.1\\cpw.mods\\securejarhandler\\0.9.54\\24b670f2c026ec9777e64a2c2126ebc8635dbe8d\\securejarhandler-0.9.54.jar;C:\\Users\\water\\.gradle\\caches\\modules-2\\files-2.1\\org.ow2.asm\\asm-commons\\9.1\\8b971b182eb5cf100b9e8d4119152d83e00e0fdd\\asm-commons-9.1.jar;C:\\Users\\water\\.gradle\\caches\\modules-2\\files-2.1\\org.ow2.asm\\asm-util\\9.1\\36464a45d871779f3383a8a9aba2b26562a86729\\asm-util-9.1.jar;C:\\Users\\water\\.gradle\\caches\\modules-2\\files-2.1\\org.ow2.asm\\asm-analysis\\9.1\\4f61b83b81d8b659958f4bcc48907e93ecea55a0\\asm-analysis-9.1.jar;C:\\Users\\water\\.gradle\\caches\\modules-2\\files-2.1\\org.ow2.asm\\asm-tree\\9.1\\c333f2a855069cb8eb17a40a3eb8b1b67755d0eb\\asm-tree-9.1.jar;C:\\Users\\water\\.gradle\\caches\\modules-2\\files-2.1\\org.ow2.asm\\asm\\9.1\\a99500cf6eea30535eeac6be73899d048f8d12a8\\asm-9.1.jar\" \"--add-modules\" \"ALL-MODULE-PATH\" \"--add-opens\" \"java.base/java.util.jar\u003dcpw.mods.securejarhandler\" \"--add-exports\" \"java.base/sun.security.util\u003dcpw.mods.securejarhandler\" \"--add-exports\" \"jdk.naming.dns/com.sun.jndi.dns\u003djava.naming\" \"-Dfabric.dli.main\u003dcpw.mods.bootstraplauncher.BootstrapLauncher\" \"-Darchitectury.main.class\u003dD:\\Git\\Matrix\\testmod-forge\\.gradle\\architectury\\.main_class\" \"-Darchitectury.runtime.transformer\u003dD:\\Git\\Matrix\\testmod-forge\\.gradle\\architectury\\.transforms\" \"-Darchitectury.properties\u003dD:\\Git\\Matrix\\testmod-forge\\.gradle\\architectury\\.properties\" \"-Djdk.attach.allowAttachSelf\u003dtrue\" \"-javaagent:D:\\Git\\Matrix\\.gradle\\architectury\\architectury-transformer-agent.jar\"",
"args": "\"nogui\"",
"env": {
"MOD_CLASSES": "forge%%D:\\Git\\Matrix\\forge\\build\\resources\\main;forge%%D:\\Git\\Matrix\\forge\\build\\classes\\java\\main;main%%D:\\Git\\Matrix\\testmod-forge\\build\\resources\\main;main%%D:\\Git\\Matrix\\testmod-forge\\build\\classes\\java\\main",
"MCP_MAPPINGS": "loom.stub"
},
"projectName": "testmod-forge"
}
]
}
2 changes: 2 additions & 0 deletions common/src/main/java/org/dimdev/matrix/Matrix.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,5 +64,7 @@ public static <T, S> void register(Class<T> clazz, ResourceKey<Registry<S>> regi
e.printStackTrace();
}
});

deferredRegister.register();
}
}
2 changes: 1 addition & 1 deletion fabric/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ processResources {

shadowJar {
configurations = [project.configurations.shadowCommon]
classifier "dev-shadow"
classifier "fabric"
}

remapJar {
Expand Down
8 changes: 4 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
org.gradle.jvmargs=-Xmx2048M

minecraft_version=1.18
minecraft_version=1.18.1

version = 1.0.0
version = 1.1.0
archives_base_name = matrix
group = "org.dimdev"

architectury_version=3.6.15

fabric_loader_version=0.13.0
fabric_loader_version=0.13.2
fabric_api_version=0.46.4+1.18

forge_version=1.18-38.0.17
forge_version=1.18.1-39.0.75
5 changes: 5 additions & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,9 @@ pluginManagement {
include("common")
include("fabric")
include("forge")

include("testmod-common")
include("testmod-fabric")
include("testmod-forge")

rootProject.name = 'Matrix'
11 changes: 11 additions & 0 deletions testmod-common/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
dependencies {
// We depend on fabric loader here to use the fabric @Environment annotations
// Do NOT use other classes from fabric loader
modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}"
modApi "dev.architectury:architectury:${rootProject.architectury_version}"
implementation project(":common")
}

architectury {
common()
}
14 changes: 14 additions & 0 deletions testmod-common/src/main/java/org/dimdev/matrix/test/ModBlocks.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package org.dimdev.matrix.test;

import dev.architectury.registry.block.BlockProperties;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.state.BlockBehaviour;
import org.dimdev.matrix.Registrar;
import org.dimdev.matrix.RegistryEntry;

@Registrar(element = Block.class, modid = "matrix-test")
public class ModBlocks {
@RegistryEntry("test_block")
public static final Block BLOCK = new Block(BlockBehaviour.Properties.copy(Blocks.DIRT));
}
14 changes: 14 additions & 0 deletions testmod-common/src/main/java/org/dimdev/matrix/test/ModItems.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package org.dimdev.matrix.test;

import net.minecraft.world.item.BlockItem;
import net.minecraft.world.item.CreativeModeTab;
import net.minecraft.world.item.Item;
import org.dimdev.matrix.Registrar;
import org.dimdev.matrix.RegistryEntry;


@Registrar(element = Item.class, modid = "matrix-test")
public class ModItems {
@RegistryEntry("test_item")
public static final Item ITEM = new BlockItem(ModBlocks.BLOCK, new Item.Properties().tab(CreativeModeTab.TAB_FOOD));
}
13 changes: 13 additions & 0 deletions testmod-common/src/main/java/org/dimdev/matrix/test/Test.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package org.dimdev.matrix.test;

import net.minecraft.core.Registry;
import org.dimdev.matrix.Matrix;

public class Test {
public static final String MOD_ID = "matrix_test";

public static void init() {
Matrix.register(ModBlocks.class, Registry.BLOCK_REGISTRY);
Matrix.register(ModItems.class, Registry.ITEM_REGISTRY);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"category.architectury_test": "Architectury Test",
"key.architectury_test.test": "Test Keybind"
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"replace": false,
"values": [
"minecraft:emerald_block"
]
}
29 changes: 29 additions & 0 deletions testmod-fabric/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
plugins {
id "com.github.johnrengelman.shadow" version "7.0.0"
}

loom {
mixin { useLegacyMixinAp = true }
}

architectury {
platformSetupLoomIde()
fabric()
}

configurations {
common
compileClasspath.extendsFrom common
runtimeClasspath.extendsFrom common
developmentFabric.extendsFrom common
}

dependencies {
modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}"
modImplementation "net.fabricmc.fabric-api:fabric-api:${rootProject.fabric_api_version}"
modApi "dev.architectury:architectury-fabric:${rootProject.architectury_version}"

implementation project(path: ":fabric", configuration: "namedElements")
common(project(path: ":common", configuration: "namedElements")) { transitive false }
common(project(path: ":testmod-common", configuration: "namedElements")) { transitive false }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"textures": [
"architectury_test:test_particle"
]
}
17 changes: 17 additions & 0 deletions testmod-fabric/src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"schemaVersion": 1,
"id": "matrix_test",
"version": "${version}",
"name": "Architectury Test",
"description": "A intermediary api aimed to ease developing multiplatform mods.",
"authors": [
"shedaniel"
],
"license": "LGPL-3",
"environment": "*",
"entrypoints": {
"main": [
"org.dimdev.matrix.test.Test::init"
]
}
}
36 changes: 36 additions & 0 deletions testmod-forge/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
plugins {
id "com.github.johnrengelman.shadow" version "7.0.0"
}

loom {
forge {
mixinConfig "architectury.mixins.json"

localMods {
forge {
it.add(project(":forge").sourceSets.main)
}
}
}
}

architectury {
platformSetupLoomIde()
forge()
}

configurations {
common
compileClasspath.extendsFrom common
runtimeClasspath.extendsFrom common
developmentForge.extendsFrom common
}

dependencies {
forge "net.minecraftforge:forge:${gradle.rootProject.forge_version}"
modApi "dev.architectury:architectury-forge:${rootProject.architectury_version}"

implementation project(path: ":forge", configuration: "namedElements")
common(project(path: ":common", configuration: "namedElements")) { transitive false }
common(project(path: ":testmod-common", configuration: "namedElements")) { transitive false }
}
1 change: 1 addition & 0 deletions testmod-forge/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
loom.platform=forge
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package dev.architectury.test.forge;

import dev.architectury.platform.forge.EventBuses;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import org.dimdev.matrix.test.Test;

@Mod(Test.MOD_ID)
public class TestModForge {
public TestModForge() {
EventBuses.registerModEventBus(Test.MOD_ID, FMLJavaModLoadingContext.get().getModEventBus());
Test.init();
}
}
14 changes: 14 additions & 0 deletions testmod-forge/src/main/resources/META-INF/mods.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
modLoader = "javafml"
loaderVersion = "[33,)"
issueTrackerURL = "https://github.com/shedaniel/architectury/issues"
license = "LGPL-3"

[[mods]]
modId = "matrix_test"
version = "${file.jarVersion}"
displayName = "Architectury Test"
authors = "shedaniel"
description = '''
A intermediary api aimed to ease developing multiplatform mods.
'''
license = "LGPL-3"
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
{
}
6 changes: 6 additions & 0 deletions testmod-forge/src/main/resources/pack.mcmeta
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"pack": {
"description": "Architectury Test",
"pack_format": 6
}
}

0 comments on commit 4c491f3

Please sign in to comment.