Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Jamalam360 authored Sep 2, 2024
0 parents commit b2f77f8
Show file tree
Hide file tree
Showing 34 changed files with 1,218 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
* 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
48 changes: 48 additions & 0 deletions .github/workflows/build.yml.disabled
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: build

on:
- push
- pull_request

jobs:
build:
runs-on: ubuntu-20.04
steps:
- name: Checkout Repository
uses: actions/checkout@v2
with:
persist-credentials: false
fetch-depth: 0

- name: Enable Caching
uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/loom-cache
~/.gradle/wrapper
key: gradle-${{ hashFiles('**/gradle-wrapper.properties') }}-${{ hashFiles('./gradle.properties') }}-${{ hashFiles('./libs.versions.toml') }}
restore-keys: gradle

- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v1

- name: Setup JDK 21
uses: actions/setup-java@v1
with:
java-version: 21

- name: Build
run: ./gradlew clean neoforge:build fabric:build

- name: Capture Fabric Build Artifacts
uses: actions/upload-artifact@v2
with:
name: Fabric Artifacts
path: fabric/build/libs/

- name: Capture NeoForge Build Artifacts
uses: actions/upload-artifact@v2
with:
name: NeoForge Artifacts
path: neoforge/build/libs/
20 changes: 20 additions & 0 deletions .github/workflows/test-server
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash

platform=$1
output_file=$(mktemp)
./gradlew $platform:runServer > "$output_file" 2>&1 &
command_pid=$!
sleep 60

if ps -p $command_pid > /dev/null; then
echo "Command still running, assuming it was a success and killing it..."
kill -9 $command_pid
cat "$output_file"
rm "$output_file"
exit 0
else
echo "Command finished within time limit, considering it to be a failure..."
cat "$output_file"
rm "$output_file"
exit 1
fi
57 changes: 57 additions & 0 deletions .github/workflows/test-template.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Test Template Mod Compiles

on:
push:
pull_request:

jobs:
test:
runs-on: "ubuntu-20.04"

steps:
- name: Clone repository
uses: actions/checkout@v4

- name: Set up Deno
uses: denoland/[email protected]
with:
deno-version: "canary"

- name: Initialize template
run: deno run --allow-read --allow-write --allow-env https://raw.githubusercontent.com/Jamalam360/easytemplate/main/easytemplate.ts --disable-interactive-mode --input name="Template Mod Test Mod" --input mod_id=template_mod_test --input description="This is a mod to test the template mod." --input author=Jamalam360 --input group="io.github.jamalam360" --input main_class="TemplateModTest" --input github_owner="JamCoreModding" --input github_repo="multi-loader-template-mod" --input github_publish=true --input unified_publishing=true

- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v2

- name: Setup JDK 21
uses: actions/setup-java@v2
with:
distribution: temurin
java-version: 21

- name: Build
run: ./gradlew clean neoforge:build fabric:build

- name: Capture Fabric Build Artifacts
uses: actions/upload-artifact@v4
with:
name: Fabric Artifacts
path: fabric/build/libs/

- name: Capture NeoForge Build Artifacts
uses: actions/upload-artifact@v4
with:
name: NeoForge Artifacts
path: neoforge/build/libs/

- name: Agree to EULAs
run: mkdir fabric/run && touch fabric/run/eula.txt && mkdir neoforge/run && touch neoforge/run/eula.txt && echo "eula=true" > fabric/run/eula.txt && echo "eula=true" > neoforge/run/eula.txt

- name: Copy Test Server Script
run: cp backup/.github/workflows/test-server ./.github/workflows/test-server

- name: Run Test Server (Fabric)
run: chmod +x .github/workflows/test-server && ./.github/workflows/test-server fabric

- name: Run Test Server (NeoForge)
run: chmod +x .github/workflows/test-server && ./.github/workflows/test-server neoforge
24 changes: 24 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# eclipse
bin
*.launch
.settings
.metadata
.classpath
.project

# idea
out
*.ipr
*.iws
*.iml
.idea/*
!.idea/scopes

# gradle
build
.gradle

# other
eclipse
run
.architectury-transformer
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.

Empty file added CHANGELOG.md
Empty file.
7 changes: 7 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Copyright 2024 {{ author }}

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26 changes: 26 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# JamCore Multi-loader Template Mod

<p align="center">
<img alt="forge" height="25" src="https://cdn.jsdelivr.net/npm/@intergrav/devins-badges@3/assets/compact/supported/forge_vector.svg">
<img alt="fabric" height="25" src="https://cdn.jsdelivr.net/npm/@intergrav/devins-badges@3/assets/compact/supported/fabric_vector.svg">
<img alt="quilt" height="25" src="https://cdn.jsdelivr.net/npm/@intergrav/devins-badges@3/assets/compact/supported/quilt_vector.svg">
</p>

This repository uses a system I created called
[easytemplate](https://github.com/Jamalam360/easytemplate) to initialize the
template automatically. After following the easytemplate prompt, you shouldn't
have to make any changes before starting programming.

1. Install [Deno](https://deno.land/)
2. Click `Use This Template`
3. Clone the repository.
4. Run
`deno run --allow-read --allow-write --allow-env https://raw.githubusercontent.com/Jamalam360/easytemplate/main/easytemplate.ts`
in the repository directory.
5. Follow the instructions.
6. See [the docs](https://docs.jamalam.tech) for more information.

## License

This repository contains the MIT license for ease of use, but you can change it
to whatever you want.
113 changes: 113 additions & 0 deletions build.gradle.easytemplate
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
plugins {
id "architectury-plugin" version "3.4-SNAPSHOT"
id "dev.architectury.loom" version "1.7-SNAPSHOT" apply false
{{#if unified_publishing}}
id "me.shedaniel.unified-publishing" version "0.1.+" apply false
{{/if}}
{{#if github_publish}}
id "com.github.breadmoirai.github-release" version "2.4.1"
{{/if}}
}
{{#if github_publish}}

if (System.getenv("GITHUB_TOKEN") != null) {
githubRelease {
token(System.getenv("GITHUB_TOKEN"))
owner("{{ github_owner }}")
repo("{{ github_repo }}")
tagName("${project.version}")
releaseName("V${project.version}")
body(project.rootProject.file("CHANGELOG.md").text)
draft(false)

if (project.branch != null) {
targetCommitish(project.branch)
}
}
}
{{/if}}

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

loom {
silentMojangMappingsLicense()
}

jar {
manifest {
attributes([
'Specification-Title' : mod_name,
'Specification-Version' : project.jar.archiveVersion,
'Implementation-Title' : project.name,
'Implementation-Version' : project.jar.archiveVersion,
'Built-On-Java' : "${System.getProperty('java.vm.version')} (${System.getProperty('java.vm.vendor')})",
'Built-On-Minecraft' : minecraft_version,
'JamLib-File-Name' : "{{mod_id}}-${project.base.archivesName.get()}-${rootProject.version}.jar",
])
}
}

dependencies {
minecraft "com.mojang:minecraft:${rootProject.minecraft_version}"
mappings loom.layered() {
officialMojangMappings()
parchment "org.parchmentmc.data:parchment-${libs.versions.parchment_minecraft.get()}:${libs.versions.parchment.get()}@zip"
}
}
}

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

version = rootProject.version
group = rootProject.group

repositories {
mavenCentral()

maven {
name = "Modrinth"
url = "https://api.modrinth.com/maven"
}

maven {
name = "Jamalam's Maven"
url = "https://maven.jamalam.tech/releases"
}

maven {
name = "ParchmentMC"
url = "https://maven.parchmentmc.org"
}
}

base {
archivesName = "{{mod_id}}"
}

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

tasks.create("prepareWorkspace") {}

java {
withSourcesJar()
}
{{#ifCond github_publish '||' unified_publishing}}

tasks.publish {
{{#if github_publish}}
dependsOn(":githubRelease")
{{/if}}
{{#if unified_publishing}}
dependsOn("fabric:publishUnified")
dependsOn("neoforge:publishUnified")
{{/if}}
}
{{/ifCond}}
}
9 changes: 9 additions & 0 deletions common/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
architectury {
common(rootProject.enabled_platforms.split(","))
}

dependencies {
modImplementation libs.fabric.loader
modImplementation libs.architectury.common
modImplementation libs.jamlib.common
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package {{group}}.{{mod_id}};

import io.github.jamalam360.jamlib.JamLib;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class {{ main_class }} {
public static final String MOD_ID = "{{ mod_id }}";
public static final String MOD_NAME = "{{ name }}";
public static final Logger LOGGER = LoggerFactory.getLogger(MOD_NAME);

public static void init() {
JamLib.checkForJarRenaming({{ main_class }}.class);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package {{group}}.{{mod_id}};

public class {{main_class}}Platform {

}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 16 additions & 0 deletions common/src/main/resources/{{ mod_id }}.mixins.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"required": true,
"minVersion": "0.8",
"package": "{{ group }}.{{ mod_id }}.mixin",
"compatibilityLevel": "JAVA_17",
"mixins": [
],
"client": [
],
"server": [
],
"injectors": {
"defaultRequire": 1
}
}

Loading

0 comments on commit b2f77f8

Please sign in to comment.