Skip to content

Commit

Permalink
Fix Forge overriding ResourceKey.equals() with a slower implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
embeddedt committed Aug 3, 2023
1 parent f1e2b21 commit eac9edb
Showing 1 changed file with 18 additions and 0 deletions.
@@ -0,0 +1,18 @@
package org.embeddedt.modernfix.forge.mixin.perf.resource_key_equality;

import net.minecraft.resources.ResourceKey;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;

@Mixin(ResourceKey.class)
public class ResourceKeyMixin {
/**
* @author embeddedt
* @reason ResourceKeys are interned, so there is no reason to waste time doing any deeper comparison. This override
* is patched in by Forge, it doesn't exist in vanilla
*/
@Overwrite(remap = false)
public boolean equals(Object o) {
return o == this;
}
}

0 comments on commit eac9edb

Please sign in to comment.