Skip to content

Commit

Permalink
Fix merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
naomieow committed Jul 30, 2024
2 parents e7f9721 + fad78ec commit fb3dab0
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 81 deletions.
36 changes: 4 additions & 32 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,32 +1,4 @@
## 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 ⚒️
- Resolved spell power attribute addition to the proper percentage.
- Fixed some overlooked dependency issues with mc-publish.
- To use this, delete the previous (data-attributes) config folder (or change spell power based attribute addition in the functions from 0.0# to #.0)
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(Attributes.ATTACK_DAMAGE.id) to FormattingPredicates.NORMAL,
EntityAttributeSupplier(Attributes.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(Attributes.ARMOR.id) to FormattingPredicates.NORMAL,
EntityAttributeSupplier(AdditionalEntityAttributes.MAGIC_PROTECTION.id) to FormattingPredicates.NORMAL,
EntityAttributeSupplier(Attributes.ARMOR_TOUGHNESS.id) to FormattingPredicates.NORMAL,
EntityAttributeSupplier(Attributes.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(Attributes.MOVEMENT_SPEED.id) to FormattingPredicates.NORMAL,
)

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

import com.bibireden.playerex.ui.components.FormattingPredicate
import net.minecraft.world.entity.ai.attributes.Attribute
import kotlin.math.round

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

fun fromBaseValue(attribute: Attribute): 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
21 changes: 11 additions & 10 deletions src/main/java/com/bibireden/playerex/mixin/AbstractArrowMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import net.minecraft.world.level.Level;
import net.minecraft.world.phys.EntityHitResult;
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,6 +20,8 @@

@Mixin(AbstractArrow.class)
public abstract class AbstractArrowMixin extends Projectile {
@Shadow public abstract void setCritArrow(boolean critical);

// Constructor for the mixin class
private AbstractArrowMixin(EntityType<? extends Projectile> entityType, Level level) {
super(entityType, level);
Expand All @@ -27,17 +30,19 @@ private AbstractArrowMixin(EntityType<? extends Projectile> entityType, Level le
@SuppressWarnings("UnreachableCode")
@Inject(method = "onHitEntity", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/projectile/AbstractArrow;isCritArrow()Z"))
private void playerex_onEntityHit(EntityHitResult entityHitResult, CallbackInfo info) {
AbstractArrow projectileEntity = (AbstractArrow)(Object)this;
Entity owner = projectileEntity.getOwner();
AbstractArrow projectileEntity = (AbstractArrow) (Object) this;
Entity entity = projectileEntity.getOwner();

if(owner instanceof LivingEntity) {
if (entity instanceof LivingEntity) {

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

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

Expand All @@ -49,10 +54,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
),
Attributes.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 @@ -93,47 +89,45 @@ object DefaultAttributeImpl {
AttributeFunction(Attributes.ARMOR.id, StackingBehavior.Add, 0.25),
AttributeFunction(AdditionalEntityAttributes.MAGIC_PROTECTION.id, StackingBehavior.Add, 0.25),
AttributeFunction(AdditionalEntityAttributes.LUNG_CAPACITY.id, StackingBehavior.Add, 0.01),
AttributeFunction(PlayerEXAttributes.POISON_RESISTANCE.id, StackingBehavior.Add, 0.1),
AttributeFunction(PlayerEXAttributes.POISON_RESISTANCE.id, StackingBehavior.Add, 0.01),
),
PlayerEXAttributes.STRENGTH.id to listOf(
AttributeFunction(Attributes.ATTACK_DAMAGE.id, StackingBehavior.Multiply, 0.02),
AttributeFunction(Attributes.KNOCKBACK_RESISTANCE.id, StackingBehavior.Add, 0.1),
AttributeFunction(PlayerEXAttributes.MELEE_CRITICAL_DAMAGE.id, StackingBehavior.Multiply, 0.05),
AttributeFunction(Attributes.KNOCKBACK_RESISTANCE.id, StackingBehavior.Add, 0.01),
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(Attributes.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),
AttributeFunction(PlayerEXAttributes.WITHER_RESISTANCE.id, StackingBehavior.Add, 0.01),
// 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))
add(AttributeFunction(ModdedAttributes.SPELL_HASTE.id, StackingBehavior.Add, 2.0))
}
},
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.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),
AttributeFunction(PlayerEXAttributes.HEAL_AMPLIFICATION.id, StackingBehavior.Add, 0.05),
AttributeFunction(PlayerEXAttributes.FREEZE_RESISTANCE.id, StackingBehavior.Add, 0.01),
AttributeFunction(PlayerEXAttributes.LIGHTNING_RESISTANCE.id, StackingBehavior.Add, 0.01),
AttributeFunction(PlayerEXAttributes.FIRE_RESISTANCE.id, StackingBehavior.Add, 0.01),
),
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(Attributes.LUCK.id, StackingBehavior.Add, 0.05),
AttributeFunction(PlayerEXAttributes.EVASION.id, StackingBehavior.Add, 0.01),
).apply {
if (CompatUtils.isModLoaded("spell_power")) {
add(AttributeFunction(ModdedAttributes.SPELL_CRITICAL_CHANCE.id, StackingBehavior.Add, 0.02))
add(AttributeFunction(ModdedAttributes.SPELL_CRITICAL_CHANCE.id, StackingBehavior.Add, 2.0))
}
},
)
Expand All @@ -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
10 changes: 5 additions & 5 deletions src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,13 @@
"curseforge": 958325,
"loaders": ["fabric", "quilt"],
"dependencies": [
"[email protected]+1.20.1(required){modrinth:P7dR8mSH}{curseforge:306612}#(ignore:github)",
"[email protected]+kotlin.1.8.22(required){modrinth:Ha28R6CL}{curseforge:308769}#(ignore:github)",
"[email protected]+1.20.1-fabric(required){modrinth:KCGxOJsE}{curseforge:955929}#(ignore:github)",
"fabric-api@>=0.92.2+1.20.1(required){modrinth:P7dR8mSH}{curseforge:306612}#(ignore:github)",
"fabric-language-kotlin@>=1.9.5+kotlin.1.8.22(required){modrinth:Ha28R6CL}{curseforge:308769}#(ignore:github)",
"data-attributes-directors-cut@>=2.0.0-beta.7+1.20.1-fabric(required){modrinth:KCGxOJsE}{curseforge:955929}#(ignore:github)",
"[email protected](required){modrinth:ccKDOlHs}{curseforge:532610}#(ignore:github)",
"[email protected]+1.20.1(required){modrinth:AqaIIO6D}{curseforge:962162}#(ignore:github)",
"ranged_weapon_api@>=1.1.0+1.20.1(required){modrinth:AqaIIO6D}{curseforge:962162}#(ignore:github)",
"[email protected](embedded){modrinth:K01OU20C}{curseforge:318449}#(ignore:github)",
"[email protected]+1.20.1(optional){modrinth:XvoWJaA2}{curseforge:807653}#(ignore:github)"
"spell-engine@>=0.15.8+1.20.1(optional){modrinth:XvoWJaA2}{curseforge:807653}#(ignore:github)"
]
}
}
Expand Down

0 comments on commit fb3dab0

Please sign in to comment.