Skip to content

Commit a2418c1

Browse files
committed
Port. Rendering/visual only.
1 parent 25e9239 commit a2418c1

22 files changed

Lines changed: 337 additions & 199 deletions

File tree

build.gradle.kts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,18 @@ plugins {
1111
id("dev.deftu.gradle.tools.resources") // Applies resource processing so that we can replace tokens, such as our mod name/version, in our resources.
1212
id("dev.deftu.gradle.tools.bloom") // Applies the Bloom plugin, which allows us to replace tokens in our source files, such as being able to use `@MOD_VERSION` in our source files.
1313
id("dev.deftu.gradle.tools.shadow") // Applies the Shadow plugin, which allows us to shade our dependencies into our mod JAR. This is NOT recommended for Fabric mods, but we have an *additional* configuration for those!
14-
id("dev.deftu.gradle.tools.ducks") // Creates a ducks source set, which allows us to use theoretical classes which may not exist at runtime (such as things which are in other mods).
1514
id("dev.deftu.gradle.tools.minecraft.loom") // Applies the Loom plugin, which automagically configures Essential's Architectury Loom plugin for you.
1615
id("dev.deftu.gradle.tools.minecraft.releases") // Applies the Minecraft auto-releasing plugin, which allows you to automatically release your mod to CurseForge and Modrinth.
1716
}
1817

18+
toolkitMultiversion {
19+
moveBuildsToRootProject = true
20+
}
21+
1922
toolkitLoomHelper {
2023
useOneConfig {
21-
version = "1.0.0-alpha.109"
22-
loaderVersion = "1.1.0-alpha.48"
24+
version = "1.0.0-alpha.153"
25+
loaderVersion = "1.1.0-alpha.49"
2326

2427
usePolyMixin = true
2528
polyMixinVersion = "0.8.4+build.2"
@@ -30,7 +33,6 @@ toolkitLoomHelper {
3033
+module
3134
}
3235
}
33-
3436
useDevAuth("1.2.1")
3537
useMixinExtras("0.4.1")
3638

@@ -62,7 +64,3 @@ dependencies {
6264
}
6365
}
6466
}
65-
66-
tasks.jar {
67-
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
68-
}

root.gradle.kts

Lines changed: 19 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -10,43 +10,25 @@ preprocess {
1010
// "1.8.9-forge"(10809, "srg")
1111
// }
1212

13-
"1.21.5-fabric"(12105, "yarn") {
14-
"1.21.5-neoforge"(12105, "srg") {
15-
"1.21.4-neoforge"(12104, "srg") {
16-
"1.21.4-fabric"(12104, "yarn") {
17-
"1.21.3-fabric"(12103, "yarn") {
18-
"1.21.3-neoforge"(12103, "srg") {
19-
"1.21.2-neoforge"(12102, "srg") {
20-
"1.21.2-fabric"(12102, "yarn") {
21-
"1.21.1-fabric"(12101, "yarn") {
22-
"1.21.1-neoforge"(12101, "srg") {
23-
"1.20.6-neoforge"(12006, "srg") {
24-
"1.20.6-fabric"(12006, "yarn") {
25-
"1.20.4-fabric"(12004, "yarn") {
26-
"1.20.4-forge"(12004, "srg") {
27-
"1.20.1-forge"(12001, "srg") {
28-
"1.20.1-fabric"(12001, "yarn") {
29-
"1.19.4-fabric"(11904, "yarn") {
30-
"1.19.4-forge"(11904, "srg") {
31-
"1.18.2-forge"(11802, "srg") {
32-
"1.18.2-fabric"(11802, "yarn") {
33-
"1.17.1-fabric"(11701, "yarn") {
34-
"1.17.1-forge"(11701, "srg") {
35-
"1.16.5-forge"(11605, "srg") {
36-
"1.16.5-fabric"(11605, "yarn") {
37-
"1.12.2-fabric"(11202, "yarn") {
38-
"1.12.2-forge"(11202, "srg") {
39-
"1.8.9-forge"(10809, "srg") {
40-
"1.8.9-fabric"(10809, "yarn")
41-
}
42-
}
43-
}
44-
}
45-
}
46-
}
47-
}
48-
}
49-
}
13+
"1.21.8-fabric"(1_21_08, "yarn") {
14+
"1.21.8-neoforge"(1_21_08, "srg") {
15+
"1.21.5-neoforge"(1_21_05, "srg") {
16+
"1.21.5-fabric"(1_21_05, "yarn") {
17+
"1.21.4-fabric"(1_21_04, "yarn") {
18+
"1.21.4-neoforge"(1_21_04, "srg") {
19+
"1.21.1-neoforge"(1_21_01, "srg") {
20+
"1.21.1-fabric"(1_21_01, "yarn") {
21+
"1.20.4-fabric"(1_20_04, "yarn") {
22+
"1.20.4-neoforge"(1_20_04, "srg") {
23+
"1.20.4-forge"(1_20_04, "srg") {
24+
"1.20.1-forge"(1_20_01, "srg") {
25+
"1.20.1-fabric"(1_20_01, "yarn") {
26+
"1.16.5-fabric"(1_16_05, "yarn") {
27+
"1.16.5-forge"(1_16_05, "srg") {
28+
"1.12.2-forge"(1_12_02, "srg") {
29+
"1.12.2-fabric"(1_12_02, "yarn") {
30+
"1.8.9-fabric"(1_08_09, "yarn") {
31+
"1.8.9-forge"(1_08_09, "srg")
5032
}
5133
}
5234
}

settings.gradle.kts

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ pluginManagement {
2323
}
2424

2525
plugins {
26-
kotlin("jvm") version("2.0.0")
27-
id("dev.deftu.gradle.multiversion-root") version("2.34.0")
26+
kotlin("jvm") version("2.2.10")
27+
id("dev.deftu.gradle.multiversion-root") version("2.55.0")
2828
}
2929
}
3030

@@ -42,32 +42,31 @@ rootProject.buildFileName = "root.gradle.kts"
4242
listOf(
4343
"1.8.9-forge",
4444
"1.8.9-fabric",
45-
"1.12.2-fabric",
45+
4646
"1.12.2-forge",
47+
"1.12.2-fabric",
48+
4749
"1.16.5-forge",
4850
"1.16.5-fabric",
49-
"1.17.1-forge",
50-
"1.17.1-fabric",
51-
"1.18.2-forge",
52-
"1.18.2-fabric",
53-
"1.19.4-fabric",
54-
"1.19.4-forge",
55-
"1.20.1-fabric",
51+
5652
"1.20.1-forge",
57-
"1.20.4-fabric",
53+
"1.20.1-fabric",
54+
5855
"1.20.4-forge",
59-
"1.20.6-fabric",
60-
"1.20.6-neoforge",
61-
"1.21.1-fabric",
56+
"1.20.4-neoforge",
57+
"1.20.4-fabric",
58+
6259
"1.21.1-neoforge",
63-
"1.21.2-fabric",
64-
"1.21.2-neoforge",
65-
"1.21.3-fabric",
66-
"1.21.3-neoforge",
67-
"1.21.4-fabric",
60+
"1.21.1-fabric",
61+
6862
"1.21.4-neoforge",
63+
"1.21.4-fabric",
64+
65+
"1.21.5-neoforge",
6966
"1.21.5-fabric",
70-
"1.21.5-neoforge"
67+
68+
"1.21.8-neoforge",
69+
"1.21.8-fabric",
7170
).forEach { version ->
7271
include(":$version")
7372
project(":$version").apply {
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package org.polyfrost.polytime.mixin;
2+
3+
import net.minecraft.client.multiplayer.WorldClient;
4+
import net.minecraft.client.renderer.RenderGlobal;
5+
import org.polyfrost.polytime.client.PolyTimeConfig;
6+
import org.polyfrost.polytime.client.realtime.RealTimeHandler;
7+
import org.spongepowered.asm.mixin.Mixin;
8+
import org.spongepowered.asm.mixin.injection.At;
9+
import org.spongepowered.asm.mixin.injection.Redirect;
10+
11+
@Mixin(RenderGlobal.class)
12+
public class Mixin_FixMoonPhases {
13+
@Redirect(method = "renderSky(FI)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/multiplayer/WorldClient;getMoonPhase()I"))
14+
private int polyweather$fixMoonPhase(WorldClient world) {
15+
if (PolyTimeConfig.isEnabled() && PolyTimeConfig.isIrlTime()) {
16+
return RealTimeHandler.getCurrentLunarPhase();
17+
}
18+
19+
return world.getMoonPhase();
20+
}
21+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
package org.polyfrost.polytime.mixin;
2+
3+
import net.minecraft.client.multiplayer.WorldClient;
4+
import net.minecraft.profiler.Profiler;
5+
import net.minecraft.world.World;
6+
import net.minecraft.world.WorldProvider;
7+
import net.minecraft.world.storage.ISaveHandler;
8+
import net.minecraft.world.storage.WorldInfo;
9+
import org.polyfrost.polytime.client.PolyTimeClient;
10+
import org.polyfrost.polytime.client.PolyTimeConfig;
11+
import org.spongepowered.asm.mixin.Mixin;
12+
import org.spongepowered.asm.mixin.Unique;
13+
14+
@Mixin(WorldClient.class)
15+
public abstract class Mixin_ModifyCelestialGradient extends World {
16+
protected Mixin_ModifyCelestialGradient(ISaveHandler saveHandlerIn, WorldInfo info, WorldProvider providerIn, Profiler profilerIn, boolean client) {
17+
super(saveHandlerIn, info, providerIn, profilerIn, client);
18+
}
19+
20+
@Override
21+
public float getCelestialAngle(float tickDelta) {
22+
if (PolyTimeConfig.isEnabled()) {
23+
return polyweather$angleFromTime(PolyTimeClient.getCurrentTime(), tickDelta);
24+
}
25+
26+
return super.getCelestialAngle(tickDelta);
27+
}
28+
29+
@Unique
30+
private float polyweather$angleFromTime(float time, float tickDelta) {
31+
float f = ((time % 24000L) + tickDelta) / 24000f - 0.25f;
32+
if (f < 0f) f += 1f;
33+
if (f > 1f) f -= 1f;
34+
return 1f - (float) ((Math.cos(f * Math.PI) + 1.0) / 2.0);
35+
}
36+
}

src/main/java/org/polyfrost/polytime/mixin/WorldInfoMixin.java

Lines changed: 0 additions & 53 deletions
This file was deleted.

src/main/java/org/polyfrost/polytime/mixin/WorldProviderMixin.java

Lines changed: 0 additions & 44 deletions
This file was deleted.
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
package org.polyfrost.polytime
22

33
object PolyTimeConstants {
4-
54
// Sets the variables from `gradle.properties`. Depends on the `bloom` DGT plugin.
65
const val ID: String = "@MOD_ID@"
76
const val NAME: String = "@MOD_NAME@"
87
const val VERSION: String = "@MOD_VERSION@"
9-
108
}

src/main/kotlin/org/polyfrost/polytime/PolyTimeEntrypoint.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ class PolyTimeEntrypoint
4141
//$$ : ClientModInitializer
4242
//#endif
4343
{
44-
4544
//#if FORGE && MC >= 1.16.5
4645
//$$ init {
4746
//$$ setupForgeEvents(FMLJavaModLoadingContext.get().getModEventBus())
@@ -86,5 +85,4 @@ class PolyTimeEntrypoint
8685
//$$ modEventBus.addListener(this::onInitializeClient)
8786
//$$ }
8887
//#endif
89-
9088
}
Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,26 @@
11
package org.polyfrost.polytime.client
22

3+
import com.mojang.brigadier.Command
34
import org.polyfrost.oneconfig.api.commands.v1.CommandManager
45
import org.polyfrost.oneconfig.utils.v1.dsl.openUI
56
import org.polyfrost.polytime.PolyTimeConstants
67
import org.polyfrost.polytime.client.realtime.RealTimeHandler
78
import org.polyfrost.polytime.realTimeToGameTime
89

910
object PolyTimeClient {
10-
1111
@JvmStatic
1212
val currentTime: Long
13-
get() = (if (PolyTimeConfig.irlTime) RealTimeHandler.currentTime else PolyTimeConfig.time).realTimeToGameTime()
13+
get() = (if (PolyTimeConfig.isIrlTime) RealTimeHandler.currentTime else PolyTimeConfig.time).realTimeToGameTime()
1414

1515
fun initialize() {
1616
PolyTimeConfig.preload()
1717
CommandManager.register(with(CommandManager.literal(PolyTimeConstants.ID)) {
1818
executes {
1919
PolyTimeConfig.openUI()
20-
1
20+
Command.SINGLE_SUCCESS
2121
}
2222
})
2323

2424
RealTimeHandler.initialize()
2525
}
26-
2726
}

0 commit comments

Comments
 (0)