Skip to content

Commit

Permalink
AEA update, hopefully adjusted values? alpha-2 forcepush
Browse files Browse the repository at this point in the history
  • Loading branch information
bibi-reden committed Jul 30, 2024
1 parent f648a7b commit ee9f000
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 76 deletions.
37 changes: 5 additions & 32 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,32 +1,5 @@
## Major Note ⚠️
This is an **alpha** build of PlayerEX.
Therefore, you should take precaution when playing.
While I have personally tested the mod multiple times with several mods,
there is a possibility of any kind of issue.

## Additions ☕
- Rewrote the entire PlayerEX mod.
- Added a new UI screen with owo-lib (thanks guys) (that is extendable, more details in the future). Default keybinding is `-` (minus).
- **WE ARE FREE FROM SINGLE, LONG-DEBOUNCED INPUTS!** feel free to hammer at that button or put in a specific amount that is within range.
- Tooltips have been added to specific areas in the UI. Discover these as you play.
- For those eager, see `PlayerEXMenuRegistry`.
- Redesigned config with owo-lib (thanks guys x2)
- Redid Brigadier commands, more info on that in the future. For now note that you can access it still by using `/playerex`.
- Diminishing attributes are currently managed by its provided `smoothness` from DataAttributes.
- In order to change smoothness and other values, open up the config using `/owo-config data_attributes` or accessing through ModMenu.
- As of now, they are currently set to 1 until balancing in future update(s) can occur. Set it lower to have less from the applied modifiers on the attribute.
- Added onto a player's nameplate their current level. This can be disabled via config.

## Changes ⚙️
- Improved general stability of the mod.
- Changed all sounds to be a bit more pleasing and attentive.
- Modified **all** mixins in the mod to be more compatible with other mod(s). [this includes data-attributes]


## Removals 🚫
- Removed `reach-entity-attribute` due to issues. Due to the nature of reach being hard-coded in this version, it's relatively challenging to gauge. A substitute will be present on the UI in later version(s).

## Afterword ✒️
This took a lot of blood, sweat and tears to make. But there might be issues! Certain things need to be ironed out (primarily the diminishing factor, and making DataAttributes ui easier to work with).
Report issues of game-breaking proportion, or supposedly incorrect values to our issues page.
If something does not scale well, try adjusting the function(s) in the config or adjusting the diminishing amount.
## Fixes ⚒️
- Most if not all values should display properly now, there were incorrect calculations.
- Applied the proper ranged damage to the screen and removed a useless playerex specific ranged attribute.
- Updated AdditionalEntityAttributes
- Resolved values to be what was intended. To use this, delete the previous (data-attributes) config folder.
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ loom_version=1.7-SNAPSHOT


# Mod Properties
mod_version=4.0.0-alpha.1+1.20.1
mod_version=4.0.0-alpha.2+1.20.1
maven_group=com.bibireden.playerex
archives_base_name=playerex-directors-cut

# Dependencies
fabric_version=0.92.2+1.20.1
cardinal_components_version=5.2.2
additional_entity_attributes_version=1.7.0+1.20.0
additional_entity_attributes_version=1.7.4+1.20.0
all_the_trims_version=3.4.2
placeholder_api_version=2.1.1+1.20
ranged_weapon_api_version=1.1.2+1.20.1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,29 +34,29 @@ class PlayerEXAttributesMenu : MenuComponent(algorithm = Algorithm.HORIZONTAL) {
private val MELEE_COMBAT_STATS: List<Pair<EntityAttributeSupplier, FormattingPredicate>> = listOf(
EntityAttributeSupplier(EntityAttributes.GENERIC_ATTACK_DAMAGE.id) to FormattingPredicates.NORMAL,
EntityAttributeSupplier(EntityAttributes.GENERIC_ATTACK_SPEED.id) to FormattingPredicates.NORMAL,
EntityAttributeSupplier(PlayerEXAttributes.MELEE_CRITICAL_DAMAGE.id) to FormattingPredicates.PERCENTAGE_DIVIDE,
EntityAttributeSupplier(PlayerEXAttributes.MELEE_CRITICAL_CHANCE.id) to FormattingPredicates.PERCENTAGE_DIVIDE
EntityAttributeSupplier(PlayerEXAttributes.MELEE_CRITICAL_DAMAGE.id) to FormattingPredicates.PERCENTAGE_MULTIPLY,
EntityAttributeSupplier(PlayerEXAttributes.MELEE_CRITICAL_CHANCE.id) to FormattingPredicates.PERCENTAGE_MULTIPLY,
)

private val RANGED_COMBAT_STATS: List<Pair<EntityAttributeSupplier, FormattingPredicate>> = listOf(
EntityAttributeSupplier(PlayerEXAttributes.RANGED_DAMAGE.id) to FormattingPredicates.NORMAL,
EntityAttributeSupplier(PlayerEXAttributes.RANGED_CRITICAL_DAMAGE.id) to FormattingPredicates.PERCENTAGE_DIVIDE,
EntityAttributeSupplier(PlayerEXAttributes.RANGED_CRITICAL_CHANCE.id) to FormattingPredicates.PERCENTAGE_DIVIDE,
EntityAttributeSupplier(PlayerEXAttributes.RANGED_CRITICAL_DAMAGE.id) to FormattingPredicates.PERCENTAGE_MULTIPLY,
EntityAttributeSupplier(PlayerEXAttributes.RANGED_CRITICAL_CHANCE.id) to FormattingPredicates.PERCENTAGE_MULTIPLY,
EntityAttributeSupplier(EntityAttributes_RangedWeapon.HASTE.id) to FormattingPredicates.fromBaseValue(EntityAttributes_RangedWeapon.HASTE.attribute),
EntityAttributeSupplier(EntityAttributes_RangedWeapon.DAMAGE.id) to FormattingPredicates.NORMAL,
)

private val DEFENSE_COMBAT_STATS: List<Pair<EntityAttributeSupplier, FormattingPredicate>> = listOf(
EntityAttributeSupplier(EntityAttributes.GENERIC_ARMOR.id) to FormattingPredicates.NORMAL,
EntityAttributeSupplier(AdditionalEntityAttributes.MAGIC_PROTECTION.id) to FormattingPredicates.NORMAL,
EntityAttributeSupplier(EntityAttributes.GENERIC_ARMOR_TOUGHNESS.id) to FormattingPredicates.NORMAL,
EntityAttributeSupplier(EntityAttributes.GENERIC_KNOCKBACK_RESISTANCE.id) to FormattingPredicates.PERCENTAGE_DIVIDE,
EntityAttributeSupplier(PlayerEXAttributes.EVASION.id) to FormattingPredicates.PERCENTAGE_DIVIDE,
EntityAttributeSupplier(PlayerEXAttributes.EVASION.id) to FormattingPredicates.PERCENTAGE_MULTIPLY,
)

private val VITALITY_STATS: List<Pair<EntityAttributeSupplier, FormattingPredicate>> = listOf(
EntityAttributeSupplier(PlayerEXAttributes.HEALTH_REGENERATION.id) to FormattingPredicates.NORMAL,
EntityAttributeSupplier(PlayerEXAttributes.HEAL_AMPLIFICATION.id) to FormattingPredicates.NORMAL,
EntityAttributeSupplier(PlayerEXAttributes.LIFESTEAL.id) to FormattingPredicates.PERCENTAGE_DIVIDE,
EntityAttributeSupplier(PlayerEXAttributes.HEALTH_REGENERATION.id) to FormattingPredicates.PERCENTAGE_MULTIPLY,
EntityAttributeSupplier(PlayerEXAttributes.HEAL_AMPLIFICATION.id) to FormattingPredicates.PERCENTAGE_MULTIPLY,
EntityAttributeSupplier(PlayerEXAttributes.LIFESTEAL.id) to FormattingPredicates.PERCENTAGE_MULTIPLY,
EntityAttributeSupplier(EntityAttributes.GENERIC_MOVEMENT_SPEED.id) to FormattingPredicates.NORMAL,
)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package com.bibireden.playerex.ui.util

import com.bibireden.data_attributes.ext.round
import com.bibireden.playerex.ui.components.FormattingPredicate
import net.minecraft.entity.attribute.EntityAttribute
import kotlin.math.round

object FormattingPredicates {
val NORMAL: FormattingPredicate = { "%.2f".format(it) }
Expand All @@ -11,7 +13,7 @@ object FormattingPredicates {

fun fromBaseValue(attribute: EntityAttribute): FormattingPredicate {
return {
val result = it - attribute.defaultValue
val result = round(it - attribute.defaultValue).toInt()
var text = "$result"
if (result > 0) text = "+$result"
text + "%"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import net.minecraft.util.hit.EntityHitResult;
import net.minecraft.world.World;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.ModifyArg;
Expand All @@ -19,25 +20,17 @@

@Mixin(PersistentProjectileEntity.class)
public abstract class PersistentProjectileEntityMixin extends ProjectileEntity {
@Shadow public abstract void setCritical(boolean critical);

// Constructor for the mixin class
private PersistentProjectileEntityMixin(EntityType<? extends ProjectileEntity> entityType, World world) {
super(entityType, world);
}

@SuppressWarnings("UnreachableCode")
@Inject(method = "onEntityHit", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/projectile/PersistentProjectileEntity;isCritical()Z"))
private void playerex_onEntityHit(EntityHitResult entityHitResult, CallbackInfo info) {
PersistentProjectileEntity persistentProjectileEntity = (PersistentProjectileEntity)(Object)this;
Entity owner = persistentProjectileEntity.getOwner();

if(owner instanceof LivingEntity) {

Optional<Double> rangedCritChanceOptional = DataAttributesAPI.getValue(PlayerEXAttributes.RANGED_CRITICAL_CHANCE, (LivingEntity)owner);

if (rangedCritChanceOptional.isPresent())
{
persistentProjectileEntity.setCritical(false);
}
if (this.getOwner() instanceof LivingEntity owner) {
DataAttributesAPI.getValue(PlayerEXAttributes.RANGED_CRITICAL_CHANCE, owner).ifPresent((chance) -> this.setCritical(false));
}
}

Expand All @@ -49,10 +42,6 @@ private float playerex_onEntityHit(float i) {
double damage = i;

if(owner instanceof LivingEntity livingEntity) {
Optional<Double> damageOptional = DataAttributesAPI.getValue(PlayerEXAttributes.RANGED_DAMAGE, livingEntity);

damage = damageOptional.isPresent() ? damageOptional.get() + i : i;

final double amount = damage;

Optional<Double> rangedCritOptional = DataAttributesAPI.getValue(PlayerEXAttributes.RANGED_CRITICAL_CHANCE, livingEntity);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@ object DefaultAttributeImpl {
smoothness = 1.0,
formula = StackingFormula.Diminished
),
EntityAttributes.GENERIC_ATTACK_SPEED.id to AttributeOverride(
smoothness = 1.0,
formula = StackingFormula.Diminished
),
PlayerEXAttributes.RANGED_CRITICAL_DAMAGE.id to AttributeOverride(
smoothness = 1.0,
formula = StackingFormula.Diminished
Expand Down Expand Up @@ -98,36 +94,34 @@ object DefaultAttributeImpl {
PlayerEXAttributes.STRENGTH.id to listOf(
AttributeFunction(EntityAttributes.GENERIC_ATTACK_DAMAGE.id, StackingBehavior.Multiply, 0.02),
AttributeFunction(EntityAttributes.GENERIC_KNOCKBACK_RESISTANCE.id, StackingBehavior.Add, 0.1),
AttributeFunction(PlayerEXAttributes.MELEE_CRITICAL_DAMAGE.id, StackingBehavior.Multiply, 0.05),
AttributeFunction(PlayerEXAttributes.MELEE_CRITICAL_DAMAGE.id, StackingBehavior.Add, 0.005),
AttributeFunction(PlayerEXAttributes.BREAKING_SPEED.id, StackingBehavior.Add, 0.01),
),
PlayerEXAttributes.DEXTERITY.id to listOf(
AttributeFunction(EntityAttributes.GENERIC_ATTACK_SPEED.id, StackingBehavior.Multiply, 0.01),
AttributeFunction(PlayerEXAttributes.RANGED_DAMAGE.id, StackingBehavior.Multiply, 0.02),
AttributeFunction(PlayerEXAttributes.RANGED_CRITICAL_DAMAGE.id, StackingBehavior.Multiply, 0.05),
AttributeFunction(PlayerEXAttributes.RANGED_CRITICAL_DAMAGE.id, StackingBehavior.Add, 0.005),
AttributeFunction(EntityAttributes_RangedWeapon.HASTE.id, StackingBehavior.Multiply, 0.02),
AttributeFunction(EntityAttributes_RangedWeapon.DAMAGE.id, StackingBehavior.Multiply, 0.1),
AttributeFunction(EntityAttributes_RangedWeapon.DAMAGE.id, StackingBehavior.Multiply, 0.02),
),
PlayerEXAttributes.INTELLIGENCE.id to mutableListOf(
AttributeFunction(AdditionalEntityAttributes.DROPPED_EXPERIENCE.id, StackingBehavior.Multiply, 0.01),
AttributeFunction(PlayerEXAttributes.WITHER_RESISTANCE.id, StackingBehavior.Add, 0.1),
// todo: max mana? (see archon)
// todo: enchanting power? (see zenith)
).apply {
if (CompatUtils.isModLoaded("spell_power")) {
add(AttributeFunction(ModdedAttributes.SPELL_HASTE.id, StackingBehavior.Add, 0.002))
}
},
PlayerEXAttributes.FOCUS.id to listOf(
AttributeFunction(PlayerEXAttributes.HEALTH_REGENERATION.id, StackingBehavior.Add, 0.01),
AttributeFunction(PlayerEXAttributes.HEAL_AMPLIFICATION.id, StackingBehavior.Multiply, 0.05),
AttributeFunction(PlayerEXAttributes.HEAL_AMPLIFICATION.id, StackingBehavior.Add, 0.05),
AttributeFunction(PlayerEXAttributes.FREEZE_RESISTANCE.id, StackingBehavior.Add, 0.1),
AttributeFunction(PlayerEXAttributes.LIGHTNING_RESISTANCE.id, StackingBehavior.Add, 0.1),
AttributeFunction(PlayerEXAttributes.FIRE_RESISTANCE.id, StackingBehavior.Add, 0.1),
),
PlayerEXAttributes.LUCKINESS.id to mutableListOf(
AttributeFunction(PlayerEXAttributes.MELEE_CRITICAL_CHANCE.id, StackingBehavior.Multiply, 0.02),
AttributeFunction(PlayerEXAttributes.RANGED_CRITICAL_CHANCE.id, StackingBehavior.Multiply, 0.02),
AttributeFunction(PlayerEXAttributes.MELEE_CRITICAL_CHANCE.id, StackingBehavior.Add, 0.02),
AttributeFunction(PlayerEXAttributes.RANGED_CRITICAL_CHANCE.id, StackingBehavior.Add, 0.02),
// loot table chance?? wh-
AttributeFunction(EntityAttributes.GENERIC_LUCK.id, StackingBehavior.Add, 0.05),
AttributeFunction(PlayerEXAttributes.EVASION.id, StackingBehavior.Add, 0.01),
Expand Down Expand Up @@ -156,7 +150,6 @@ object DefaultAttributeImpl {
PlayerEXAttributes.MELEE_CRITICAL_CHANCE.id to 0.0,
PlayerEXAttributes.RANGED_CRITICAL_DAMAGE.id to 0.0,
PlayerEXAttributes.RANGED_CRITICAL_CHANCE.id to 0.0,
PlayerEXAttributes.RANGED_DAMAGE.id to 0.0,
PlayerEXAttributes.FIRE_RESISTANCE.id to 0.0,
PlayerEXAttributes.FREEZE_RESISTANCE.id to 0.0,
PlayerEXAttributes.LIGHTNING_RESISTANCE.id to 0.0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,6 @@ object PlayerEXAttributes {
@JvmField
val EVASION = register("evasion", 0.0, 0.0, 100.0);

@JvmField
val RANGED_DAMAGE = register("ranged_damage", 0.0, 0.0, 1000000.0)

@JvmField
val RANGED_CRITICAL_CHANCE = register("ranged_crit_chance", 0.0, 0.0, 1.0)

Expand Down

0 comments on commit ee9f000

Please sign in to comment.