Skip to content

Commit

Permalink
Switched config to use values with 1.0 corresponding to 100%
Browse files Browse the repository at this point in the history
  • Loading branch information
Dariensg committed Jun 14, 2022
1 parent 2335593 commit 7ab330b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ public void onEntityDamage(LivingDamageEvent event) {

if (entity instanceof Player) {
Player player = (Player) entity;
double activationHealth = SecondChanceConfig.CONFIG.usePercentConfig.get() ? SecondChanceConfig.CONFIG.secondChanceActivationPercent.get() * player.getMaxHealth() / 100 : SecondChanceConfig.CONFIG.secondChanceActivationHealth.get();
double remainderHealth = SecondChanceConfig.CONFIG.usePercentConfig.get() ? SecondChanceConfig.CONFIG.secondChanceRemainderPercent.get() * player.getMaxHealth() / 100 : SecondChanceConfig.CONFIG.secondChanceHealthRemainder.get();
double activationHealth = SecondChanceConfig.CONFIG.usePercentConfig.get() ? SecondChanceConfig.CONFIG.secondChanceActivationPercent.get() * player.getMaxHealth() : SecondChanceConfig.CONFIG.secondChanceActivationHealth.get();
double remainderHealth = SecondChanceConfig.CONFIG.usePercentConfig.get() ? SecondChanceConfig.CONFIG.secondChanceRemainderPercent.get() * player.getMaxHealth() : SecondChanceConfig.CONFIG.secondChanceHealthRemainder.get();

if (SecondChanceConfig.CONFIG.secondChanceEnabled.get() && canActivateSecondChance(source) && player.getHealth() <= event.getAmount() && player.getHealth() >= activationHealth) {
if (SecondChanceConfig.CONFIG.secondChanceEnabled.get() && player.getHealth() <= event.getAmount() && player.getHealth() >= activationHealth && canActivateSecondChance(source)) {
if (SecondChanceConfig.CONFIG.secondChanceSound.get()) {
player.getCommandSenderWorld().playSound(null, player.getX(), player.getY(), player.getZ(), SecondChanceSoundEvents.CLASSIC_HURT.get(), SoundSource.PLAYERS, 2.0F, 1.0F);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,11 +159,11 @@ public SecondChanceConfig(Builder builder) {
secondChanceActivationPercent = builder
.comment("Determines what percent of health the player must start with for 'Second Chance' to activate.")
.translation(SecondChanceForge.MOD_ID + ".config.tooltip.secondChanceActivationPercent")
.defineInRange("secondChanceActivationPercent", 65.0D, 0.01D, Double.MAX_VALUE);
.defineInRange("secondChanceActivationPercent", 0.65D, 0.01D, Double.MAX_VALUE);

secondChanceRemainderPercent = builder
.comment("Determines what percent health the player should be left with after 'Second Chance' activates.")
.translation(SecondChanceForge.MOD_ID + ".config.tooltip.secondChanceRemainderPercent")
.defineInRange("secondChanceHealthPercent", 5.0D, 0.01D, Double.MAX_VALUE);
.defineInRange("secondChanceHealthPercent", 0.05D, 0.01D, Double.MAX_VALUE);
}
}

0 comments on commit 7ab330b

Please sign in to comment.