Skip to content

Commit

Permalink
chore: Merge branch '1.18+' into experiment/advancedGen/obsidian
Browse files Browse the repository at this point in the history
  • Loading branch information
null2264 committed Nov 6, 2023
2 parents 49ba599 + 7116bc5 commit 7b6fd19
Show file tree
Hide file tree
Showing 23 changed files with 466 additions and 150 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,4 @@ jobs:
CHANGELOG: ${{ github.event.release.body }}
CURSEFORGE: ${{ secrets.CURSEFORGE }}
MODRINTH: ${{ secrets.MODRINTH }}
run: ./gradlew publishUnified --stacktrace --no-daemon --max-workers 1
run: ./gradlew publishMods --stacktrace --no-daemon --max-workers 1
139 changes: 88 additions & 51 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,31 @@ plugins {
id "dev.architectury.loom" version "1.1-SNAPSHOT"
id "com.github.johnrengelman.shadow"
id "com.github.null2264.preprocess"
id "me.shedaniel.unified-publishing" version "0.1.+"
id "me.modmuss50.mod-publish-plugin" version "0.3.5"
}

def isForge = project.name.endsWith("forge")
def isNeo = project.name.endsWith("neoforge")
def isFabric = project.name.endsWith("fabric")
def mcVersion
def (major, minor, patch) = project.name.tokenize('-')[0].tokenize('.')
mcVersion = "${major}${minor.padLeft(2, '0')}${(patch ?: '').padLeft(2, '0')}" as int
static def String stringifyVersion(int ver) {
static String stringifyVersion(int ver) {
return "${(int)(ver/10000)}.${(int)(ver/100)%100}" + (ver%100==0 ? '' : ".${ver%100}")
}
def mcVersionStr = stringifyVersion(mcVersion)
def supportedVersionRange = [
11802: [null, "1.18.2"],
11902: ["1.19", "1.19.2"],
11904: ["1.19.3", "1.19.4"],
12001: ["1.20", null],
12001: ["1.20", "1.20.1"],
12002: ["1.20.2", null],
][mcVersion]

preprocess {
vars.put("MC", mcVersion)
vars.put("FABRIC", isFabric ? 1 : 0)
vars.put("FORGE", isForge ? 1 + (isNeo ? 1 : 0) : 0)

patternAnnotation.set("io.github.null2264.gradle.Pattern")
}
Expand Down Expand Up @@ -50,9 +54,6 @@ archivesBaseName = project.archives_base_name
ext.buildNumber = System.getenv("GITHUB_RUN_NUMBER")
project.version = project.mod_version + "+${mcVersionStr}" + (buildNumber != null ? "b${buildNumber}-" : "-") + project.version_stage + (isFabric ? "-fabric" : "-forge")

ext.isAlpha = project.version_stage == "ALPHA"
ext.isBeta = project.version_stage == "BETA"

group = project.maven_group

loom {
Expand Down Expand Up @@ -85,29 +86,43 @@ configurations {
}

dependencies {
minecraft "com.mojang:minecraft:${mcVersionStr}"
// for snapshots
def mc = []
minecraft "com.mojang:minecraft:${mc[mcVersion] ?: mcVersionStr}"

mappings loom.officialMojangMappings()

if (isFabric) {
if (mcVersion <= 11902)
modImplementation "net.fabricmc:fabric-loader:0.14.14" // I don't get it, REI hate 0.14.21 in 1.19.2 or lower, wtf?
else
else if (mcVersion <= 12001)
modImplementation "net.fabricmc:fabric-loader:0.14.21"
else
modImplementation "net.fabricmc:fabric-loader:0.14.22"

// For testing
modLocalRuntime modCompileOnlyApi("net.fabricmc.fabric-api:fabric-api:" + [
11802: "0.76.0+1.18.2",
11902: "0.76.0+1.19.2",
11904: "0.83.0+1.19.4",
12001: "0.83.1+1.20.1",
12002: "0.89.0+1.20.2",
][mcVersion])
} else {
forge "net.minecraftforge:forge:" + [
11802: "1.18.2-40.2.9",
11902: "1.19.2-43.2.14",
11904: "1.19.4-45.1.0",
12001: "1.20.1-47.0.3",
][mcVersion]
if (!isNeo) {
forge "net.minecraftforge:forge:" + [
11802: "1.18.2-40.2.9",
11902: "1.19.2-43.2.14",
11904: "1.19.4-45.1.0",
12001: "1.20.1-47.0.3",
12002: "1.20.2-48.0.13",
// TODO: 1.20.3
][mcVersion]
} else {
forge "net.neoforged:forge:" + [
// TODO
][mcVersion]
}
}

shade("blue.endless:jankson:${project.jankson_version}")
Expand All @@ -131,11 +146,18 @@ dependencies {
if (project.recipe_viewer == "emi")
modLocalRuntime("dev.emi:emi:0.7.3+${mcVersionStr}")
} else {
def suffix = [
11902: "1.19.2",
11904: "1.19.4",
12001: "1.20.1",
12002: "1.20.2",
12003: "1.20.2", // TODO
]
// EMI support multiple platform since 1.0.0
// EMI seems to also skip 1.19 and 1.19.1
modCompileOnly("dev.emi:emi-${isFabric ? "fabric" : "forge"}:${project.emi_version}+${mcVersion >= 11902 ? mcVersionStr : '1.19.2'}:api")
modCompileOnly("dev.emi:emi-${isFabric ? "fabric" : "forge"}:${project.emi_version}+${mcVersion >= 11902 ? suffix[mcVersion] : '1.19.2'}:api")
if (project.recipe_viewer == "emi")
modLocalRuntime("dev.emi:emi-${isFabric ? "fabric" : "forge"}:${project.emi_version}+${mcVersion >= 11902 ? mcVersionStr : '1.19.2'}")
modLocalRuntime("dev.emi:emi-${isFabric ? "fabric" : "forge"}:${project.emi_version}+${mcVersion >= 11902 ? suffix[mcVersion] : '1.19.2'}")
}

// REI
Expand All @@ -144,6 +166,8 @@ dependencies {
11902: "9.1.619",
11904: "11.0.621",
12001: "12.0.625",
12002: "13.0.666",
12003: "13.0.666", // TODO
]
if (isFabric)
modCompileOnly("me.shedaniel:RoughlyEnoughItems-api-fabric:${reiVersions[mcVersion]}")
Expand All @@ -161,11 +185,16 @@ dependencies {
11902: "11.6.0.1015",
11904: "13.1.0.13",
12001: "15.0.0.12",
12002: "16.0.0.28",
12003: "16.0.0.28", // TODO
]
def jeiMc = [
12003: "1.20.2",
]
modCompileOnly("mezz.jei:jei-${mcVersionStr}-common-api:${jeiVersions[mcVersion]}")
modCompileOnly("mezz.jei:jei-${mcVersionStr}-${isFabric ? "fabric" : "forge"}-api:${jeiVersions[mcVersion]}")
modCompileOnly("mezz.jei:jei-${jeiMc[mcVersion] ?: mcVersionStr}-common-api:${jeiVersions[mcVersion]}")
modCompileOnly("mezz.jei:jei-${jeiMc[mcVersion] ?: mcVersionStr}-${isFabric ? "fabric" : "forge"}-api:${jeiVersions[mcVersion]}")
if (project.recipe_viewer == "jei")
modLocalRuntime("mezz.jei:jei-${mcVersionStr}-${isFabric ? "fabric" : "forge"}:${jeiVersions[mcVersion]}")
modLocalRuntime("mezz.jei:jei-${jeiMc[mcVersion] ?: mcVersionStr}-${isFabric ? "fabric" : "forge"}:${jeiVersions[mcVersion]}")

/* FIXME: Broken, somehow
if (mcVersion == 11802 && isFabric) {
Expand Down Expand Up @@ -246,50 +275,58 @@ jar {
}
}

def _releaseType = "release"
if (ext.isAlpha) {
_releaseType = "alpha"
} else if (ext.isBeta) {
_releaseType = "beta"
}

def mcReleaseVersions = [
11802: ["1.18.2"],
11902: ["1.19", "1.19.1", "1.19.2"],
11904: ["1.19.3", "1.19.4"],
12001: ["1.20", "1.20.1"],
12002: ["1.20.2"],
][mcVersion]

unifiedPublishing {
project {
releaseType = _releaseType
displayName = "[${isFabric ? "Fabric" : "Forge"} MC${mcReleaseVersions[0] + (mcReleaseVersions.size() > 1 ? "+" : "")}] v${project.mod_version}-${project.version_stage}"
version = project.version as String
changelog = System.getenv("CHANGELOG") ?: "Please visit our [releases](https://github.com/null2264/CobbleGen/releases) for a changelog"
gameVersions = mcReleaseVersions
gameLoaders = isFabric ? ["fabric", "quilt"] : ["forge"]

mainPublication tasks.remapJar

relations {
includes {
curseforge = "jankson"
publishMods {
file = tasks.remapJar.archiveFile
displayName = "[${isFabric ? "Fabric" : "Forge"} MC${mcReleaseVersions[0] + (mcReleaseVersions.size() > 1 ? "+" : "")}] v${project.mod_version}-${project.version_stage}"
changelog = System.getenv("CHANGELOG") ?: "Please visit our [releases](https://github.com/null2264/CobbleGen/releases) for a changelog"
version = project.version
if (isFabric) {
modLoaders.add("fabric")
modLoaders.add("quilt")
} else {
modLoaders.add("forge")
if (mcVersion >= 12001)
modLoaders.add("neoforge")
}
if (project.version_stage == "ALPHA")
type = ALPHA
else if (project.version_stage == "BETA")
type = BETA
else
type = RELEASE

var cfToken = System.getenv("CURSEFORGE")
if (cfToken != null) {
curseforge {
accessToken = cfToken
projectId = project.curseforge_project

for (final def mcVer in mcReleaseVersions) {
minecraftVersions.add(mcVer)
}
}

var cfToken = System.getenv("CURSEFORGE")
if (cfToken != null) {
curseforge {
token = cfToken
id = project.curseforge_project
embeds {
slug = "jankson"
}
}
}

var mrToken = System.getenv("MODRINTH")
if (mrToken != null) {
modrinth {
accessToken = mrToken
projectId = project.modrinth_project

var mrToken = System.getenv("MODRINTH")
if (mrToken != null) {
modrinth {
token = mrToken
id = project.modrinth_project
for (final def mcVer in mcReleaseVersions) {
minecraftVersions.add(mcVer)
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
org.gradle.jvmargs=-Xmx5G

# Mod Properties
mod_version=5.0.1
mod_version=5.1.1
version_stage=BETA
maven_group=io.github.null2264
archives_base_name=cobblegen
Expand All @@ -16,11 +16,11 @@ loader_version_1_18_2=0.14.14
fabric_version_1_18_2=0.76.0+1.18.2

# Runtime Properties
recipe_viewer=emi
recipe_viewer=rei

# Dependencies
jankson_version=1.2.2
emi_version=1.0.4
emi_version=1.0.21

# Version Specific Dependencies
create_version_1_18_2=0.5.0.i-1002+1.18.2
Expand Down
14 changes: 11 additions & 3 deletions root.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ plugins {
}

preprocess {
//val neo12002 = createNode("1.20.2-neoforge", 12002, "mojang")
val forge12002 = createNode("1.20.2-forge", 12002, "mojang")
val fabric12002 = createNode("1.20.2-fabric", 12002, "mojang")
val forge12001 = createNode("1.20.1-forge", 12001, "mojang")
val fabric12001 = createNode("1.20.1-fabric", 12001, "mojang")
val forge11904 = createNode("1.19.4-forge", 11904, "mojang")
Expand All @@ -12,11 +15,16 @@ preprocess {
val forge11802 = createNode("1.18.2-forge", 11802, "mojang")
val fabric11802 = createNode("1.18.2-fabric", 11802, "mojang")

//neo12002.link(fabric12002)

forge12002.link(fabric12002)
forge12001.link(fabric12001)
fabric12001.link(fabric11904)
forge11904.link(fabric11904)
fabric11904.link(fabric11902)
forge11902.link(fabric11902)
fabric11902.link(fabric11802)
forge11802.link(fabric11802)

fabric12002.link(fabric12001)
fabric12001.link(fabric11904)
fabric11904.link(fabric11902)
fabric11902.link(fabric11802)
}
3 changes: 2 additions & 1 deletion run/server/server.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#Minecraft server properties
#Mon Jun 19 12:26:15 ICT 2023
#Sat Sep 23 13:37:39 ICT 2023
enable-jmx-monitoring=false
rcon.port=25575
level-seed=
Expand Down Expand Up @@ -47,6 +47,7 @@ white-list=false
broadcast-console-to-ops=true
spawn-npcs=true
spawn-animals=true
log-ips=true
function-permission-level=2
initial-enabled-packs=vanilla,fabric
level-type=minecraft\:flat
Expand Down
2 changes: 2 additions & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ listOf(
"1.19.4-forge",
"1.20.1-fabric",
"1.20.1-forge",
"1.20.2-fabric",
"1.20.2-forge",
).forEach { version ->
include(":$version")
project(":$version").apply {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/io/github/null2264/cobblegen/CobbleGen.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class CobbleGen implements net.fabricmc.api.ModInitializer
{
public static final String MOD_ID = "cobblegen";
public static final ResourceLocation SYNC_CHANNEL = new ResourceLocation(MOD_ID, "sync");
public static final ResourceLocation SYNC_PING_CHANNEL = new ResourceLocation(MOD_ID, "sync_ping");
public static final ResourceLocation SYNC_PING_CHANNEL = new ResourceLocation(MOD_ID, "ping");
/**
* @deprecated Now only for internal usage. Use the parameter {@link CGRegistry registry} instead
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
package io.github.null2264.cobblegen.compat;

import com.mojang.blaze3d.vertex.PoseStack;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Font;
import net.minecraft.network.chat.Component;

public class GraphicsCompat {
@SuppressWarnings("UnusedReturnValue")
//#if MC<12000
public static int drawString(PoseStack pose, Component text, int x, int y, int colour) {
public static int drawString(com.mojang.blaze3d.vertex.PoseStack pose, Component text, int x, int y, int colour) {
//#else
//$$ public static int drawString(net.minecraft.client.gui.GuiGraphics graphics, Component text, int x, int y, int colour) {
//#endif
Expand Down
Loading

0 comments on commit 7b6fd19

Please sign in to comment.