rearranged constructors
This commit is contained in:
parent
74dc8d4118
commit
a589cb0d9e
@ -17,8 +17,8 @@
|
||||
|
||||
package baritone.behavior;
|
||||
|
||||
import baritone.api.event.events.TickEvent;
|
||||
import baritone.api.behavior.Behavior;
|
||||
import baritone.api.event.events.TickEvent;
|
||||
import baritone.pathing.goals.GoalNear;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
@ -32,11 +32,10 @@ public final class FollowBehavior extends Behavior {
|
||||
|
||||
public static final FollowBehavior INSTANCE = new FollowBehavior();
|
||||
|
||||
private FollowBehavior() {
|
||||
}
|
||||
|
||||
private Entity following;
|
||||
|
||||
private FollowBehavior() {}
|
||||
|
||||
@Override
|
||||
public void onTick(TickEvent event) {
|
||||
if (event.getType() == TickEvent.Type.OUT) {
|
||||
|
@ -29,8 +29,6 @@ public final class LookBehavior extends Behavior implements Helper {
|
||||
|
||||
public static final LookBehavior INSTANCE = new LookBehavior();
|
||||
|
||||
private LookBehavior() {}
|
||||
|
||||
/**
|
||||
* Target's values are as follows:
|
||||
* <p>
|
||||
@ -51,6 +49,8 @@ public final class LookBehavior extends Behavior implements Helper {
|
||||
*/
|
||||
private float lastYaw;
|
||||
|
||||
private LookBehavior() {}
|
||||
|
||||
public void updateTarget(Rotation target, boolean force) {
|
||||
this.target = target;
|
||||
this.force = force || !Baritone.settings().freeLook.get();
|
||||
|
@ -42,8 +42,6 @@ public final class MemoryBehavior extends Behavior implements Helper {
|
||||
|
||||
public static MemoryBehavior INSTANCE = new MemoryBehavior();
|
||||
|
||||
private MemoryBehavior() {}
|
||||
|
||||
/**
|
||||
* Possible future inventories that we will be able to remember
|
||||
*/
|
||||
@ -54,6 +52,8 @@ public final class MemoryBehavior extends Behavior implements Helper {
|
||||
*/
|
||||
private final Map<BlockPos, RememberedInventory> rememberedInventories = new HashMap<>();
|
||||
|
||||
private MemoryBehavior() {}
|
||||
|
||||
@Override
|
||||
public void onPlayerUpdate(PlayerUpdateEvent event) {
|
||||
if (event.getState() == EventState.PRE) {
|
||||
|
@ -49,12 +49,11 @@ public final class MineBehavior extends Behavior implements Helper {
|
||||
|
||||
public static final MineBehavior INSTANCE = new MineBehavior();
|
||||
|
||||
private MineBehavior() {
|
||||
}
|
||||
|
||||
private List<Block> mining;
|
||||
private List<BlockPos> locationsCache;
|
||||
|
||||
private MineBehavior() {}
|
||||
|
||||
@Override
|
||||
public void onTick(TickEvent event) {
|
||||
if (mining == null) {
|
||||
|
@ -47,9 +47,6 @@ public final class PathingBehavior extends Behavior implements Helper {
|
||||
|
||||
public static final PathingBehavior INSTANCE = new PathingBehavior();
|
||||
|
||||
private PathingBehavior() {
|
||||
}
|
||||
|
||||
private PathExecutor current;
|
||||
private PathExecutor next;
|
||||
|
||||
@ -62,6 +59,8 @@ public final class PathingBehavior extends Behavior implements Helper {
|
||||
|
||||
private boolean lastAutoJump;
|
||||
|
||||
private PathingBehavior() {}
|
||||
|
||||
private void dispatchPathEvent(PathEvent event) {
|
||||
Baritone.INSTANCE.getExecutor().execute(() -> Baritone.INSTANCE.getGameEventHandler().onPathEvent(event));
|
||||
}
|
||||
@ -391,6 +390,5 @@ public final class PathingBehavior extends Behavior implements Helper {
|
||||
// if (end - start > 0) {
|
||||
// System.out.println("Frame took " + (split - start) + " " + (end - split));
|
||||
//}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -50,6 +50,8 @@ public class AStarPathFinder extends AbstractNodeCostSearch implements Helper {
|
||||
|
||||
private final Optional<HashSet<BetterBlockPos>> favoredPositions;
|
||||
|
||||
private final Random random = new Random();
|
||||
|
||||
public AStarPathFinder(BlockPos start, Goal goal, Optional<Collection<BetterBlockPos>> favoredPositions) {
|
||||
super(start, goal);
|
||||
this.favoredPositions = favoredPositions.map(HashSet::new); // <-- okay this is epic
|
||||
@ -250,8 +252,6 @@ public class AStarPathFinder extends AbstractNodeCostSearch implements Helper {
|
||||
};
|
||||
}
|
||||
|
||||
private final Random random = new Random();
|
||||
|
||||
private <T> void shuffle(T[] list) {
|
||||
int len = list.length;
|
||||
for (int i = 0; i < len; i++) {
|
||||
|
@ -59,6 +59,12 @@ public abstract class Movement implements Helper, MovementHelper {
|
||||
|
||||
private Double cost;
|
||||
|
||||
public List<BlockPos> toBreakCached = null;
|
||||
public List<BlockPos> toPlaceCached = null;
|
||||
public List<BlockPos> toWalkIntoCached = null;
|
||||
|
||||
private Boolean calculatedWhileLoaded;
|
||||
|
||||
protected Movement(BetterBlockPos src, BetterBlockPos dest, BlockPos[] toBreak, BlockPos toPlace) {
|
||||
this.src = src;
|
||||
this.dest = dest;
|
||||
@ -290,8 +296,6 @@ public abstract class Movement implements Helper, MovementHelper {
|
||||
return getDest().subtract(getSrc());
|
||||
}
|
||||
|
||||
private Boolean calculatedWhileLoaded;
|
||||
|
||||
public void checkLoadedChunk() {
|
||||
calculatedWhileLoaded = !(world().getChunk(getDest()) instanceof EmptyChunk);
|
||||
}
|
||||
@ -300,10 +304,6 @@ public abstract class Movement implements Helper, MovementHelper {
|
||||
return calculatedWhileLoaded;
|
||||
}
|
||||
|
||||
public List<BlockPos> toBreakCached = null;
|
||||
public List<BlockPos> toPlaceCached = null;
|
||||
public List<BlockPos> toWalkIntoCached = null;
|
||||
|
||||
public List<BlockPos> toBreak() {
|
||||
if (toBreakCached != null) {
|
||||
return toBreakCached;
|
||||
|
@ -27,14 +27,14 @@ import net.minecraft.util.math.BlockPos;
|
||||
*/
|
||||
public final class BlockBreakHelper implements Helper {
|
||||
|
||||
private BlockBreakHelper() {}
|
||||
|
||||
/**
|
||||
* The last block that we tried to break, if this value changes
|
||||
* between attempts, then we re-initialize the breaking process.
|
||||
*/
|
||||
private static BlockPos lastBlock;
|
||||
|
||||
private BlockBreakHelper() {}
|
||||
|
||||
public static void tryBreakBlock(BlockPos pos, EnumFacing side) {
|
||||
if (!pos.equals(lastBlock)) {
|
||||
mc.playerController.clickBlock(pos, side);
|
||||
|
@ -50,12 +50,11 @@ import static org.lwjgl.opengl.GL11.*;
|
||||
*/
|
||||
public final class PathRenderer implements Helper {
|
||||
|
||||
private PathRenderer() {
|
||||
}
|
||||
|
||||
private static final Tessellator TESSELLATOR = Tessellator.getInstance();
|
||||
private static final BufferBuilder BUFFER = TESSELLATOR.getBuffer();
|
||||
|
||||
private PathRenderer() {}
|
||||
|
||||
public static void drawPath(IPath path, int startIndex, EntityPlayerSP player, float partialTicks, Color color, boolean fadeOut, int fadeStart0, int fadeEnd0) {
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.tryBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ZERO);
|
||||
|
Loading…
Reference in New Issue
Block a user