diff --git a/src/api/java/baritone/api/utils/IPlayerContext.java b/src/api/java/baritone/api/utils/IPlayerContext.java index 470e1378..c7e7e24a 100644 --- a/src/api/java/baritone/api/utils/IPlayerContext.java +++ b/src/api/java/baritone/api/utils/IPlayerContext.java @@ -18,6 +18,7 @@ package baritone.api.utils; import baritone.api.cache.IWorldData; +import net.minecraft.block.BlockSlab; import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.client.multiplayer.PlayerControllerMP; import net.minecraft.util.math.Vec3d; @@ -37,7 +38,14 @@ public interface IPlayerContext { IWorldData worldData(); - BetterBlockPos playerFeet(); + default BetterBlockPos playerFeet() { + // TODO find a better way to deal with soul sand!!!!! + BetterBlockPos feet = new BetterBlockPos(player().posX, player().posY + 0.1251, player().posZ); + if (world().getBlockState(feet).getBlock() instanceof BlockSlab) { + return feet.up(); + } + return feet; + } default Vec3d playerFeetAsVec() { return new Vec3d(player().posX, player().posY, player().posZ); diff --git a/src/main/java/baritone/behavior/LookBehavior.java b/src/main/java/baritone/behavior/LookBehavior.java index de0af60d..31e76913 100644 --- a/src/main/java/baritone/behavior/LookBehavior.java +++ b/src/main/java/baritone/behavior/LookBehavior.java @@ -23,9 +23,8 @@ import baritone.api.behavior.ILookBehavior; import baritone.api.event.events.PlayerUpdateEvent; import baritone.api.event.events.RotationMoveEvent; import baritone.api.utils.Rotation; -import baritone.utils.Helper; -public final class LookBehavior extends Behavior implements ILookBehavior, Helper { +public final class LookBehavior extends Behavior implements ILookBehavior { /** * Target's values are as follows: diff --git a/src/main/java/baritone/behavior/MemoryBehavior.java b/src/main/java/baritone/behavior/MemoryBehavior.java index 2fa085ae..59a3af44 100644 --- a/src/main/java/baritone/behavior/MemoryBehavior.java +++ b/src/main/java/baritone/behavior/MemoryBehavior.java @@ -27,7 +27,6 @@ import baritone.api.event.events.PlayerUpdateEvent; import baritone.api.event.events.type.EventState; import baritone.cache.Waypoint; import baritone.utils.BlockStateInterface; -import baritone.utils.Helper; import net.minecraft.block.BlockBed; import net.minecraft.item.ItemStack; import net.minecraft.network.Packet; @@ -45,7 +44,7 @@ import java.util.*; * @author Brady * @since 8/6/2018 9:47 PM */ -public final class MemoryBehavior extends Behavior implements IMemoryBehavior, Helper { +public final class MemoryBehavior extends Behavior implements IMemoryBehavior { private final Map worldDataContainers = new HashMap<>(); diff --git a/src/main/java/baritone/cache/CachedChunk.java b/src/main/java/baritone/cache/CachedChunk.java index abc741a5..406a9475 100644 --- a/src/main/java/baritone/cache/CachedChunk.java +++ b/src/main/java/baritone/cache/CachedChunk.java @@ -17,7 +17,6 @@ package baritone.cache; -import baritone.utils.Helper; import baritone.utils.pathing.PathingBlockType; import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; @@ -30,7 +29,7 @@ import java.util.*; * @author Brady * @since 8/3/2018 1:04 AM */ -public final class CachedChunk implements Helper { +public final class CachedChunk { public static final Set BLOCKS_TO_KEEP_TRACK_OF; diff --git a/src/main/java/baritone/cache/ChunkPacker.java b/src/main/java/baritone/cache/ChunkPacker.java index d73cdb03..be7655b4 100644 --- a/src/main/java/baritone/cache/ChunkPacker.java +++ b/src/main/java/baritone/cache/ChunkPacker.java @@ -18,7 +18,6 @@ package baritone.cache; import baritone.pathing.movement.MovementHelper; -import baritone.utils.Helper; import baritone.utils.pathing.PathingBlockType; import net.minecraft.block.Block; import net.minecraft.block.BlockDoublePlant; @@ -38,7 +37,7 @@ import java.util.*; * @author Brady * @since 8/3/2018 1:09 AM */ -public final class ChunkPacker implements Helper { +public final class ChunkPacker { private ChunkPacker() {} diff --git a/src/main/java/baritone/cache/WorldScanner.java b/src/main/java/baritone/cache/WorldScanner.java index 378bbc9c..1d220188 100644 --- a/src/main/java/baritone/cache/WorldScanner.java +++ b/src/main/java/baritone/cache/WorldScanner.java @@ -19,7 +19,6 @@ package baritone.cache; import baritone.api.cache.IWorldScanner; import baritone.api.utils.IPlayerContext; -import baritone.utils.Helper; import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.client.multiplayer.ChunkProviderClient; @@ -31,7 +30,7 @@ import net.minecraft.world.chunk.storage.ExtendedBlockStorage; import java.util.LinkedList; import java.util.List; -public enum WorldScanner implements IWorldScanner, Helper { +public enum WorldScanner implements IWorldScanner { INSTANCE; diff --git a/src/main/java/baritone/pathing/movement/CalculationContext.java b/src/main/java/baritone/pathing/movement/CalculationContext.java index 7d0d9dab..d2398ae2 100644 --- a/src/main/java/baritone/pathing/movement/CalculationContext.java +++ b/src/main/java/baritone/pathing/movement/CalculationContext.java @@ -88,7 +88,7 @@ public class CalculationContext { } public final IBaritone getBaritone() { - return this.baritone; + return baritone; } public IBlockState get(int x, int y, int z) { diff --git a/src/main/java/baritone/pathing/movement/Movement.java b/src/main/java/baritone/pathing/movement/Movement.java index 1d1552c3..c1b4e351 100644 --- a/src/main/java/baritone/pathing/movement/Movement.java +++ b/src/main/java/baritone/pathing/movement/Movement.java @@ -23,7 +23,6 @@ import baritone.api.pathing.movement.MovementStatus; import baritone.api.utils.*; import baritone.api.utils.input.Input; import baritone.utils.BlockStateInterface; -import baritone.utils.Helper; import net.minecraft.block.BlockLiquid; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; @@ -34,7 +33,7 @@ import java.util.List; import java.util.Objects; import java.util.Optional; -public abstract class Movement implements IMovement, Helper, MovementHelper { +public abstract class Movement implements IMovement, MovementHelper { protected static final EnumFacing[] HORIZONTALS = {EnumFacing.NORTH, EnumFacing.SOUTH, EnumFacing.EAST, EnumFacing.WEST}; diff --git a/src/main/java/baritone/pathing/movement/movements/MovementParkour.java b/src/main/java/baritone/pathing/movement/movements/MovementParkour.java index d67e0929..9859f9ad 100644 --- a/src/main/java/baritone/pathing/movement/movements/MovementParkour.java +++ b/src/main/java/baritone/pathing/movement/movements/MovementParkour.java @@ -45,7 +45,7 @@ import java.util.Objects; public class MovementParkour extends Movement { - private static final EnumFacing[] HORIZONTAL_AND_DOWN = { EnumFacing.NORTH, EnumFacing.SOUTH, EnumFacing.EAST, EnumFacing.WEST, EnumFacing.DOWN }; + private static final EnumFacing[] HORIZONTALS_BUT_ALSO_DOWN____SO_EVERY_DIRECTION_EXCEPT_UP = { EnumFacing.NORTH, EnumFacing.SOUTH, EnumFacing.EAST, EnumFacing.WEST, EnumFacing.DOWN }; private static final BetterBlockPos[] EMPTY = new BetterBlockPos[]{}; private final EnumFacing direction; @@ -139,8 +139,8 @@ public class MovementParkour extends Movement { return; } for (int i = 0; i < 5; i++) { - int againstX = destX + HORIZONTAL_AND_DOWN[i].getXOffset(); - int againstZ = destZ + HORIZONTAL_AND_DOWN[i].getZOffset(); + int againstX = destX + HORIZONTALS_BUT_ALSO_DOWN____SO_EVERY_DIRECTION_EXCEPT_UP [i].getXOffset(); + int againstZ = destZ + HORIZONTALS_BUT_ALSO_DOWN____SO_EVERY_DIRECTION_EXCEPT_UP [i].getZOffset(); if (againstX == x + xDiff * 3 && againstZ == z + zDiff * 3) { // we can't turn around that fast continue; } @@ -216,7 +216,7 @@ public class MovementParkour extends Movement { if (!MovementHelper.canWalkOn(ctx, dest.down()) && !ctx.player().onGround) { BlockPos positionToPlace = dest.down(); for (int i = 0; i < 5; i++) { - BlockPos against1 = positionToPlace.offset(HORIZONTAL_AND_DOWN[i]); + BlockPos against1 = positionToPlace.offset(HORIZONTALS_BUT_ALSO_DOWN____SO_EVERY_DIRECTION_EXCEPT_UP [i]); if (against1.up().equals(src.offset(direction, 3))) { // we can't turn around that fast continue; } diff --git a/src/main/java/baritone/utils/BlockStateInterface.java b/src/main/java/baritone/utils/BlockStateInterface.java index e4e79867..4e422eda 100644 --- a/src/main/java/baritone/utils/BlockStateInterface.java +++ b/src/main/java/baritone/utils/BlockStateInterface.java @@ -35,7 +35,7 @@ import net.minecraft.world.chunk.Chunk; * * @author leijurv */ -public class BlockStateInterface implements Helper { +public class BlockStateInterface { private final World world; private final WorldData worldData; diff --git a/src/main/java/baritone/utils/player/AbstractPlayerContext.java b/src/main/java/baritone/utils/player/AbstractPlayerContext.java deleted file mode 100644 index 252c30a3..00000000 --- a/src/main/java/baritone/utils/player/AbstractPlayerContext.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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 . - */ - -package baritone.utils.player; - -import baritone.api.utils.BetterBlockPos; -import baritone.api.utils.IPlayerContext; -import net.minecraft.block.BlockSlab; - -/** - * @author Brady - * @since 11/12/2018 - */ -public abstract class AbstractPlayerContext implements IPlayerContext { - - @Override - public BetterBlockPos playerFeet() { - // TODO find a better way to deal with soul sand!!!!! - BetterBlockPos feet = new BetterBlockPos(player().posX, player().posY + 0.1251, player().posZ); - if (world().getBlockState(feet).getBlock() instanceof BlockSlab) { - return feet.up(); - } - return feet; - } -} diff --git a/src/main/java/baritone/utils/player/LocalPlayerContext.java b/src/main/java/baritone/utils/player/LocalPlayerContext.java index c95689bf..355c2497 100644 --- a/src/main/java/baritone/utils/player/LocalPlayerContext.java +++ b/src/main/java/baritone/utils/player/LocalPlayerContext.java @@ -31,7 +31,7 @@ import net.minecraft.world.World; * @author Brady * @since 11/12/2018 */ -public final class LocalPlayerContext extends AbstractPlayerContext { +public final class LocalPlayerContext implements IPlayerContext { private static final Minecraft mc = Minecraft.getMinecraft();