Remove unnecessary casts

This commit is contained in:
Brady 2018-10-27 23:21:30 -05:00
parent 1b1233d26a
commit 3d4a856bb2
No known key found for this signature in database
GPG Key ID: 73A788379A197567
3 changed files with 13 additions and 13 deletions

View File

@ -144,37 +144,37 @@ public enum Baritone implements IBaritoneProvider {
}
@Override
public IFollowBehavior getFollowBehavior() {
public FollowBehavior getFollowBehavior() {
return followBehavior;
}
@Override
public ILookBehavior getLookBehavior() {
public LookBehavior getLookBehavior() {
return lookBehavior;
}
@Override
public IMemoryBehavior getMemoryBehavior() {
public MemoryBehavior getMemoryBehavior() {
return memoryBehavior;
}
@Override
public IMineBehavior getMineBehavior() {
public MineBehavior getMineBehavior() {
return mineBehavior;
}
@Override
public IPathingBehavior getPathingBehavior() {
public PathingBehavior getPathingBehavior() {
return pathingBehavior;
}
@Override
public IWorldProvider getWorldProvider() {
public WorldProvider getWorldProvider() {
return WorldProvider.INSTANCE;
}
@Override
public IWorldScanner getWorldScanner() {
public WorldScanner getWorldScanner() {
return WorldScanner.INSTANCE;
}

View File

@ -82,7 +82,7 @@ public final class MineBehavior extends Behavior implements IMineBehavior, Helpe
addNearby();
}
updateGoal();
((PathingBehavior) baritone.getPathingBehavior()).revalidateGoal();
baritone.getPathingBehavior().revalidateGoal();
}
private void updateGoal() {
@ -93,7 +93,7 @@ public final class MineBehavior extends Behavior implements IMineBehavior, Helpe
if (!locs.isEmpty()) {
List<BlockPos> locs2 = prune(new ArrayList<>(locs), mining, 64);
// can't reassign locs, gotta make a new var locs2, because we use it in a lambda right here, and variables you use in a lambda must be effectively final
((PathingBehavior) baritone.getPathingBehavior()).setGoalAndPath(new GoalComposite(locs2.stream().map(loc -> coalesce(loc, locs2)).toArray(Goal[]::new)));
baritone.getPathingBehavior().setGoalAndPath(new GoalComposite(locs2.stream().map(loc -> coalesce(loc, locs2)).toArray(Goal[]::new)));
knownOreLocations = locs;
return;
}
@ -108,7 +108,7 @@ public final class MineBehavior extends Behavior implements IMineBehavior, Helpe
// cool, path is over and we are at desired y
branchPoint = playerFeet();
} else {
((PathingBehavior) baritone.getPathingBehavior()).setGoalAndPath(new GoalYLevel(y));
baritone.getPathingBehavior().setGoalAndPath(new GoalYLevel(y));
return;
}
}
@ -117,7 +117,7 @@ public final class MineBehavior extends Behavior implements IMineBehavior, Helpe
// TODO mine 1x1 shafts to either side
branchPoint = branchPoint.north(10);
}
((PathingBehavior) baritone.getPathingBehavior()).setGoalAndPath(new GoalBlock(branchPoint));
baritone.getPathingBehavior().setGoalAndPath(new GoalBlock(branchPoint));
}
private void rescan() {

View File

@ -70,7 +70,7 @@ public class ExampleBaritoneControl extends Behavior implements Helper {
public boolean runCommand(String msg0) {
String msg = msg0.toLowerCase(Locale.US).trim(); // don't reassign the argument LOL
PathingBehavior pathingBehavior = (PathingBehavior) baritone.getPathingBehavior();
PathingBehavior pathingBehavior = baritone.getPathingBehavior();
List<Settings.Setting<Boolean>> toggleable = Baritone.settings().getAllValuesByType(Boolean.class);
for (Settings.Setting<Boolean> setting : toggleable) {
if (msg.equalsIgnoreCase(setting.getName())) {
@ -372,7 +372,7 @@ public class ExampleBaritoneControl extends Behavior implements Helper {
return true;
}
} else {
List<BlockPos> locs = ((MineBehavior) baritone.getMineBehavior()).searchWorld(Collections.singletonList(block), 64);
List<BlockPos> locs = baritone.getMineBehavior().searchWorld(Collections.singletonList(block), 64);
if (locs.isEmpty()) {
logDirect("No locations for " + mining + " known, cancelling");
return true;