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