Skip to content

Commit

Permalink
feat: Add Better Clouds compatibility
Browse files Browse the repository at this point in the history
Also downgraded the required Fabric Loader version to `v0.14.10`, removed Sodium from the mod's dependencies, and fixed some clientside translations.
  • Loading branch information
Steveplays28 committed Dec 7, 2023
1 parent f75b36f commit 682ff73
Show file tree
Hide file tree
Showing 11 changed files with 59 additions and 134 deletions.
5 changes: 0 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,6 @@ dependencies {
exclude(group: "net.fabricmc.fabric-api")
}

// Sodium
modCompileOnly("maven.modrinth:sodium:${project.sodium_version}") {
exclude(group: "net.fabricmc.fabric-api")
}

// Server Translation API
modImplementation include("xyz.nucleoid:server-translations-api:${project.server_translation_api_version}")

Expand Down
3 changes: 1 addition & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ org.gradle.jvmargs=-Xmx1G
# check these on https://modmuss50.me/fabric.html
minecraft_version=1.20
yarn_mappings=1.20+build.1
loader_version=0.15.0
loader_version=0.14.10

# Mod Properties
mod_version=1.9.2
Expand All @@ -18,5 +18,4 @@ supported_minecraft_version_name=1.20-1.20.1
fabric_version=0.83.0+1.20
cloth_config_version=11.0.99
modmenu_version=7.0.1
sodium_version=mc1.20.1-0.5.3
server_translation_api_version=2.0.0+1.20
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
package com.github.steveplays28.realisticsleep;

import com.github.steveplays28.realisticsleep.api.RealisticSleepApi;
import com.github.steveplays28.realisticsleep.config.RealisticSleepConfig;
import me.shedaniel.autoconfig.AutoConfig;
import me.shedaniel.autoconfig.serializer.GsonConfigSerializer;
import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
import net.fabricmc.fabric.api.entity.event.v1.EntitySleepEvents;
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.world.ClientWorld;
import net.minecraft.util.ActionResult;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand All @@ -14,7 +18,6 @@ public class RealisticSleep implements ModInitializer {
public static final String MOD_ID = "realisticsleep";
public static final String MOD_NAME = "Realistic Sleep";
public static final Logger LOGGER = LoggerFactory.getLogger(MOD_ID);
public static final String SODIUM_MOD_ID = "sodium";

public static RealisticSleepConfig config;

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

return ActionResult.PASS;
}));

// Tick the world renderer faster while sleeping
ClientTickEvents.START_WORLD_TICK.register(this::tickWorldRendererFasterWhileSleeping);
}

private void tickWorldRendererFasterWhileSleeping(ClientWorld world) {
if (RealisticSleepApi.isSleeping(world)) {
for (int i = 0; i < config.worldRenderingSpeedMultiplier; i++) {
MinecraftClient.getInstance().worldRenderer.tick();
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public class RealisticSleepConfig implements ConfigData {
@ConfigEntry.Gui.Tooltip
public double fluidRandomTickSpeedMultiplier = 1d;
@ConfigEntry.Gui.Tooltip
public float cloudSpeedMultiplier = 25f;
public float worldRenderingSpeedMultiplier = 25f;

@ConfigEntry.Gui.Tooltip
public long tickDelay = -1;
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

47 changes: 37 additions & 10 deletions src/main/resources/assets/realisticsleep/lang/en_us.json
Original file line number Diff line number Diff line change
@@ -1,29 +1,56 @@
{
"text.autoconfig.realisticsleep.title": "Realistic Sleep mod config",
"text.autoconfig.realisticsleep.title": "Realistic Sleep Config",
"text.autoconfig.realisticsleep.option.sendDawnMessage": "Send dawn message?",
"text.autoconfig.realisticsleep.option.sendDawnMessage.@Tooltip": "Send a message to all players on the actionbar at dawn.",
"text.autoconfig.realisticsleep.option.sendDuskMessage": "Send dusk message?",
"text.autoconfig.realisticsleep.option.sendDuskMessage.@Tooltip": "Send a message to all players on the actionbar at dusk.",
"text.autoconfig.realisticsleep.option.dawnMessage": "Dawn message",
"text.autoconfig.realisticsleep.option.dawnMessage.@Tooltip": "The message that will be displayed to all players on the action bar after sleeping through the night.",
"text.autoconfig.realisticsleep.option.dawnMessage.@Tooltip": "The message displayed to all players on the actionbar at dawn.",
"text.autoconfig.realisticsleep.option.duskMessage": "Dusk message",
"text.autoconfig.realisticsleep.option.duskMessage.@Tooltip": "The message displayed to all players at dawn on the actionbar.",
"text.autoconfig.realisticsleep.option.sendSleepingMessage": "Send sleeping message?",
"text.autoconfig.realisticsleep.option.sendSleepingMessage.@Tooltip": "Toggles the \"x/y players are sleeping through this night (time until dawn: z)\" message on the actionbar.",
"text.autoconfig.realisticsleep.option.sendSleepingMessage.@Tooltip": "Toggles the \"players are sleeping through this night...\" message on the actionbar.",
"text.autoconfig.realisticsleep.option.showTimeUntilDawn": "Show time until dawn?",
"text.autoconfig.realisticsleep.option.showTimeUntilDawn.@Tooltip": "Displays the seconds until dawn on the actionbar.",
"text.autoconfig.realisticsleep.option.showTimeUntilDusk": "Show time until dusk?",
"text.autoconfig.realisticsleep.option.showTimeUntilDusk.@Tooltip": "Displays the seconds until dusk on the actionbar.",
"text.autoconfig.realisticsleep.option.sendNotEnoughPlayersSleepingMessage": "Send not enough players sleeping message?",
"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.",
"text.autoconfig.realisticsleep.option.sendNotEnoughPlayersSleepingMessage.@Tooltip": "Toggles the amount of players who need to sleep to skip to dawn message on the actionbar.",
"text.autoconfig.realisticsleep.option.allowDaySleeping": "Allow sleeping through the day?",
"text.autoconfig.realisticsleep.option.allowDaySleeping.@Tooltip": "Toggles daytime sleeping.",
"text.autoconfig.realisticsleep.option.sleepSpeedCurve": "Sleep speed curve",
"text.autoconfig.realisticsleep.option.sleepSpeedCurve.@Tooltip": "The curve which is used to determine the multiplier of the speed of the night as time progresses.",
"text.autoconfig.realisticsleep.option.sleepSpeedCurve.@Tooltip": "The curve used to determine the speed multiplier of the night as time progresses.",
"text.autoconfig.realisticsleep.option.sleepSpeedMultiplier": "Sleep speed multiplier",
"text.autoconfig.realisticsleep.option.sleepSpeedMultiplier.@Tooltip": "How many times faster the night should go.",
"text.autoconfig.realisticsleep.option.blockEntityTickSpeedMultiplier": "Block entity tick speed multiplier",
"text.autoconfig.realisticsleep.option.blockEntityTickSpeedMultiplier.@Tooltip": "How many times faster block entities like furnaces should tick.",
"text.autoconfig.realisticsleep.option.chunkTickSpeedMultiplier": "Chunk tick speed multiplier",
"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.",
"text.autoconfig.realisticsleep.option.chunkTickSpeedMultiplier.@Tooltip": "How many times faster chunks should tick. Enable at your own risk, may cause huge TPS loss!",
"text.autoconfig.realisticsleep.option.raidTickSpeedMultiplier": "Raid tick speed multiplier",
"text.autoconfig.realisticsleep.option.raidTickSpeedMultiplier.@Tooltip": "How many times faster raid timers should tick .",
"text.autoconfig.realisticsleep.option.entityTickSpeedMultiplier": "Entity tick speed multiplier",
"text.autoconfig.realisticsleep.option.entityTickSpeedMultiplier.@Tooltip": "How many times faster entities should tick.",
"text.autoconfig.realisticsleep.option.raidTickSpeedMultiplier.@Tooltip": "How many times faster raid timers should tick.",
"text.autoconfig.realisticsleep.option.fluidScheduledTickSpeedMultiplier": "Fluid scheduled tick speed multiplier",
"text.autoconfig.realisticsleep.option.fluidScheduledTickSpeedMultiplier.@Tooltip": "How many times faster fluid movements should tick.",
"text.autoconfig.realisticsleep.option.thunderTickSpeedMultiplier": "Thunder tick speed multiplier",
"text.autoconfig.realisticsleep.option.thunderTickSpeedMultiplier.@Tooltip": "How many times faster thunder should occur.",
"text.autoconfig.realisticsleep.option.iceAndSnowTickSpeedMultiplier": "Ice and snow formation speed multiplier",
"text.autoconfig.realisticsleep.option.iceAndSnowTickSpeedMultiplier.@Tooltip": "How many times faster ice and snow should form.",
"text.autoconfig.realisticsleep.option.cropGrowthTickSpeedMultiplier": "Crop growth speed multiplier",
"text.autoconfig.realisticsleep.option.cropGrowthTickSpeedMultiplier.@Tooltip": "How many times faster crops should grow.",
"text.autoconfig.realisticsleep.option.precipitationTickSpeedMultiplier": "Precipitation tick speed multiplier",
"text.autoconfig.realisticsleep.option.precipitationTickSpeedMultiplier.@Tooltip": "How many times faster cauldrons should fill.",
"text.autoconfig.realisticsleep.option.blockRandomTickSpeedMultiplier": "Block random tick speed multiplier",
"text.autoconfig.realisticsleep.option.blockRandomTickSpeedMultiplier.@Tooltip": "How many times faster blocks should random tick. Enable at your own risk, may cause huge TPS loss!",
"text.autoconfig.realisticsleep.option.fluidRandomTickSpeedMultiplier": "Fluid random tick speed multiplier",
"text.autoconfig.realisticsleep.option.fluidRandomTickSpeedMultiplier.@Tooltip": "How many times faster fluids should random tick. Enable at your own risk, may cause huge TPS loss!",
"text.autoconfig.realisticsleep.option.worldRenderingSpeedMultiplier": "World rendering speed multiplier",
"text.autoconfig.realisticsleep.option.worldRenderingSpeedMultiplier.@Tooltip": "How many times faster clouds should move, rain should fall, and thunder should strike.",
"text.autoconfig.realisticsleep.option.tickDelay": "Tick delay",
"text.autoconfig.realisticsleep.option.tickDelay.@Tooltip": "Adds an amount of ticks delay to every tick, so time goes slower.",
"realisticsleep.text.sleep_message": "%d/%d players are sleeping through this ",
"realisticsleep.text.not_enough_players_sleeping_message": "%d/%d players are currently sleeping. %d/%d players are required to sleep through the %s",
"realisticsleep.text.night": "night",
"realisticsleep.text.day": "day",
"realisticsleep.text.thunderstorm": "thunderstorm",
"realisticsleep.text.time_until_dawn": " (Time until dawn: %ds)"
"realisticsleep.text.time_until_dawn": " (time until dawn: %ds)",
"realisticsleep.text.time_until_dusk": " (time until dusk: %ds)"
}
4 changes: 2 additions & 2 deletions src/main/resources/data/realisticsleep/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@
"text.autoconfig.realisticsleep.option.blockRandomTickSpeedMultiplier.@Tooltip": "How many times faster blocks should random tick. Enable at your own risk, may cause huge TPS loss!",
"text.autoconfig.realisticsleep.option.fluidRandomTickSpeedMultiplier": "Fluid random tick speed multiplier",
"text.autoconfig.realisticsleep.option.fluidRandomTickSpeedMultiplier.@Tooltip": "How many times faster fluids should random tick. Enable at your own risk, may cause huge TPS loss!",
"text.autoconfig.realisticsleep.option.cloudSpeedMultiplier": "Cloud speed multiplier",
"text.autoconfig.realisticsleep.option.cloudSpeedMultiplier.@Tooltip": "How many times faster clouds should move.",
"text.autoconfig.realisticsleep.option.worldRenderingSpeedMultiplier": "World rendering speed multiplier",
"text.autoconfig.realisticsleep.option.worldRenderingSpeedMultiplier.@Tooltip": "How many times faster clouds should move, rain should fall, and thunder should strike.",
"text.autoconfig.realisticsleep.option.tickDelay": "Tick delay",
"text.autoconfig.realisticsleep.option.tickDelay.@Tooltip": "Adds an amount of ticks delay to every tick, so time goes slower.",
"realisticsleep.text.sleep_message": "%d/%d players are sleeping through this ",
Expand Down
4 changes: 3 additions & 1 deletion src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@
"fabric": ">=${fabric_version}"
},
"suggests": {
"modmenu": ">=${modmenu_version}"
"modmenu": ">=${modmenu_version}",
"sodium": "*",
"better-clouds": "*"
},
"conflicts": {
"tawct": "*",
Expand Down
5 changes: 0 additions & 5 deletions src/main/resources/realisticsleep.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,13 @@
"minVersion": "0.8",
"package": "com.github.steveplays28.realisticsleep.mixin",
"compatibilityLevel": "JAVA_17",
"plugin": "com.github.steveplays28.realisticsleep.mixin.RealisticSleepMixinPlugin",
"mixins": [
"CauldronBlockMixin",
"ServerPlayerEntityMixin",
"ServerWorldMixin",
"SleepManagerMixin",
"accessor.ServerWorldAccessor"
],
"client": [
"WorldRendererMixin",
"sodium.SodiumCloudRendererMixin"
],
"injectors": {
"defaultRequire": 1
}
Expand Down

0 comments on commit 682ff73

Please sign in to comment.