Fix particles being visible after world change when jumping in time (fixes #35)

This commit is contained in:
johni0702
2016-11-13 20:03:30 +01:00
parent e20dfa6d7f
commit 75c0e7b77a
2 changed files with 32 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
package com.replaymod.replay.mixin;
import net.minecraft.client.particle.Particle;
import net.minecraft.client.particle.ParticleManager;
import net.minecraft.world.World;
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 java.util.Queue;
@Mixin(ParticleManager.class)
public abstract class MixinParticleManager {
@Shadow
private Queue<Particle> queueEntityFX;
/**
* This method additionally clears the queue of particles to be added when the world is changed.
* Otherwise particles from the previous world might show up in this one if they were spawned after
* the last tick in the previous world.
*
* @param world The new world
* @param ci Callback info
*/
@Inject(method = "clearEffects", at = @At("HEAD"))
public void replayModReplay_clearParticleQueue(World world, CallbackInfo ci) {
queueEntityFX.clear();
}
}

View File

@@ -3,6 +3,7 @@
"package": "com.replaymod.replay.mixin",
"mixins": [
"MixinGuiSpectator",
"MixinParticleManager",
"MixinPlayerControllerMP",
"MixinRenderArmorStand",
"MixinRenderArrow",