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 Dec 14, 2024
1 parent c3861c6 commit 5151dff
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,10 @@ public boolean canBeUsedBy(@NotNull IVampirePlayer player) {
if (player.getRepresentingPlayer().level().getDifficulty() == Difficulty.PEACEFUL) return false;
if (player.isRemote()) {
Entity target = VampirismMod.proxy.getMouseOverEntity();
if (target != null) {
if (target instanceof LivingEntity living) {
if (UtilLib.canReallySee(living, player.getRepresentingPlayer(), false)) {
return false;
}
return deriveBiteableEntry(target).map(b -> b.canBeInfected(player)).orElse(false);
}
return false;
Expand Down

0 comments on commit 5151dff

Please sign in to comment.