Skip to content

Commit b4c132d

Browse files
committed
feat: Add Better Clouds compatibility
(cherry picked from commit 682ff73)
1 parent 4c08bae commit b4c132d

File tree

11 files changed

+59
-134
lines changed

11 files changed

+59
-134
lines changed

build.gradle

-5
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,6 @@ dependencies {
5959
exclude(group: "net.fabricmc.fabric-api")
6060
}
6161

62-
// Sodium
63-
modCompileOnly("maven.modrinth:sodium:${project.sodium_version}") {
64-
exclude(group: "net.fabricmc.fabric-api")
65-
}
66-
6762
// Server Translation API
6863
modImplementation include("xyz.nucleoid:server-translations-api:${project.server_translation_api_version}")
6964

gradle.properties

+1-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ org.gradle.jvmargs=-Xmx1G
55
# check these on https://modmuss50.me/fabric.html
66
minecraft_version=1.20.2
77
yarn_mappings=1.20.2+build.4
8-
loader_version=0.15.0
8+
loader_version=0.14.10
99

1010
# Mod Properties
1111
mod_version=1.9.2
@@ -18,5 +18,4 @@ supported_minecraft_version_name=1.20.2
1818
fabric_version=0.91.1+1.20.2
1919
cloth_config_version=12.0.111
2020
modmenu_version=8.0.0
21-
sodium_version=mc1.20.2-0.5.3
2221
server_translation_api_version=2.1.0+1.20.2-rc2

src/main/java/com/github/steveplays28/realisticsleep/RealisticSleep.java

+15-1
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
package com.github.steveplays28.realisticsleep;
22

3+
import com.github.steveplays28.realisticsleep.api.RealisticSleepApi;
34
import com.github.steveplays28.realisticsleep.config.RealisticSleepConfig;
45
import me.shedaniel.autoconfig.AutoConfig;
56
import me.shedaniel.autoconfig.serializer.GsonConfigSerializer;
67
import net.fabricmc.api.ModInitializer;
8+
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
79
import net.fabricmc.fabric.api.entity.event.v1.EntitySleepEvents;
810
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents;
11+
import net.minecraft.client.MinecraftClient;
12+
import net.minecraft.client.world.ClientWorld;
913
import net.minecraft.util.ActionResult;
1014
import org.slf4j.Logger;
1115
import org.slf4j.LoggerFactory;
@@ -14,7 +18,6 @@ public class RealisticSleep implements ModInitializer {
1418
public static final String MOD_ID = "realisticsleep";
1519
public static final String MOD_NAME = "Realistic Sleep";
1620
public static final Logger LOGGER = LoggerFactory.getLogger(MOD_ID);
17-
public static final String SODIUM_MOD_ID = "sodium";
1821

1922
public static RealisticSleepConfig config;
2023

@@ -39,5 +42,16 @@ public void onInitialize() {
3942

4043
return ActionResult.PASS;
4144
}));
45+
46+
// Tick the world renderer faster while sleeping
47+
ClientTickEvents.START_WORLD_TICK.register(this::tickWorldRendererFasterWhileSleeping);
48+
}
49+
50+
private void tickWorldRendererFasterWhileSleeping(ClientWorld world) {
51+
if (RealisticSleepApi.isSleeping(world)) {
52+
for (int i = 0; i < config.worldRenderingSpeedMultiplier; i++) {
53+
MinecraftClient.getInstance().worldRenderer.tick();
54+
}
55+
}
4256
}
4357
}

src/main/java/com/github/steveplays28/realisticsleep/config/RealisticSleepConfig.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public class RealisticSleepConfig implements ConfigData {
5353
@ConfigEntry.Gui.Tooltip
5454
public double fluidRandomTickSpeedMultiplier = 1d;
5555
@ConfigEntry.Gui.Tooltip
56-
public float cloudSpeedMultiplier = 25f;
56+
public float worldRenderingSpeedMultiplier = 25f;
5757

5858
@ConfigEntry.Gui.Tooltip
5959
public long tickDelay = -1;

src/main/java/com/github/steveplays28/realisticsleep/mixin/RealisticSleepMixinPlugin.java

-51
This file was deleted.

src/main/java/com/github/steveplays28/realisticsleep/mixin/WorldRendererMixin.java

-31
This file was deleted.

src/main/java/com/github/steveplays28/realisticsleep/mixin/sodium/SodiumCloudRendererMixin.java

-25
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,56 @@
11
{
2-
"text.autoconfig.realisticsleep.title": "Realistic Sleep mod config",
2+
"text.autoconfig.realisticsleep.title": "Realistic Sleep Config",
3+
"text.autoconfig.realisticsleep.option.sendDawnMessage": "Send dawn message?",
4+
"text.autoconfig.realisticsleep.option.sendDawnMessage.@Tooltip": "Send a message to all players on the actionbar at dawn.",
5+
"text.autoconfig.realisticsleep.option.sendDuskMessage": "Send dusk message?",
6+
"text.autoconfig.realisticsleep.option.sendDuskMessage.@Tooltip": "Send a message to all players on the actionbar at dusk.",
37
"text.autoconfig.realisticsleep.option.dawnMessage": "Dawn message",
4-
"text.autoconfig.realisticsleep.option.dawnMessage.@Tooltip": "The message that will be displayed to all players on the action bar after sleeping through the night.",
8+
"text.autoconfig.realisticsleep.option.dawnMessage.@Tooltip": "The message displayed to all players on the actionbar at dawn.",
9+
"text.autoconfig.realisticsleep.option.duskMessage": "Dusk message",
10+
"text.autoconfig.realisticsleep.option.duskMessage.@Tooltip": "The message displayed to all players at dawn on the actionbar.",
511
"text.autoconfig.realisticsleep.option.sendSleepingMessage": "Send sleeping message?",
6-
"text.autoconfig.realisticsleep.option.sendSleepingMessage.@Tooltip": "Toggles the \"x/y players are sleeping through this night (time until dawn: z)\" message on the actionbar.",
12+
"text.autoconfig.realisticsleep.option.sendSleepingMessage.@Tooltip": "Toggles the \"players are sleeping through this night...\" message on the actionbar.",
13+
"text.autoconfig.realisticsleep.option.showTimeUntilDawn": "Show time until dawn?",
14+
"text.autoconfig.realisticsleep.option.showTimeUntilDawn.@Tooltip": "Displays the seconds until dawn on the actionbar.",
15+
"text.autoconfig.realisticsleep.option.showTimeUntilDusk": "Show time until dusk?",
16+
"text.autoconfig.realisticsleep.option.showTimeUntilDusk.@Tooltip": "Displays the seconds until dusk on the actionbar.",
717
"text.autoconfig.realisticsleep.option.sendNotEnoughPlayersSleepingMessage": "Send not enough players sleeping message?",
8-
"text.autoconfig.realisticsleep.option.sendNotEnoughPlayersSleepingMessage.@Tooltip": "Toggles the \"x/y players are currently sleeping. z/w players are required to sleep through the night.\" message on the actionbar.",
18+
"text.autoconfig.realisticsleep.option.sendNotEnoughPlayersSleepingMessage.@Tooltip": "Toggles the amount of players who need to sleep to skip to dawn message on the actionbar.",
19+
"text.autoconfig.realisticsleep.option.allowDaySleeping": "Allow sleeping through the day?",
20+
"text.autoconfig.realisticsleep.option.allowDaySleeping.@Tooltip": "Toggles daytime sleeping.",
921
"text.autoconfig.realisticsleep.option.sleepSpeedCurve": "Sleep speed curve",
10-
"text.autoconfig.realisticsleep.option.sleepSpeedCurve.@Tooltip": "The curve which is used to determine the multiplier of the speed of the night as time progresses.",
22+
"text.autoconfig.realisticsleep.option.sleepSpeedCurve.@Tooltip": "The curve used to determine the speed multiplier of the night as time progresses.",
1123
"text.autoconfig.realisticsleep.option.sleepSpeedMultiplier": "Sleep speed multiplier",
1224
"text.autoconfig.realisticsleep.option.sleepSpeedMultiplier.@Tooltip": "How many times faster the night should go.",
1325
"text.autoconfig.realisticsleep.option.blockEntityTickSpeedMultiplier": "Block entity tick speed multiplier",
1426
"text.autoconfig.realisticsleep.option.blockEntityTickSpeedMultiplier.@Tooltip": "How many times faster block entities like furnaces should tick.",
1527
"text.autoconfig.realisticsleep.option.chunkTickSpeedMultiplier": "Chunk tick speed multiplier",
16-
"text.autoconfig.realisticsleep.option.chunkTickSpeedMultiplier.@Tooltip": "How many times faster chunks should tick. There's a reason this is disabled by default, enable at your own risk. Insane TPS loss is guaranteed.",
28+
"text.autoconfig.realisticsleep.option.chunkTickSpeedMultiplier.@Tooltip": "How many times faster chunks should tick. Enable at your own risk, may cause huge TPS loss!",
1729
"text.autoconfig.realisticsleep.option.raidTickSpeedMultiplier": "Raid tick speed multiplier",
18-
"text.autoconfig.realisticsleep.option.raidTickSpeedMultiplier.@Tooltip": "How many times faster raid timers should tick .",
19-
"text.autoconfig.realisticsleep.option.entityTickSpeedMultiplier": "Entity tick speed multiplier",
20-
"text.autoconfig.realisticsleep.option.entityTickSpeedMultiplier.@Tooltip": "How many times faster entities should tick.",
30+
"text.autoconfig.realisticsleep.option.raidTickSpeedMultiplier.@Tooltip": "How many times faster raid timers should tick.",
31+
"text.autoconfig.realisticsleep.option.fluidScheduledTickSpeedMultiplier": "Fluid scheduled tick speed multiplier",
32+
"text.autoconfig.realisticsleep.option.fluidScheduledTickSpeedMultiplier.@Tooltip": "How many times faster fluid movements should tick.",
33+
"text.autoconfig.realisticsleep.option.thunderTickSpeedMultiplier": "Thunder tick speed multiplier",
34+
"text.autoconfig.realisticsleep.option.thunderTickSpeedMultiplier.@Tooltip": "How many times faster thunder should occur.",
35+
"text.autoconfig.realisticsleep.option.iceAndSnowTickSpeedMultiplier": "Ice and snow formation speed multiplier",
36+
"text.autoconfig.realisticsleep.option.iceAndSnowTickSpeedMultiplier.@Tooltip": "How many times faster ice and snow should form.",
37+
"text.autoconfig.realisticsleep.option.cropGrowthTickSpeedMultiplier": "Crop growth speed multiplier",
38+
"text.autoconfig.realisticsleep.option.cropGrowthTickSpeedMultiplier.@Tooltip": "How many times faster crops should grow.",
39+
"text.autoconfig.realisticsleep.option.precipitationTickSpeedMultiplier": "Precipitation tick speed multiplier",
40+
"text.autoconfig.realisticsleep.option.precipitationTickSpeedMultiplier.@Tooltip": "How many times faster cauldrons should fill.",
41+
"text.autoconfig.realisticsleep.option.blockRandomTickSpeedMultiplier": "Block random tick speed multiplier",
42+
"text.autoconfig.realisticsleep.option.blockRandomTickSpeedMultiplier.@Tooltip": "How many times faster blocks should random tick. Enable at your own risk, may cause huge TPS loss!",
43+
"text.autoconfig.realisticsleep.option.fluidRandomTickSpeedMultiplier": "Fluid random tick speed multiplier",
44+
"text.autoconfig.realisticsleep.option.fluidRandomTickSpeedMultiplier.@Tooltip": "How many times faster fluids should random tick. Enable at your own risk, may cause huge TPS loss!",
45+
"text.autoconfig.realisticsleep.option.worldRenderingSpeedMultiplier": "World rendering speed multiplier",
46+
"text.autoconfig.realisticsleep.option.worldRenderingSpeedMultiplier.@Tooltip": "How many times faster clouds should move, rain should fall, and thunder should strike.",
2147
"text.autoconfig.realisticsleep.option.tickDelay": "Tick delay",
2248
"text.autoconfig.realisticsleep.option.tickDelay.@Tooltip": "Adds an amount of ticks delay to every tick, so time goes slower.",
2349
"realisticsleep.text.sleep_message": "%d/%d players are sleeping through this ",
2450
"realisticsleep.text.not_enough_players_sleeping_message": "%d/%d players are currently sleeping. %d/%d players are required to sleep through the %s",
2551
"realisticsleep.text.night": "night",
2652
"realisticsleep.text.day": "day",
2753
"realisticsleep.text.thunderstorm": "thunderstorm",
28-
"realisticsleep.text.time_until_dawn": " (Time until dawn: %ds)"
54+
"realisticsleep.text.time_until_dawn": " (time until dawn: %ds)",
55+
"realisticsleep.text.time_until_dusk": " (time until dusk: %ds)"
2956
}

src/main/resources/data/realisticsleep/lang/en_us.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@
4242
"text.autoconfig.realisticsleep.option.blockRandomTickSpeedMultiplier.@Tooltip": "How many times faster blocks should random tick. Enable at your own risk, may cause huge TPS loss!",
4343
"text.autoconfig.realisticsleep.option.fluidRandomTickSpeedMultiplier": "Fluid random tick speed multiplier",
4444
"text.autoconfig.realisticsleep.option.fluidRandomTickSpeedMultiplier.@Tooltip": "How many times faster fluids should random tick. Enable at your own risk, may cause huge TPS loss!",
45-
"text.autoconfig.realisticsleep.option.cloudSpeedMultiplier": "Cloud speed multiplier",
46-
"text.autoconfig.realisticsleep.option.cloudSpeedMultiplier.@Tooltip": "How many times faster clouds should move.",
45+
"text.autoconfig.realisticsleep.option.worldRenderingSpeedMultiplier": "World rendering speed multiplier",
46+
"text.autoconfig.realisticsleep.option.worldRenderingSpeedMultiplier.@Tooltip": "How many times faster clouds should move, rain should fall, and thunder should strike.",
4747
"text.autoconfig.realisticsleep.option.tickDelay": "Tick delay",
4848
"text.autoconfig.realisticsleep.option.tickDelay.@Tooltip": "Adds an amount of ticks delay to every tick, so time goes slower.",
4949
"realisticsleep.text.sleep_message": "%d/%d players are sleeping through this ",

src/main/resources/fabric.mod.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@
5050
"fabric": ">=${fabric_version}"
5151
},
5252
"suggests": {
53-
"modmenu": ">=${modmenu_version}"
53+
"modmenu": ">=${modmenu_version}",
54+
"sodium": "*",
55+
"better-clouds": "*"
5456
},
5557
"conflicts": {
5658
"tawct": "*",

src/main/resources/realisticsleep.mixins.json

-5
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,13 @@
33
"minVersion": "0.8",
44
"package": "com.github.steveplays28.realisticsleep.mixin",
55
"compatibilityLevel": "JAVA_17",
6-
"plugin": "com.github.steveplays28.realisticsleep.mixin.RealisticSleepMixinPlugin",
76
"mixins": [
87
"CauldronBlockMixin",
98
"ServerPlayerEntityMixin",
109
"ServerWorldMixin",
1110
"SleepManagerMixin",
1211
"accessor.ServerWorldAccessor"
1312
],
14-
"client": [
15-
"WorldRendererMixin",
16-
"sodium.SodiumCloudRendererMixin"
17-
],
1813
"injectors": {
1914
"defaultRequire": 1
2015
}

0 commit comments

Comments
 (0)