Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
ZiYueCommentary committed Jul 21, 2024
0 parents commit 22f1e03
Show file tree
Hide file tree
Showing 511 changed files with 17,857 additions and 0 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Build
on: [ pull_request, push ]

jobs:
build:
strategy:
matrix:
minecraft: [ 1.16.5, 1.19.4 ]
loader: [ fabric ] #forge
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Validate gradle wrapper
uses: gradle/wrapper-validation-action@v1
- name: Setup JDK 17
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 17
- name: Make gradle wrapper executable
run: chmod +x ./gradlew
- name: Setup ${{ matrix.minecraft }} ${{ matrix.loader }}
run: ./gradlew setupLibrary -PbuildVersion="${{ matrix.minecraft }}"
- name: Build ${{ matrix.minecraft }} ${{ matrix.loader }}
run: ./gradlew ${{ matrix.loader }}:build -PbuildVersion="${{ matrix.minecraft }}"
#- name: Capture release artifacts
# uses: actions/upload-artifact@v3
# with:
# name: Fabric&Forge Artifacts
# path: build/release/
42 changes: 42 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# gradle

.gradle/
build/
out/
classes/
checkouts/

# eclipse

*.launch

# idea

.idea/
*.iml
*.ipr
*.iws

# vscode

.settings/
.vscode/
bin/
.classpath
.project

# macos

*.DS_Store

# fabric

fabric/run/
run/
forge/src/main/java/**/mod
forge/src/main/resources/assets
forge/src/main/resources/data
forge/run

**/lang/*.json
!en_us.json
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2022-2024 ZiYueCommentary

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.
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Tianjin Metro

<img alt="Requires Java 16" height="50px" src="icons/requires_java16.svg"/>

A small mod for [Minecraft Transit Railway](https://github.com/jonafanho/Minecraft-Transit-Railway), in developing stage.

## How to build

1. Clone this repository
2. Sync the Gradle project

# 天津地铁模组

一个 [Minecraft Transit Railway](https://github.com/jonafanho/Minecraft-Transit-Railway) 的附属模组,处于开发阶段。

## 构建步骤

1. 克隆仓库
2. 同步 Gradle 项目
88 changes: 88 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
plugins {
id "io.github.pacifistmc.forgix" version "1.+"
}

forgix {
group = "ziyue.tjmetro"
mergedJarName = "${project.archives_base_name}-${project.mod_version}+${project.minecraft_version}.jar"
outputDir = "build/"

fabric {
projectName = "fabric"
jarLocation = "build/libs/${project.archives_base_name}-fabric-${project.mod_version}+${project.minecraft_version}.jar"
}

forge {
projectName = "forge"
jarLocation = "build/libs/${project.archives_base_name}-forge-${project.mod_version}+${project.minecraft_version}.jar"
}
}

subprojects {
apply plugin: "java"

group project.maven_group
version "${rootProject.properties.mod_version}+${rootProject.properties.minecraft_version}"

base {
archivesName = "${rootProject.archives_base_name}-${project.properties.loader_name}"
}

dependencies {
implementation 'com.google.code.findbugs:jsr305:+'
}

repositories {
flatDir { dirs "../libs" }
maven { url "https://jitpack.io" }
maven { url "https://maven.ziyuesinicization.site/releases/" }
maven { url "https://maven.shedaniel.me/" }
}

def mc_ver = rootProject.properties.minecraft_version
def mc_major = mc_ver.split("\\.")[0]
def mc_main = mc_ver.split("\\.")[1]
def mc_minor = mc_ver.split("\\.").size() > 2 ? (mc_ver.split("\\.")[2] as String).padLeft(2, '0') : 0
def merged_mc_version = "$mc_major$mc_main$mc_minor"

ext { // Expose to subproject
java_version = 17

full_mod_version = version
}

/* Manifold support */
tasks.withType(JavaCompile).forEach {
it.options.compilerArgs += ["-Xplugin:Manifold",
"-AMC_VERSION=$merged_mc_version",
"-ALOADER=$project.properties.loader_name"]
}

// Some system don't compile with UTF-8 by default
compileJava {
options.encoding = 'UTF-8'
}

// Replace placeholder resources
processResources {
inputs.property "version", mod_version
inputs.property "minecraft_version", minecraft_version

filesMatching('META-INF/mods.toml') {
expand(
"minecraft_version": minecraft_version,
"version": mod_version
)
}

filesMatching("fabric.mod.json") {
expand(
"version": mod_version,
"minecraft_version": minecraft_version
)
}
}

build.finalizedBy(mergeJars)
assemble.finalizedBy(mergeJars)
}
12 changes: 12 additions & 0 deletions common/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
dependencies {
modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}"
modApi "${rootProject.architectury_id}:architectury:${rootProject.architectury_version}"
modApi("me.shedaniel.cloth:cloth-config-fabric:${rootProject.cloth_config_fabric_version}") {
exclude(group: "net.fabricmc.fabric-api")
}
modApi "ziyue:filters:${rootProject.filters_api_version}"
}

architectury {
common()
}
3 changes: 3 additions & 0 deletions common/src/main/latest-tjmetro.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"version": "@version@"
}
14 changes: 14 additions & 0 deletions common/src/main/resources/tjmetro.mixins.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"required": true,
"minVersion": "0.8",
"package": "ziyue.tjmetro.mixin",
"compatibilityLevel": "JAVA_16",
"mixins": [
],
"injectors": {
"defaultRequire": 1
},
"client": [
],
"refmap": "tjmetro-refmap.json"
}
59 changes: 59 additions & 0 deletions fabric/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
plugins {
id 'fabric-loom' version '1.7-SNAPSHOT'
}

loom {
runConfigs.configureEach { ideConfigGenerated = true }
}

repositories {
maven { url = "https://maven.terraformersmc.com/" }
}

def yarn_version = project.properties["yarn_mappings_${rootProject.minecraft_version}"]
def fabric_api_version = project.properties["fabric_api_version_${rootProject.minecraft_version}"]
def mod_menu_version = project.properties["mod_menu_version_${rootProject.minecraft_version}"]
def cloth_config_version = project.properties["cloth_config_version_${rootProject.minecraft_version}"]

dependencies {
// To change the versions see the gradle.properties file
minecraft "com.mojang:minecraft:${rootProject.minecraft_version}"
mappings "net.fabricmc:yarn:${yarn_version}:v2"
//modImplementation "org.mtr:MTR-fabric:${rootProject.mtr_version}+${rootProject.minecraft_version}-server"
modImplementation(files("E:\\Tianjin-Metro\\libs\\MTR-fabric-4.0.0-beta-8+1.16.5-server.jar"))
modImplementation "net.fabricmc:fabric-loader:${project.fabric_loader_version}"
modImplementation "net.fabricmc.fabric-api:fabric-api:${fabric_api_version}"
modApi "com.terraformersmc:modmenu:${mod_menu_version}"
modApi("me.shedaniel.cloth:cloth-config-fabric:${cloth_config_version}") {
exclude(group: "net.fabricmc.fabric-api")
}
modApi ("ziyue.filters:filters-fabric:1.0.0+${rootProject.minecraft_version}") {
exclude(group: "net.fabricmc")
}
annotationProcessor 'systems.manifold:manifold-preprocessor:2023.1.33' // Delibrate: Newer versions just throws an error *when displaying an compiling error*
}

tasks.withType(JavaCompile).configureEach {
it.options.release = 17
}

configurations.configureEach {
// Force use our version of mod-loader even if dependency requires a lower mod-loader so the game can launch
// May cause problems, but they're usually backward compatible
resolutionStrategy {
force("net.fabricmc:fabric-loader:$project.fabric_loader_version")
}
}

java {
withSourcesJar()

sourceCompatibility = JavaVersion.VERSION_16
targetCompatibility = JavaVersion.VERSION_16
}

jar {
from("LICENSE") {
rename { "${it}_${base.archivesName.get()}"}
}
}
32 changes: 32 additions & 0 deletions fabric/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Fabric Properties
# check these on https://fabricmc.net/develop
fabric_loader_version=0.15.11
loader_name=fabric

yarn_mappings_1.20.4=1.20.4+build.3
yarn_mappings_1.20.1=1.20.1+build.10
yarn_mappings_1.19.4=1.19.4+build.2
yarn_mappings_1.19.2=1.19.2+build.28
yarn_mappings_1.18.2=1.18.2+build.4
yarn_mappings_1.17.1=1.17.1+build.65
yarn_mappings_1.16.5=1.16.5+build.10

# Dependencies
fabric_api_version_1.20.4=0.97.0+1.20.4
fabric_api_version_1.20.1=0.92.1+1.20.1
fabric_api_version_1.19.4=0.87.2+1.19.4
fabric_api_version_1.19.2=0.77.0+1.19.2
fabric_api_version_1.18.2=0.77.0+1.18.2
fabric_api_version_1.17.1=0.46.1+1.17
fabric_api_version_1.16.5=0.42.0+1.16

mod_menu_version_1.20.4=9.0.0
mod_menu_version_1.20.1=7.2.2
mod_menu_version_1.19.4=6.3.1
mod_menu_version_1.19.2=4.1.2
mod_menu_version_1.18.2=3.2.5
mod_menu_version_1.17.1=2.0.17
mod_menu_version_1.16.5=1.16.23

cloth_config_version_1.16.5=4.17.101
cloth_config_version_1.19.4=10.1.117
15 changes: 15 additions & 0 deletions fabric/src/main/java/ziyue/tjmetro/fabric/MainFabric.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package ziyue.tjmetro.fabric;

import net.fabricmc.api.ModInitializer;
import ziyue.tjmetro.mod.Registry;
import ziyue.tjmetro.mod.TianjinMetro;

public final class MainFabric implements ModInitializer {

@Override
public void onInitialize() {
TianjinMetro.init();
Registry.FILTERS_REGISTRY_ITEM.forEach(pair -> pair.getFirst().addItems(pair.getSecond().get().data));
Registry.FILTERS_REGISTRY_BLOCK.forEach(pair -> pair.getFirst().addItems(pair.getSecond().get().asItem().data));
}
}
13 changes: 13 additions & 0 deletions fabric/src/main/java/ziyue/tjmetro/fabric/MainFabricClient.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package ziyue.tjmetro.fabric;

import net.fabricmc.api.ClientModInitializer;
import ziyue.tjmetro.mod.Registry;
import ziyue.tjmetro.mod.TianjinMetroClient;

public final class MainFabricClient implements ClientModInitializer
{
@Override
public void onInitializeClient() {
TianjinMetroClient.init();
}
}
14 changes: 14 additions & 0 deletions fabric/src/main/java/ziyue/tjmetro/fabric/ModMenuConfig.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package ziyue.tjmetro.fabric;

import com.terraformersmc.modmenu.api.ConfigScreenFactory;
import com.terraformersmc.modmenu.api.ModMenuApi;
import org.mtr.mapping.holder.Screen;
import ziyue.tjmetro.mod.config.ConfigClient;

public class ModMenuConfig implements ModMenuApi
{
@Override
public ConfigScreenFactory<?> getModConfigScreenFactory() {
return screen -> ConfigClient.getConfigScreen(new Screen(screen)).data;
}
}
Loading

0 comments on commit 22f1e03

Please sign in to comment.