Skip to content

Commit

Permalink
Project outline
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeryn99 committed Sep 28, 2022
0 parents commit 28afa3b
Show file tree
Hide file tree
Showing 25 changed files with 789 additions and 0 deletions.
19 changes: 19 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
build/
*.ipr
run/
*.iws
out/
*.iml
.gradle/
output/
bin/
libs/

.classpath
.project
.idea/
classes/
.metadata
.vscode
.settings
*.launch
51 changes: 51 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
plugins {
id "architectury-plugin" version "3.4-SNAPSHOT"
id "dev.architectury.loom" version "0.12.0-SNAPSHOT" apply false
}

architectury {
minecraft = rootProject.minecraft_version
}

subprojects {
apply plugin: "dev.architectury.loom"

loom {
silentMojangMappingsLicense()
}

dependencies {
minecraft "com.mojang:minecraft:${rootProject.minecraft_version}"
mappings loom.layered() {
officialMojangMappings()
parchment("org.parchmentmc.data:parchment-${rootProject.mappings}")
}
}
}

allprojects {
apply plugin: "java"
apply plugin: "architectury-plugin"
apply plugin: "maven-publish"

archivesBaseName = rootProject.archives_base_name
version = rootProject.mod_version
group = rootProject.maven_group

repositories {
// Add repositories to retrieve artifacts from in here.
// You should only use this when depending on other mods because
// Loom adds the essential maven repositories to download Minecraft and libraries from automatically.
// See https://docs.gradle.org/current/userguide/declaring_repositories.html
// for more information about repositories.
}

tasks.withType(JavaCompile) {
options.encoding = "UTF-8"
options.release = 17
}

java {
withSourcesJar()
}
}
27 changes: 27 additions & 0 deletions common/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
architectury {
common(rootProject.enabled_platforms.split(","))
}

loom {
accessWidenerPath = file("src/main/resources/whocosmetics.accesswidener")
}

dependencies {
// We depend on fabric loader here to use the fabric @Environment annotations and get the mixin dependencies
// Do NOT use other classes from fabric loader
modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}"
}

publishing {
publications {
mavenCommon(MavenPublication) {
artifactId = rootProject.archives_base_name
from components.java
}
}

// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
repositories {
// Add repositories to publish to here.
}
}
18 changes: 18 additions & 0 deletions common/src/main/java/me/craig/software/cosmetics/WhoCosmetics.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package me.craig.software.cosmetics;

import com.google.common.base.Suppliers;
import net.minecraft.core.Registry;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.CreativeModeTab;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;

import java.util.function.Supplier;

public class WhoCosmetics {
public static final String MOD_ID = "whocosmetics";

public static void init() {

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package me.craig.software.cosmetics.mixin;

import net.minecraft.client.gui.screens.TitleScreen;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

@Mixin(TitleScreen.class)
public class MixinTitleScreen {
@Inject(at = @At("HEAD"), method = "init()V")
private void init(CallbackInfo info) {
System.out.println("Hello from example architectury common mixin!");
}
}
3 changes: 3 additions & 0 deletions common/src/main/resources/assets/whocosmetics/lang/en_us.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"item.whocosmetics.example_item": "Example Item"
}
1 change: 1 addition & 0 deletions common/src/main/resources/whocosmetics.accesswidener
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
accessWidener v2 named
3 changes: 3 additions & 0 deletions common/src/main/resources/whocosmetics.common.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"accessWidener": "whocosmetics.accesswidener"
}
13 changes: 13 additions & 0 deletions common/src/main/resources/whocosmetics.common.mixins.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"required": true,
"package": "me.craig.software.cosmetics.mixin",
"compatibilityLevel": "JAVA_17",
"client": [
"MixinTitleScreen"
],
"mixins": [
],
"injectors": {
"defaultRequire": 1
}
}
79 changes: 79 additions & 0 deletions fabric/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
plugins {
id "com.github.johnrengelman.shadow" version "7.1.2"
}

architectury {
platformSetupLoomIde()
fabric()
}

loom {
accessWidenerPath = project(":common").loom.accessWidenerPath
}

configurations {
common
shadowCommon // Don't use shadow from the shadow plugin because we don't want IDEA to index this.
compileClasspath.extendsFrom common
runtimeClasspath.extendsFrom common
developmentFabric.extendsFrom common
}

dependencies {
modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}"
modApi "net.fabricmc.fabric-api:fabric-api:${rootProject.fabric_api_version}"
common(project(path: ":common", configuration: "namedElements")) { transitive false }
shadowCommon(project(path: ":common", configuration: "transformProductionFabric")) { transitive false }
}

processResources {
inputs.property "version", project.version

filesMatching("fabric.mod.json") {
expand "version": project.version
}
}

shadowJar {
exclude "whocosmetics.common.json"

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

remapJar {
injectAccessWidener = true
input.set shadowJar.archiveFile
dependsOn shadowJar
classifier null
}

jar {
classifier "dev"
}

sourcesJar {
def commonSources = project(":common").sourcesJar
dependsOn commonSources
from commonSources.archiveFile.map { zipTree(it) }
}

components.java {
withVariantsFromConfiguration(project.configurations.shadowRuntimeElements) {
skip()
}
}

publishing {
publications {
mavenFabric(MavenPublication) {
artifactId = rootProject.archives_base_name + "-" + project.name
from components.java
}
}

// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
repositories {
// Add repositories to publish to here.
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package me.craig.software.cosmetics.fabric;

import me.craig.software.cosmetics.WhoCosmetics;
import net.fabricmc.api.ModInitializer;

public class WhoCosmeticsFabric implements ModInitializer {
@Override
public void onInitialize() {
WhoCosmetics.init();
}
}
30 changes: 30 additions & 0 deletions fabric/src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"schemaVersion": 1,
"id": "whocosmetics",
"version": "${version}",
"name": "Example Mod",
"description": "This is an example description! Tell everyone what your mod is about!",
"authors": [
"Me!"
],
"contact": {
"homepage": "https://fabricmc.net/",
"sources": "https://github.com/FabricMC/fabric-whocosmetics"
},
"license": "Insert License Here",
"icon": "assets/whocosmetics/icon.png",
"environment": "*",
"entrypoints": {
"main": [
"me.craig.software.cosmetics.fabric.WhoCosmeticsFabric"
]
},
"mixins": [
"whocosmetics.mixins.json",
"whocosmetics.common.mixins.json"
],
"depends": {
"fabric": "*",
"minecraft": ">=1.19.2"
}
}
12 changes: 12 additions & 0 deletions fabric/src/main/resources/whocosmetics.mixins.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"required": true,
"package": "me.craig.software.cosmetics.fabric.mixin",
"compatibilityLevel": "JAVA_17",
"client": [
],
"mixins": [
],
"injectors": {
"defaultRequire": 1
}
}
86 changes: 86 additions & 0 deletions forge/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
plugins {
id "com.github.johnrengelman.shadow" version "7.1.2"
}

architectury {
platformSetupLoomIde()
forge()
}

loom {
accessWidenerPath = project(":common").loom.accessWidenerPath

forge {
convertAccessWideners = true
extraAccessWideners.add loom.accessWidenerPath.get().asFile.name

mixinConfig "whocosmetics-common.mixins.json"
mixinConfig "whocosmetics.mixins.json"
}
}

configurations {
common
shadowCommon // Don't use shadow from the shadow plugin because we don't want IDEA to index this.
compileClasspath.extendsFrom common
runtimeClasspath.extendsFrom common
developmentForge.extendsFrom common
}

dependencies {
forge "net.minecraftforge:forge:${rootProject.forge_version}"
common(project(path: ":common", configuration: "namedElements")) { transitive false }
shadowCommon(project(path: ":common", configuration: "transformProductionForge")) { transitive = false }
}

processResources {
inputs.property "version", project.version

filesMatching("META-INF/mods.toml") {
expand "version": project.version
}
}

shadowJar {
exclude "fabric.mod.json"
exclude "whocosmetics.common.json"

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

remapJar {
input.set shadowJar.archiveFile
dependsOn shadowJar
classifier null
}

jar {
classifier "dev"
}

sourcesJar {
def commonSources = project(":common").sourcesJar
dependsOn commonSources
from commonSources.archiveFile.map { zipTree(it) }
}

components.java {
withVariantsFromConfiguration(project.configurations.shadowRuntimeElements) {
skip()
}
}

publishing {
publications {
mavenForge(MavenPublication) {
artifactId = rootProject.archives_base_name + "-" + project.name
from components.java
}
}

// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
repositories {
// Add repositories to publish to here.
}
}
1 change: 1 addition & 0 deletions forge/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
loom.platform=forge
Loading

0 comments on commit 28afa3b

Please sign in to comment.