aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/dulkirfabric/mixin
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/dulkirfabric/mixin')
-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();
+ }
+ }
+}