Skip to content

Commit

Permalink
updated
Browse files Browse the repository at this point in the history
  • Loading branch information
leijurv committed Apr 7, 2016
1 parent c6a36ac commit c36f332
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions mcp918/src/minecraft/minebot/pathfinding/actions/Action.java
Original file line number Diff line number Diff line change
Expand Up @@ -111,15 +111,11 @@ public static boolean isLiquid(Block b) {
return b instanceof BlockLiquid;
//return b != null && (waterFlowing.equals(b) || waterStill.equals(b) || lavaFlowing.equals(b) || lavaStill.equals(b));
}
public static boolean isFlowing(BlockPos pos) {
IBlockState state = Minecraft.theMinecraft.theWorld.getBlockState(pos);
public static boolean isFlowing(BlockPos pos, IBlockState state) {
Block b = state.getBlock();
Material m = b.getMaterial();
if (b instanceof BlockLiquid) {
BlockLiquid bl = (BlockLiquid) b;
if (BlockLiquid.getFlowDirection(Minecraft.theMinecraft.theWorld, pos, m) != -1000.0D) {
return true;
}
return BlockLiquid.getFlowDirection(Minecraft.theMinecraft.theWorld, pos, m) != -1000.0D;
}
return false;
}
Expand Down Expand Up @@ -147,12 +143,12 @@ public static boolean avoidBreaking(BlockPos pos) {
* @return
*/
public static boolean canWalkThrough(BlockPos pos) {
Block block = Minecraft.theMinecraft.theWorld.getBlockState(pos).getBlock();
IBlockState state = Minecraft.theMinecraft.theWorld.getBlockState(pos);
Block block = state.getBlock();
if (block instanceof BlockLilyPad || block instanceof BlockFire) {//you can't actually walk through a lilypad from the side, and you shouldn't walk through fire
return false;
}
boolean liquid = isLiquid(block);
if (liquid && isFlowing(pos)) {
if (isFlowing(pos, state)) {
return false;//don't walk through flowing liquids
}
if (isLiquid(pos.up())) {
Expand Down

0 comments on commit c36f332

Please sign in to comment.