Skip to content

Commit

Permalink
Fix Fire Resistance (#21)
Browse files Browse the repository at this point in the history
* Update readme

* Apply proper fire resistance

* Stage update
  • Loading branch information
bibi-reden authored Aug 8, 2024
1 parent 6cc5df1 commit bcccffc
Show file tree
Hide file tree
Showing 5 changed files with 121 additions and 47 deletions.
5 changes: 2 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
## Changes 🌽
- Uses the latest DataAttributes (beta.9) & OfflinePlayerCache.
- The namespace of DataAttributes got changed on this update, breaking the ability to use the mod with the latest one. This has been addressed now.
- This patches an issue when updating modifiers (for I forgot to update PlayerEX when changing namespaces.)
- Update FLK
- Fixed **Fire Resistance** not calculating correctly.
146 changes: 111 additions & 35 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,36 +1,112 @@
![logo](https://cdn.modrinth.com/data/cached_images/f8dd730cf295dc3a449337df81cc47e010eddf3e.png)
[![GitHub license](https://img.shields.io/badge/MIT-MIT?style=for-the-badge&label=LICENCE&labelColor=582b11&color=a48350&link=https%3A%2F%2Fgithub.com%2FPlayerEXDirectorsCut%2Fplayerex%2Fblob%2F1.20.1%2Fmain%2FLICENSE)](https://github.com/PlayerEXDirectorsCut/playerex/blob/1.20.1/main/LICENSE)
[![GitHub stars](https://img.shields.io/github/stars/PlayerEXDirectorsCut/playerex?style=for-the-badge&logo=github&color=ffb046&link=https%3A%2F%2Fgithub.com%2FPlayerEXDirectorsCut%2Fplayerex%2Fstargazers
)](https://github.com/PlayerEXDirectorsCut/playerex/stargazers)
[![GitHub forks](https://img.shields.io/github/forks/PlayerEXDirectorsCut/playerex?style=for-the-badge&logo=github&link=https%3A%2F%2Fgithub.com%2FPlayerEXDirectorsCut%2Fplayerex%2Fforks
)](https://github.com/PlayerEXDirectorsCut/playerex/forks)
[![GitHub issues](https://img.shields.io/github/issues/PlayerEXDirectorsCut/playerex?style=for-the-badge&logo=github&label=ISSUES&link=https%3A%2F%2Fgithub.com%2FPlayerEXDirectorsCut%2Fplayerex%2Fissues
)](https://github.com/PlayerEXDirectorsCut/playerex/issues)

[![docs](https://cdn.jsdelivr.net/npm/@intergrav/devins-badges@3/assets/cozy/documentation/generic_vector.svg)](https://playerexdirectorscut.github.io/Bare-Minimum-Docs/)
![mkdocs](https://cdn.jsdelivr.net/npm/@intergrav/devins-badges@3/assets/cozy/built-with/mkdocs_vector.svg)
![java17](https://cdn.jsdelivr.net/npm/@intergrav/devins-badges@3/assets/cozy/built-with/java17_vector.svg)
[![curseforge](https://cdn.jsdelivr.net/npm/@intergrav/devins-badges@3/assets/cozy/available/curseforge_vector.svg)](https://www.curseforge.com/minecraft/mc-mods/playerex-directors-cut)
[![modrinth](https://cdn.jsdelivr.net/npm/@intergrav/devins-badges@3/assets/cozy/available/modrinth_vector.svg)](https://modrinth.com/mod/playerex-directors-cut)

### Preamble

PlayerEX:
Directors Cut is an entire rewrite of **[PlayerEx](https://www.curseforge.com/minecraft/mc-mods/playerex)**
(1.20.1+, though a ported version is available) and
a mod built using Fabric that adds RPG themed attributes to the game and the player.
It is available to download from [Curseforge](https://curseforge.com/minecraft/mc-mods/playerex-directors-cut) and [Modrinth](https://modrinth.com/mod/playerex-directors-cut).

Find the original mod [here!](https://modrinth.com/mod/playerex)

### Content

In addition to attributes powered by [Data Attributes: Directors Cut](https://www.curseforge.com/minecraft/mc-mods/data-attributes-directors-cut), PlayerEX: Directors Cut adds a levelling system and skill points to spend, enabled through a nonintrusive vanilla-styled gui accessible from the inventory or by hotkey. For further documentation, as well as how to use the PlayerEX:Directors Cut API in your own project, please see the [wiki](https://github.com/CleverNucleus/PlayerEx/wiki).

### Contributors (Former)
- [gyular](https://github.com/gyular) - Korean translation.
- [Hertz](https://github.com/elhertz) - Spanish translation.
- [MrTYZzik](https://github.com/MrTYZzik) - Russian translation.
- [Orygeunik](https://github.com/Orygeunik) - Russian translation improvements.
- [NianGuu](https://github.com/NianGuu) - Simplified Chinese
- [sky_bai](https://github.com/a1640727878) - Simplified Chinese (legacy release)

<p style="text-align: center"><b><i>Forge when?</i></b></p>

<br>

<p style="text-align: center">
<img src="https://img.shields.io/badge/MIT-MIT?style=for-the-badge&label=LICENCE&labelColor=582b11&color=a48350&link=https%3A%2F%2Fgithub.com%2FBareMinimumStudios%2Fplayerex%2Fblob%2F1.20.1%2Fmain%2FLICENSEe">
<img src="https://img.shields.io/github/stars/BareMinimumStudios/playerex?style=for-the-badge&logo=github&color=faa526&link=https%3A%2F%2Fgithub.com%2FBareMinimumStudios%2Fplayerex%2Fstargazers">
<img src="https://img.shields.io/github/forks/BareMinimumStudios/playerex?style=for-the-badge&logo=github&color=fa9256&link=https%3A%2F%2Fgithub.com%2FBareMinimumStudios%2Fplayerex%2Fforks">
<img src="https://img.shields.io/github/issues/BareMinimumStudios/playerex?style=for-the-badge&logo=github&label=ISSUES&link=https%3A%2F%2Fgithub.com%2FBareMinimumStudios%2Fplayerex%2Fissues">
</p>

<p style="text-align: center">
<img alt="fabric" height="56" src="https://cdn.jsdelivr.net/npm/@intergrav/devins-badges@3/assets/cozy/supported/fabric_vector.svg">
<img alt="quilt" height="56" src="https://cdn.jsdelivr.net/npm/@intergrav/devins-badges@3/assets/cozy/supported/quilt_vector.svg">
</p>

<p style="text-align: center">
<img alt="forge" height="56" src="https://cdn.jsdelivr.net/npm/@intergrav/devins-badges@3/assets/cozy/supported/forge_vector.svg">
</p>
<p style="text-align: center">(though more assembly is required, see further below)</p>

<p style="text-align: center">
<a href="https://bareminimumstudios.github.io/Bare-Minimum-Docs/">
<img src="https://cdn.jsdelivr.net/npm/@intergrav/devins-badges@3/assets/cozy/documentation/generic_vector.svg">
</a>
<a href="https://github.com/BareMinimumStudios/playerex">
<img src="https://cdn.jsdelivr.net/npm/@intergrav/devins-badges@3/assets/cozy/available/github_vector.svg">
</a>
<img alt="java" height="56" src="https://cdn.jsdelivr.net/npm/@intergrav/devins-badges@3/assets/cozy/built-with/java_vector.svg">
<img alt="gradle" height="56" src="https://cdn.jsdelivr.net/npm/@intergrav/devins-badges@3/assets/cozy/built-with/gradle_vector.svg">
<a href="https://discord.gg/pcRw79hwey">
<img src="https://cdn.jsdelivr.net/npm/@intergrav/devins-badges@3/assets/cozy/social/discord-plural_vector.svg">
</a>
</p>

<br>

_________________

<br>

![PlayerEX Screen at Level 5](https://cdn.modrinth.com/data/cached_images/a1932f9482b132e06b75717be8e060149b275b94.png)

### Preamble 📝

PlayerEX is a fundamentally rewritten mod based on the work of **CleverNucleus's [PlayerEx](https://modrinth.com/mod/playerex)**. The mod provides RPG-themed attributes to the game and a configurable leveling system.

### Content 📦

With higher-level, highly configurable attribute modification provided by **[Data Attributes: Directors Cut](https://www.curseforge.com/minecraft/mc-mods/data-attributes-directors-cut)**, PlayerEX integrates skill and refundable points to spend through the non-intrusive, extendable, and modern screen, which can be activated by a hotkey (default is `-`).

### Extras 🎬

- **[EXHud](https://modrinth.com/mod/exhud-directors-cut)**, which provides an optional, opinionated and highly-configurable UI complimentary for PlayerEX, and has compatibility with other mods, such as [**Thermoo**](https://modrinth.com/mod/thermoo), and [**AppleSkin**](https://modrinth.com/mod/appleskin).

- **[RelicEX](https://modrinth.com/mod/relicex-directors-cut)**, which adds relics, tomes, different ways to obtain level, skill, and refund points.

- **[WizardEX](https://modrinth.com/mod/wizardex-directors-cut)**, which provides a layer between this mod and **[Wizards](https://modrinth.com/mod/wizards)** and other mods that use **[Spell Power Attributes](https://modrinth.com/mod/spell-power)**.

### Wiki 📑

To learn more about the mod, you can go **[here!](https://bareminimumstudios.github.io/Bare-Minimum-Docs/)**

### Developers 💻

Ah, my favorite people. You will get some more information on how to mod PlayerEX once the release is stable. For now, know that you will be getting:

- A way to implement attribute modification (and target any attribute you want and apply functions to them) into a registry.
- Override **any** registered attribute.
- Apply **any** attribute to **any** `LivingEntity` (primarily for the player).
- Attach to a screen using `owo-lib`.
- And much more...

### For Forge Users 🪨

Howdy, I know you have all been **dying** for a forge release. This will come in due time. For now, the mod has been rewritten for fabric, but due to its compatible and improved nature, there is a way you can play it!

*Refer to the **Usage Guide** on [**Sinytra Connector**](https://modrinth.com/mod/connector) to get started.*

> There is no guarantee that it will work for Forge completely, and support **can not** be provided until an actual release of a forge mod is created.
### Contributors 🆘

### The People Who Made This A Reality

- The studio
- The wispforest team 💖
- One guy's modpack
- Literally **YOU**
- And most importantly, **CleverNucleus**

### Translators (legacy, `<=3.*`)

- [gyular](https://github.com/gyular) - Korean translation.
- [Hertz](https://github.com/elhertz) - Spanish translation.
- [MrTYZzik](https://github.com/MrTYZzik) - Russian translation.
- [Orygeunik](https://github.com/Orygeunik) - Russian translation improvements.
- [NianGuu](https://github.com/NianGuu) - Simplified Chinese
- [sky_bai](https://github.com/a1640727878) - Simplified Chinese (older releases)

### A Thanks To Our Sponsor

---

</br>

<p><img src="https://i.imgur.com/V38aMzY.png" alt="Sponsor Banner"/></p>
<p style="text-align: center">
<i><b>Use code &quot;BAREMINIMUM&quot; to get 15% off your first month!</b></i>
</p>
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ loader=fabric
# Fabric Properties
minecraft_version=1.20.1
loader_version=0.15.11
fabric_kotlin_version=1.11.0+kotlin.2.0.0
fabric_kotlin_version=1.12.0+kotlin.2.0.10
loom_version=1.7-SNAPSHOT

# Mappings
parchment_version=1.20.1:2023.09.03
quilt_mappings_version=23

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ public abstract class InventoryMixin {

@ModifyReturnValue(method = "getDestroySpeed", at = @At("RETURN"))
private float playerex$getBlockBreakingSpeed(float original) {
Optional<Double> maybeBreakingSpeed = DataAttributesAPI.getValue(PlayerEXAttributes.BREAKING_SPEED, this.player);
return maybeBreakingSpeed.map(v -> original + v.floatValue() - 1.0F).orElse(original);
return DataAttributesAPI.getValue(PlayerEXAttributes.BREAKING_SPEED, this.player).map((v) -> original + v.floatValue() - 1.0F).orElse(original);
}
}
10 changes: 5 additions & 5 deletions src/main/kotlin/com/bibireden/playerex/factory/DamageFactory.kt
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,24 @@ object DamageFactory {
fun forEach(registry: (damagePredicate: DamagePredicate, damageFunction: DamageFunction) -> Unit)
{
registry.invoke({ _, source, _ -> source.`is`(DamageTypes.ON_FIRE) }, { entity, _, damage ->
DataAttributesAPI.getValue(PlayerEXAttributes.FIRE_RESISTANCE, entity).map { ((1.0 - (it / 100)) * damage).toFloat() }.orElse(damage)
DataAttributesAPI.getValue(PlayerEXAttributes.FIRE_RESISTANCE, entity).map { damage * (1 - it) }.map(Double::toFloat).orElse(damage)
})
registry.invoke({ _, source, _ -> source.`is`(DamageTypes.FREEZE)}, { living, _, damage ->
DataAttributesAPI.getValue(PlayerEXAttributes.FREEZE_RESISTANCE, living).map { (damage * (1.0 - it)).toFloat() }.orElse(damage)
DataAttributesAPI.getValue(PlayerEXAttributes.FREEZE_RESISTANCE, living).map { damage * (1 - it) }.map(Double::toFloat).orElse(damage)
})
registry.invoke({ _, source, _ -> source.`is`(DamageTypes.LIGHTNING_BOLT)}, { living, _, damage ->
DataAttributesAPI.getValue(PlayerEXAttributes.LIGHTNING_RESISTANCE, living).map { (damage * (1.0 - it)).toFloat() }.orElse(damage)
DataAttributesAPI.getValue(PlayerEXAttributes.LIGHTNING_RESISTANCE, living).map { damage * (1 - it) }.map(Double::toFloat).orElse(damage)
})
registry.invoke(
{ living, source, damage -> living.hasEffect(MobEffects.POISON) && source.`is`(DamageTypes.MAGIC) && damage <= 1.0F },
{living, _, damage -> DataAttributesAPI.getValue(PlayerEXAttributes.POISON_RESISTANCE, living).map { (damage * (1.0 - it)).toFloat() }.orElse(damage) }
{living, _, damage -> DataAttributesAPI.getValue(PlayerEXAttributes.POISON_RESISTANCE, living).map { damage * (1 - it) }.map(Double::toFloat).orElse(damage) }
)
registry.invoke({_, source, _ -> source.`is`(DamageTypes.WITHER) || (source.`is`(DamageTypes.INDIRECT_MAGIC) && ((source.directEntity is ThrownPotion) || (source.directEntity is AreaEffectCloud))) }, {
living, source, damage ->
DataAttributesAPI.getValue(PlayerEXAttributes.WITHER_RESISTANCE, living).map {
if (source.`is`(DamageTypes.WITHER) && living.isInvertedHealAndHarm) return@map 0.0F
if (source.`is`(DamageTypes.INDIRECT_MAGIC) && source.directEntity is ThrownPotion && living.isInvertedHealAndHarm) return@map damage
(damage * (1.0 - it)).toFloat()
(damage * 1 - it).toFloat()
}.orElse(damage)
})
}
Expand Down

0 comments on commit bcccffc

Please sign in to comment.