aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com
diff options
context:
space:
mode:
authoringlettronald <inglettronald@gmail.com>2023-07-16 07:11:23 -0500
committeringlettronald <inglettronald@gmail.com>2023-07-16 07:11:23 -0500
commit46e64e85b65d3a6d896f352a7b9de8323870c96d (patch)
tree00b006433f493e24b1036f3d2b33e203ce5fbf25 /src/main/java/com
parent59f0d43c301b926bef01439adb7ab2a5d465837b (diff)
downloadDulkirMod-Fabric-46e64e85b65d3a6d896f352a7b9de8323870c96d.tar.gz
DulkirMod-Fabric-46e64e85b65d3a6d896f352a7b9de8323870c96d.tar.bz2
DulkirMod-Fabric-46e64e85b65d3a6d896f352a7b9de8323870c96d.zip
Explosion Particles Culling Option
Diffstat (limited to 'src/main/java/com')
-rw-r--r--src/main/java/com/dulkirfabric/mixin/render/ParticleManagerMixin.java26
1 files changed, 26 insertions, 0 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();
+ }
+ }
+}