Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Hendrix-Shen committed Jan 31, 2022
0 parents commit cae3648
Show file tree
Hide file tree
Showing 24 changed files with 1,593 additions and 0 deletions.
Empty file added .clear-target-files
Empty file.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Auto detect text files and perform LF normalization
* text=auto
71 changes: 71 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: CI
on:
push:
branches:
- 'dev/**'
pull_request:

jobs:
build:
if: ${{ github.event_name == 'push' }}
strategy:
matrix:
java: [17]
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout the sources
uses: actions/checkout@v1
- name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: ${{ matrix.java }}
- name: Generate build number
id: buildnumber
uses: einaregilsson/build-number@v3
with:
token: ${{ secrets.github_token }}
prefix: ${{ github.ref }}
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Publish Maven with Gradle
run: ./gradlew build publish -x test --stacktrace
- name: Upload Maven to GitHub
uses: s0/[email protected]
env:
REPO: [email protected]:Hendrix-Shen/Maven.git
BRANCH: master
FOLDER: publish
SSH_PRIVATE_KEY: ${{ secrets.DEPLOY_PRIVATE_KEY }}
CLEAR_GLOBS_FILE: '.clear-target-files'
- name: Create Github release
uses: marvinpinto/[email protected]
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "exp"
prerelease: true
title: "${{ github.ref_name }}.${{ steps.buildnumber.outputs.build_number }}"
files: |
LICENSE
build/libs/*.jar
pull_request:
if: ${{ github.event_name == 'pull_request' }}
strategy:
matrix:
java: [17]
os: [ubuntu-20.04]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout the sources
uses: actions/checkout@v2
- name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: ${{ matrix.java }}
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew build
674 changes: 674 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

Binary file added LevelRenderer.class
Binary file not shown.
29 changes: 29 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# MagicLib
[![License](https://img.shields.io/github/license/Hendrix-Shen/MagicLib?label=License&style=flat-square)](https://github.com/Hendrix-Shen/MagicLib/blob/main/LICENSE)
![Languages](https://img.shields.io/github/languages/top/Hendrix-Shen/MagicLib?style=flat-square)
![Java](https://img.shields.io/badge/Java-8%20%7C%209%20%7C%2010%20%7C%2011%20%7C%2012%20%7C%2013%20%7C%2014%20%7C%2015%20%7C%2016%7C%2017-orange?style=flat-square)
[![Issues](https://img.shields.io/github/issues/Hendrix-Shen/MagicLib?style=flat-square)](https://github.com/Hendrix-Shen/MagicLib/issues)
[![Pull Requests](https://img.shields.io/github/issues-pr/Hendrix-Shen/MagicLib?style=flat-square)](https://github.com/Hendrix-Shen/MagicLib/pulls)
[![Public Beta](https://img.shields.io/github/workflow/status/Hendrix-Shen/MagicLib/CI?label=Last&20building&style=flat-square)](https://github.com/Hendrix-Shen/MagicLib/actions/workflows/CI.yml)
[![Github Release](https://img.shields.io/github/v/release/Hendrix-Shen/MagicLib?include_prereleases&label=Release&style=flat-square)](https://github.com/Hendrix-Shen/MagicLib/releases)
[![Github Release Downloads](https://img.shields.io/github/downloads/Hendrix-Shen/MagicLib/total?label=Github%20Release%20Downloads&style=flat-square)](https://github.com/Hendrix-Shen/MagicLib/releases)

[中文](./README_ZH_CN.md)

**Warning: The project is still in the early development stage.**

A library for mod dependencies.

## Development

### Mappings

We are using the **Mojang official** mappings to de-obfuscate Minecraft and insert patches.

### Document

The English doc and the Chinese doc are aligned line by line.

## License

This project is available under the GPLv3 license. Feel free to learn from it and incorporate it in your own projects.
29 changes: 29 additions & 0 deletions README_ZH_CN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# MagicLib
[![License](https://img.shields.io/github/license/Hendrix-Shen/MagicLib?label=License&style=flat-square)](https://github.com/Hendrix-Shen/MagicLib/blob/main/LICENSE)
![Languages](https://img.shields.io/github/languages/top/Hendrix-Shen/MagicLib?style=flat-square)
![Java](https://img.shields.io/badge/Java-8%20%7C%209%20%7C%2010%20%7C%2011%20%7C%2012%20%7C%2013%20%7C%2014%20%7C%2015%20%7C%2016%7C%2017-orange?style=flat-square)
[![Issues](https://img.shields.io/github/issues/Hendrix-Shen/MagicLib?style=flat-square)](https://github.com/Hendrix-Shen/MagicLib/issues)
[![Pull Requests](https://img.shields.io/github/issues-pr/Hendrix-Shen/MagicLib?style=flat-square)](https://github.com/Hendrix-Shen/MagicLib/pulls)
[![Public Beta](https://img.shields.io/github/workflow/status/Hendrix-Shen/MagicLib/CI?label=Last&20building&style=flat-square)](https://github.com/Hendrix-Shen/MagicLib/actions/workflows/CI.yml)
[![Github Release](https://img.shields.io/github/v/release/Hendrix-Shen/MagicLib?include_prereleases&label=Release&style=flat-square)](https://github.com/Hendrix-Shen/MagicLib/releases)
[![Github Release Downloads](https://img.shields.io/github/downloads/Hendrix-Shen/MagicLib/total?label=Github%20Release%20Downloads&style=flat-square)](https://github.com/Hendrix-Shen/MagicLib/releases)

[English](./README.md)

**警告: 此项目仍然处于早期开发阶段。**

一个模组依赖库。

## 开发

### 混淆映射表

我们使用 **Mojang 官方** 混淆映射表来反混淆 Minecraft 并插入补丁程序。

### 文档

英文文档与中文文档是逐行对应的。

## 许可

此项目在 GPLv3许可证 下可用。 从中学习,并将其融入到您自己的项目中。
106 changes: 106 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
import com.modrinth.minotaur.TaskModrinthUpload
import com.modrinth.minotaur.request.VersionType

plugins {
id 'fabric-loom' version '0.10-SNAPSHOT'
id 'maven-publish'
id "com.modrinth.minotaur" version "1.2.1"
}

group = "${project.group}.${project.mod_id}" as String
archivesBaseName = "${project.mod_id}"

def baseVersion = "${project.mod_version}" as String
def ENV = System.getenv()

if (ENV.BUILD_NUMBER) {
version = baseVersion + '.' + ENV.BUILD_NUMBER
} else {
version = baseVersion + '.local'
}

dependencies {
minecraft("com.mojang:minecraft:${project.minecraft_version}")
mappings(loom.officialMojangMappings())
modApi("net.fabricmc:fabric-loader:${project.fabric_loader_version}")
}

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

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

tasks.withType(JavaCompile).configureEach {
it.options.encoding = "UTF-8"
it.sourceCompatibility = JavaVersion.VERSION_1_8
it.targetCompatibility = JavaVersion.VERSION_1_8
}

task publishModrinth (type: TaskModrinthUpload) {
onlyIf {
System.getenv("MODRINTH_API_TOKEN")
}
token = System.getenv("MODRINTH_API_TOKEN")
projectId = "${project.modrinth_project_id}"
versionNumber = System.getenv("VERSION_NUMBER")
changelog = System.getenv("CHANGE_LOG")
uploadFile = remapJar
switch ("${project.modrinth_release_type}") {
case "alpha":
versionType = VersionType.ALPHA
break
case "beta":
versionType = VersionType.BETA
break
case "release":
versionType = VersionType.RELEASE
break
}
addGameVersion("${project.minecraft_version}")
addLoader('fabric')
}

runClient {
defaultCharacterEncoding = "UTF-8"
}

runServer {
defaultCharacterEncoding = "UTF-8"
}

java {
withSourcesJar()
}

jar {
from("LICENSE")
}

publishing {
publications {
mavenJava(MavenPublication) {
groupId(project.group)
artifactId(project.archivesBaseName)
version(project.version)
from(components.java)
}

snapshot(MavenPublication) {
groupId(project.group)
artifactId(project.archivesBaseName)
version(baseVersion + '-SNAPSHOT')
from(components.java)
}
}

repositories {
maven {
url "$projectDir/publish"
}
}
}

47 changes: 47 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
org.gradle.jvmargs=-Xmx2G
# Mod reference
author = Hendrix-Shen
group = top.hendrixshen
mod_id = magiclib
mod_name = MagicLib
mod_version = 0.1

# Development Environment
fabric_loader_version = 0.12.12
minecraft_version = 1.18.1

# Release settings
# Curseforge api code is follow:
# Java:
# 8: 4458
# 9: 6762
# 10: 7113
# 11: 8320
# 12: 8321
# 13: 8322
# 14: 8323
# 15: 8324
# 16: 8325
# 17: 8326
# 18: 8634
# Minecraft:
# 1.14.4: 7469
# 1.15.2: 7722
# 1.16.5: 8203
# 1.17.1: 8516
# 1.18.1: 8857
# Fabric: 7499
# Curseforge release type: alpha, beta, release
# Curseforge relations format: slug1:type,slug2,type,...
# Curseforge relations types embeddedLibrary, incompatible, optionalDependency, requiredDependency, tool
# Modrinth api code is follow:
# Modrinth release type: alpha, beta, release
cruseforge_gameversion = 7499, 4458, 6762, 7113, 8320, 8321, 8322, 8323, 8324, 8325, 8326, 7469, 7722, 8203, 8203, 8516, 8857
cruseforge_projectid = undefined
cruseforge_relations = undefined
cruseforge_release = false
cruseforge_release_type = alpha
github_release = true
modrinth_project_id = undefined
modrinth_release = false
modrinth_release_type = alpha
Binary file added gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
5 changes: 5 additions & 0 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit cae3648

Please sign in to comment.