Skip to content

Commit

Permalink
Config Changes
Browse files Browse the repository at this point in the history
 - Redid the McdwEnchantmentsConfig and McdwEnchantmentSettingsConfig to be easier to read and use
 - Removed EnchantStatsID.java, as it is no longer needed
 - Moved the following values from the McdwEnchantmentSettingsConfig to the McdwEnchantmentsConfig
   - `ENIGMA_RESONATOR_DIVISOR` -> `offset` value for `ENIGMA_RESONATOR`
   - `DYNAMO_STACK_CAP` -> `offset` value for `DYNAMO`
   - `ENCHANTMENT_TRIGGER_BASE_CHANCE` -> `procChance` value in proc-able enchantments
   - `HEALING_FACTOR` -> `offset` value for healing enchantments
   - `directDamageEnchantmentMultiplier` called the same thing, but moved to top of McdwEnchantmentsConfig
 - Propagated necessary changes throughout project
 - Configs will be reset; BACK UP YOUR CONFIG __BEFORE__ UPDATING
  • Loading branch information
chronosacaria committed Nov 30, 2023
1 parent 63bed2f commit 202c424
Show file tree
Hide file tree
Showing 66 changed files with 1,117 additions and 522 deletions.
14 changes: 7 additions & 7 deletions src/main/java/chronosacaria/mcdw/client/McdwClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public static void registerBowPredicates(McdwBow bow) {
return 0.0F;
} else {
int useTicks = itemStack.getMaxUseTime() - livingEntity.getItemUseTimeLeft();
if (Mcdw.CONFIG.mcdwEnchantmentsConfig.ENABLE_ENCHANTMENTS.get(EnchantmentsID.ACCELERATE)) {
if (Mcdw.CONFIG.mcdwEnchantmentsConfig.ENCHANTMENT_CONFIG.get(EnchantmentsID.ACCELERATE).mcdw$getIsEnabled()) {
int accelerateLevel = EnchantmentHelper.getLevel(EnchantsRegistry.ACCELERATE, itemStack);
if (accelerateLevel > 0) {
StatusEffectInstance accelerateInstance = livingEntity.getStatusEffect(StatusEffectsRegistry.ACCELERATE);
Expand All @@ -53,7 +53,7 @@ public static void registerBowPredicates(McdwBow bow) {
useTicks = (int) (useTicks * (1f + (MathHelper.clamp(consecutiveShots * (6.0f + 2.0f * accelerateLevel), 0f, 100f) / 100f)));
}
}
if (Mcdw.CONFIG.mcdwEnchantmentsConfig.ENABLE_ENCHANTMENTS.get(EnchantmentsID.OVERCHARGE)) {
if (Mcdw.CONFIG.mcdwEnchantmentsConfig.ENCHANTMENT_CONFIG.get(EnchantmentsID.OVERCHARGE).mcdw$getIsEnabled()) {
int overchargeLevel = EnchantmentHelper.getLevel(EnchantsRegistry.OVERCHARGE, itemStack);
if (overchargeLevel > 0) {
int overcharge = (int) Math.min((useTicks / bow.getDrawSpeed()) - 1, overchargeLevel);
Expand All @@ -77,7 +77,7 @@ public static void registerShortBowPredicates(McdwShortbow bow) {
return 0.0F;
} else {
int useTicks = itemStack.getMaxUseTime() - livingEntity.getItemUseTimeLeft();
if (Mcdw.CONFIG.mcdwEnchantmentsConfig.ENABLE_ENCHANTMENTS.get(EnchantmentsID.ACCELERATE)) {
if (Mcdw.CONFIG.mcdwEnchantmentsConfig.ENCHANTMENT_CONFIG.get(EnchantmentsID.ACCELERATE).mcdw$getIsEnabled()) {
int accelerateLevel = EnchantmentHelper.getLevel(EnchantsRegistry.ACCELERATE, itemStack);
if (accelerateLevel > 0) {
StatusEffectInstance accelerateInstance = livingEntity.getStatusEffect(StatusEffectsRegistry.ACCELERATE);
Expand All @@ -86,7 +86,7 @@ public static void registerShortBowPredicates(McdwShortbow bow) {
useTicks = (int) (useTicks * (1f + (MathHelper.clamp(consecutiveShots * (6.0f + 2.0f * accelerateLevel), 0f, 100f) / 100f)));
}
}
if (Mcdw.CONFIG.mcdwEnchantmentsConfig.ENABLE_ENCHANTMENTS.get(EnchantmentsID.OVERCHARGE)) {
if (Mcdw.CONFIG.mcdwEnchantmentsConfig.ENCHANTMENT_CONFIG.get(EnchantmentsID.OVERCHARGE).mcdw$getIsEnabled()) {
int overchargeLevel = EnchantmentHelper.getLevel(EnchantsRegistry.OVERCHARGE, itemStack);
if (overchargeLevel > 0) {
int overcharge = (int) Math.min((useTicks / bow.getDrawSpeed()) - 1, overchargeLevel);
Expand All @@ -110,7 +110,7 @@ public static void registerLongBowPredicates(McdwLongbow bow) {
return 0.0F;
} else {
int useTicks = itemStack.getMaxUseTime() - livingEntity.getItemUseTimeLeft();
if (Mcdw.CONFIG.mcdwEnchantmentsConfig.ENABLE_ENCHANTMENTS.get(EnchantmentsID.ACCELERATE)) {
if (Mcdw.CONFIG.mcdwEnchantmentsConfig.ENCHANTMENT_CONFIG.get(EnchantmentsID.ACCELERATE).mcdw$getIsEnabled()) {
int accelerateLevel = EnchantmentHelper.getLevel(EnchantsRegistry.ACCELERATE, itemStack);
if (accelerateLevel > 0) {
StatusEffectInstance accelerateInstance = livingEntity.getStatusEffect(StatusEffectsRegistry.ACCELERATE);
Expand All @@ -119,7 +119,7 @@ public static void registerLongBowPredicates(McdwLongbow bow) {
useTicks = (int) (useTicks * (1f + (MathHelper.clamp(consecutiveShots * (6.0f + 2.0f * accelerateLevel), 0f, 100f) / 100f)));
}
}
if (Mcdw.CONFIG.mcdwEnchantmentsConfig.ENABLE_ENCHANTMENTS.get(EnchantmentsID.OVERCHARGE)) {
if (Mcdw.CONFIG.mcdwEnchantmentsConfig.ENCHANTMENT_CONFIG.get(EnchantmentsID.OVERCHARGE).mcdw$getIsEnabled()) {
int overchargeLevel = EnchantmentHelper.getLevel(EnchantsRegistry.OVERCHARGE, itemStack);
if (overchargeLevel > 0) {
int overcharge = (int) Math.min((useTicks / bow.getDrawSpeed()) - 1, overchargeLevel);
Expand All @@ -143,7 +143,7 @@ public static void registerCrossbowPredicates(McdwCrossbow crossbow) {
return 0.0F;
} else {
int useTicks = itemStack.getMaxUseTime() - livingEntity.getItemUseTimeLeft();
if (Mcdw.CONFIG.mcdwEnchantmentsConfig.ENABLE_ENCHANTMENTS.get(EnchantmentsID.ACCELERATE)) {
if (Mcdw.CONFIG.mcdwEnchantmentsConfig.ENCHANTMENT_CONFIG.get(EnchantmentsID.ACCELERATE).mcdw$getIsEnabled()) {
int accelerateLevel = EnchantmentHelper.getLevel(EnchantsRegistry.ACCELERATE, itemStack);
if (accelerateLevel > 0) {
StatusEffectInstance accelerateInstance = livingEntity.getStatusEffect(StatusEffectsRegistry.ACCELERATE);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
package chronosacaria.mcdw.configs;

import org.jetbrains.annotations.Nullable;

import java.util.List;

public class EnchantmentIDConfigHelper {
List<String> comment;
float offset = 0.0f;
boolean isEnabled = true;
boolean isAvailableForEnchantedBookOffer = true;
boolean isAvailableForRandomSelection = true;
int maxLevel = 3;
@Nullable Integer procChance = 0;

public float mcdw$getOffset(){
return offset;
}
public boolean mcdw$getIsEnabled() {
return isEnabled;
}
public boolean mcdw$getIsAvailableForEnchantedBookOffer() {
return isAvailableForEnchantedBookOffer;
}
public boolean mcdw$getIsAvailableForRandomSelection() {
return isAvailableForRandomSelection;
}
public int mcdw$getMaxLevel() {
return maxLevel;
}
public @Nullable Integer mcdw$getProcChance() {
return procChance;
}

@SuppressWarnings("unused")
public EnchantmentIDConfigHelper(){
}

public EnchantmentIDConfigHelper(boolean isEnabled, boolean isAvailableForEnchantedBookOffer, boolean isAvailableForRandomSelection, int maxLevel, @Nullable Integer procChance) {
this.isEnabled = isEnabled;
this.isAvailableForEnchantedBookOffer = isAvailableForEnchantedBookOffer;
this.isAvailableForRandomSelection = isAvailableForRandomSelection;
this.maxLevel = maxLevel;
this.procChance = procChance;
}

public EnchantmentIDConfigHelper(List<String> comment, boolean isEnabled, boolean isAvailableForEnchantedBookOffer, boolean isAvailableForRandomSelection, int maxLevel, @Nullable Integer procChance, float effectOffset) {
this.comment = comment;
this.isEnabled = isEnabled;
this.isAvailableForEnchantedBookOffer = isAvailableForEnchantedBookOffer;
this.isAvailableForRandomSelection = isAvailableForRandomSelection;
this.maxLevel = maxLevel;
this.procChance = procChance;
this.offset = effectOffset;
}

}
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package chronosacaria.mcdw.configs;

import chronosacaria.mcdw.enums.EnchantStatsID;
import chronosacaria.mcdw.enums.EnchantmentsID;
import chronosacaria.mcdw.enums.SettingsID;
import me.shedaniel.autoconfig.ConfigData;
import me.shedaniel.autoconfig.annotation.Config;
Expand All @@ -25,64 +23,12 @@ Final Permission (4): Only hostile mobs
// Enchantment Settings
public final LinkedHashMap<SettingsID, Boolean> ENABLE_ENCHANTMENT_SETTINGS = new LinkedHashMap<>();

@Comment("ENIGMA_RESONATOR_DIVISOR -> Higher number = lower damage. Default value = 3.25.")
public final LinkedHashMap<EnchantStatsID, Float> ENIGMA_RESONATOR_DIVISOR = new LinkedHashMap<>();

@Comment("Dynamo Stack Cap, Higher number = more potential damage. Default value = 20.")
public final LinkedHashMap<EnchantStatsID, Integer> DYNAMO_STACK_CAP = new LinkedHashMap<>();

@Comment("Enchantment Trigger Chances Base. This is not the % to occur, but the higher this number, the higher " +
"the chance to trigger.")
public final LinkedHashMap<EnchantmentsID, Integer> ENCHANTMENT_TRIGGER_BASE_CHANCE = new LinkedHashMap<>();

@Comment("""
A slider value for damage modifying enchantments: Ambush, Critical Hit, Void Strike, Pain Cycle,
Enigma Resonator, Dynamo, Shadow Form, Enigma Shot, Growing, Void Shot, Overcharge, Committed,
Hunter's Promise.
""")
public float directDamageEnchantmentMultiplier = 1.0f;

@Comment("Healing Factor Slider. Percentage of healing -> 1.0 = 100%. Default value = 1.0.")
public final LinkedHashMap<EnchantStatsID, Float> HEALING_FACTOR = new LinkedHashMap<>();

public McdwEnchantmentSettingsConfig(){
ENABLE_ENCHANTMENT_SETTINGS.put(SettingsID.ENABLE_OP_ENCHANTMENT_MIXING, false);
ENABLE_ENCHANTMENT_SETTINGS.put(SettingsID.LEECHING_CAN_BE_MIXED_WITH_HEALING, false);
ENABLE_ENCHANTMENT_SETTINGS.put(SettingsID.EXTRA_XP_HEALING, false);
ENABLE_ENCHANTMENT_SETTINGS.put(SettingsID.SHARED_PAIN_CAN_DAMAGE_USER, false);
ENABLE_ENCHANTMENT_SETTINGS.put(SettingsID.AREA_OF_EFFECT_ENCHANTS_DONT_AFFECT_PLAYERS, true);
ENABLE_ENCHANTMENT_SETTINGS.put(SettingsID.ENABLE_INNATE_ENCHANTMENTS, true);

ENIGMA_RESONATOR_DIVISOR.put(EnchantStatsID.ENIGMA_RESONATOR_DIVISOR, 3.25f);
DYNAMO_STACK_CAP.put(EnchantStatsID.DYNAMO_STACK_CAP, 20);
HEALING_FACTOR.put(EnchantStatsID.HEALING_FACTOR, 1.0f);

ENCHANTMENT_TRIGGER_BASE_CHANCE.put(EnchantmentsID.CHAIN_REACTION, 10);
ENCHANTMENT_TRIGGER_BASE_CHANCE.put(EnchantmentsID.CHAINS, 20);
ENCHANTMENT_TRIGGER_BASE_CHANCE.put(EnchantmentsID.CHARGE, 10);
ENCHANTMENT_TRIGGER_BASE_CHANCE.put(EnchantmentsID.COMMITTED, 30);
ENCHANTMENT_TRIGGER_BASE_CHANCE.put(EnchantmentsID.CRITICAL_HIT, 10);
ENCHANTMENT_TRIGGER_BASE_CHANCE.put(EnchantmentsID.ECHO, 10);
ENCHANTMENT_TRIGGER_BASE_CHANCE.put(EnchantmentsID.EXPLODING, 20);
ENCHANTMENT_TRIGGER_BASE_CHANCE.put(EnchantmentsID.FREEZING, 30);
ENCHANTMENT_TRIGGER_BASE_CHANCE.put(EnchantmentsID.FUSE_SHOT, 20);
ENCHANTMENT_TRIGGER_BASE_CHANCE.put(EnchantmentsID.GRAVITY, 30);
ENCHANTMENT_TRIGGER_BASE_CHANCE.put(EnchantmentsID.POISONING, 30);
ENCHANTMENT_TRIGGER_BASE_CHANCE.put(EnchantmentsID.POISON_CLOUD, 30);
ENCHANTMENT_TRIGGER_BASE_CHANCE.put(EnchantmentsID.PROSPECTOR, 5);
ENCHANTMENT_TRIGGER_BASE_CHANCE.put(EnchantmentsID.RADIANCE, 20);
ENCHANTMENT_TRIGGER_BASE_CHANCE.put(EnchantmentsID.RAMPAGING, 10);
ENCHANTMENT_TRIGGER_BASE_CHANCE.put(EnchantmentsID.REPLENISH, 3);
ENCHANTMENT_TRIGGER_BASE_CHANCE.put(EnchantmentsID.RUSHDOWN, 10);
ENCHANTMENT_TRIGGER_BASE_CHANCE.put(EnchantmentsID.SHADOW_SHOT, 10);
ENCHANTMENT_TRIGGER_BASE_CHANCE.put(EnchantmentsID.SHOCKWAVE, 10);
ENCHANTMENT_TRIGGER_BASE_CHANCE.put(EnchantmentsID.SOUL_SIPHON, 10);
ENCHANTMENT_TRIGGER_BASE_CHANCE.put(EnchantmentsID.STUNNING, 20);
ENCHANTMENT_TRIGGER_BASE_CHANCE.put(EnchantmentsID.SWIRLING, 10);
ENCHANTMENT_TRIGGER_BASE_CHANCE.put(EnchantmentsID.THUNDERING, 20);
ENCHANTMENT_TRIGGER_BASE_CHANCE.put(EnchantmentsID.VOID_SHOT, 25);
ENCHANTMENT_TRIGGER_BASE_CHANCE.put(EnchantmentsID.VOID_STRIKE, 15);
ENCHANTMENT_TRIGGER_BASE_CHANCE.put(EnchantmentsID.WEAKENING, 30);
ENCHANTMENT_TRIGGER_BASE_CHANCE.put(EnchantmentsID.WILD_RAGE, 10);
}
}
Loading

0 comments on commit 202c424

Please sign in to comment.