Combit/src/main/java/io/gitlab/jfronny/combit/CombitConfig.java

106 lines
4.3 KiB
Java

package io.gitlab.jfronny.combit;
import io.gitlab.jfronny.libjf.config.api.*;
import net.fabricmc.loader.api.FabricLoader;
import net.minecraft.entity.damage.DamageSource;
import java.util.HashSet;
public class CombitConfig implements JfConfig {
// Invulnerability
@Entry public static Integer iFrameInterval = 0;
@Entry(min=Double.MIN_VALUE, max = 1) public static Double attackCancelThreshold = 0.1;
@Entry(min=Double.MIN_VALUE, max = 1) public static Double knockbackCancelThreshold = 0.75;
@Entry public static HashSet<String> attackerWhitelist = null;
@Entry public static HashSet<String> damageSourceWhitelist = null;
@Entry public static HashSet<String> targetEntityWhitelist = null;
@Entry public static Boolean excludeAllMobs = false;
@Entry public static Boolean excludePlayers = false;
// Health
@Entry public static Double entityHealthFactor = 1.5;
@Entry public static HashSet<String> entityHealthBlacklist = null;
// Weapons
@Entry public static Double cooldownProgressOverride = 0.8;
@Entry public static Double cooldownProgressPerTickOverride = Double.MIN_VALUE;
@Entry public static Double weaponAttackDamageFactor = 0.6;
@Entry public static Double axeAttackDamageFactor = 0.5;
// Knockback
@Entry public static Double snowballKnockbackFactor = -1.0;
@Entry public static Float snowballDamage = 1.0f;
@Entry public static Double eggKnockbackFactor = -1.0;
@Entry public static Float eggDamage = 1.0f;
@Entry public static Double fishingBobberPullFactor = 2.0;
// Debug
@Entry public static Boolean debug = FabricLoader.getInstance().isDevelopmentEnvironment();
@Verifier public static void validate() {
if (attackerWhitelist == null) {
attackerWhitelist = new HashSet<>();
attackerWhitelist.add("minecraft:slime");
attackerWhitelist.add("minecraft:magma_cube");
attackerWhitelist.add("tconstruct:blueslime");
attackerWhitelist.add("thaumcraft:thaumslime");
}
if (targetEntityWhitelist == null) {
targetEntityWhitelist = new HashSet<>();
}
if (damageSourceWhitelist == null) {
damageSourceWhitelist = new HashSet<>();
damageSourceWhitelist.add(DamageSource.IN_FIRE.getName());
damageSourceWhitelist.add(DamageSource.LIGHTNING_BOLT.getName());
damageSourceWhitelist.add(DamageSource.LAVA.getName());
damageSourceWhitelist.add(DamageSource.HOT_FLOOR.getName());
damageSourceWhitelist.add(DamageSource.IN_WALL.getName());
damageSourceWhitelist.add(DamageSource.CACTUS.getName());
damageSourceWhitelist.add(DamageSource.OUT_OF_WORLD.getName());
damageSourceWhitelist.add(DamageSource.SWEET_BERRY_BUSH.getName());
}
if (entityHealthBlacklist == null) {
entityHealthBlacklist = new HashSet<>();
entityHealthBlacklist.add("minecraft:player");
}
}
@Preset public static void v189() {
iFrameInterval = -1;
attackCancelThreshold = 0.1;
knockbackCancelThreshold = 0.75;
attackerWhitelist = null;
damageSourceWhitelist = null;
targetEntityWhitelist = null;
excludeAllMobs = false;
excludePlayers = false;
entityHealthFactor = 1.0;
entityHealthBlacklist = null;
cooldownProgressOverride = 0.8;
cooldownProgressPerTickOverride = Double.MIN_VALUE;
weaponAttackDamageFactor = 1.0;
axeAttackDamageFactor = 0.5;
snowballKnockbackFactor = 1.0;
snowballDamage = 0.0f;
eggKnockbackFactor = 1.0;
eggDamage = 0.0f;
fishingBobberPullFactor = 1.0;
}
@Preset public static void noInvulnerability() {
iFrameInterval = 0;
}
@Preset public static void disable() {
iFrameInterval = -1;
excludeAllMobs = true;
excludePlayers = true;
entityHealthFactor = 1.0;
cooldownProgressOverride = -1.0;
cooldownProgressPerTickOverride = -1.0;
weaponAttackDamageFactor = 1.0;
axeAttackDamageFactor = 1.0;
snowballKnockbackFactor = 0.0;
snowballDamage = 0f;
eggKnockbackFactor = 0.0;
eggDamage = 0.0f;
fishingBobberPullFactor = 1.0;
}
}