From aa82ac7a79042aacc66cf71e999a844e5ea424a2 Mon Sep 17 00:00:00 2001 From: cheaterpaul Date: Sun, 8 Dec 2024 14:43:00 +0100 Subject: [PATCH] fix entity cast without type check close #1459 --- .../vampirism/entity/player/vampire/actions/InfectAction.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/de/teamlapen/vampirism/entity/player/vampire/actions/InfectAction.java b/src/main/java/de/teamlapen/vampirism/entity/player/vampire/actions/InfectAction.java index 2203622b8..3434365cd 100644 --- a/src/main/java/de/teamlapen/vampirism/entity/player/vampire/actions/InfectAction.java +++ b/src/main/java/de/teamlapen/vampirism/entity/player/vampire/actions/InfectAction.java @@ -62,8 +62,8 @@ public IActionResult canBeUsedBy(@NotNull IVampirePlayer player) { } if (player.isRemote()) { Entity target = VampirismMod.proxy.getMouseOverEntity(); - if (target != null) { - if (UtilLib.canReallySee((LivingEntity) target, player.asEntity(), false)) { + if (target instanceof LivingEntity living) { + if (UtilLib.canReallySee(living, player.asEntity(), false)) { return IActionResult.fail(Component.translatable("text.vampirism.action.infect.sees_you")); } if(!deriveBiteableEntry(target).map(b -> b.canBeInfected(player)).orElse(false)) {