mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-11-27 23:27:59 +01:00
Fixed sun blindness being incorrectly applied on the client when changing dimensions. Closes #55
This commit is contained in:
parent
b35c592569
commit
3255eacd18
2 changed files with 6 additions and 5 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue