Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
strategy:
fail-fast: false
matrix:
version: ["1.21.1", "1.21.4", "1.21.5", "1.21.8", "1.21.10", "1.21.11", "26.1", "26.2"]
version: ["1.8.9", "1.21.1", "1.21.4", "1.21.5", "1.21.8", "1.21.10", "1.21.11", "26.1", "26.2"]

steps:
- uses: actions/checkout@v6
Expand Down
72 changes: 55 additions & 17 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import net.ornithemc.ploceus.api.PloceusGradleExtensionApi
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

Expand All @@ -8,18 +9,37 @@ configurations.implementation.get().extendsFrom(bundleOnly)

plugins {
id("dev.kikugie.loom-back-compat")
id("net.fabricmc.fabric-loom-remap") apply false
id("ploceus") version "1.17.4" apply false
id("org.jetbrains.kotlin.jvm") version "2.3.0"
id("dev.deftu.gradle.bloom") version "0.2.0"
id("me.modmuss50.mod-publish-plugin") version "1.1.0"
}

val isOrnithe = stonecutter.current.version == "1.8.9"
val ploceus = if (isOrnithe) {
pluginManager.apply("net.fabricmc.fabric-loom-remap")
pluginManager.apply("ploceus")

configurations.configureEach {
exclude(group = "org.lwjgl.lwjgl")
}

extensions.getByType<PloceusGradleExtensionApi>().apply {
setIntermediaryGeneration(2)
}
} else {
null
}

val modid = property("mod.id") as String
val modname = property("mod.name") as String
val modversion = property("mod.version") as String
val mcversion = property("minecraft_version") as String
val versionrange = property("minecraft_version_range")
val loaderversion = property("loader_version")
val oneconfigVersion = "1.0.0-beta.5"
val loader = if (isOrnithe) "ornithe" else "fabric"
val oneconfigVersion = "1.1.6"

base {
archivesName.set("$modid-$modversion+$mcversion")
Expand All @@ -29,8 +49,22 @@ repositories {
mavenCentral()
google()
gradlePluginPortal()
exclusiveContent {
forRepository { mavenCentral() }
filter { includeGroup("org.lwjgl") }
}
maven("https://maven.axolotlclient.com/releases") {
content {
includeGroup("io.github.moehreag")
includeGroup("io.github.moehreag.legacy-lwjgl3")
}
}
maven("https://repo.saadndm.com/releases")
maven("https://repo.polyfrost.org/releases")
maven("https://repo.polyfrost.org/snapshots")
maven("https://api.modrinth.com/maven") {
content { includeGroup("maven.modrinth") }
}
maven("https://maven.parchmentmc.org") {
content { includeGroupAndSubgroups("org.parchmentmc") }
}
Expand Down Expand Up @@ -67,25 +101,29 @@ loom {
dependencies {
minecraft("com.mojang:minecraft:${property("minecraft_version")}")

val hasOfficialMappings = findProperty("has_official_mappings")?.toString()?.toBoolean() ?: true
if (hasOfficialMappings) {
@Suppress("UnstableApiUsage")
mappings(loom.layered {
officialMojangMappings()
optionalProp("${property("parchment_version")}") {
parchment("org.parchmentmc.data:parchment-${property("minecraft_version")}:$it@zip")
}
optionalProp("${property("yalmm_version")}") {
mappings("dev.lambdaurora:yalmm-mojbackward:${property("minecraft_version")}+build.$it")
}
})
if (isOrnithe) {
mappings(ploceus!!.featherMappings(property("feather_build") as String))
} else {
findProperty("mappings_version")?.toString()?.takeUnless { it.isBlank() }?.let {
mappings(it)
val hasOfficialMappings = findProperty("has_official_mappings")?.toString()?.toBoolean() ?: true
if (hasOfficialMappings) {
@Suppress("UnstableApiUsage")
mappings(loom.layered {
officialMojangMappings()
optionalProp("${property("parchment_version")}") {
parchment("org.parchmentmc.data:parchment-${property("minecraft_version")}:$it@zip")
}
optionalProp("${property("yalmm_version")}") {
mappings("dev.lambdaurora:yalmm-mojbackward:${property("minecraft_version")}+build.$it")
}
})
} else {
findProperty("mappings_version")?.toString()?.takeUnless { it.isBlank() }?.let {
mappings(it)
}
}
}
modImplementation("net.fabricmc:fabric-loader:${property("loader_version")}")
modImplementation("org.polyfrost.oneconfig:${property("minecraft_version")}-fabric:$oneconfigVersion")
modImplementation("org.polyfrost.oneconfig:${property("minecraft_version")}-$loader:$oneconfigVersion")
implementation("org.polyfrost.oneconfig:commands:$oneconfigVersion")
implementation("org.polyfrost.oneconfig:config:$oneconfigVersion")
implementation("org.polyfrost.oneconfig:config-impl:$oneconfigVersion")
Expand Down Expand Up @@ -203,7 +241,7 @@ publishMods {
changelog = changelogs
type = STABLE

modLoaders.add("fabric")
modLoaders.add(loader)

dryRun = modrinthId == null || modrinthToken == null

Expand Down
4 changes: 3 additions & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@ pluginManagement {
mavenCentral()
gradlePluginPortal()
maven("https://maven.fabricmc.net")
maven("https://maven.ornithemc.net/releases")
maven("https://maven.kikugie.dev/snapshots")
maven("https://maven.kikugie.dev/releases")
maven("https://jitpack.io/")
maven("https://maven.deftu.dev/releases")
maven("https://maven.deftu.dev/snapshots")
maven("https://maven.architectury.dev")
maven("https://repo.saadndm.com/releases")
maven("https://repo.polyfrost.org/releases")
maven("https://repo.polyfrost.org/snapshots")
}
Expand All @@ -22,7 +24,7 @@ plugins {

stonecutter {
create(rootProject) {
versions("1.21.1", "1.21.4", "1.21.5", "1.21.8", "1.21.10", "1.21.11", "26.1", "26.2")
versions("1.8.9", "1.21.1", "1.21.4", "1.21.5", "1.21.8", "1.21.10", "1.21.11", "26.1", "26.2")

vcsVersion = "1.21.10"
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.polyfrost.polytime.mixin;

//? if >= 1.21.11 {
//? if >= 1.21.11 || = 1.8.9 {
/*import org.spongepowered.asm.mixin.injection.Inject;
*///?} else {
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
Expand All @@ -13,21 +13,27 @@
import net.minecraft.world.level.MoonPhase;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
*///?}
//? if > 1.8.9
import net.minecraft.client.multiplayer.ClientLevel;
//? if >= 1.21.10 {
import net.minecraft.client.renderer.SkyRenderer;
//?} else
//import net.minecraft.client.renderer.LevelRenderer;
//?} elif > 1.8.9 {
/*import net.minecraft.client.renderer.LevelRenderer;
*///?} else {
/*import net.minecraft.world.World;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
*///?}
import org.polyfrost.polytime.client.PolyTimeConfig;
import org.polyfrost.polytime.client.realtime.RealTimeHandler;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;

//? if >= 1.21.10 {
@Mixin(SkyRenderer.class)
//?} else {
//?} elif > 1.8.9 {
/*@Mixin(LevelRenderer.class)
*///?}
*///?} else
//@Mixin(World.class)
public class Mixin_FixMoonPhases {
//? if >= 1.21.11 {
/*@Inject(method = "extractRenderState", at = @At("TAIL"))
Expand All @@ -36,7 +42,7 @@ public class Mixin_FixMoonPhases {
state.moonPhase = MoonPhase.values()[RealTimeHandler.getCurrentLunarPhase()];
}
}
*///?} elif >= 1.21 {
*///?} elif > 1.8.9 {
@WrapOperation(method = /*? if 1.21.10 {*/ "extractRenderState" /*?} elif >= 1.21.4 {*/ /*"method_62215" *//*?} else {*/ /*"renderSky" *//*?}*/ , at = @At(value = "INVOKE", target = "Lnet/minecraft/client/multiplayer/ClientLevel;getMoonPhase()I"))
private int polyweather$fixMoonPhase(ClientLevel instance, Operation<Integer> original) {
if (PolyTimeConfig.isEnabled() && PolyTimeConfig.getIrlLunarPhases()) {
Expand All @@ -45,5 +51,12 @@ public class Mixin_FixMoonPhases {

return original.call(instance);
}
//?}
//?} else {
/*@Inject(method = "getMoonPhase", at = @At("HEAD"), cancellable = true)
private void polytime$fixMoonPhase(CallbackInfoReturnable<Integer> cir) {
if (PolyTimeConfig.isEnabled() && PolyTimeConfig.getIrlLunarPhases()) {
cir.setReturnValue(RealTimeHandler.getCurrentLunarPhase());
}
}
*///?}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.polyfrost.polytime.mixin;

//? if < 1.21.11 {
//? if > 1.8.9 {
import net.minecraft.client.multiplayer.ClientLevel;
import net.minecraft.core.Holder;
import net.minecraft.core.RegistryAccess;
Expand All @@ -10,6 +11,14 @@
import net.minecraft.world.level.Level;
import net.minecraft.world.level.dimension.DimensionType;
import net.minecraft.world.level.storage.WritableLevelData;
//?} else {
/*import net.minecraft.client.world.ClientWorld;
import net.minecraft.util.profiler.Profiler;
import net.minecraft.world.World;
import net.minecraft.world.WorldData;
import net.minecraft.world.dimension.Dimension;
import net.minecraft.world.storage.WorldStorage;
*///?}
import org.polyfrost.polytime.client.PolyTimeClient;
import org.polyfrost.polytime.client.PolyTimeConfig;
import org.spongepowered.asm.mixin.Mixin;
Expand All @@ -18,11 +27,19 @@
//? if 1.21.1
//import java.util.function.Supplier;

//? if > 1.8.9 {
@Mixin(ClientLevel.class)
public abstract class Mixin_ModifyCelestialGradient extends Level {
protected Mixin_ModifyCelestialGradient(WritableLevelData levelData, ResourceKey<Level> dimension, RegistryAccess registryAccess, Holder<DimensionType> dimensionTypeRegistration, /*? if 1.21.1 {*/ /*Supplier<ProfilerFiller> profiler, *//*?}*/ boolean isClientSide, boolean isDebug, long biomeZoomSeed, int maxChainedNeighborUpdates) {
super(levelData, dimension, registryAccess, dimensionTypeRegistration, /*? if 1.21.1 {*/ /*profiler, *//*?}*/ isClientSide, isDebug, biomeZoomSeed, maxChainedNeighborUpdates);
}
//?} else {
/*@Mixin(ClientWorld.class)
public abstract class Mixin_ModifyCelestialGradient extends World {
protected Mixin_ModifyCelestialGradient(WorldStorage storage, WorldData data, Dimension dimension, Profiler profiler, boolean isClient) {
super(storage, data, dimension, profiler, isClient);
}
*///?}

@Override
public float getTimeOfDay(float tickDelta) {
Expand Down
4 changes: 4 additions & 0 deletions src/test/kotlin/org/polyfrost/polytime/test/MixinTest.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.polyfrost.polytime.test

//? if > 1.8.9
import net.minecraft.SharedConstants
import net.minecraft.server.Bootstrap
import org.junit.jupiter.api.Assertions
Expand All @@ -19,8 +20,11 @@ class MixinTest {
@JvmStatic
@BeforeAll
fun setupEnvironment() {
//? if > 1.8.9 {
SharedConstants.tryDetectVersion()
Bootstrap.bootStrap()
//?} else
//Bootstrap.init()
}
}

Expand Down
1 change: 1 addition & 0 deletions src/test/resources/log4j2.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<Configuration/>
16 changes: 16 additions & 0 deletions stonecutter.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,19 @@ plugins {
}

stonecutter active "1.21.10" /* [SC] DO NOT EDIT */
stonecutter {
parameters {
replacements {
string(eval(current.version, "= 1.8.9")) {
replace(
"com.mojang.blaze3d.platform.InputConstants",
"org.polyfrost.oneconfig.internal.legacy.InputConstants"
)
replace(
"net.minecraft.server.Bootstrap",
"net.minecraft.Bootstrap"
)
}
}
}
}
3 changes: 3 additions & 0 deletions versions/1.8.9/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
feather_build=1
minecraft_version=1.8.9
minecraft_version_range=1.8.9