Skip to content

Commit

Permalink
fix entity cast without type check
Browse files Browse the repository at this point in the history
close #1459
  • Loading branch information
Cheaterpaul committed Jan 11, 2025
1 parent 7400e5c commit aa82ac7
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down

0 comments on commit aa82ac7

Please sign in to comment.