From f3c42d6ac2926949efe1478a7e51d991e5f2fc95 Mon Sep 17 00:00:00 2001 From: AViewFromTheTop <87103914+AViewFromTheTop@users.noreply.github.com> Date: Sun, 10 Dec 2023 19:40:15 -0500 Subject: [PATCH] add item save cooldown again --- .../wilderwild/config/gui/ItemConfigGui.java | 40 +++++++++++++++---- .../assets/wilderwild/lang/en_us.json | 2 +- 2 files changed, 34 insertions(+), 8 deletions(-) diff --git a/src/main/java/net/frozenblock/wilderwild/config/gui/ItemConfigGui.java b/src/main/java/net/frozenblock/wilderwild/config/gui/ItemConfigGui.java index 7959a3e551..bf9ebee56c 100644 --- a/src/main/java/net/frozenblock/wilderwild/config/gui/ItemConfigGui.java +++ b/src/main/java/net/frozenblock/wilderwild/config/gui/ItemConfigGui.java @@ -24,6 +24,7 @@ import net.fabricmc.api.Environment; import net.frozenblock.lib.config.api.instance.Config; import net.frozenblock.lib.config.clothconfig.FrozenClothConfig; +import net.frozenblock.lib.config.frozenlib_config.FrozenLibConfig; import net.frozenblock.wilderwild.config.ItemConfig; import net.frozenblock.wilderwild.misc.WilderSharedConstants; import static net.frozenblock.wilderwild.misc.WilderSharedConstants.text; @@ -37,6 +38,7 @@ private ItemConfigGui() { } public static void setupEntries(@NotNull ConfigCategory category, @NotNull ConfigEntryBuilder entryBuilder) { + // WW CONFIG var config = ItemConfig.get(true); Class clazz = config.getClass(); Config configInstance = ItemConfig.INSTANCE; @@ -44,17 +46,41 @@ public static void setupEntries(@NotNull ConfigCategory category, @NotNull Confi var defaultConfig = ItemConfig.INSTANCE.defaultInstance(); var ancientHorn = config.ancientHorn; var modifiedAncientHorn = modifiedConfig.ancientHorn; + var ancientHornClass = config.ancientHorn.getClass(); var projectileLandingSounds = config.projectileLandingSounds; var modifiedProjectileLandingSounds = modifiedConfig.projectileLandingSounds; + // FROZENLIB CONFIG + var frozenLibConfig = FrozenLibConfig.get(true); + Class frozenConfigClass = frozenLibConfig.getClass(); + Config frozenConfigInstance = FrozenLibConfig.INSTANCE; + var modifiedFrozenConfig = FrozenLibConfig.getWithSync(); + var defaultFrozenConfig = FrozenLibConfig.INSTANCE.defaultInstance(); + category.setBackground(WilderSharedConstants.id("textures/config/item.png")); + var itemCooldownsSave = category.addEntry( + FrozenClothConfig.syncedEntry( + entryBuilder.startBooleanToggle(text("save_item_cooldowns"), modifiedFrozenConfig.saveItemCooldowns) + .setDefaultValue(defaultFrozenConfig.saveItemCooldowns) + .setSaveConsumer(newValue -> { + frozenLibConfig.saveItemCooldowns = newValue; + frozenConfigInstance.save(); + }) + .setTooltip(tooltip("save_item_cooldowns")) + .build(), + frozenConfigClass, + "saveItemCooldowns", + frozenConfigInstance + ) + ); + var summonsWarden = FrozenClothConfig.syncedEntry( entryBuilder.startBooleanToggle(text("ancient_horn_can_summon_warden"), modifiedAncientHorn.ancientHornCanSummonWarden) .setDefaultValue(defaultConfig.ancientHorn.ancientHornCanSummonWarden) .setSaveConsumer(newValue -> ancientHorn.ancientHornCanSummonWarden = newValue) .setTooltip(tooltip("ancient_horn_can_summon_warden")) .build(), - config.ancientHorn.getClass(), + ancientHornClass, "ancientHornCanSummonWarden", configInstance ); @@ -65,7 +91,7 @@ public static void setupEntries(@NotNull ConfigCategory category, @NotNull Confi .setSaveConsumer(newValue -> ancientHorn.ancientHornLifespan = newValue) .setTooltip(tooltip("ancient_horn_lifespan")) .build(), - config.ancientHorn.getClass(), + ancientHornClass, "ancientHornLifespan", configInstance ); @@ -76,7 +102,7 @@ public static void setupEntries(@NotNull ConfigCategory category, @NotNull Confi .setSaveConsumer(newValue -> ancientHorn.ancientHornMobDamage = newValue) .setTooltip(tooltip("ancient_horn_mob_damage")) .build(), - config.ancientHorn.getClass(), + ancientHornClass, "ancientHornMobDamage", configInstance ); @@ -87,7 +113,7 @@ public static void setupEntries(@NotNull ConfigCategory category, @NotNull Confi .setSaveConsumer(newValue -> ancientHorn.ancientHornPlayerDamage = newValue) .setTooltip(tooltip("ancient_horn_player_damage")) .build(), - config.ancientHorn.getClass(), + ancientHornClass, "ancientHornPlayerDamage", configInstance ); @@ -98,7 +124,7 @@ public static void setupEntries(@NotNull ConfigCategory category, @NotNull Confi .setSaveConsumer(newValue -> ancientHorn.ancientHornShattersGlass = newValue) .setTooltip(tooltip("ancient_horn_shatters_glass")) .build(), - config.ancientHorn.getClass(), + ancientHornClass, "ancientHornShattersGlass", configInstance ); @@ -109,7 +135,7 @@ public static void setupEntries(@NotNull ConfigCategory category, @NotNull Confi .setSaveConsumer(newValue -> ancientHorn.ancientHornSizeMultiplier = newValue) .setTooltip(tooltip("ancient_horn_size_multiplier")) .build(), - config.ancientHorn.getClass(), + ancientHornClass, "ancientHornSizeMultiplier", configInstance ); @@ -189,7 +215,7 @@ public static void setupEntries(@NotNull ConfigCategory category, @NotNull Confi .setDefaultValue(defaultConfig.restrictInstrumentSound) .setSaveConsumer(newValue -> config.restrictInstrumentSound = newValue) .setTooltip(tooltip("restrict_instrument_sound")) - .build() , + .build(), clazz, "restrictInstrumentSound", configInstance diff --git a/src/main/resources/assets/wilderwild/lang/en_us.json b/src/main/resources/assets/wilderwild/lang/en_us.json index 2fe017851e..bab2e3865c 100644 --- a/src/main/resources/assets/wilderwild/lang/en_us.json +++ b/src/main/resources/assets/wilderwild/lang/en_us.json @@ -570,7 +570,7 @@ "tooltip.wilderwild.podzol_sounds": "Whether or not Podzol sounds should be overridden.", "tooltip.wilderwild.projectile_landing_sounds": "Contains toggles for thrown projectile landing sounds.", "tooltip.wilderwild.projectile_break_particles": "Whether or not projectiles like Arrows or Tridents\nshould emit block breaking particles when colliding.", - "tooltip.wilderwild.item_cooldowns_save": "Whether or not item cooldowns will save instead of being\ncleared upon switching dimensions or rejoining a world.", + "tooltip.wilderwild.item_cooldowns_save": "Whether or not item cooldowns will save instead of being\ncleared upon switching dimensions or rejoining a world.\nAncient Horns will save their cooldowns regardless of this config.", "tooltip.wilderwild.reinforced_deepslate_sounds": "Whether or not Reinforced Deepslate sounds should be overridden.", "tooltip.wilderwild.restrict_instrument_sound": "Whether or not instruments, such as the Goat Horn, should stop their sound when the user releases the mouse button", "tooltip.wilderwild.sapling_sounds": "Whether or not Sapling sounds should be overridden.",