Skip to content

Commit

Permalink
3.7.1+1.20.1-fabric (#15)
Browse files Browse the repository at this point in the history
* Initialize 3.6.2 w/ dependency updates

* 3.7.0+1.20.1 staging

* Integrate new Ranged Weapon API

* Resolve build issues

* Apply lifesteal fix for `Infinity` & `NaN` unexpected values

* x

* Stage CL
  • Loading branch information
bibi-reden authored May 19, 2024
1 parent 0752375 commit 5e2d6ad
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 40 deletions.
16 changes: 3 additions & 13 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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.
- Resolved damage that goes to `Infinity`, or are `NaN` which would have been applied to the `playerex:lifesteal` attribute, and corrupted its value.
42 changes: 21 additions & 21 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
}
Expand Down Expand Up @@ -122,8 +122,8 @@ publishing {
from components.java
}
}

repositories {

}
}
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
});
}

Expand Down

0 comments on commit 5e2d6ad

Please sign in to comment.