Skip to content

Commit

Permalink
Merge pull request #161 from 4P5/particle-fix
Browse files Browse the repository at this point in the history
Fix particles not being removed
  • Loading branch information
skyrina committed Jan 9, 2024
2 parents e27d451 + aad0ad3 commit a6a9261
Showing 1 changed file with 1 addition and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public abstract class ParticleEngineMixin implements ParticleEngineAccessor {
@Unique private final HashMap<Particle, UUID> particleMap = new HashMap<>();

// This fixes a conflict with Optifine having slightly different args + it should be more stable in general, capturing Locals is bad practice
@ModifyVariable(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/particle/ParticleEngine;tickParticle(Lnet/minecraft/client/particle/Particle;)V"), method = "tickParticleList", ordinal = 0)
@ModifyVariable(method = "tickParticleList", at = @At(value = "INVOKE", target = "Ljava/util/Iterator;remove()V", ordinal = 0))
private Particle tickParticleList(Particle particle) {
particleMap.remove(particle);
return particle;
Expand All @@ -50,7 +50,6 @@ private Particle tickParticleList(Particle particle) {
Iterator<Map.Entry<Particle, UUID>> iterator = particleMap.entrySet().iterator();
while (iterator.hasNext()) {
Map.Entry<Particle, UUID> entry = iterator.next();

if ((owner == null || entry.getValue().equals(owner))) {
if (entry.getKey() != null)
entry.getKey().remove();
Expand Down

0 comments on commit a6a9261

Please sign in to comment.