Update to LibJF 3

This commit is contained in:
Johannes Frohnmeyer 2022-08-28 15:21:37 +02:00
parent ef6b31b8fb
commit 74879cadb4
Signed by: Johannes
GPG Key ID: E76429612C2929F4
5 changed files with 43 additions and 42 deletions

View File

@ -1,11 +1,11 @@
apply from: "https://jfmods.gitlab.io/scripts/jfmod.gradle" apply from: "https://jfmods.gitlab.io/scripts/gradle/v2.gradle"
dependencies { dependencies {
modImplementation("io.gitlab.jfronny.libjf:libjf-config-v0:${project.jfapi_version}") modImplementation("io.gitlab.jfronny.libjf:libjf-config-core-v1:${project.libjf_version}")
// modRuntimeOnly("io.gitlab.jfronny.libjf:libjf-devutil-v0:${project.jfapi_version}")
modImplementation "com.terraformersmc:modmenu:4.0.5" // Dev env
modLocalRuntime("io.gitlab.jfronny.libjf:libjf-config-reflect-v1:${project.libjf_version}")
// Compat fix modLocalRuntime("io.gitlab.jfronny.libjf:libjf-config-ui-tiny-v1:${project.libjf_version}")
include modImplementation(fabricApi.module("fabric-command-api-v2", "${project.fabric_version}")) modLocalRuntime("io.gitlab.jfronny.libjf:libjf-devutil:${project.libjf_version}")
modLocalRuntime("com.terraformersmc:modmenu:4.0.6")
} }

View File

@ -7,7 +7,7 @@ maven_group=io.gitlab.jfronny
archives_base_name=combit archives_base_name=combit
fabric_version=0.60.0+1.19.2 fabric_version=0.60.0+1.19.2
jfapi_version=2.10.0 libjf_version=3.0.3
modrinth_id=combit modrinth_id=combit
modrinth_required_dependencies=libjf modrinth_required_dependencies=libjf

View File

@ -1,46 +1,47 @@
package io.gitlab.jfronny.combit; package io.gitlab.jfronny.combit;
import io.gitlab.jfronny.libjf.config.api.Entry; import io.gitlab.jfronny.libjf.config.api.v1.*;
import io.gitlab.jfronny.libjf.config.api.JfConfig;
import io.gitlab.jfronny.libjf.config.api.Preset;
import io.gitlab.jfronny.libjf.config.api.Verifier;
import net.fabricmc.loader.api.FabricLoader; import net.fabricmc.loader.api.FabricLoader;
import net.minecraft.entity.damage.DamageSource;
import java.util.HashSet; import java.util.HashSet;
public class CombitConfig implements JfConfig { @JfConfig
public class CombitConfig {
// Invulnerability // Invulnerability
@Entry public static Integer iFrameInterval = -1; @Entry public static int iFrameInterval = -1;
@Entry(min=-1, max = 1) public static Double attackCancelThreshold = -1d; @Entry(min=-1, max = 1) public static double attackCancelThreshold = -1d;
@Entry(min=-1, max = 1) public static Double knockbackCancelThreshold = -1d; @Entry(min=-1, max = 1) public static double knockbackCancelThreshold = -1d;
@Entry public static HashSet<String> attackerWhitelist = null; @Entry public static HashSet<String> attackerWhitelist = null;
@Entry public static HashSet<String> damageSourceWhitelist = null; @Entry public static HashSet<String> damageSourceWhitelist = null;
@Entry public static HashSet<String> targetEntityWhitelist = null; @Entry public static HashSet<String> targetEntityWhitelist = null;
@Entry public static Boolean excludeAllMobs = false; @Entry public static boolean excludeAllMobs = false;
@Entry public static Boolean excludePlayers = false; @Entry public static boolean excludePlayers = false;
// Entity Modification // Entity Modification
@Entry public static Boolean skeletonsBurn = true; @Entry public static boolean skeletonsBurn = true;
@Entry public static Boolean zombiesBurn = true; @Entry public static boolean zombiesBurn = true;
@Entry public static Boolean creepersBurn = false; @Entry public static boolean creepersBurn = false;
@Entry public static Boolean creepersExplodeWhenBurning = false; @Entry public static boolean creepersExplodeWhenBurning = false;
@Entry public static Boolean alwaysBurn = false; @Entry public static boolean alwaysBurn = false;
// Health // Health
@Entry public static Double entityHealthFactor = 1.5; @Entry public static double entityHealthFactor = 1.5;
@Entry public static HashSet<String> entityHealthBlacklist = null; @Entry public static HashSet<String> entityHealthBlacklist = null;
// Weapons // Weapons
@Entry public static Double cooldownProgressOverride = -1d; @Entry public static float cooldownProgressOverride = -1f;
@Entry public static Double cooldownProgressPerTickOverride = -1d; @Entry public static float cooldownProgressPerTickOverride = -1f;
@Entry public static Double weaponAttackDamageFactor = 1d; @Entry public static double weaponAttackDamageFactor = 1d;
@Entry public static Double axeAttackDamageFactor = 1d; @Entry public static double axeAttackDamageFactor = 1d;
// Knockback // Knockback
@Entry public static Double snowballKnockbackFactor = 0d; @Entry public static double snowballKnockbackFactor = 0d;
@Entry public static Float snowballDamage = 0f; @Entry public static float snowballDamage = 0f;
@Entry public static Double eggKnockbackFactor = 0d; @Entry public static double eggKnockbackFactor = 0d;
@Entry public static Float eggDamage = 0f; @Entry public static float eggDamage = 0f;
@Entry public static Double fishingBobberPullFactor = 1d; @Entry public static double fishingBobberPullFactor = 1d;
// Debug // Debug
@Entry public static Boolean debug = FabricLoader.getInstance().isDevelopmentEnvironment(); @Entry public static boolean debug = FabricLoader.getInstance().isDevelopmentEnvironment();
static {
validate();
}
@Verifier public static void validate() { @Verifier public static void validate() {
if (attackerWhitelist == null) { if (attackerWhitelist == null) {
@ -87,8 +88,8 @@ public class CombitConfig implements JfConfig {
alwaysBurn = false; alwaysBurn = false;
entityHealthFactor = 1.0; entityHealthFactor = 1.0;
entityHealthBlacklist = null; entityHealthBlacklist = null;
cooldownProgressOverride = 0.8; cooldownProgressOverride = 0.8f;
cooldownProgressPerTickOverride = Double.MIN_VALUE; cooldownProgressPerTickOverride = Float.MIN_VALUE;
weaponAttackDamageFactor = 1d; weaponAttackDamageFactor = 1d;
axeAttackDamageFactor = 0.5; axeAttackDamageFactor = 0.5;
snowballKnockbackFactor = 1d; snowballKnockbackFactor = 1d;
@ -114,8 +115,8 @@ public class CombitConfig implements JfConfig {
alwaysBurn = true; alwaysBurn = true;
entityHealthFactor = 10d; entityHealthFactor = 10d;
entityHealthBlacklist = null; entityHealthBlacklist = null;
cooldownProgressOverride = 1d; cooldownProgressOverride = 1f;
cooldownProgressPerTickOverride = Double.MAX_VALUE; cooldownProgressPerTickOverride = Float.MAX_VALUE;
weaponAttackDamageFactor = 0.5; weaponAttackDamageFactor = 0.5;
axeAttackDamageFactor = 5d; axeAttackDamageFactor = 5d;
snowballKnockbackFactor = -1d; snowballKnockbackFactor = -1d;

View File

@ -34,14 +34,14 @@ public class PlayerEntityMixin {
@Inject(at = @At("HEAD"), method = "getAttackCooldownProgress(F)F", cancellable = true) @Inject(at = @At("HEAD"), method = "getAttackCooldownProgress(F)F", cancellable = true)
public void getAttackCooldownProgress(float baseTime, CallbackInfoReturnable<Float> info) { public void getAttackCooldownProgress(float baseTime, CallbackInfoReturnable<Float> info) {
if (CombitConfig.cooldownProgressOverride >= 0) { if (CombitConfig.cooldownProgressOverride >= 0) {
info.setReturnValue(CombitConfig.cooldownProgressOverride.floatValue()); info.setReturnValue(CombitConfig.cooldownProgressOverride);
} }
} }
@Inject(at = @At("HEAD"), method = "getAttackCooldownProgressPerTick()F", cancellable = true) @Inject(at = @At("HEAD"), method = "getAttackCooldownProgressPerTick()F", cancellable = true)
public void getAttackCooldownProgressPerTick(CallbackInfoReturnable<Float> info) { public void getAttackCooldownProgressPerTick(CallbackInfoReturnable<Float> info) {
if (CombitConfig.cooldownProgressPerTickOverride >= 0) { if (CombitConfig.cooldownProgressPerTickOverride >= 0) {
info.setReturnValue(CombitConfig.cooldownProgressPerTickOverride.floatValue()); info.setReturnValue(CombitConfig.cooldownProgressPerTickOverride);
} }
} }
} }

View File

@ -29,6 +29,6 @@
"depends": { "depends": {
"fabricloader": ">=0.12.12", "fabricloader": ">=0.12.12",
"minecraft": "*", "minecraft": "*",
"libjf-config-v0": ">=2.7.2" "libjf-config-core-v1": ">=3.0.0"
} }
} }