A couple minor cleanups
This commit is contained in:
parent
527691a2ec
commit
c50af5acfd
@ -19,6 +19,17 @@ package baritone.api;
|
|||||||
|
|
||||||
import net.minecraft.client.entity.EntityPlayerSP;
|
import net.minecraft.client.entity.EntityPlayerSP;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Leijurv
|
||||||
|
*/
|
||||||
public interface IBaritoneProvider {
|
public interface IBaritoneProvider {
|
||||||
IBaritone getBaritoneForPlayer(EntityPlayerSP player); // tenor be like
|
|
||||||
|
/**
|
||||||
|
* Provides the {@link IBaritone} instance for a given {@link EntityPlayerSP}. This will likely be
|
||||||
|
* replaced with {@code #getBaritoneForUser(IBaritoneUser)} when {@code bot-system} is merged.
|
||||||
|
*
|
||||||
|
* @param player The player
|
||||||
|
* @return The {@link IBaritone} instance.
|
||||||
|
*/
|
||||||
|
IBaritone getBaritoneForPlayer(EntityPlayerSP player);
|
||||||
}
|
}
|
||||||
|
@ -19,17 +19,39 @@ package baritone.api.process;
|
|||||||
|
|
||||||
import baritone.api.pathing.goals.Goal;
|
import baritone.api.pathing.goals.Goal;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Leijurv
|
||||||
|
*/
|
||||||
public class PathingCommand {
|
public class PathingCommand {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The target goal, may be {@code null}.
|
||||||
|
*/
|
||||||
public final Goal goal;
|
public final Goal goal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The command type.
|
||||||
|
*
|
||||||
|
* @see PathingCommandType
|
||||||
|
*/
|
||||||
public final PathingCommandType commandType;
|
public final PathingCommandType commandType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new {@link PathingCommand}.
|
||||||
|
*
|
||||||
|
* @see Goal
|
||||||
|
* @see PathingCommandType
|
||||||
|
*
|
||||||
|
* @param goal The target goal, may be {@code null}.
|
||||||
|
* @param commandType The command type, cannot be {@code null}.
|
||||||
|
* @throws NullPointerException if {@code commandType} is {@code null}.
|
||||||
|
*/
|
||||||
public PathingCommand(Goal goal, PathingCommandType commandType) {
|
public PathingCommand(Goal goal, PathingCommandType commandType) {
|
||||||
|
Objects.requireNonNull(commandType);
|
||||||
|
|
||||||
this.goal = goal;
|
this.goal = goal;
|
||||||
this.commandType = commandType;
|
this.commandType = commandType;
|
||||||
if (commandType == null) {
|
|
||||||
throw new IllegalArgumentException();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,6 +27,7 @@ import baritone.utils.Helper;
|
|||||||
import net.minecraft.world.chunk.Chunk;
|
import net.minecraft.world.chunk.Chunk;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Brady
|
* @author Brady
|
||||||
@ -36,7 +37,7 @@ public final class GameEventHandler implements IGameEventListener, Helper {
|
|||||||
|
|
||||||
private final Baritone baritone;
|
private final Baritone baritone;
|
||||||
|
|
||||||
private final ArrayList<IGameEventListener> listeners = new ArrayList<>();
|
private final List<IGameEventListener> listeners = new ArrayList<>();
|
||||||
|
|
||||||
public GameEventHandler(Baritone baritone) {
|
public GameEventHandler(Baritone baritone) {
|
||||||
this.baritone = baritone;
|
this.baritone = baritone;
|
||||||
@ -54,7 +55,7 @@ public final class GameEventHandler implements IGameEventListener, Helper {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final void onProcessKeyBinds() {
|
public final void onProcessKeyBinds() {
|
||||||
listeners.forEach(l -> l.onProcessKeyBinds());
|
listeners.forEach(IGameEventListener::onProcessKeyBinds);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -131,7 +132,7 @@ public final class GameEventHandler implements IGameEventListener, Helper {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPlayerDeath() {
|
public void onPlayerDeath() {
|
||||||
listeners.forEach(l -> l.onPlayerDeath());
|
listeners.forEach(IGameEventListener::onPlayerDeath);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user