mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-19 12:25:12 -04:00
particles: minecraft:enchanted_hit
This commit is contained in:
parent
62fea42a6e
commit
b3cd731395
@ -19,6 +19,7 @@ import de.bixilon.minosoft.gui.rendering.particle.types.norender.ExplosionEmitte
|
||||
import de.bixilon.minosoft.gui.rendering.particle.types.render.texture.advanced.block.BlockDustParticle
|
||||
import de.bixilon.minosoft.gui.rendering.particle.types.render.texture.simple.CampfireSmokeParticle
|
||||
import de.bixilon.minosoft.gui.rendering.particle.types.render.texture.simple.ExplosionParticle
|
||||
import de.bixilon.minosoft.gui.rendering.particle.types.render.texture.simple.damage.EnchantedHitParticle
|
||||
import de.bixilon.minosoft.gui.rendering.particle.types.render.texture.simple.dust.DustParticle
|
||||
import de.bixilon.minosoft.gui.rendering.particle.types.render.texture.simple.fire.SmokeParticle
|
||||
import de.bixilon.minosoft.gui.rendering.particle.types.render.texture.simple.lava.LavaParticle
|
||||
@ -38,4 +39,5 @@ object DefaultParticleFactory : DefaultFactory<ParticleFactory<out Particle>>(
|
||||
EntityEffectParticle,
|
||||
AmbientEntityEffectParticle,
|
||||
BlockDustParticle,
|
||||
EnchantedHitParticle,
|
||||
)
|
||||
|
@ -0,0 +1,48 @@
|
||||
/*
|
||||
* Minosoft
|
||||
* Copyright (C) 2021 Moritz Zwerger
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* This software is not affiliated with Mojang AB, the original developer of Minecraft.
|
||||
*/
|
||||
|
||||
package de.bixilon.minosoft.gui.rendering.particle.types.render.texture.simple.damage
|
||||
|
||||
import de.bixilon.minosoft.data.mappings.particle.data.ParticleData
|
||||
import de.bixilon.minosoft.data.text.RGBColor.Companion.asGray
|
||||
import de.bixilon.minosoft.gui.rendering.particle.types.render.texture.simple.SimpleTextureParticle
|
||||
import de.bixilon.minosoft.gui.rendering.util.VecUtil.EMPTY
|
||||
import de.bixilon.minosoft.protocol.network.connection.PlayConnection
|
||||
import de.bixilon.minosoft.util.MMath
|
||||
import glm_.vec3.Vec3
|
||||
|
||||
abstract class DamageParticle(connection: PlayConnection, position: Vec3, velocity: Vec3, data: ParticleData? = null) : SimpleTextureParticle(connection, position, Vec3.EMPTY, data) {
|
||||
|
||||
override var scale: Float
|
||||
get() = super.scale * MMath.clamp(floatAge / maxAge * 32.0f, 0.0f, 1.0f)
|
||||
set(value) {
|
||||
super.scale = value
|
||||
}
|
||||
|
||||
init {
|
||||
friction = 0.7f
|
||||
gravityStrength = 0.5f
|
||||
this.velocity *= 0.10000000149011612f
|
||||
this.velocity += velocity * 0.4f
|
||||
color = (random.nextFloat() * 0.30000001192092896f + 0.6000000238418579f).asGray()
|
||||
super.scale *= 0.75f
|
||||
maxAge = (6.0f / (random.nextFloat() * 0.8f + 0.6f)).toInt().coerceAtLeast(1)
|
||||
physics = false
|
||||
realTick()
|
||||
}
|
||||
|
||||
final override fun realTick() {
|
||||
super.realTick()
|
||||
color = color.with(green = this.color.floatGreen * 0.96f, blue = this.color.floatBlue * 0.96f)
|
||||
}
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Minosoft
|
||||
* Copyright (C) 2021 Moritz Zwerger
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* This software is not affiliated with Mojang AB, the original developer of Minecraft.
|
||||
*/
|
||||
|
||||
package de.bixilon.minosoft.gui.rendering.particle.types.render.texture.simple.damage
|
||||
|
||||
import de.bixilon.minosoft.data.mappings.ResourceLocation
|
||||
import de.bixilon.minosoft.data.mappings.particle.data.ParticleData
|
||||
import de.bixilon.minosoft.gui.rendering.particle.ParticleFactory
|
||||
import de.bixilon.minosoft.protocol.network.connection.PlayConnection
|
||||
import de.bixilon.minosoft.util.KUtil.asResourceLocation
|
||||
import glm_.vec3.Vec3
|
||||
|
||||
class EnchantedHitParticle(connection: PlayConnection, position: Vec3, velocity: Vec3, data: ParticleData? = null) : DamageParticle(connection, position, velocity, data) {
|
||||
|
||||
init {
|
||||
color = color.with(red = color.floatRed * 0.3f, green = color.floatGreen * 0.8f)
|
||||
}
|
||||
|
||||
companion object : ParticleFactory<EnchantedHitParticle> {
|
||||
override val RESOURCE_LOCATION: ResourceLocation = "minecraft:enchanted_hit".asResourceLocation()
|
||||
|
||||
override fun build(connection: PlayConnection, position: Vec3, velocity: Vec3, data: ParticleData): EnchantedHitParticle {
|
||||
return EnchantedHitParticle(connection, position, velocity, data)
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user