-
Notifications
You must be signed in to change notification settings - Fork 181
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve default enchantment API (#1698)
* Make sure to not modify the tool property's enchantments * Add capability for "default enchantment level increases" * Further modification protection and EnchantmentLevel * Apply ALSON's suggestions * Expose to CraftTweaker
- Loading branch information
Showing
7 changed files
with
50 additions
and
20 deletions.
There are no files selected for viewing
15 changes: 15 additions & 0 deletions
15
src/main/java/gregtech/api/items/toolitem/EnchantmentLevel.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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package gregtech.api.items.toolitem; | ||
|
||
public class EnchantmentLevel { | ||
private double level; | ||
private double levelGrowth; | ||
|
||
public EnchantmentLevel(double level, double levelGrowth) { | ||
this.level = level; | ||
this.levelGrowth = levelGrowth; | ||
} | ||
|
||
public int getLevel(int harvestTier) { | ||
return (int) Math.min(Byte.MAX_VALUE, Math.floor(this.level + this.levelGrowth * harvestTier)); | ||
} | ||
} |
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