Skip to content

Commit

Permalink
fix several bugs related to persist mode
Browse files Browse the repository at this point in the history
  • Loading branch information
Wudji committed Nov 12, 2024
1 parent 2498e6d commit b3b1d05
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/main/java/troy/autofish/Autofish.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,12 @@ public Autofish(FabricModAutofish modAutofish) {
//Initiate the repeating action for persistent mode casting
modAutofish.getScheduler().scheduleRepeatingAction(10000, () -> {
if(!modAutofish.getConfig().isPersistentMode()) return;
if(modAutofish.getConfig().isNoBreak() && Objects.requireNonNull(getHeldItem()).getDamage() >= 63) return;
if(!isHoldingFishingRod()) return;
if(hookExists && isBobberInWater()) return;
if(hookExists){
if(isBobberInWater()) return;
else useRod();
}
if(modAutofish.getScheduler().isRecastQueued()) return;

useRod();
Expand Down Expand Up @@ -244,7 +248,7 @@ public void switchToFirstRod(ClientPlayerEntity player) {

public boolean isBobberInWater(){
if(client.player != null && client.world != null && client.player.fishHook != null) {
return client.player.fishHook.isTouchingWater();
return client.world.getBlockState(client.player.fishHook.getBlockPos()).getBlock() == Blocks.WATER;
} else{
return false;
}
Expand Down

0 comments on commit b3b1d05

Please sign in to comment.