Skip to content

Commit

Permalink
Changed name of runModifiers method to be less ambiguous of its funct…
Browse files Browse the repository at this point in the history
…ion. Fixed square default formula to use z axis.
  • Loading branch information
arazadaz committed Feb 10, 2024
1 parent 029a5d2 commit b1c2e51
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/main/java/com/arazadaz/dd/api/origins/Origin.java
Original file line number Diff line number Diff line change
Expand Up @@ -92,17 +92,17 @@ public double getDifficultyHere(Vec3 dstPos, DifficultyType type, RadiusMode rMo
switch(rMode){

case CIRCLE -> {
difficulty = runModifiers(modifierIterator, context, 0, dstPos);
difficulty = getDifficultyAndRunModifiers(modifierIterator, context, 0, dstPos);
return getFinalDifficulty(difficulty);
}

case SQUARE -> {
difficulty = runModifiers(modifierIterator, context, 1, dstPos);
difficulty = getDifficultyAndRunModifiers(modifierIterator, context, 1, dstPos);
return getFinalDifficulty(difficulty);
}

case CUSTOM -> {
difficulty = runModifiers(modifierIterator, context, 2, dstPos);
difficulty = getDifficultyAndRunModifiers(modifierIterator, context, 2, dstPos);
return getFinalDifficulty(difficulty);
}

Expand All @@ -116,7 +116,7 @@ private double getFinalDifficulty(double finalDifficulty){
return finalDifficulty;
}

private double runModifiers(Iterator<DifficultyModifier> modifierIterator, DDContext context, int formula, Vec3 dstPos){ //Formula can be 0, 1, or 2 with those values representing circle, square, and custom respectively.
private double getDifficultyAndRunModifiers(Iterator<DifficultyModifier> modifierIterator, DDContext context, int formula, Vec3 dstPos){ //Formula can be 0, 1, or 2 with those values representing circle, square, and custom respectively.
double base = new FormulaInterpreter().run(this.formulas[formula], this, dstPos);

while(modifierIterator.hasNext()){
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/arazadaz/dd/config/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public class Config

public static final ModConfigSpec.ConfigValue<String> GLOBAL_FORMULAS = BUILDER
.comment("The default formulas used for Origins if the values weren't specified at their creation. Three formulas: circle, square, and custom in that order")
.define("Global formulas", "'(distance/range)*100', 'max(abs(dst.x-src.x)/range*100, abs(dst.y-src.y)/range*100)', '(50/100)*100'");
.define("Global formulas", "'(distance/range)*100', 'max(abs(dst.x-src.x)/range*100, abs(dst.z-src.z)/range*100)', '(50/100)*100'");

// a list of strings that are treated as resource locations for items
private static final ModConfigSpec.ConfigValue<List<? extends String>> USER_DEFINED_ORIGINS = BUILDER
Expand Down

0 comments on commit b1c2e51

Please sign in to comment.