From 2b77a214d5305267d4ede8031504af9e57803823 Mon Sep 17 00:00:00 2001 From: NewJumper Date: Tue, 9 Jan 2024 23:35:39 -0600 Subject: [PATCH] added soul elytra cooldown config --- .../com/kyanite/deeperdarker/content/items/SoulElytraItem.java | 3 ++- .../kyanite/deeperdarker/network/PacketSoulElytraBoost.java | 3 ++- .../java/com/kyanite/deeperdarker/util/DeeperDarkerConfig.java | 3 +++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/kyanite/deeperdarker/content/items/SoulElytraItem.java b/src/main/java/com/kyanite/deeperdarker/content/items/SoulElytraItem.java index b50d73f05..1f3974fa3 100644 --- a/src/main/java/com/kyanite/deeperdarker/content/items/SoulElytraItem.java +++ b/src/main/java/com/kyanite/deeperdarker/content/items/SoulElytraItem.java @@ -4,6 +4,7 @@ import com.google.common.collect.Multimap; import com.kyanite.deeperdarker.DeeperDarker; import com.kyanite.deeperdarker.content.DDItems; +import com.kyanite.deeperdarker.util.DeeperDarkerConfig; import net.minecraft.network.chat.Component; import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.entity.ai.attributes.Attribute; @@ -40,7 +41,7 @@ public boolean isValidRepairItem(@NotNull ItemStack pToRepair, ItemStack pRepair public void onArmorTick(ItemStack stack, Level level, Player player) { if(level.isClientSide() && player.getCooldowns().isOnCooldown(DDItems.SOUL_ELYTRA.get())) { float percent = player.getCooldowns().getCooldownPercent(DDItems.SOUL_ELYTRA.get(), 0); - player.displayClientMessage(Component.translatable("item." + DeeperDarker.MOD_ID + ".soul_elytra.cooldown", (int) Math.ceil(percent * 30)), true); + player.displayClientMessage(Component.translatable("item." + DeeperDarker.MOD_ID + ".soul_elytra.cooldown", (int) Math.ceil(percent * DeeperDarkerConfig.soulElytraCooldown / 20)), true); } } } diff --git a/src/main/java/com/kyanite/deeperdarker/network/PacketSoulElytraBoost.java b/src/main/java/com/kyanite/deeperdarker/network/PacketSoulElytraBoost.java index 01872e980..d7ca99942 100644 --- a/src/main/java/com/kyanite/deeperdarker/network/PacketSoulElytraBoost.java +++ b/src/main/java/com/kyanite/deeperdarker/network/PacketSoulElytraBoost.java @@ -1,6 +1,7 @@ package com.kyanite.deeperdarker.network; import com.kyanite.deeperdarker.content.DDItems; +import com.kyanite.deeperdarker.util.DeeperDarkerConfig; import io.netty.buffer.ByteBuf; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.entity.projectile.FireworkRocketEntity; @@ -28,7 +29,7 @@ public void handle(Supplier context) { if(player.isFallFlying() && player.getInventory().armor.get(2).is(DDItems.SOUL_ELYTRA.get()) && !player.getCooldowns().isOnCooldown(DDItems.SOUL_ELYTRA.get())) { FireworkRocketEntity rocket = new FireworkRocketEntity(level, new ItemStack(Items.FIREWORK_ROCKET), player); level.addFreshEntity(rocket); - player.getCooldowns().addCooldown(DDItems.SOUL_ELYTRA.get(), 600); + player.getCooldowns().addCooldown(DDItems.SOUL_ELYTRA.get(), DeeperDarkerConfig.soulElytraCooldown); } }); diff --git a/src/main/java/com/kyanite/deeperdarker/util/DeeperDarkerConfig.java b/src/main/java/com/kyanite/deeperdarker/util/DeeperDarkerConfig.java index 1fea6a2a9..93f56cae1 100644 --- a/src/main/java/com/kyanite/deeperdarker/util/DeeperDarkerConfig.java +++ b/src/main/java/com/kyanite/deeperdarker/util/DeeperDarkerConfig.java @@ -9,15 +9,18 @@ public class DeeperDarkerConfig { private static final ForgeConfigSpec.BooleanValue WARDEN_HEART_PULSES = BUILDER.comment("Heart of the Deep beats like a heart", "Default: true").define("wardenHeartPulses", true); private static final ForgeConfigSpec.DoubleValue FAKE_VASE_CHANCE = BUILDER.comment("Chance of a vase being fake", "Default: 0.16").defineInRange("fakeVaseChance", 0.16, 0, 1); private static final ForgeConfigSpec.DoubleValue STALKER_SPAWN_CHANCE = BUILDER.comment("Chance of a Stalker spawning when a fake vase is broken", "Default: 0.3125").defineInRange("stalkerSpawnChance", 0.3125, 0, 1); + private static final ForgeConfigSpec.IntValue SOUL_ELYTRA_COOLDOWN = BUILDER.comment("Soul Elytra's boost cooldown in ticks", "Default: 600").defineInRange("soulElytraCooldown", 600, 0, 12000); public static final ForgeConfigSpec SPEC = BUILDER.build(); public static boolean wardenHeartPulses; public static double fakeVaseChance; public static double stalkerSpawnChance; + public static int soulElytraCooldown; public static void loadConfigs(final ModConfigEvent event) { wardenHeartPulses = WARDEN_HEART_PULSES.get(); fakeVaseChance = FAKE_VASE_CHANCE.get(); stalkerSpawnChance = STALKER_SPAWN_CHANCE.get(); + soulElytraCooldown = SOUL_ELYTRA_COOLDOWN.get(); } }