diff --git a/src/main/java/troy/autofish/Autofish.java b/src/main/java/troy/autofish/Autofish.java index 3787428..a8ca43e 100644 --- a/src/main/java/troy/autofish/Autofish.java +++ b/src/main/java/troy/autofish/Autofish.java @@ -49,9 +49,11 @@ public Autofish(FabricModAutofish modAutofish) { modAutofish.getScheduler().scheduleRepeatingAction(10000, () -> { if(!modAutofish.getConfig().isPersistentMode()) return; if(!isHoldingFishingRod()) return; - if(hookExists && isBobberInWater()) return; + if(hookExists){ + if(isBobberInWater()) return; + else useRod(); + } if(modAutofish.getScheduler().isRecastQueued()) return; - useRod(); }); } @@ -244,7 +246,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; } diff --git a/src/main/java/troy/autofish/FabricModAutofish.java b/src/main/java/troy/autofish/FabricModAutofish.java index b1c8730..9fbe645 100644 --- a/src/main/java/troy/autofish/FabricModAutofish.java +++ b/src/main/java/troy/autofish/FabricModAutofish.java @@ -42,11 +42,13 @@ public void onInitializeClient() { } public void tick(MinecraftClient client) { - if (autofishGuiKey.wasPressed()) { - client.setScreen(AutofishScreenBuilder.buildScreen(this, client.currentScreen)); + if (this.autofish != null){ + if (autofishGuiKey.wasPressed()) { + client.setScreen(AutofishScreenBuilder.buildScreen(this, client.currentScreen)); + } + autofish.tick(client); + scheduler.tick(client); } - autofish.tick(client); - scheduler.tick(client); } /**