Skip to content
This repository has been archived by the owner on Dec 24, 2023. It is now read-only.

Commit

Permalink
1.5.1
Browse files Browse the repository at this point in the history
Config is now in Kotlin
Info about the mod and credits are now included in the config screen
Chroma could be toggled even when the master control was off
  • Loading branch information
Wyvest committed May 3, 2021
1 parent d0c2c79 commit 552e162
Show file tree
Hide file tree
Showing 9 changed files with 102 additions and 128 deletions.
12 changes: 8 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@ buildscript {
}
dependencies {
classpath "com.github.asbyth:ForgeGradle:86b2392"
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.72'
classpath "com.github.jengelman.gradle.plugins:shadow:6.1.0"
}
}
apply plugin: 'net.minecraftforge.gradle.forge'
apply plugin: 'kotlin'
apply plugin: "com.github.johnrengelman.shadow"

version = modVersion
Expand All @@ -41,15 +43,16 @@ repositories {
}

dependencies {
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.72")
implementation 'com.github.wyvest:WyLib:0d5efa2c9a'
implementation("club.sk1er:Vigilance:100-10809-SNAPSHOT")
implementation('org.projectlombok:lombok:1.18.16')
annotationProcessor('org.projectlombok:lombok:1.18.16')
}

jar {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
archiveName = "$baseName.$extension"
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}

processResources {
Expand Down Expand Up @@ -83,13 +86,14 @@ task moveResources {

shadowJar {
dependencies {
include(dependency('com.github.wyvest:WyLib:0d5efa2c9a'))
include(dependency('com.github.wyvest:WyLib:0d5efa2c9a'))
include(dependency('club.sk1er:Vigilance:100-10809-SNAPSHOT'))
include(dependency('org.projectlombok:lombok:1.18.16'))
}
archiveFileName = jar.archiveFileName
duplicatesStrategy = DuplicatesStrategy.EXCLUDE

duplicatesStrategy = DuplicatesStrategy.EXCLUDE
archiveName = "$baseName.$extension"
classifier = ''
exclude "dummyThing"
exclude "club/sk1er/vigilance/example"
exclude "module-info.class"
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
modGroup=net.wyvest
modVersion=1.5
modVersion=1.5.1
modBaseName=TimerHUD
forgeVersion=1.8.9-11.15.1.2318-1.8.9
mcpVersion=stable_22
Expand Down
18 changes: 9 additions & 9 deletions src/main/java/net/wyvest/timer/TimerHUD.java
Original file line number Diff line number Diff line change
@@ -1,24 +1,21 @@
package net.wyvest.timer;

import club.sk1er.vigilance.Vigilance;
import lombok.Getter;
import lombok.Setter;
import net.minecraft.client.settings.KeyBinding;
import net.minecraftforge.client.ClientCommandHandler;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.client.registry.ClientRegistry;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.wyvest.lib.WyLib;
import net.wyvest.lib.util.Notifications;
import net.wyvest.lib.util.betterkeybinds.KeyBind;
import net.wyvest.lib.util.betterkeybinds.KeyBindManager;
import net.wyvest.timer.command.TimerCommand;
import net.wyvest.timer.config.TimerConfig;
import net.wyvest.timer.keybind.TimerKeybind;
import net.wyvest.timer.listener.TimerListener;
import net.wyvest.timer.others.Constants;
import net.wyvest.timer.others.JsonResponse;
import net.wyvest.timer.others.VersionChecker;

Expand All @@ -30,14 +27,16 @@
*/

@Getter
@Mod(name = Constants.NAME, version = Constants.VER, modid = Constants.ID)
@Mod(name = "TimerHUD", version = "1.5.1", modid = "timer")
public class TimerHUD {

public String modName = "TimerHUD";
public String version = "1.5.1";
public String modId = "timer";
@Setter @Getter private boolean running;
public final TimerConfig config = new TimerConfig();
@Setter @Getter private JsonResponse onlineData;

@Mod.Instance(Constants.ID)
@Mod.Instance()
public static TimerHUD INSTANCE;

@Mod.EventHandler
Expand All @@ -48,15 +47,16 @@ protected void onPreInit(FMLPreInitializationEvent event) {

@Mod.EventHandler
protected void onInit(FMLInitializationEvent event) {
Vigilance.initialize();
KeyBindManager.register(new TimerKeybind());
MinecraftForge.EVENT_BUS.register(new TimerListener());
ClientCommandHandler.instance.registerCommand(new TimerCommand());
config.preload();
TimerConfig.INSTANCE.preload();
}

@Mod.EventHandler
protected void onPostInit(FMLPostInitializationEvent event) {
if (Double.parseDouble(VersionChecker.version) > Double.parseDouble(Constants.VER)) Notifications.push("TimerHUD", "Your version of TimerHUD is outdated. Please update to the latest version by clicking here.", this::openTab);
if (!VersionChecker.version.matches(version)) Notifications.push("TimerHUD", "Your version of TimerHUD is outdated. Please update to the latest version by clicking here.", this::openTab);
}

void openTab() {
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/net/wyvest/timer/command/TimerCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import net.minecraft.command.ICommandSender;
import net.wyvest.lib.util.ChatHandler;
import net.wyvest.lib.util.GuiHelper;
import net.wyvest.timer.TimerHUD;
import net.wyvest.timer.config.TimerConfig;
import net.wyvest.timer.overlay.GUI;

public class TimerCommand extends CommandBase {
Expand All @@ -22,7 +22,7 @@ public String getCommandUsage(ICommandSender sender) {
@Override
public void processCommand(ICommandSender sender, String[] args) {
if (args.length <= 0) {
GuiHelper.open(TimerHUD.INSTANCE.getConfig().gui());
GuiHelper.open(TimerConfig.INSTANCE.gui());
return;
}
switch (args[0].toLowerCase()) {
Expand All @@ -37,7 +37,7 @@ public void processCommand(ICommandSender sender, String[] args) {
ChatHandler.sendMessage(ChatColor.GREEN + "[TimerHUD] " + ChatColor.LIGHT_PURPLE + "Command Help\n" + "/timerhud - Open Config Menu\n" + "/timerhud help - Shows help for command usage\n" + "/timerhud hud or /timerhud gui - Opens a GUI to configure where the timer is rendered.\n" + "/timerhud config - Open Config Menu");
break;
case "config":
GuiHelper.open(TimerHUD.INSTANCE.getConfig().gui());
GuiHelper.open(TimerConfig.INSTANCE.gui());
}
}

Expand Down
97 changes: 0 additions & 97 deletions src/main/java/net/wyvest/timer/config/TimerConfig.java

This file was deleted.

78 changes: 78 additions & 0 deletions src/main/java/net/wyvest/timer/config/TimerConfig.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
@file:Suppress("unused")
package net.wyvest.timer.config

import club.sk1er.vigilance.Vigilant
import club.sk1er.vigilance.data.Property
import club.sk1er.vigilance.data.PropertyType
import java.awt.Color
import java.io.File

object TimerConfig : Vigilant(File("./config/timerhud.toml")) {

@Property(type = PropertyType.TEXT, name = "Info", description = "You are using TimerHUD Version 1.5.1, made by Wyvest.", category = "General")
var paragraph = ""

@kotlin.jvm.JvmField
@Property(type = PropertyType.SWITCH, name = "Toggle Mod", description = "Toggle the mod.", category = "General")
var modToggled = false

@kotlin.jvm.JvmField
@Property(type = PropertyType.SWITCH, name = "Render Nothing", description = "Render nothing when the timer is off.", category = "Render")
var renderNothing = false

@kotlin.jvm.JvmField
@Property(type = PropertyType.COLOR, name = "Text Color", description = "Change the text color for the HUD.", category = "Render", subcategory = "Color")
var color = Color.WHITE

@kotlin.jvm.JvmField
@Property(type = PropertyType.SWITCH, name = "Turn on Chroma", description = "Turn on Chroma. This overrides Text Color.", category = "Render", subcategory = "Color")
var chroma = false

@kotlin.jvm.JvmField
@Property(type = PropertyType.SWITCH, name = "Make Chroma Text One Color", description = "Make the Chroma text one color that changes instead of each character being a different color.", category = "Render", subcategory = "Color")
var oneColorChroma = false

@kotlin.jvm.JvmField
@Property(type = PropertyType.SWITCH, name = "Display Background", description = "Toggle the background of the HUD.", category = "Render")
var displayBackground = false

@kotlin.jvm.JvmField
@Property(type = PropertyType.SWITCH, name = "Render Shadow", description = "Toggle the shadow of text in the timer.", category = "Render")
var renderShadow = false

@kotlin.jvm.JvmField
@Property(type = PropertyType.SWITCH, name = "Show in GUIs", description = "Show in GUIs instead of hiding in GUIs.", category = "Render")
var showinGui = false

@kotlin.jvm.JvmField
@Property(type = PropertyType.SWITCH, name = "Reset Timer When Exiting Worlds", description = "Reset the timer when a world is exited.", category = "General")
var resetWhenWorldExit = false

@kotlin.jvm.JvmField
@Property(type = PropertyType.SWITCH, name = "Turn on Timer When Entering Worlds", description = "Turn on the timer when entering worlds.", category = "General")
var turnOnTimerWhenWorldEnter = false

@kotlin.jvm.JvmField
@Property(type = PropertyType.NUMBER, name = "x", category = "Render", hidden = true)
var x = 0

@kotlin.jvm.JvmField
@Property(type = PropertyType.NUMBER, name = "y", category = "Render", hidden = true)
var y = 0

@Property(type = PropertyType.PARAGRAPH, name = "Credits", description = "This mod would not be possible without OSS projects and other forms of help. This page lists the people who helped make this mod.", category = "Credits")
var credits = ""

@Property(type = PropertyType.TEXT, name = "LlamaLad7 and conor", description = "For helping on how to count.", category = "Credits")
var credits1 = ""

@Property(type = PropertyType.TEXT, name = "1fxe", description = "For many parts of the GUI.", category = "Credits")
var credits2 = ""

@Property(type = PropertyType.TEXT, name = "pinkulu", description = "For the update checker.", category = "Credits")
var credits3 = ""

@Property(type = PropertyType.TEXT, name = "chachy", description = "For fixing parts of the build.gradle in v1.5.0.", category = "Credits")
var credits4 = ""

}
11 changes: 0 additions & 11 deletions src/main/java/net/wyvest/timer/others/Constants.java

This file was deleted.

4 changes: 2 additions & 2 deletions src/main/java/net/wyvest/timer/overlay/GUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ public boolean doesGuiPauseGame() {

@Override
public void onGuiClosed() {
TimerHUD.INSTANCE.config.markDirty();
TimerHUD.INSTANCE.config.writeData();
TimerConfig.INSTANCE.markDirty();
TimerConfig.INSTANCE.writeData();
super.onGuiClosed();
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/net/wyvest/timer/overlay/HUD.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public static void drawTimer(Integer seconds) {


if (TimerConfig.modToggled) {
if (TimerConfig.oneColorChroma) {
if (!TimerConfig.oneColorChroma && TimerConfig.chroma) {
ChromaUtils.drawChromaString(fontRenderer, text, Float.parseFloat(String.valueOf(x + 5)), Float.parseFloat(String.valueOf(y)), TimerConfig.renderShadow);
}else {
fontRenderer.drawString(text, x + 5,
Expand Down

0 comments on commit 552e162

Please sign in to comment.