Skip to content

Commit

Permalink
added soul elytra cooldown config
Browse files Browse the repository at this point in the history
  • Loading branch information
NewJumper committed Jan 10, 2024
1 parent e7d7936 commit 2b77a21
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
}
}
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -28,7 +29,7 @@ public void handle(Supplier<NetworkEvent.Context> 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);
}
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}

0 comments on commit 2b77a21

Please sign in to comment.