diff options
Diffstat (limited to 'src/main')
7 files changed, 60 insertions, 2 deletions
diff --git a/src/main/java/com/dulkirfabric/mixin/render/ParticleManagerMixin.java b/src/main/java/com/dulkirfabric/mixin/render/ParticleManagerMixin.java new file mode 100644 index 0000000..7c3c2b9 --- /dev/null +++ b/src/main/java/com/dulkirfabric/mixin/render/ParticleManagerMixin.java @@ -0,0 +1,26 @@ +package com.dulkirfabric.mixin.render; + +import com.dulkirfabric.events.AddParticleEvent; +import com.llamalad7.mixinextras.injector.ModifyReturnValue; +import net.minecraft.client.particle.Particle; +import net.minecraft.client.particle.ParticleManager; +import net.minecraft.particle.ParticleEffect; +import net.minecraft.resource.ResourceReloader; +import org.jetbrains.annotations.Nullable; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +@Mixin(ParticleManager.class) +public abstract class ParticleManagerMixin implements ResourceReloader { + + @Inject(at = @At("HEAD"), method = "addParticle(Lnet/minecraft/client/particle/Particle;)V", cancellable = true) + public void onAddParticle(Particle particle, CallbackInfo ci) { + if (new AddParticleEvent(particle).post()) { + ci.cancel(); + } + } +} diff --git a/src/main/kotlin/com/dulkirfabric/Registrations.kt b/src/main/kotlin/com/dulkirfabric/Registrations.kt index d8dea01..5fa7cd8 100644 --- a/src/main/kotlin/com/dulkirfabric/Registrations.kt +++ b/src/main/kotlin/com/dulkirfabric/Registrations.kt @@ -58,6 +58,7 @@ object Registrations { EVENT_BUS.subscribe(AliasImpl) EVENT_BUS.subscribe(EffigyDisplay) EVENT_BUS.subscribe(TablistUtils) + EVENT_BUS.subscribe(CullExplosionParticles) } fun registerEvents() { diff --git a/src/main/kotlin/com/dulkirfabric/config/DulkirConfig.kt b/src/main/kotlin/com/dulkirfabric/config/DulkirConfig.kt index c9fd0dd..75bd592 100644 --- a/src/main/kotlin/com/dulkirfabric/config/DulkirConfig.kt +++ b/src/main/kotlin/com/dulkirfabric/config/DulkirConfig.kt @@ -101,6 +101,9 @@ class DulkirConfig { general.addEntry( entryBuilder.mkToggle(Text.literal("Inactive Effigy Waypoints"), configOptions::inactiveEffigyDisplay) ) + general.addEntry( + entryBuilder.mkToggle(Text.literal("Disable Explosion Particles"), configOptions::disableExplosionParticles) + ) val shortcuts = builder.getOrCreateCategory(Text.literal("Shortcuts")) shortcuts.addEntry( @@ -156,7 +159,8 @@ class DulkirConfig { var abiPhoneCallerID: Boolean = false, var tooltipScale: Float = 1f, var statusEffectHidden: Boolean = false, - var inactiveEffigyDisplay: Boolean = false + var inactiveEffigyDisplay: Boolean = false, + var disableExplosionParticles: Boolean = false ) @Serializable diff --git a/src/main/kotlin/com/dulkirfabric/events/AddParticleEvent.kt b/src/main/kotlin/com/dulkirfabric/events/AddParticleEvent.kt new file mode 100644 index 0000000..2091adf --- /dev/null +++ b/src/main/kotlin/com/dulkirfabric/events/AddParticleEvent.kt @@ -0,0 +1,8 @@ +package com.dulkirfabric.events + +import com.dulkirfabric.events.base.CancellableEvent +import net.minecraft.client.particle.Particle + +data class AddParticleEvent( + val particle: Particle +) : CancellableEvent()
\ No newline at end of file diff --git a/src/main/kotlin/com/dulkirfabric/features/CullExplosionParticles.kt b/src/main/kotlin/com/dulkirfabric/features/CullExplosionParticles.kt new file mode 100644 index 0000000..8c034b6 --- /dev/null +++ b/src/main/kotlin/com/dulkirfabric/features/CullExplosionParticles.kt @@ -0,0 +1,19 @@ +package com.dulkirfabric.features + +import com.dulkirfabric.events.AddParticleEvent +import meteordevelopment.orbit.EventHandler +import net.minecraft.client.particle.ExplosionLargeParticle + +/** + * Remove nearby Explosions that would be intrusive visually + */ +object CullExplosionParticles { + + @EventHandler + fun onParticle(event: AddParticleEvent) { + val particle = event.particle + if (particle is ExplosionLargeParticle) { + event.cancel() + } + } +}
\ No newline at end of file diff --git a/src/main/resources/1.0 TODO.txt b/src/main/resources/1.0 TODO.txt index f67b55d..2100b33 100644 --- a/src/main/resources/1.0 TODO.txt +++ b/src/main/resources/1.0 TODO.txt @@ -4,7 +4,6 @@ Hype Broken Arachne Timer Keeper Waypoints Item Ability Cooldown displays -Hide Explosion Particles Starred Mob glow Trim Useless Messages Tablist Utility diff --git a/src/main/resources/dulkirmod-fabric.mixins.json b/src/main/resources/dulkirmod-fabric.mixins.json index 32f8b98..bdf1721 100644 --- a/src/main/resources/dulkirmod-fabric.mixins.json +++ b/src/main/resources/dulkirmod-fabric.mixins.json @@ -17,6 +17,7 @@ "render.KeyboardMixin", "render.LoomScreenMixin", "render.MinecraftClientMixin", + "render.ParticleManagerMixin", "render.PerspectiveMixin", "render.ScreenMixin" ], |