This commit is contained in:
petrak@ 2023-02-17 22:06:15 -06:00
parent 237e75e6da
commit 293f96d8d7
3 changed files with 16 additions and 2 deletions

View file

@ -6,6 +6,10 @@ import at.petrak.hexcasting.xplat.IXplatAbstractions
import net.minecraft.server.level.ServerLevel
import net.minecraft.world.phys.Vec3
/**
* @param fuzziness the radius of the sphere the particle might happen in (pos)
* @param spread the max angle in radians the particle can move in, in relation to vel
*/
data class ParticleSpray(val pos: Vec3, val vel: Vec3, val fuzziness: Double, val spread: Double, val count: Int = 20) {
companion object {
@JvmStatic

View file

@ -139,9 +139,9 @@ class OpFlight(val type: Type) : SpellAction {
val color = IXplatAbstractions.INSTANCE.getColorizer(player)
// TODO: have the particles go in the opposite direction of the velocity?
ParticleSpray(player.position(), Vec3(0.0, -0.6, 0.0), Math.PI * 0.3, 0.6, count = okParticleCount)
ParticleSpray(player.position(), Vec3(0.0, -0.6, 0.0), 0.6, Math.PI * 0.3, count = okParticleCount)
.sprayParticles(player.getLevel(), color)
val dangerSpray = ParticleSpray(player.position(), Vec3(0.0, 1.0, 0.0), Math.PI * 0.75, 0.3, count = 0)
val dangerSpray = ParticleSpray(player.position(), Vec3(0.0, 1.0, 0.0), 0.3, Math.PI * 0.75, count = 0)
dangerSpray.copy(count = oneDangerParticleCount)
.sprayParticles(player.getLevel(), FrozenColorizer(ItemStack(HexItems.DYE_COLORIZERS[DyeColor.BLACK]!!), Util.NIL_UUID))
dangerSpray.copy(count = oneDangerParticleCount)

View file

@ -8,9 +8,11 @@ import at.petrak.hexcasting.api.casting.getPlayer
import at.petrak.hexcasting.api.casting.iota.Iota
import at.petrak.hexcasting.api.misc.MediaConstants
import at.petrak.hexcasting.api.player.AltioraAbility
import at.petrak.hexcasting.common.lib.HexSounds
import at.petrak.hexcasting.xplat.IXplatAbstractions
import net.minecraft.server.level.ServerLevel
import net.minecraft.server.level.ServerPlayer
import net.minecraft.sounds.SoundSource
import net.minecraft.world.phys.Vec3
import kotlin.math.max
@ -47,9 +49,17 @@ object OpAltiora : SpellAction {
if (altiora != null) {
if (altiora.gracePeriod == 0 && (player.isOnGround || player.horizontalCollision)) {
IXplatAbstractions.INSTANCE.setAltiora(player, null)
player.level.playSound(null, player.x, player.y, player.z, HexSounds.FLIGHT_FINISH, SoundSource.PLAYERS, 2f, 1f)
} else {
val grace2 = max(altiora.gracePeriod - 1, 0)
IXplatAbstractions.INSTANCE.setAltiora(player, AltioraAbility(grace2))
if (player.level.random.nextFloat() < 0.02)
player.level.playSound(null, player.x, player.y, player.z, HexSounds.FLIGHT_AMBIENCE, SoundSource.PLAYERS, 0.2f, 1f)
val color = IXplatAbstractions.INSTANCE.getColorizer(player)
ParticleSpray(player.position(), Vec3(0.0, -0.2, 0.0), 0.4, Math.PI * 0.5, count = 3)
.sprayParticles(player.getLevel(), color)
}
}
}