Skip to content

Commit

Permalink
fix rendering issue on death
Browse files Browse the repository at this point in the history
fix #162
  • Loading branch information
Cheaterpaul committed Nov 15, 2023
1 parent 82190c7 commit 041b64a
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import net.minecraftforge.client.event.RenderLevelStageEvent;
import net.minecraftforge.client.event.RenderLivingEvent;
import net.minecraftforge.client.event.ViewportEvent;
import net.minecraftforge.common.util.LazyOptional;
import net.minecraftforge.event.TickEvent;
import net.minecraftforge.event.level.LevelEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
Expand All @@ -30,6 +31,7 @@

import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.Optional;

public class RenderHandler implements ResourceManagerReloadListener {
private static final Logger LOGGER = LogManager.getLogger();
Expand Down Expand Up @@ -70,9 +72,9 @@ public void onClientTick(TickEvent.ClientTickEvent event) {
if (this.mc.level == null || this.mc.player == null || !this.mc.player.isAlive()) return;
if (event.phase == TickEvent.Phase.END) return;
this.lastTicks = this.ticks;
WerewolfPlayer werewolf = WerewolfPlayer.get(this.mc.player);
LazyOptional<WerewolfPlayer> werewolf = WerewolfPlayer.getOpt(this.mc.player);

if (werewolf.getActionHandler().isActionActive(ModActions.SENSE.get())) {
if (werewolf.filter(s -> s.getActionHandler().isActionActive(ModActions.SENSE.get())).isPresent()) {
if (this.ticks < VISION_FADE_TICKS) {
this.ticks++;
}
Expand Down

0 comments on commit 041b64a

Please sign in to comment.