forked from CleverNucleus/data-attributes
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix tooltips, integrate some sort of diminishing for now
- Loading branch information
1 parent
3629ca8
commit ad163ac
Showing
13 changed files
with
96 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 18 additions & 28 deletions
46
src/main/java/com/bibireden/data_attributes/api/attribute/StackingBehavior.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,29 @@ | ||
package com.bibireden.data_attributes.api.attribute; | ||
|
||
/** | ||
* Used to factor into {@link com.bibireden.data_attributes.config.functions.AttributeFunction}'s | ||
* to determine what operation to use when calculating how their modifier(s) are applied. | ||
* <p/> | ||
* @since 1.4.0 | ||
* @author CleverNucleus | ||
* @author Bare Minimum Studios (B.M.S), CleverNucleus | ||
*/ | ||
public enum StackingBehavior { | ||
/** Addition of values as defined by the parent attribute. Equivalent of EntityAttributeModifier.Operation.ADDITION. */ | ||
Add((byte)0), | ||
/** Multiplication of parent attribute. Equivalent of EntityAttributeModifier.Operation.MULTIPLY_TOTAL. */ | ||
Multiply((byte)1); | ||
|
||
private final byte id; | ||
|
||
StackingBehavior(final byte id) { | ||
this.id = id; | ||
} | ||
|
||
public static StackingBehavior of(final byte id) { | ||
return switch(id) { | ||
case 0 -> Add; | ||
case 1 -> Multiply; | ||
default -> Add; | ||
}; | ||
} | ||
/** | ||
* Addition of values as defined by the parent attribute. | ||
* <p/> | ||
* Equivalent to {@link net.minecraft.entity.attribute.EntityAttributeModifier.Operation#ADDITION}. | ||
*/ | ||
Add, | ||
/** | ||
* Multiplication of parent attribute. | ||
* <p> | ||
* Equivalent to {@link net.minecraft.entity.attribute.EntityAttributeModifier.Operation#MULTIPLY_TOTAL}. | ||
*/ | ||
Multiply; | ||
|
||
public static StackingBehavior of(final String id) { | ||
return id.equalsIgnoreCase("multiply") ? Multiply : Add; | ||
} | ||
|
||
public byte id() { | ||
return this.id; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return String.valueOf(this.id); | ||
} | ||
|
||
public String getTranslationKey() { return "text.data_attributes.stackingBehavior." + this.name().toLowerCase(); } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters