Skip to content

Commit

Permalink
Convert to multiloader
Browse files Browse the repository at this point in the history
  • Loading branch information
Mrbysco committed Jan 14, 2024
1 parent 0c9733f commit 550a666
Show file tree
Hide file tree
Showing 228 changed files with 4,124 additions and 687 deletions.
32 changes: 15 additions & 17 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
# Auto detect text files and perform LF normalization
* text=auto

# Custom for Visual Studio
*.cs diff=csharp

# Standard to msysgit
*.doc diff=astextplain
*.DOC diff=astextplain
*.docx diff=astextplain
*.DOCX diff=astextplain
*.dot diff=astextplain
*.DOT diff=astextplain
*.pdf diff=astextplain
*.PDF diff=astextplain
*.rtf diff=astextplain
*.RTF diff=astextplain
* text eol=lf
*.bat text eol=crlf
*.patch text eol=lf
*.java text eol=lf
*.gradle text eol=crlf
*.png binary
*.gif binary
*.exe binary
*.dll binary
*.jar binary
*.lzma binary
*.zip binary
*.pyd binary
*.cfg text eol=lf
*.jks binary
6 changes: 3 additions & 3 deletions .github/ISSUE_TEMPLATE/BUG_REPORT.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ body:
- label: I am crashing and can provide my crash report(s)
- label: I am using the latest version of the mod
- type: input
id: forge-info
id: loader-info
attributes:
label: Forge version
placeholder: ex. 36.2.0
label: Loader version
placeholder: ex. Forge 36.2.0 / Fabric 0.14.12
description: Please be as specific as possible, latest is not a valid version
validations:
required: true
Expand Down
12 changes: 8 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,22 @@ jobs:
run: ./gradlew build
- uses: actions/upload-artifact@v3
with:
name: Artifact
path: ./build/libs/*.jar
name: ForgeArtifact
path: ./forge/build/libs/*.jar
- uses: actions/upload-artifact@v3
with:
name: FabricArtifact
path: ./fabric/build/libs/*.jar
- name: Publish To Curseforge
if: contains(github.event.head_commit.message, '[publish]') || contains(github.event.head_commit.message, '[curseforge]')
env:
CURSEFORGE_KEY: ${{ secrets.CURSEFORGE_KEY }}
run: ./gradlew curseforge --stacktrace
run: ./gradlew curseforge
- name: Publish To Modrinth
if: contains(github.event.head_commit.message, '[publish]') || contains(github.event.head_commit.message, '[modrinth]')
env:
MODRINTH_KEY: ${{ secrets.MODRINTH_KEY }}
run: ./gradlew modrinth --stacktrace
run: ./gradlew modrinth
- name: Publish to maven
if: contains(github.event.head_commit.message, '[push]') || contains(github.event.head_commit.message, '[build]')
env:
Expand Down
6 changes: 2 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ out
*.ipr
*.iws
*.iml
.idea
.idea/*
!.idea/scopes

# gradle
build
Expand All @@ -21,6 +22,3 @@ build
eclipse
run
runs
run-data

repo
3 changes: 3 additions & 0 deletions .idea/scopes/Fabric_sources.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions .idea/scopes/Forge_sources.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

197 changes: 48 additions & 149 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,168 +1,67 @@
plugins {
id 'eclipse'
id 'idea'
id 'maven-publish'
id 'net.minecraftforge.gradle' version '[6.0,6.2)'
id 'com.matthewprenger.cursegradle' version '1.4.0'
id 'com.modrinth.minotaur' version "2.+"
id 'fabric-loom' version '1.2-SNAPSHOT' apply(false)
id 'net.minecraftforge.gradle' version '[6.0,6.2)' apply(false)
id 'org.spongepowered.gradle.vanilla' version '0.2.1-SNAPSHOT' apply(false)
id("org.spongepowered.mixin") version "0.7-SNAPSHOT" apply(false)
id "net.darkhax.curseforgegradle" version "1.1.18" apply(false)
id("com.modrinth.minotaur") version "2.+" apply(false)
}

version = "${version}"
group = "${mod_group}"
base {
archivesName = "Instrumental-Mobs-${mc_version}"
}

// Mojang ships Java 17 to end users in 1.18+, so your mod should target Java 17.
java.toolchain.languageVersion = JavaLanguageVersion.of(17)

println "Java: ${System.getProperty 'java.version'}, JVM: ${System.getProperty 'java.vm.version'} (${System.getProperty 'java.vendor'}), Arch: ${System.getProperty 'os.arch'}"
minecraft {
mappings channel: mapping_channel, version: mapping_version

//copyIdeResources = true

accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
subprojects {
apply plugin: 'java'

runs {
client {
workingDirectory project.file('run')
property 'mixin.env.remapRefMap', 'true'
property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg"
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
java.withSourcesJar()

// Recommended logging data for a userdev environment
// property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
property 'forge.logging.markers', 'REGISTRIES'

// Recommended logging level for the console
property 'forge.logging.console.level', 'debug'

// Comma-separated list of namespaces to load gametests from. Empty = all namespaces.
property 'forge.enabledGameTestNamespaces', "${mod_id}"

mods {
"${mod_id}" {
source sourceSets.main
}
}
jar {
from(rootProject.file("LICENSE")) {
rename { "${it}_${mod_name}" }
}

server {
workingDirectory project.file('run')
property 'mixin.env.remapRefMap', 'true'
property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg"

// Recommended logging data for a userdev environment
// property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
property 'forge.logging.markers', 'REGISTRIES'

// Recommended logging level for the console
property 'forge.logging.console.level', 'debug'

// Comma-separated list of namespaces to load gametests from. Empty = all namespaces.
property 'forge.enabledGameTestNamespaces', "${mod_id}"

mods {
"${mod_id}" {
source sourceSets.main
}
}
manifest {
attributes([
'Specification-Title' : mod_name,
'Specification-Vendor' : mod_author,
'Specification-Version' : project.jar.archiveVersion,
'Implementation-Title' : project.name,
'Implementation-Version' : project.jar.archiveVersion,
'Implementation-Vendor' : mod_author,
'Implementation-Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"),
'Timestamp' : System.currentTimeMillis(),
'Built-On-Java' : "${System.getProperty('java.vm.version')} (${System.getProperty('java.vm.vendor')})",
'Built-On-Minecraft' : minecraft_version
])
}
}

data {
workingDirectory project.file('run')
property 'mixin.env.remapRefMap', 'true'
property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg"

// Recommended logging data for a userdev environment
// property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
property 'forge.logging.markers', 'REGISTRIES'

// Recommended logging level for the console
property 'forge.logging.console.level', 'debug'

// Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources.
args '--mod', "${mod_id}", '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/')

mods {
"${mod_id}" {
source sourceSets.main
}
}
sourcesJar {
from(rootProject.file("LICENSE")) {
rename { "${it}_${mod_name}" }
}
}
}

// Include resources generated by data generators.
sourceSets.main.resources { srcDir 'src/generated/resources' }

repositories {
maven {
url = "https://maven.blamejared.com"
repositories {
mavenCentral()
maven {
name = 'Sponge / Mixin'
url = 'https://repo.spongepowered.org/repository/maven-public/'
}
}
}

dependencies {
minecraft "net.minecraftforge:forge:${mc_version}-${forge_version}"

compileOnly fg.deobf("mezz.jei:jei-${mc_version}-common-api:${jei_version}")
compileOnly fg.deobf("mezz.jei:jei-${mc_version}-forge-api:${jei_version}")

runtimeOnly fg.deobf("mezz.jei:jei-${mc_version}-forge:${jei_version}")
}

// Example for how to get properties into the manifest for reading at runtime.
jar {
manifest {
attributes([
"Specification-Title" : "${mod_id}",
"Specification-Vendor" : "Mrbysco",
"Specification-Version" : "1", // We are version 1 of ourselves
"Implementation-Title" : project.name,
"Implementation-Version" : project.jar.archiveVersion,
"Implementation-Vendor" : "Mrbysco",
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
])
tasks.withType(JavaCompile).configureEach {
it.options.encoding = 'UTF-8'
it.options.getRelease().set(17)
}
}

// Example configuration to allow publishing using the maven-publish plugin
// This is the preferred method to reobfuscate your jar file
jar.finalizedBy('reobfJar')
// However if you are in a multi-project build, dev time needs unobfed jar files, so you can delay the obfuscation until publishing by doing
// publish.dependsOn('reobfJar')

def reobfFile = file("$buildDir/reobfJar/output.jar")
def reobfArtifact = artifacts.add('default', reobfFile) {
type 'jar'
builtBy 'reobfJar'
}
publishing {
publications {
mavenJava(MavenPublication) {
artifact(reobfArtifact) {
builtBy reobfArtifact
artifactId = archivesBaseName
classifier null
}
processResources {
filesMatching(['pack.mcmeta', 'fabric.mod.json', 'mods.toml', '*.mixins.json']) {
expand project.properties
}
}
repositories {
if (System.getenv().SAP_SECRET) {
maven {
url "https://maven.saps.dev/releases"
credentials {
username = "mrbysco"
password = "${System.getenv().SAP_SECRET}"
}
}
}
}
}

tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation
// Disables Gradle's custom module metadata from being published to maven. The
// metadata includes mapped dependencies which are not reasonably consumable by
// other mod developers.
tasks.withType(GenerateModuleMetadata).configureEach {
enabled = false
}
}

apply from: 'gradle/curseforge.gradle'
apply from: 'gradle/modrinth.gradle'
1 change: 0 additions & 1 deletion changelog.md
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
* Fix Trumpet skeleton dropping a Xylophone instead of a Trumpet
22 changes: 22 additions & 0 deletions common/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
plugins {
id 'idea'
id 'java'
id 'maven-publish'
id 'org.spongepowered.gradle.vanilla'
}

base {
archivesName = "${mod_name}-common-${minecraft_version}"
}

minecraft {
version(minecraft_version)
if (file("src/main/resources/${mod_id}.accesswidener").exists()) {
accessWideners(file("src/main/resources/${mod_id}.accesswidener"))
}
}

dependencies {
compileOnly group: 'org.spongepowered', name: 'mixin', version: '0.8.5'
implementation group: 'com.google.code.findbugs', name: 'jsr305', version: '3.0.1'
}
14 changes: 14 additions & 0 deletions common/src/main/java/com/mrbysco/instrumentalmobs/CommonClass.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.mrbysco.instrumentalmobs;

import com.mrbysco.instrumentalmobs.registration.InstrumentalEntities;
import com.mrbysco.instrumentalmobs.registration.InstrumentalRegistry;
import com.mrbysco.instrumentalmobs.registration.InstrumentalSounds;

public class CommonClass {

public static void init() {
InstrumentalSounds.loadClass();
InstrumentalEntities.loadClass();
InstrumentalRegistry.loadClass();
}
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
package com.mrbysco.instrumentalmobs;

import com.mrbysco.instrumentalmobs.init.InstrumentalDamageTypes;
import com.mrbysco.instrumentalmobs.registration.InstrumentalDamageTypes;
import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.Entity;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class Reference {
public class Constants {
public static final String MOD_ID = "instrumentalmobs";
public static final String MOD_PREFIX = MOD_ID + ":";
public static final String MOD_NAME = "Instrumental Mobs";
public static final Logger LOGGER = LoggerFactory.getLogger(MOD_NAME);

public static DamageSource causeSoundDamage(Entity entity) {
return entity.damageSources().source(InstrumentalDamageTypes.SOUND, entity);
Expand Down
Loading

0 comments on commit 550a666

Please sign in to comment.