blob: 7c3c2b905389fd6c5fdab7795184cda606438991 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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();
}
}
}
|