Skip to content

Commit

Permalink
workaround some scuff
Browse files Browse the repository at this point in the history
  • Loading branch information
leijurv committed Mar 13, 2019
1 parent ee6df27 commit a75317c
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 8 deletions.
11 changes: 10 additions & 1 deletion src/api/java/baritone/api/process/IBaritoneProcess.java
Original file line number Diff line number Diff line change
Expand Up @@ -101,5 +101,14 @@ default double priority() {
*
* @return A display name that's suitable for a HUD
*/
String displayName();
default String displayName() {
if (!isActive()) {
// i love it when impcat's scuffed HUD calls displayName for inactive processes for 1 tick too long
// causing NPEs when the displayname relies on fields that become null when inactive
return "INACTIVE";
}
return displayName0();
}

String displayName0();
}
2 changes: 1 addition & 1 deletion src/main/java/baritone/process/BuilderProcess.java
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,7 @@ public void onLostControl() {
}

@Override
public String displayName() {
public String displayName0() {
return "Building " + name;
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/baritone/process/CustomGoalProcess.java
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public void onLostControl() {
}

@Override
public String displayName() {
public String displayName0() {
return "Custom Goal " + this.goal;
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/baritone/process/ExploreProcess.java
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public void onLostControl() {
}

@Override
public String displayName() {
public String displayName0() {
return "Exploring around " + explorationOrigin + ", currently going to " + closestUncachedChunk(explorationOrigin);
}
}
2 changes: 1 addition & 1 deletion src/main/java/baritone/process/FollowProcess.java
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public void onLostControl() {
}

@Override
public String displayName() {
public String displayName0() {
return "Follow " + cache;
}

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/baritone/process/GetToBlockProcess.java
Original file line number Diff line number Diff line change
Expand Up @@ -160,11 +160,11 @@ public synchronized void onLostControl() {
}

@Override
public String displayName() {
public String displayName0() {
if (knownLocations.isEmpty()) {
return "Exploring randomly to find " + gettingTo + ", no known locations";
}
return "Get To Block " + gettingTo + ", " + knownLocations.size() + " known locations";
return "Get To " + gettingTo + ", " + knownLocations.size() + " known locations";
}

private synchronized void rescan(List<BlockPos> known, CalculationContext context) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/baritone/process/MineProcess.java
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public void onLostControl() {
}

@Override
public String displayName() {
public String displayName0() {
return "Mine " + mining;
}

Expand Down

0 comments on commit a75317c

Please sign in to comment.