UTILIZE Service Loaders

https://i.imgur.com/kAm0xd3.png
This commit is contained in:
Brady
2018-09-29 23:52:01 -05:00
parent bcb95c55c9
commit b12c2ea62f
5 changed files with 129 additions and 55 deletions

View File

@@ -88,8 +88,6 @@ public enum Baritone {
// We might want to change this...
this.settings = BaritoneAPI.getSettings();
BaritoneAPI.registerProviders(WorldProvider.INSTANCE);
this.behaviors = new ArrayList<>();
{
registerBehavior(PathingBehavior.INSTANCE);
@@ -98,16 +96,6 @@ public enum Baritone {
registerBehavior(LocationTrackingBehavior.INSTANCE);
registerBehavior(FollowBehavior.INSTANCE);
registerBehavior(MineBehavior.INSTANCE);
// TODO: Clean this up
// Maybe combine this call in someway with the registerBehavior calls?
BaritoneAPI.registerDefaultBehaviors(
FollowBehavior.INSTANCE,
LookBehavior.INSTANCE,
MemoryBehavior.INSTANCE,
MineBehavior.INSTANCE,
PathingBehavior.INSTANCE
);
}
if (BaritoneAutoTest.ENABLE_AUTO_TEST) {
registerEventListener(BaritoneAutoTest.INSTANCE);

View File

@@ -0,0 +1,67 @@
/*
* This file is part of Baritone.
*
* Baritone is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Baritone is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
package baritone;
import baritone.api.IBaritoneProvider;
import baritone.api.Settings;
import baritone.api.behavior.*;
import baritone.api.cache.IWorldProvider;
import baritone.behavior.*;
import baritone.cache.WorldProvider;
/**
* @author Brady
* @since 9/29/2018
*/
public final class BaritoneProvider implements IBaritoneProvider {
@Override
public IFollowBehavior getFollowBehavior() {
return FollowBehavior.INSTANCE;
}
@Override
public ILookBehavior getLookBehavior() {
return LookBehavior.INSTANCE;
}
@Override
public IMemoryBehavior getMemoryBehavior() {
return MemoryBehavior.INSTANCE;
}
@Override
public IMineBehavior getMineBehavior() {
return MineBehavior.INSTANCE;
}
@Override
public IPathingBehavior getPathingBehavior() {
return PathingBehavior.INSTANCE;
}
@Override
public Settings getSettings() {
return Baritone.settings();
}
@Override
public IWorldProvider getWorldProvider() {
return WorldProvider.INSTANCE;
}
}

View File

@@ -0,0 +1 @@
baritone.BaritoneProvider