Skip to content

Commit

Permalink
Updated to 1.18
Browse files Browse the repository at this point in the history
  • Loading branch information
LatvianModder committed Jan 11, 2022
1 parent 84217ce commit 9e75c2c
Show file tree
Hide file tree
Showing 18 changed files with 305 additions and 392 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Build & Release

on:
push:
tags:
- 'v*'

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- uses: actions/checkout@v2
with:
fetch-depth: 30 # Gets the last 30 commits so the changelog might work
- name: Set up JDK
uses: actions/setup-java@v1
with:
java-version: 17
- name: Build & release to curseforge
env:
GIT_COMMIT: ${{ github.event.after }}
GIT_PREVIOUS_COMMIT: ${{ github.event.before }}
NANITE_DEPLOY: ${{ secrets.NANITE_DEPLOY }}
CURSE_DEPLOY: ${{ secrets.CURSE_DEPLOY }}
run: |
chmod +x ./gradlew
./gradlew build publish curseforge --stacktrace --no-daemon
206 changes: 88 additions & 118 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,143 +1,113 @@
buildscript {
repositories {
jcenter()
maven { url = 'https://files.minecraftforge.net/maven' }
maven { url "https://plugins.gradle.org/m2/" }
maven { url "https://repo.spongepowered.org/repository/maven-public/" }
mavenCentral()
}
dependencies {
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '3.+', changing: true
classpath 'gradle.plugin.com.matthewprenger:CurseGradle:1.1.0'
classpath 'com.wynprice.cursemaven:CurseMaven:1.2.+'
classpath 'org.spongepowered:mixingradle:0.7-SNAPSHOT'
}
plugins {
id "dev.architectury.loom" version "0.10.0-SNAPSHOT"
id 'maven-publish'
id "com.matthewprenger.cursegradle" version "1.4.0"
}
apply plugin: 'net.minecraftforge.gradle'
apply plugin: 'eclipse'
apply plugin: 'com.matthewprenger.cursegradle'
apply plugin: 'maven'
apply plugin: 'com.wynprice.cursemaven'
apply plugin: 'org.spongepowered.mixin'

apply from: 'https://raw.githubusercontent.com/MinecraftModDevelopment/Gradle-Collection/master/generic/markdown-git-changelog.gradle'
apply from: 'https://files.latmod.com/public/markdown-git-changelog.gradle'

sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = 17

def ENV = System.getenv()
version = ENV.BUILD_NUMBER ? "${project_version}.${ENV.BUILD_NUMBER}" : "${project_version}.custom"
group = 'com.sunekaer.mods'
archivesBaseName = 'StructureExpansion'

sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8'

minecraft {
mappings channel: 'snapshot', version: "${mcp_mappings}"
accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
runs {
client {
workingDirectory project.file('run')
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
property 'forge.logging.console.level', 'debug'
args '--mixin.config', 'structureexpansion.mixins.json'
mods {
structureexpansion {
source sourceSets.main
}
}
}

server {
workingDirectory project.file('run')
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
property 'forge.logging.console.level', 'debug'
args '--mixin.config', 'structureexpansion.mixins.json'
mods {
structureexpansion {
source sourceSets.main
}
}
}
data {
workingDirectory project.file('run')
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
property 'forge.logging.console.level', 'debug'
args '--mod', 'structureexpansion', '--all', '--output', file('src/generated/resources/')
args '--mixin.config', 'structureexpansion.mixins.json'
mods {
structureexpansion {
source sourceSets.main
}
}
}
}
version = "${mod_version}-build.${ENV.GITHUB_RUN_NUMBER ?: 9999}"
archivesBaseName = project.archives_base_name
group = project.maven_group

loom {
silentMojangMappingsLicense()

forge {
mixinConfigs = [
'structureexpansion.mixins.json'
]

dataGen {
mod project.mod_id
}

launches {
data {
arg "--existing", file("src/main/resources").absolutePath
}
}
}
}

repositories {
mavenLocal()
maven { url "https://maven.latmod.com/" }
maven { url "https://dvs1.progwml6.com/files/maven/"}
}

dependencies {
minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}"
}
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings minecraft.officialMojangMappings()

mixin {
add sourceSets.main, "structureexpansion.refmap.json"
forge "net.minecraftforge:forge:${project.minecraft_version}-${project.forge_version}"
}

jar {
manifest {
attributes([
"MixinConfigs": "structureexpansion.mixins.json",
"Specification-Title": "structureexpansion",
"Specification-Vendor": "Sunekaer",
"Specification-Version": "1", // We are version 1 of ourselves
"Implementation-Title": project.name,
"Implementation-Version": "${version}",
"Implementation-Vendor" :"Sunekaer",
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
])
}
}
processResources {
inputs.property "version", project.version

def reobfFile = file("$buildDir/reobfJar/output.jar")
def reobfArtifact = artifacts.add('default', reobfFile) {
type 'jar'
builtBy 'reobfJar'
filesMatching("META-INF/mods.toml") {
expand "version": project.version
}
}

task deobfJar(type: Jar) {
from sourceSets.main.output
classifier 'deobf'
compileJava {
options.encoding = "UTF-8"
}

build.dependsOn deobfJar
java {
withSourcesJar()
}

artifacts {
archives deobfJar
jar {
from("LICENSE") {
rename { "${it}_${project.archivesBaseName}" }
}

manifest {
attributes([
"Specification-Title" : project.mod_id,
"Specification-Vendor" : project.mod_author,
"Specification-Version" : "1",
"Implementation-Title" : project.name,
"Implementation-Version" : version,
"Implementation-Vendor" : project.mod_author,
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
])
}
}

if (ENV.LOCAL_MAVEN) {
uploadArchives {
repositories {
mavenDeployer {
repository(url: "file://${ENV.LOCAL_MAVEN}")
}
}
}
publishing {
publications {
mavenForge(MavenPublication) {
artifactId = rootProject.archivesBaseName
from components.java
}
}

repositories {
if (ENV.NANITE_DEPLOY) {
maven {
url "https://maven.nanite.dev/"
credentials {
username = "nanite"
password = "${ENV.NANITE_DEPLOY}"
}
}
}
}
}

if (ENV.WTBW_CF_KEY) {
curseforge {
apiKey = ENV.WTBW_CF_KEY
project {
id = "398430"
releaseType = "release"
addGameVersion "1.16.5"
changelog = getGitChangelog
changelogType = 'markdown'
addArtifact(deobfJar)
}
}
if (ENV.CURSE_DEPLOY) {
curseforge {
apiKey = ENV.CURSE_DEPLOY
project {
id = project.curseforge_id
releaseType = project.curseforge_type
addGameVersion "1.18.1"
mainArtifact(remapJar.archivePath)
changelog = getGitChangelog
changelogType = 'markdown'
}
}
}
20 changes: 11 additions & 9 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
# Sets default memory used for gradle commands. Can be overridden by user or command line properties.
# This is required to provide enough memory for the Minecraft decompilation process.
org.gradle.jvmargs=-Xmx3G
org.gradle.daemon=false

project_version=1.16.5-1.0
mcp_mappings=20210309-1.16.5
minecraft_version=1.16.5
forge_version=36.1.0
org.gradle.jvmargs=-Xmx1G
loom.platform=forge
mod_id=structure-expansion
archives_base_name=structure-expansion
maven_group=com.sunekaer.mods
minecraft_version=1.18.1
mod_version=1801.1.0
mod_author=LatvianModder
forge_version=39.0.10
curseforge_id=398430
curseforge_type=release
5 changes: 2 additions & 3 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#Mon Jul 27 23:20:33 CEST 2020
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.3-all.zip
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.2-bin.zip
9 changes: 9 additions & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
pluginManagement {
repositories {
maven { url "https://maven.creeperhost.net/" }
maven { url "https://maven.shedaniel.me/" }
gradlePluginPortal()
}
}

rootProject.name = 'Structure-Expansion'
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
package com.sunekaer.mods.structureexpansion;

import com.sunekaer.mods.structureexpansion.commands.CommandClean;
import net.minecraft.commands.Commands;
import net.minecraftforge.event.RegisterCommandsEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;

@Mod("structureexpansion")
@Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.FORGE)
public class StructureExpansion {
public static final int NEW_LIMIT = 512;
public static final int NEW_LIMIT_POS = NEW_LIMIT - 1;
public static final int NEW_LIMIT_NEG = -NEW_LIMIT_POS;

@SubscribeEvent
public static void registerCommands(RegisterCommandsEvent event) {
event.getDispatcher().register(Commands.literal("structure").then(CommandClean.register()));
}
}
Loading

0 comments on commit 9e75c2c

Please sign in to comment.