Skip to content

Commit

Permalink
fix night vision upgrade suppressing other night vision sources
Browse files Browse the repository at this point in the history
  • Loading branch information
desht committed Sep 9, 2024
1 parent f56439c commit c123b54
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,17 @@ public void tick(ICommonArmorHandler commonArmorHandler, boolean enabled) {
MobEffectInstance nvInstance = player.getEffect(MobEffects.NIGHT_VISION);
if (enabled && hasPressure && (nvInstance == null || nvInstance.getDuration() <= 220)) {
player.addEffect(new MobEffectInstance(MobEffects.NIGHT_VISION, 500, 0, false, false));
} else if ((!enabled || !hasPressure) && nvInstance != null) {
player.removeEffect(MobEffects.NIGHT_VISION);
}
}
}

@Override
public void onToggle(ICommonArmorHandler commonArmorHandler, boolean newState) {
if (!newState) {
commonArmorHandler.getPlayer().removeEffect(MobEffects.NIGHT_VISION);
}
}

@Override
public void onShutdown(ICommonArmorHandler commonArmorHandler) {
commonArmorHandler.getPlayer().removeEffect(MobEffects.NIGHT_VISION);
Expand Down

0 comments on commit c123b54

Please sign in to comment.