diff --git a/build.gradle.kts b/build.gradle.kts index b634d63..091b14f 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -21,7 +21,7 @@ labyMod { author = "RappyTV" description = "Stops you from using your currently used tool when its almost destroyed." minecraftVersion = "1.8<1.20.4" - version = System.getenv().getOrDefault("VERSION", "1.3.3") + version = System.getenv().getOrDefault("VERSION", "1.3.4") } minecraft { diff --git a/core/src/main/java/com/rappytv/toolwarn/TbwAddon.java b/core/src/main/java/com/rappytv/toolwarn/TbwAddon.java index 70a9221..0a77a26 100644 --- a/core/src/main/java/com/rappytv/toolwarn/TbwAddon.java +++ b/core/src/main/java/com/rappytv/toolwarn/TbwAddon.java @@ -4,12 +4,15 @@ import com.rappytv.toolwarn.core.generated.DefaultReferenceStorage; import com.rappytv.toolwarn.listener.GameTickListener; import com.rappytv.toolwarn.util.ITbwSounds; +import net.labymod.api.Laby; import net.labymod.api.addon.LabyAddon; import net.labymod.api.client.component.Component; import net.labymod.api.client.component.format.NamedTextColor; import net.labymod.api.client.component.format.Style; import net.labymod.api.client.component.format.TextDecoration; import net.labymod.api.models.addon.annotation.AddonMain; +import net.labymod.api.revision.SimpleRevision; +import net.labymod.api.util.version.SemanticVersion; @AddonMain public class TbwAddon extends LabyAddon { @@ -17,6 +20,11 @@ public class TbwAddon extends LabyAddon { public static Component prefix; private static ITbwSounds sounds; + @Override + protected void preConfigurationLoad() { + Laby.references().revisionRegistry().register(new SimpleRevision("toolwarn", new SemanticVersion("1.4.3"), "2024-01-26")); + } + @Override protected void enable() { prefix = Component diff --git a/core/src/main/java/com/rappytv/toolwarn/config/TbwConfiguration.java b/core/src/main/java/com/rappytv/toolwarn/config/TbwConfiguration.java index 8bdae7c..02e6e4a 100644 --- a/core/src/main/java/com/rappytv/toolwarn/config/TbwConfiguration.java +++ b/core/src/main/java/com/rappytv/toolwarn/config/TbwConfiguration.java @@ -5,8 +5,10 @@ import net.labymod.api.client.gui.screen.widget.widgets.input.SliderWidget.SliderSetting; import net.labymod.api.client.gui.screen.widget.widgets.input.SwitchWidget.SwitchSetting; import net.labymod.api.configuration.loader.annotation.ConfigName; +import net.labymod.api.configuration.loader.annotation.IntroducedIn; import net.labymod.api.configuration.loader.annotation.SpriteSlot; import net.labymod.api.configuration.loader.annotation.SpriteTexture; +import net.labymod.api.configuration.loader.annotation.VersionCompatibility; import net.labymod.api.configuration.loader.property.ConfigProperty; import net.labymod.api.configuration.settings.annotation.SettingSection; @@ -26,22 +28,40 @@ public class TbwConfiguration extends AddonConfig { private final ConfigProperty lastHit = new ConfigProperty<>(true); @SettingSection("sounds") - @SpriteSlot(size = 32, y = 1, x = 1) + @SpriteSlot(size = 32, y = 1) private final TbwSoundSubConfig sounds = new TbwSoundSubConfig(); @SettingSection("tools") @SliderSetting(steps = 1, min = 1, max = 25) - @SpriteSlot(size = 32, y = 3) + @SpriteSlot(size = 32, y = 2) private final ConfigProperty swordPercentage = new ConfigProperty<>(5); @SliderSetting(steps = 1, min = 1, max = 25) - @SpriteSlot(size = 32, x = 1, y = 3) + @SpriteSlot(size = 32, y = 2, x = 1) private final ConfigProperty pickaxePercentage = new ConfigProperty<>(5); @SliderSetting(steps = 1, min = 1, max = 25) - @SpriteSlot(size = 32, x = 2, y = 3) + @SpriteSlot(size = 32, y = 2, x = 2) private final ConfigProperty axePercentage = new ConfigProperty<>(5); @SliderSetting(steps = 1, min = 1, max = 25) - @SpriteSlot(size = 32, x = 3, y = 3) + @SpriteSlot(size = 32, y = 2, x = 3) private final ConfigProperty shovelPercentage = new ConfigProperty<>(5); + @SliderSetting(steps = 1, min = 1, max = 25) + @SpriteSlot(size = 32, y = 3) + @VersionCompatibility("1.14<*") + @IntroducedIn(namespace = "globaltags", value = "1.4.3") + private final ConfigProperty crossbowPercentage = new ConfigProperty<>(5); + @SliderSetting(steps = 1, min = 1, max = 25) + @SpriteSlot(size = 32, y = 3, x = 1) + @IntroducedIn(namespace = "globaltags", value = "1.4.3") + private final ConfigProperty lighterPercentage = new ConfigProperty<>(5); + @SliderSetting(steps = 1, min = 1, max = 25) + @SpriteSlot(size = 32, y = 3, x = 2) + @IntroducedIn(namespace = "globaltags", value = "1.4.3") + private final ConfigProperty shearsPercentage = new ConfigProperty<>(5); + @SliderSetting(steps = 1, min = 1, max = 25) + @SpriteSlot(size = 32, y = 3, x = 3) + @VersionCompatibility("1.13<*") + @IntroducedIn(namespace = "globaltags", value = "1.4.3") + private final ConfigProperty tridentPercentage = new ConfigProperty<>(5); @Override public ConfigProperty enabled() { @@ -70,4 +90,16 @@ public ConfigProperty axePercentage() { public ConfigProperty shovelPercentage() { return shovelPercentage; } + public ConfigProperty crossbowPercentage() { + return crossbowPercentage; + } + public ConfigProperty lighterPercentage() { + return lighterPercentage; + } + public ConfigProperty shearsPercentage() { + return shearsPercentage; + } + public ConfigProperty tridentPercentage() { + return tridentPercentage; + } } diff --git a/core/src/main/java/com/rappytv/toolwarn/config/subconfig/TbwSoundSubConfig.java b/core/src/main/java/com/rappytv/toolwarn/config/subconfig/TbwSoundSubConfig.java index 03f5f57..d0b0623 100644 --- a/core/src/main/java/com/rappytv/toolwarn/config/subconfig/TbwSoundSubConfig.java +++ b/core/src/main/java/com/rappytv/toolwarn/config/subconfig/TbwSoundSubConfig.java @@ -12,10 +12,10 @@ public class TbwSoundSubConfig extends Config { @ParentSwitch private final ConfigProperty enabled = new ConfigProperty<>(true); @DropdownSetting - @SpriteSlot(size = 32, y = 1, x = 2) + @SpriteSlot(size = 32, y = 1, x = 1) private final ConfigProperty warnSound = new ConfigProperty<>(WarnSound.PLING); @DropdownSetting - @SpriteSlot(size = 32, y = 1, x = 3) + @SpriteSlot(size = 32, y = 1, x = 2) private final ConfigProperty lastHitSound = new ConfigProperty<>(WarnSound.ANVIL_USE); public ConfigProperty enabled() { diff --git a/core/src/main/java/com/rappytv/toolwarn/util/ToolType.java b/core/src/main/java/com/rappytv/toolwarn/util/ToolType.java index 815afd5..d71b562 100644 --- a/core/src/main/java/com/rappytv/toolwarn/util/ToolType.java +++ b/core/src/main/java/com/rappytv/toolwarn/util/ToolType.java @@ -2,10 +2,9 @@ import com.rappytv.toolwarn.config.TbwConfiguration; import net.labymod.api.client.world.item.ItemStack; -import net.labymod.api.util.I18n; public enum ToolType { - None, Sword, Pickaxe, Axe, Shovel; + None, Sword, Pickaxe, Axe, Shovel, Crossbow, Lighter, Shears, Trident; public static ToolType getByItem(ItemStack itemStack) { String path = itemStack.getIdentifier().getPath(); @@ -17,6 +16,14 @@ else if(path.endsWith("_axe")) return Axe; else if(path.endsWith("_shovel")) return Shovel; + else if(path.equalsIgnoreCase("crossbow")) + return Crossbow; + else if(path.equalsIgnoreCase("flint_and_steel")) + return Lighter; + else if(path.equalsIgnoreCase("shears")) + return Shears; + else if(path.equalsIgnoreCase("trident")) + return Trident; return None; } @@ -26,11 +33,11 @@ public int getWarnPercentage(TbwConfiguration configuration) { case Pickaxe -> configuration.pickAxePercentage().get(); case Axe -> configuration.axePercentage().get(); case Shovel -> configuration.shovelPercentage().get(); + case Crossbow -> configuration.crossbowPercentage().get(); + case Lighter -> configuration.lighterPercentage().get(); + case Shears -> configuration.shearsPercentage().get(); + case Trident -> configuration.tridentPercentage().get(); default -> -1; }; } - - public String displayName() { - return I18n.translate("toolwarn.tooltype." + this.name().toLowerCase()); - } } diff --git a/core/src/main/resources/assets/toolwarn/i18n/de_de.json b/core/src/main/resources/assets/toolwarn/i18n/de_de.json index b9634c6..c51ed1e 100644 --- a/core/src/main/resources/assets/toolwarn/i18n/de_de.json +++ b/core/src/main/resources/assets/toolwarn/i18n/de_de.json @@ -49,24 +49,30 @@ } }, "swordPercentage": { - "name": "Schwertwarnung (%)" + "name": "Schwert-Warnung (%)" }, "pickaxePercentage": { - "name": "Spitzhackenwarnung (%)" + "name": "Spitzhacken-Warnung (%)" }, "axePercentage": { - "name": "Axtwarnung (%)" + "name": "Axt-Warnung (%)" }, "shovelPercentage": { - "name": "Schaufelwarnung (%)" + "name": "Schaufel-Warnung (%)" + }, + "crossbowPercentage": { + "name": "Armbrust-Warnung (%)" + }, + "lighterPercentage": { + "name": "Feuerzeug-Warnung (%)" + }, + "shearsPercentage": { + "name": "Scheren-Warnung (%)" + }, + "tridentPercentage": { + "name": "Dreizack-Warnung (%)" } }, - "tooltype": { - "sword": "Schwert", - "pickaxe": "Spitzhacke", - "axe": "Axt", - "shovel": "Schaufel" - }, "messages": { "lastHit": "Du solltest das Tool jetzt weglegen. Das ist dein letzter Schlag!", "warning": "Willst du das Tool wirklich weiter benutzen? Die Haltbarkeit liegt bei %s%%!" diff --git a/core/src/main/resources/assets/toolwarn/i18n/en_us.json b/core/src/main/resources/assets/toolwarn/i18n/en_us.json index aa36874..dc4efaf 100644 --- a/core/src/main/resources/assets/toolwarn/i18n/en_us.json +++ b/core/src/main/resources/assets/toolwarn/i18n/en_us.json @@ -49,24 +49,30 @@ } }, "swordPercentage": { - "name": "Sword Warn Percentage" + "name": "Sword warn percentage" }, "pickaxePercentage": { - "name": "Pickaxe Warn Percentage" + "name": "Pickaxe warn percentage" }, "axePercentage": { - "name": "Axe Warn Percentage" + "name": "Axe warn percentage" }, "shovelPercentage": { - "name": "Shovel Warn Percentage" + "name": "Shovel warn percentage" + }, + "crossbowPercentage": { + "name": "Crossbow warn percentage" + }, + "lighterPercentage": { + "name": "Flint and Steel warn percentage" + }, + "shearsPercentage": { + "name": "Shears warn percentage" + }, + "tridentPercentage": { + "name": "Trident warn percentage" } }, - "tooltype": { - "sword": "Sword", - "pickaxe": "Pickaxe", - "axe": "Axe", - "shovel": "Shovel" - }, "messages": { "lastHit": "You should stop using this tool now, this is your last hit!", "warning": "Do you really want to continue using this tool? Its durability is at %s%%!" diff --git a/core/src/main/resources/assets/toolwarn/textures/icon.png b/core/src/main/resources/assets/toolwarn/textures/icon.png index 604f684..e1b2673 100644 Binary files a/core/src/main/resources/assets/toolwarn/textures/icon.png and b/core/src/main/resources/assets/toolwarn/textures/icon.png differ diff --git a/core/src/main/resources/assets/toolwarn/themes/vanilla/textures/settings.png b/core/src/main/resources/assets/toolwarn/themes/vanilla/textures/settings.png index 9bb8382..25ca292 100644 Binary files a/core/src/main/resources/assets/toolwarn/themes/vanilla/textures/settings.png and b/core/src/main/resources/assets/toolwarn/themes/vanilla/textures/settings.png differ diff --git a/settings.gradle.kts b/settings.gradle.kts index 94cf5ba..8fd1110 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1,7 +1,7 @@ rootProject.name = "toolwarn" pluginManagement { - val labyGradlePluginVersion = "0.3.38" + val labyGradlePluginVersion = "0.3.44" plugins { id("net.labymod.gradle") version (labyGradlePluginVersion) }