Add the dust cloud when pegasi take off from sand, gravel, and concrete power

+ fix dust particles flying away too quickly from where a pegasus takes off
This commit is contained in:
Sollace 2024-01-31 14:05:14 +00:00
parent dc6bc9fe9e
commit a36aa10085
No known key found for this signature in database
GPG key ID: E52FACE7B5C773DB

View file

@ -40,6 +40,7 @@ import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.damage.DamageSource; import net.minecraft.entity.damage.DamageSource;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NbtCompound; import net.minecraft.nbt.NbtCompound;
import net.minecraft.particle.BlockStateParticleEffect;
import net.minecraft.particle.ParticleTypes; import net.minecraft.particle.ParticleTypes;
import net.minecraft.predicate.entity.EntityPredicates; import net.minecraft.predicate.entity.EntityPredicates;
import net.minecraft.registry.RegistryKeys; import net.minecraft.registry.RegistryKeys;
@ -564,10 +565,14 @@ public class PlayerPhysics extends EntityPhysics<PlayerEntity> implements Tickab
entity.calculateDimensions(); entity.calculateDimensions();
if (entity.isOnGround() || !force) { if (entity.isOnGround() || !force) {
Supplier<Vec3d> pos = VecHelper.sphere(pony.asWorld().getRandom(), 0.5D); BlockState steppingState = pony.asEntity().getSteppingBlockState();
Supplier<Vec3d> vel = VecHelper.sphere(pony.asWorld().getRandom(), 0.15D); if (steppingState.isIn(UTags.KICKS_UP_DUST)) {
pony.spawnParticles(ParticleTypes.CAMPFIRE_COSY_SMOKE, pos, vel, 5); pony.addParticle(new BlockStateParticleEffect(UParticles.DUST_CLOUD, steppingState), pony.getOrigin().down().toCenterPos(), Vec3d.ZERO);
pony.spawnParticles(ParticleTypes.CLOUD, pos, vel, 5); } else {
Supplier<Vec3d> pos = VecHelper.sphere(pony.asWorld().getRandom(), 0.5D);
Supplier<Vec3d> vel = VecHelper.sphere(pony.asWorld().getRandom(), 0.015D);
pony.spawnParticles(ParticleTypes.CLOUD, pos, vel, 5);
}
} }
} }