Skip to content

Commit

Permalink
Bug fixes
Browse files Browse the repository at this point in the history
+Fixed issue with CaelusAPI and Icarus
+Likely fixed issue with BetterEnd, but hard to test as unfamiliar with the mod.
+Exposed some functions in the API since I need them in other mods.
+Fixed issue with preliminary RelicEx refund points issue: you could refund attributes added by trinket items, use those skillpoints to skill something else, then reequip the same trinket and regain those attributes. Fixed now.
+Incremented version
  • Loading branch information
CleverNucleus committed Jul 3, 2021
1 parent dec093d commit c41576c
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 7 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ org.gradle.jvmargs=-Xmx2G
loader_version=0.11.3

# Mod Properties
mod_version = 2.0.2
mod_version = 2.0.3
maven_group = com.github.clevernucleus
archives_base_name = playerex

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@
*/
public interface AttributeData extends Component {

/**
* Resets all attributes to their defaults. requires a sync.
*/
void reset();

/**
* Adds refund points (if allowed). Refund points are clamped above zero.
* @param valueIn
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import com.github.clevernucleus.playerex.client.gui.widget.ScreenButtonWidget;
import com.github.clevernucleus.playerex.client.network.ClientNetworkHandler;
import com.github.clevernucleus.playerex.handler.NetworkHandler.PacketType;
import com.github.clevernucleus.playerex.impl.attribute.AttributeDataManager;
import com.mojang.blaze3d.platform.GlStateManager;

import net.fabricmc.api.EnvType;
Expand Down Expand Up @@ -329,7 +330,7 @@ public void drawBackground(MatrixStack matrices, float delta, int mouseX, int mo
IPlayerAttribute attribute = this.fromKey(key);

if(this.refunds()) {
button.active = this.data.get(attribute) >= 1.0D;
button.active = ((AttributeDataManager)this.data).getValue(attribute) >= 1.0D;
} else {
button.active = (this.data.get(attribute) < attribute.maxValue()) && (this.data.get(PlayerAttributes.SKILLPOINTS.get()) >= 1.0D);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,6 @@ private void applyAttributeModifier(Set<IPlayerAttribute> recursives, final IPla
}
}

private double getValue(final IPlayerAttribute keyIn) {
return this.attributes.getOrDefault(keyIn.registryKey(), keyIn.valueFromType());
}

private void setValue(final IPlayerAttribute keyIn, final double value) {
this.attributes.put(keyIn.registryKey(), value);
}
Expand All @@ -170,6 +166,10 @@ private void setAttribute(final IPlayerAttribute keyIn, final double valueIn) {
ExAPI.DATA.sync(this.player);
}

public double getValue(final IPlayerAttribute keyIn) {
return this.attributes.getOrDefault(keyIn.registryKey(), keyIn.valueFromType());
}

public void initContainer() {
DefaultAttributeContainer.Builder builder = DefaultAttributeContainer.builder();

Expand Down Expand Up @@ -206,6 +206,7 @@ public boolean levelled() {
return this.levelled;
}

@Override
public void reset() {
this.levelled = false;
this.refunds = 0;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"type": "GAME",
"uuid": "ed0b99aa-b2f2-4c5e-b135-ecd62ceea26e",
"defaultValue": 0.0,
"minValue": 0.0,
"maxValue": 1.0,
"translationKey": "attribute.name.generic.blindness_resistance",
"properties": {},
"functions": []
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"type": "GAME",
"uuid": "6bfd7b15-d025-4cbc-9949-34df70d90d4c",
"defaultValue": 0.0,
"minValue": 0.0,
"maxValue": 1.0,
"translationKey": "attribute.name.generic.caelus.flight",
"properties": {},
"functions": []
}
2 changes: 1 addition & 1 deletion src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"schemaVersion": 1,
"id": "playerex",
"version": "2.0.2",
"version": "2.0.3",
"name": "PlayerEx",
"description": "Implements a more detailed attributes system with an rpg theme.",
"authors": [
Expand Down

0 comments on commit c41576c

Please sign in to comment.