Update player dimensions when the flight type changes. Should fix #38

This commit is contained in:
Sollace 2021-12-24 23:00:26 +02:00
parent be0317de1b
commit 59db55aa63

View file

@ -15,7 +15,6 @@ import com.minelittlepony.unicopia.entity.player.MagicReserves.Bar;
import com.minelittlepony.unicopia.item.AmuletItem; import com.minelittlepony.unicopia.item.AmuletItem;
import com.minelittlepony.unicopia.item.UItems; import com.minelittlepony.unicopia.item.UItems;
import com.minelittlepony.unicopia.item.enchantment.UEnchantments; import com.minelittlepony.unicopia.item.enchantment.UEnchantments;
import com.minelittlepony.unicopia.particle.ParticleUtils;
import com.minelittlepony.unicopia.projectile.ProjectileUtil; import com.minelittlepony.unicopia.projectile.ProjectileUtil;
import com.minelittlepony.unicopia.util.NbtSerialisable; import com.minelittlepony.unicopia.util.NbtSerialisable;
import com.minelittlepony.unicopia.util.Tickable; import com.minelittlepony.unicopia.util.Tickable;
@ -183,8 +182,10 @@ public class PlayerPhysics extends EntityPhysics<PlayerEntity> implements Tickab
FlightType type = getFlightType(); FlightType type = getFlightType();
if (type != lastFlightType && (lastFlightType.isArtifical() || type.isArtifical())) { boolean typeChanged = type != lastFlightType && (lastFlightType.isArtifical() || type.isArtifical());
ParticleUtils.spawnParticles(ParticleTypes.CLOUD, entity, 10);
if (typeChanged) {
pony.spawnParticles(ParticleTypes.CLOUD, 10);
entity.playSound(entity.world.getDimension().isUltrawarm() ? SoundEvents.BLOCK_BELL_USE : SoundEvents.BLOCK_BELL_RESONATE, 0.1125F, 1.5F); entity.playSound(entity.world.getDimension().isUltrawarm() ? SoundEvents.BLOCK_BELL_USE : SoundEvents.BLOCK_BELL_RESONATE, 0.1125F, 1.5F);
} }
@ -235,7 +236,7 @@ public class PlayerPhysics extends EntityPhysics<PlayerEntity> implements Tickab
isFlyingSurvival = entity.getAbilities().flying && !creative; isFlyingSurvival = entity.getAbilities().flying && !creative;
isFlyingEither = isFlyingSurvival || (creative && entity.getAbilities().flying); isFlyingEither = isFlyingSurvival || (creative && entity.getAbilities().flying);
if (startedFlyingCreative) { if (typeChanged || startedFlyingCreative) {
entity.calculateDimensions(); entity.calculateDimensions();
} }