Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve Fishing Helper Accuracy #837

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ public abstract class ClientPlayNetworkHandlerMixin {
EggFinder.checkIfEgg(armorStandEntity);
try { //Prevent packet handling fails if something goes wrong so that entity trackers still update, just without compact damage numbers
CompactDamage.compactDamage(armorStandEntity);
FishingHelper.checkIfFishWasCaught(armorStandEntity);
} catch (Exception e) {
LOGGER.error("[Skyblocker Compact Damage] Failed to compact damage number", e);
}
Expand Down
18 changes: 18 additions & 0 deletions src/main/java/de/hysky/skyblocker/skyblock/FishingHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import net.fabricmc.fabric.api.event.player.UseItemCallback;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.network.ClientPlayerEntity;
import net.minecraft.entity.decoration.ArmorStandEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.FishingRodItem;
import net.minecraft.item.ItemStack;
Expand Down Expand Up @@ -75,6 +76,23 @@ public static void onSound(PlaySoundS2CPacket packet) {
}
}

// Sends a title notification if a fish is caught, the sound method is kept still in case the player doesn't have this skyblock option on
public static void checkIfFishWasCaught(ArmorStandEntity armorStand) {
if (Utils.isOnSkyblock() && SkyblockerConfigManager.get().helpers.fishing.enableFishingHelper) {
if (!armorStand.isInvisible() || !armorStand.hasCustomName() || !armorStand.isCustomNameVisible()) return;

ClientPlayerEntity player = MinecraftClient.getInstance().player;
if (player != null && player.fishHook != null) {
String name = armorStand.getCustomName().getString();

if (name.equals("!!!") && player.fishHook.getBoundingBox().expand(4D).contains(armorStand.getPos())) {
RenderHelper.displayInTitleContainerAndPlaySound(title, 10);
resetFish();
}
}
}
}

public static void render(WorldRenderContext context) {
if (SkyblockerConfigManager.get().helpers.fishing.enableFishingTimer && startTime != 0) {
ClientPlayerEntity player = MinecraftClient.getInstance().player;
Expand Down