mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-17 19:35:00 -04:00
particle config
This commit is contained in:
parent
05e9063b42
commit
462d944031
@ -14,8 +14,10 @@
|
||||
package de.bixilon.minosoft.config.config.game.graphics
|
||||
|
||||
import com.squareup.moshi.Json
|
||||
import de.bixilon.minosoft.config.config.game.particles.ParticleConfig
|
||||
|
||||
data class GraphicsGameConfig(
|
||||
var animations: AnimationsGameConfig = AnimationsGameConfig(),
|
||||
var particles: ParticleConfig = ParticleConfig(),
|
||||
@Json(name = "biome_blend_radius") var biomeBlendRadius: Int = 3,
|
||||
)
|
||||
|
@ -0,0 +1,22 @@
|
||||
/*
|
||||
* 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.config.config.game.particles
|
||||
|
||||
import com.squareup.moshi.Json
|
||||
|
||||
data class ParticleConfig(
|
||||
var enabled: Boolean = false,
|
||||
@Json(name = "by_packet") var byPacket: Boolean = true,
|
||||
var explosions: Boolean = true,
|
||||
)
|
@ -13,6 +13,7 @@
|
||||
|
||||
package de.bixilon.minosoft.gui.rendering
|
||||
|
||||
import de.bixilon.minosoft.Minosoft
|
||||
import de.bixilon.minosoft.config.StaticConfiguration
|
||||
import de.bixilon.minosoft.config.config.game.controls.KeyBindingsNames
|
||||
import de.bixilon.minosoft.data.mappings.ResourceLocation
|
||||
@ -114,7 +115,9 @@ class RenderWindow(
|
||||
registerRenderer(SkyRenderer)
|
||||
registerRenderer(WorldRenderer)
|
||||
registerRenderer(BlockOutlineRenderer)
|
||||
if (Minosoft.config.config.game.graphics.particles.enabled) {
|
||||
registerRenderer(ParticleRenderer)
|
||||
}
|
||||
registerRenderer(HUDRenderer)
|
||||
}
|
||||
|
||||
|
@ -13,10 +13,12 @@
|
||||
|
||||
package de.bixilon.minosoft.gui.rendering.particle
|
||||
|
||||
import de.bixilon.minosoft.Minosoft
|
||||
import de.bixilon.minosoft.gui.rendering.particle.types.norender.ExplosionEmitterParticle
|
||||
import de.bixilon.minosoft.gui.rendering.particle.types.render.texture.simple.ExplosionParticle
|
||||
import de.bixilon.minosoft.gui.rendering.util.VecUtil.times
|
||||
import de.bixilon.minosoft.modding.event.CallbackEventInvoker
|
||||
import de.bixilon.minosoft.modding.event.EventInitiators
|
||||
import de.bixilon.minosoft.modding.event.events.ExplosionEvent
|
||||
import de.bixilon.minosoft.modding.event.events.ParticleSpawnEvent
|
||||
import de.bixilon.minosoft.protocol.network.connection.PlayConnection
|
||||
@ -33,6 +35,9 @@ object DefaultParticleBehavior {
|
||||
val explosionEmitterParticleType = connection.registries.particleTypeRegistry[ExplosionEmitterParticle]!!
|
||||
val invokers = listOf(
|
||||
CallbackEventInvoker.of<ExplosionEvent> {
|
||||
if (!Minosoft.config.config.game.graphics.particles.explosions) {
|
||||
return@of
|
||||
}
|
||||
if (it.power >= 2.0f) {
|
||||
particleRenderer += ExplosionEmitterParticle(connection, it.position, explosionEmitterParticleType.default())
|
||||
} else {
|
||||
@ -40,6 +45,9 @@ object DefaultParticleBehavior {
|
||||
}
|
||||
},
|
||||
CallbackEventInvoker.of<ParticleSpawnEvent> {
|
||||
if (it.initiator == EventInitiators.SERVER && !Minosoft.config.config.game.graphics.particles.byPacket) {
|
||||
return@of
|
||||
}
|
||||
fun spawn(position: Vec3, velocity: Vec3) {
|
||||
val particle = it.data.type.factory?.build(connection, position, velocity, it.data) ?: let { _ ->
|
||||
Log.log(LogMessageType.RENDERING_GENERAL, LogLevels.WARN) { "Can not spawn particle: ${it.data.type}" }
|
||||
|
Loading…
x
Reference in New Issue
Block a user