feat: finalize branding

This commit is contained in:
Erica Marigold 2023-12-07 23:35:53 +05:30
parent 4f06d2dec7
commit 78ae19c185
No known key found for this signature in database
GPG key ID: 2768CC0C23D245D1
12 changed files with 40 additions and 51 deletions

View file

@ -39,7 +39,7 @@
loom { loom {
mods { mods {
"touch_grass_warning" { "touch_grass_reminder" {
sourceSet("main") sourceSet("main")
} }
} }

View file

@ -5,6 +5,6 @@ org.gradle.parallel = true
# Mod Properties # Mod Properties
version = 0.1.0 version = 0.1.0
maven_group = xyz.devcomp maven_group = xyz.devcomp
archives_base_name = touch_grass_warning archives_base_name = touch_grass_reminder
# Dependencies are managed at gradle/libs.versions.toml # Dependencies are managed at gradle/libs.versions.toml

View file

@ -6,7 +6,6 @@ quilt_loader = "0.22.1-beta.2"
quilted_fabric_api = "7.4.0+0.90.0-1.20.1" quilted_fabric_api = "7.4.0+0.90.0-1.20.1"
mixin_extras = "0.2.0" mixin_extras = "0.2.0"
# twelvemonkeys_imageio = "3.10.0"
quilt_parsers = "0.2.1" quilt_parsers = "0.2.1"
[libraries] [libraries]

View file

@ -1,26 +1,27 @@
package xyz.devcomp.touch_grass_warning.client; package xyz.devcomp.touch_grass_reminder.client;
import java.util.UUID; import java.util.UUID;
import xyz.devcomp.touch_grass_warning.config.ConfigModel; import xyz.devcomp.touch_grass_reminder.config.ConfigModel;
import xyz.devcomp.touch_grass_warning.utils.PlayDurationHandler; import xyz.devcomp.touch_grass_reminder.utils.PlayDurationHandler;
import net.minecraft.client.multiplayer.ServerData;
import org.quiltmc.loader.api.ModContainer; import org.quiltmc.loader.api.ModContainer;
import org.quiltmc.qsl.base.api.entrypoint.client.ClientModInitializer; import org.quiltmc.qsl.base.api.entrypoint.client.ClientModInitializer;
import org.quiltmc.qsl.networking.api.client.ClientPlayConnectionEvents; import org.quiltmc.qsl.networking.api.client.ClientPlayConnectionEvents;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import net.minecraft.client.multiplayer.ServerData; public class TouchGrassReminderClient implements ClientModInitializer {
public static final Logger LOGGER = LoggerFactory.getLogger("Touch Grass Reminder");
public class TouchGrassWarningClient implements ClientModInitializer {
public static final Logger LOGGER = LoggerFactory.getLogger("Touch Grass Warning");
private ConfigModel config = new ConfigModel(); private ConfigModel config = new ConfigModel();
private Thread thread; private Thread thread;
@Override @Override
public void onInitializeClient(ModContainer mod) { public void onInitializeClient(ModContainer mod) {
LOGGER.info("Touch Grass Warning init; isEnabled={}, reminderFrequency={}h", config.isEnabled, LOGGER.info("Touch Grass reminder init; isEnabled={}, reminderFrequency={}h", config.isEnabled,
config.reminderFrequency); config.reminderFrequency);
LOGGER.info("Registering JOIN & DISCONNECT events..."); LOGGER.info("Registering JOIN & DISCONNECT events...");

View file

@ -1,4 +1,4 @@
package xyz.devcomp.touch_grass_warning.config; package xyz.devcomp.touch_grass_reminder.config;
import net.minecraft.client.gui.screens.Screen; import net.minecraft.client.gui.screens.Screen;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
@ -20,5 +20,4 @@ public class ConfigHandler {
public Screen showGui(Screen parent) { public Screen showGui(Screen parent) {
return HANDLER.generateGui().generateScreen(parent); return HANDLER.generateGui().generateScreen(parent);
} }
} }

View file

@ -1,16 +1,16 @@
package xyz.devcomp.touch_grass_warning.config; package xyz.devcomp.touch_grass_reminder.config;
import dev.isxander.yacl3.config.v2.api.SerialEntry; import dev.isxander.yacl3.config.v2.api.SerialEntry;
import dev.isxander.yacl3.config.v2.api.autogen.*; import dev.isxander.yacl3.config.v2.api.autogen.*;
public class ConfigModel { public class ConfigModel {
@SerialEntry(comment = "Whether the mod's functionality is enabled") @SerialEntry(comment = "Whether the mod's functionality is enabled")
@AutoGen(category = "touch_grass_warning") @AutoGen(category = "touch_grass_reminder")
@TickBox @TickBox
public boolean isEnabled = true; public boolean isEnabled = true;
@SerialEntry(comment = "Number of hours the warning should be displayed after") @SerialEntry(comment = "Number of hours the reminder should be displayed after")
@AutoGen(category = "touch_grass_warning") @AutoGen(category = "touch_grass_reminder")
@IntField(min = 1) @IntField(min = 1)
public int reminderFrequency = 24; public int reminderFrequency = 24;
} }

View file

@ -1,12 +1,12 @@
package xyz.devcomp.touch_grass_warning.integrations; package xyz.devcomp.touch_grass_reminder.integrations;
import xyz.devcomp.touch_grass_reminder.config.ConfigHandler;
import org.quiltmc.loader.api.QuiltLoader; import org.quiltmc.loader.api.QuiltLoader;
import com.terraformersmc.modmenu.api.ConfigScreenFactory; import com.terraformersmc.modmenu.api.ConfigScreenFactory;
import com.terraformersmc.modmenu.api.ModMenuApi; import com.terraformersmc.modmenu.api.ModMenuApi;
import xyz.devcomp.touch_grass_warning.config.ConfigHandler;
public class ModMenuIntegration implements ModMenuApi { public class ModMenuIntegration implements ModMenuApi {
@Override @Override
public ConfigScreenFactory<?> getModConfigScreenFactory() { public ConfigScreenFactory<?> getModConfigScreenFactory() {

View file

@ -1,10 +1,11 @@
package xyz.devcomp.touch_grass_warning.utils; package xyz.devcomp.touch_grass_reminder.utils;
import xyz.devcomp.touch_grass_reminder.client.TouchGrassReminderClient;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.components.toasts.SystemToast; import net.minecraft.client.gui.components.toasts.SystemToast;
import net.minecraft.client.gui.components.toasts.SystemToast.SystemToastIds; import net.minecraft.client.gui.components.toasts.SystemToast.SystemToastIds;
import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Component;
import xyz.devcomp.touch_grass_warning.client.TouchGrassWarningClient;
public class PlayDurationHandler implements Runnable { public class PlayDurationHandler implements Runnable {
Minecraft client; Minecraft client;
@ -18,18 +19,18 @@ public PlayDurationHandler(Minecraft client, long startTime, int reminderFrequen
this.reminderFrequency = reminderFrequency; this.reminderFrequency = reminderFrequency;
this.toast = new SystemToast(SystemToastIds.TUTORIAL_HINT, this.toast = new SystemToast(SystemToastIds.TUTORIAL_HINT,
Component.translatable("touch_grass_warning.toast.name", reminderFrequency), Component.translatable("touch_grass_reminder.toast.name", reminderFrequency),
Component.translatable("touch_grass_warning.toast.description")); Component.translatable("touch_grass_reminder.toast.description"));
} }
@Override @Override
public void run() { public void run() {
TouchGrassWarningClient.LOGGER.info("Started playing Minecraft at: {}", this.startTime); TouchGrassReminderClient.LOGGER.info("Started playing Minecraft at: {}", this.startTime);
while (true) { while (true) {
if (System.currentTimeMillis() - this.startTime > this.reminderFrequency) { if (System.currentTimeMillis() - this.startTime > this.reminderFrequency) {
TouchGrassWarningClient.LOGGER TouchGrassReminderClient.LOGGER
.info("Player has spent more than 24 hours in Minecraft. Displaying warning."); .info("Player has spent more than 24 hours in Minecraft. Displaying reminder.");
this.client.getToasts().addToast(toast); this.client.getToasts().addToast(toast);
return; return;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 180 B

After

Width:  |  Height:  |  Size: 46 KiB

View file

@ -1,11 +1,11 @@
{ {
"yacl3.config.touchgrassreminder:config.category.touch_grass_warning": "Touch Grass Reminder", "yacl3.config.touchgrassreminder:config.category.touch_grass_reminder": "Touch Grass Reminder",
"yacl3.config.touchgrassreminder:config.isEnabled": "Enabled", "yacl3.config.touchgrassreminder:config.isEnabled": "Enabled",
"yacl3.config.touchgrassreminder:config.isEnabled.desc.1": "Whether most of the mod's functionality is enabled", "yacl3.config.touchgrassreminder:config.isEnabled.desc.1": "Whether most of the mod's functionality is enabled",
"yacl3.config.touchgrassreminder:config.isEnabled.desc.2": "Takes effect on restart", "yacl3.config.touchgrassreminder:config.isEnabled.desc.2": "Takes effect on restart",
"yacl3.config.touchgrassreminder:config.reminderFrequency": "Reminder frequency", "yacl3.config.touchgrassreminder:config.reminderFrequency": "Reminder frequency",
"yacl3.config.touchgrassreminder:config.reminderFrequency.desc.1": "After how long the warning should appear (in hours)", "yacl3.config.touchgrassreminder:config.reminderFrequency.desc.1": "After how long the reminder should appear (in hours)",
"yacl3.config.touchgrassreminder:config.reminderFrequency.desc.2": "Takes effect on restart", "yacl3.config.touchgrassreminder:config.reminderFrequency.desc.2": "Takes effect on restart",
"touch_grass_warning.toast.title": "You've been playing for greater than %d hours", "touch_grass_reminder.toast.title": "You've been playing for greater than %d hours",
"touch_grass_warning.toast.description": "Excessive gaming may interfere with normal daily life" "touch_grass_reminder.toast.description": "Excessive gaming may interfere with normal daily life"
} }

View file

@ -2,26 +2,26 @@
"schema_version": 1, "schema_version": 1,
"quilt_loader": { "quilt_loader": {
"group": "xyz.devcomp", "group": "xyz.devcomp",
"id": "touch_grass_warning", "id": "touch_grass_reminder",
"version": "${version}", "version": "${version}",
"metadata": { "metadata": {
"name": "Touch Grass Warning", "name": "Touch Grass Reminder",
"description": "Client-side mod which warns players when they have been excessively playing Minecraft (more than 24 hours at a time).", "description": "Client-side mod which warns players when they have been excessively playing Minecraft (by default more than 24 hours at a time).",
"contributors": { "contributors": {
"Erica Marigold": "Owner" "Erica Marigold": "Owner"
}, },
"contact": { "contact": {
"homepage": "", "homepage": "",
"issues": "https://github.com/CompeyDev/touch-grass-warning/issues", "issues": "https://github.com/CompeyDev/touch-grass-reminder/issues",
"sources": "https://github.com/CompeyDev/touch-grass-warning" "sources": "https://github.com/CompeyDev/touch-grass-reminder"
}, },
"license": "LGPL-3.0-only", "license": "LGPL-3.0-only",
"icon": "assets/touch_grass_warning/icon.png" "icon": "assets/touch_grass_reminder/icon.png"
}, },
"intermediate_mappings": "net.fabricmc:intermediary", "intermediate_mappings": "net.fabricmc:intermediary",
"entrypoints": { "entrypoints": {
"client_init": "xyz.devcomp.touch_grass_warning.client.TouchGrassWarningClient", "client_init": "xyz.devcomp.touch_grass_reminder.client.TouchGrassreminderClient",
"modmenu": "xyz.devcomp.touch_grass_warning.integrations.ModMenuIntegration" "modmenu": "xyz.devcomp.touch_grass_reminder.integrations.ModMenuIntegration"
}, },
"depends": [ "depends": [
{ {
@ -43,5 +43,5 @@
} }
] ]
}, },
"mixin": "touch_grass_warning.mixins.json" "mixin": "touch_grass_reminder.mixins.json"
} }

View file

@ -1,11 +0,0 @@
{
"required": true,
"minVersion": "0.8",
"package": "xyz.devcomp.touch_grass_warning.mixin",
"compatibilityLevel": "JAVA_17",
"mixins": [],
"client": [],
"injectors": {
"defaultRequire": 1
}
}