Skip to content

Commit

Permalink
added check for block above in GetOutOfWaterTask
Browse files Browse the repository at this point in the history
  • Loading branch information
MiranCZ committed Jun 29, 2024
1 parent 5d3bcdb commit 326e408
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package adris.altoclef.tasks.movement;

import adris.altoclef.AltoClef;
import adris.altoclef.Debug;
import adris.altoclef.tasksystem.Task;
import adris.altoclef.util.helpers.LookHelper;
import adris.altoclef.util.helpers.StorageHelper;
Expand All @@ -27,7 +28,7 @@ protected void onStart(AltoClef mod) {
protected Task onTick(AltoClef mod) {
// get on the surface first
if (mod.getPlayer().getAir() < mod.getPlayer().getMaxAir() || mod.getPlayer().isSubmergedInWater()) {
return null;
return super.onTick(mod);
}

boolean hasBlockBelow = false;
Expand All @@ -36,8 +37,9 @@ protected Task onTick(AltoClef mod) {
hasBlockBelow = true;
}
}
boolean hasAirAbove = mod.getWorld().getBlockState(mod.getPlayer().getBlockPos().up(2)).getBlock().equals(Blocks.AIR);

if (hasBlockBelow && StorageHelper.getNumberOfThrowawayBlocks(mod) > 0) {
if (hasAirAbove && hasBlockBelow && StorageHelper.getNumberOfThrowawayBlocks(mod) > 0) {
mod.getInputControls().tryPress(Input.JUMP);
if (mod.getPlayer().isOnGround()) {

Expand Down

0 comments on commit 326e408

Please sign in to comment.