mirror of
https://github.com/CompeyDev/touch-grass-reminder.git
synced 2024-12-12 04:40:39 +00:00
feat: finalize branding
This commit is contained in:
parent
4f06d2dec7
commit
78ae19c185
12 changed files with 40 additions and 51 deletions
|
@ -39,7 +39,7 @@
|
|||
|
||||
loom {
|
||||
mods {
|
||||
"touch_grass_warning" {
|
||||
"touch_grass_reminder" {
|
||||
sourceSet("main")
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,6 +5,6 @@ org.gradle.parallel = true
|
|||
# Mod Properties
|
||||
version = 0.1.0
|
||||
maven_group = xyz.devcomp
|
||||
archives_base_name = touch_grass_warning
|
||||
archives_base_name = touch_grass_reminder
|
||||
|
||||
# Dependencies are managed at gradle/libs.versions.toml
|
||||
|
|
|
@ -6,7 +6,6 @@ quilt_loader = "0.22.1-beta.2"
|
|||
quilted_fabric_api = "7.4.0+0.90.0-1.20.1"
|
||||
|
||||
mixin_extras = "0.2.0"
|
||||
# twelvemonkeys_imageio = "3.10.0"
|
||||
quilt_parsers = "0.2.1"
|
||||
|
||||
[libraries]
|
||||
|
|
|
@ -1,26 +1,27 @@
|
|||
package xyz.devcomp.touch_grass_warning.client;
|
||||
package xyz.devcomp.touch_grass_reminder.client;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import xyz.devcomp.touch_grass_warning.config.ConfigModel;
|
||||
import xyz.devcomp.touch_grass_warning.utils.PlayDurationHandler;
|
||||
import xyz.devcomp.touch_grass_reminder.config.ConfigModel;
|
||||
import xyz.devcomp.touch_grass_reminder.utils.PlayDurationHandler;
|
||||
|
||||
import net.minecraft.client.multiplayer.ServerData;
|
||||
|
||||
import org.quiltmc.loader.api.ModContainer;
|
||||
import org.quiltmc.qsl.base.api.entrypoint.client.ClientModInitializer;
|
||||
import org.quiltmc.qsl.networking.api.client.ClientPlayConnectionEvents;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import net.minecraft.client.multiplayer.ServerData;
|
||||
|
||||
public class TouchGrassWarningClient implements ClientModInitializer {
|
||||
public static final Logger LOGGER = LoggerFactory.getLogger("Touch Grass Warning");
|
||||
public class TouchGrassReminderClient implements ClientModInitializer {
|
||||
public static final Logger LOGGER = LoggerFactory.getLogger("Touch Grass Reminder");
|
||||
private ConfigModel config = new ConfigModel();
|
||||
private Thread thread;
|
||||
|
||||
@Override
|
||||
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);
|
||||
LOGGER.info("Registering JOIN & DISCONNECT events...");
|
||||
|
|
@ -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.resources.ResourceLocation;
|
||||
|
@ -20,5 +20,4 @@ public class ConfigHandler {
|
|||
public Screen showGui(Screen parent) {
|
||||
return HANDLER.generateGui().generateScreen(parent);
|
||||
}
|
||||
|
||||
}
|
|
@ -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.autogen.*;
|
||||
|
||||
public class ConfigModel {
|
||||
@SerialEntry(comment = "Whether the mod's functionality is enabled")
|
||||
@AutoGen(category = "touch_grass_warning")
|
||||
@AutoGen(category = "touch_grass_reminder")
|
||||
@TickBox
|
||||
public boolean isEnabled = true;
|
||||
|
||||
@SerialEntry(comment = "Number of hours the warning should be displayed after")
|
||||
@AutoGen(category = "touch_grass_warning")
|
||||
@SerialEntry(comment = "Number of hours the reminder should be displayed after")
|
||||
@AutoGen(category = "touch_grass_reminder")
|
||||
@IntField(min = 1)
|
||||
public int reminderFrequency = 24;
|
||||
}
|
|
@ -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 com.terraformersmc.modmenu.api.ConfigScreenFactory;
|
||||
import com.terraformersmc.modmenu.api.ModMenuApi;
|
||||
|
||||
import xyz.devcomp.touch_grass_warning.config.ConfigHandler;
|
||||
|
||||
public class ModMenuIntegration implements ModMenuApi {
|
||||
@Override
|
||||
public ConfigScreenFactory<?> getModConfigScreenFactory() {
|
|
@ -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.gui.components.toasts.SystemToast;
|
||||
import net.minecraft.client.gui.components.toasts.SystemToast.SystemToastIds;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import xyz.devcomp.touch_grass_warning.client.TouchGrassWarningClient;
|
||||
|
||||
public class PlayDurationHandler implements Runnable {
|
||||
Minecraft client;
|
||||
|
@ -18,18 +19,18 @@ public PlayDurationHandler(Minecraft client, long startTime, int reminderFrequen
|
|||
this.reminderFrequency = reminderFrequency;
|
||||
|
||||
this.toast = new SystemToast(SystemToastIds.TUTORIAL_HINT,
|
||||
Component.translatable("touch_grass_warning.toast.name", reminderFrequency),
|
||||
Component.translatable("touch_grass_warning.toast.description"));
|
||||
Component.translatable("touch_grass_reminder.toast.name", reminderFrequency),
|
||||
Component.translatable("touch_grass_reminder.toast.description"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
TouchGrassWarningClient.LOGGER.info("Started playing Minecraft at: {}", this.startTime);
|
||||
TouchGrassReminderClient.LOGGER.info("Started playing Minecraft at: {}", this.startTime);
|
||||
|
||||
while (true) {
|
||||
if (System.currentTimeMillis() - this.startTime > this.reminderFrequency) {
|
||||
TouchGrassWarningClient.LOGGER
|
||||
.info("Player has spent more than 24 hours in Minecraft. Displaying warning.");
|
||||
TouchGrassReminderClient.LOGGER
|
||||
.info("Player has spent more than 24 hours in Minecraft. Displaying reminder.");
|
||||
|
||||
this.client.getToasts().addToast(toast);
|
||||
return;
|
Binary file not shown.
Before Width: | Height: | Size: 180 B After Width: | Height: | Size: 46 KiB |
|
@ -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.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.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",
|
||||
"touch_grass_warning.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.title": "You've been playing for greater than %d hours",
|
||||
"touch_grass_reminder.toast.description": "Excessive gaming may interfere with normal daily life"
|
||||
}
|
||||
|
|
|
@ -2,26 +2,26 @@
|
|||
"schema_version": 1,
|
||||
"quilt_loader": {
|
||||
"group": "xyz.devcomp",
|
||||
"id": "touch_grass_warning",
|
||||
"id": "touch_grass_reminder",
|
||||
"version": "${version}",
|
||||
"metadata": {
|
||||
"name": "Touch Grass Warning",
|
||||
"description": "Client-side mod which warns players when they have been excessively playing Minecraft (more than 24 hours at a time).",
|
||||
"name": "Touch Grass Reminder",
|
||||
"description": "Client-side mod which warns players when they have been excessively playing Minecraft (by default more than 24 hours at a time).",
|
||||
"contributors": {
|
||||
"Erica Marigold": "Owner"
|
||||
},
|
||||
"contact": {
|
||||
"homepage": "",
|
||||
"issues": "https://github.com/CompeyDev/touch-grass-warning/issues",
|
||||
"sources": "https://github.com/CompeyDev/touch-grass-warning"
|
||||
"issues": "https://github.com/CompeyDev/touch-grass-reminder/issues",
|
||||
"sources": "https://github.com/CompeyDev/touch-grass-reminder"
|
||||
},
|
||||
"license": "LGPL-3.0-only",
|
||||
"icon": "assets/touch_grass_warning/icon.png"
|
||||
"icon": "assets/touch_grass_reminder/icon.png"
|
||||
},
|
||||
"intermediate_mappings": "net.fabricmc:intermediary",
|
||||
"entrypoints": {
|
||||
"client_init": "xyz.devcomp.touch_grass_warning.client.TouchGrassWarningClient",
|
||||
"modmenu": "xyz.devcomp.touch_grass_warning.integrations.ModMenuIntegration"
|
||||
"client_init": "xyz.devcomp.touch_grass_reminder.client.TouchGrassreminderClient",
|
||||
"modmenu": "xyz.devcomp.touch_grass_reminder.integrations.ModMenuIntegration"
|
||||
},
|
||||
"depends": [
|
||||
{
|
||||
|
@ -43,5 +43,5 @@
|
|||
}
|
||||
]
|
||||
},
|
||||
"mixin": "touch_grass_warning.mixins.json"
|
||||
"mixin": "touch_grass_reminder.mixins.json"
|
||||
}
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
{
|
||||
"required": true,
|
||||
"minVersion": "0.8",
|
||||
"package": "xyz.devcomp.touch_grass_warning.mixin",
|
||||
"compatibilityLevel": "JAVA_17",
|
||||
"mixins": [],
|
||||
"client": [],
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue