Fixed sun blindness being incorrectly applied on the client when changing dimensions. Closes #55

This commit is contained in:
Sollace 2022-03-28 19:34:55 +02:00
parent b35c592569
commit 3255eacd18
2 changed files with 6 additions and 5 deletions

View file

@ -51,7 +51,7 @@ public class SunBlindnessStatusEffect extends StatusEffect {
public static boolean hasSunExposure(LivingEntity entity) {
if (entity.hasNetherPortalCooldown()) { // TODO: test this. Entities shouldn't get sun blindness when existing a portal
if (entity.hasNetherPortalCooldown()) {
return false;
}

View file

@ -356,15 +356,16 @@ public class Pony extends Living<PlayerEntity> implements Transmittable, Copieab
if (getSpecies() == Race.BAT) {
if (SunBlindnessStatusEffect.hasSunExposure(entity)) {
System.out.println("Sun exposure " + entity);
if (ticksInSun < 200) {
ticksInSun++;
}
if (ticksInSun == 1) {
entity.addStatusEffect(new StatusEffectInstance(UEffects.SUN_BLINDNESS, SunBlindnessStatusEffect.MAX_DURATION * 10, 1, true, false));
UCriteria.LOOK_INTO_SUN.trigger(entity);
if (isClient() && isClientPlayer()) {
if (!isClient()) {
entity.addStatusEffect(new StatusEffectInstance(UEffects.SUN_BLINDNESS, SunBlindnessStatusEffect.MAX_DURATION * 10, 1, true, false));
UCriteria.LOOK_INTO_SUN.trigger(entity);
} else if (isClientPlayer()) {
InteractionManager.instance().playLoopingSound(entity, InteractionManager.SOUND_EARS_RINGING);
}
}