diff --git a/CHANGELOG.md b/CHANGELOG.md index 2baa0c47..f2e296dd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,15 +1,5 @@ -## Changelog +# Changelog -### Dependencies +## 🔨 Fixes -- Comes embedded (jar-in-jar) with [Ranged Weapon API](https://github.com/FabricExtras/RangedWeaponAPI) `1.1.0+1.20.1-fabric`. - -### Gameplay - -+ Added support for [Ranged Weapon API](https://github.com/FabricExtras/RangedWeaponAPI). This is considered a **breaking change**, and removes the original Projectile Damage Attribute. - -+ Removed stdout logging of damage (possible console clutter). - -+ Some translations are missing, if you are knowledgeable in a certain language, please send a PR or present your interest! - -+ Oops, forgot to include the Ranged Weapon API... should be fixed now. \ No newline at end of file +- Resolved damage that goes to `Infinity`, or are `NaN` which would have been applied to the `playerex:lifesteal` attribute, and corrupted its value. \ No newline at end of file diff --git a/build.gradle b/build.gradle index fdb76aac..7cb107c4 100644 --- a/build.gradle +++ b/build.gradle @@ -37,42 +37,42 @@ repositories { } } maven { - name = "Cursemaven" - url = "https://cursemaven.com" - } + name = "Cursemaven" + url = "https://cursemaven.com" + } } dependencies { minecraft "com.mojang:minecraft:${project.minecraft_version}" mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2" - + modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" - + modImplementation "maven.modrinth:data-attributes-directors-cut:${project.dataattributes_version}" - - modImplementation "maven.modrinth:opc-directors-cut:${project.opc_dc_version}" - include "maven.modrinth:opc-directors-cut:${project.opc_dc_version}" - - modImplementation "dev.onyxstudios.cardinal-components-api:cardinal-components-base:${project.cardinal_components_version}" - include "dev.onyxstudios.cardinal-components-api:cardinal-components-base:${project.cardinal_components_version}" - modImplementation "dev.onyxstudios.cardinal-components-api:cardinal-components-entity:${project.cardinal_components_version}" - include "dev.onyxstudios.cardinal-components-api:cardinal-components-entity:${project.cardinal_components_version}" + + modImplementation "maven.modrinth:opc-directors-cut:${project.opc_dc_version}" + include "maven.modrinth:opc-directors-cut:${project.opc_dc_version}" + + modImplementation "dev.onyxstudios.cardinal-components-api:cardinal-components-base:${project.cardinal_components_version}" + include "dev.onyxstudios.cardinal-components-api:cardinal-components-base:${project.cardinal_components_version}" + modImplementation "dev.onyxstudios.cardinal-components-api:cardinal-components-entity:${project.cardinal_components_version}" + include "dev.onyxstudios.cardinal-components-api:cardinal-components-entity:${project.cardinal_components_version}" modImplementation "dev.onyxstudios.cardinal-components-api:cardinal-components-chunk:${project.cardinal_components_version}" - include "dev.onyxstudios.cardinal-components-api:cardinal-components-chunk:${project.cardinal_components_version}" - + include "dev.onyxstudios.cardinal-components-api:cardinal-components-chunk:${project.cardinal_components_version}" + modApi("me.shedaniel.cloth:cloth-config-fabric:${project.cloth_config_version}") { exclude(group: "net.fabricmc.fabric-api") } - + modImplementation("com.terraformersmc:modmenu:${project.modmenu_version}") { exclude(group: "net.fabricmc.fabric-api") } - + modImplementation include("eu.pb4:placeholder-api:${project.placeholder_api}") + + modImplementation include("maven.modrinth:ranged-weapon-api:${project.ranged_weapon_api_version}") - modImplementation include("maven.modrinth:ranged-weapon-api:${project.ranged_weapon_api_version}") - implementation 'net.objecthunter:exp4j:0.4.8' include 'net.objecthunter:exp4j:0.4.8' } @@ -122,8 +122,8 @@ publishing { from components.java } } - + repositories { - + } } \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 07ddc256..69aa6c92 100644 --- a/gradle.properties +++ b/gradle.properties @@ -8,7 +8,7 @@ loader_version=0.15.11 #Fabric api fabric_version=0.92.1+1.20.1 -mod_version = 3.7.0+1.20.1 +mod_version = 3.7.1+1.20.1 maven_group = com.github.clevernucleus archives_base_name = playerex diff --git a/src/main/java/com/github/clevernucleus/playerex/factory/EventFactory.java b/src/main/java/com/github/clevernucleus/playerex/factory/EventFactory.java index 4ecd0843..26e9f1dd 100644 --- a/src/main/java/com/github/clevernucleus/playerex/factory/EventFactory.java +++ b/src/main/java/com/github/clevernucleus/playerex/factory/EventFactory.java @@ -10,6 +10,7 @@ import net.minecraft.entity.Entity; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.attribute.EntityAttribute; +import net.minecraft.entity.attribute.EntityAttributes; import net.minecraft.entity.damage.DamageSource; import net.minecraft.entity.effect.StatusEffects; import net.minecraft.entity.player.PlayerEntity; @@ -81,12 +82,19 @@ public static boolean shouldDamage(final LivingEntity livingEntity, final Damage Entity origin = source.getSource(); Entity attacker = source.getAttacker(); - if (attacker instanceof LivingEntity - && (origin instanceof LivingEntity || origin instanceof PersistentProjectileEntity)) { + if (attacker instanceof LivingEntity && (origin instanceof LivingEntity || origin instanceof PersistentProjectileEntity)) { LivingEntity user = (LivingEntity) attacker; - DataAttributesAPI.ifPresent(user, ExAPI.LIFESTEAL, (Object) null, value -> { - user.heal((float) (original * value * 10.0)); - return (Object) null; + DataAttributesAPI.ifPresent(user, ExAPI.LIFESTEAL, null, value -> { + if (value != 0.0F) { + if (Float.isNaN(original) || original >= user.getMaxHealth()) { + user.heal(user.getMaxHealth()); + } + else { + double evaluated = original * value * 10.0; + user.heal((float) evaluated); + } + } + return null; }); }