diff --git a/src/main/java/dan200/computercraft/fabric/mixin/MixinLanguage.java b/src/main/java/dan200/computercraft/fabric/mixin/MixinLanguage.java index fdd5eeeb3..cd053439c 100644 --- a/src/main/java/dan200/computercraft/fabric/mixin/MixinLanguage.java +++ b/src/main/java/dan200/computercraft/fabric/mixin/MixinLanguage.java @@ -22,6 +22,7 @@ import org.spongepowered.asm.mixin.injection.callback.LocalCapture; import java.io.IOException; import java.io.InputStream; import java.util.HashMap; +import java.util.Map; import java.util.function.BiConsumer; /** @@ -59,6 +60,7 @@ public class MixinLanguage @Inject( method = "create", locals = LocalCapture.CAPTURE_FAILSOFT, at = @At( value = "INVOKE", remap = false, target = "Lcom/google/common/collect/ImmutableMap$Builder;build()Lcom/google/common/collect/ImmutableMap;" ) ) private static void create( CallbackInfoReturnable cir, ImmutableMap.Builder builder ) { + final Map originalTranslation = builder.build(); /* We must ensure that the keys are de-duplicated because we can't catch the error that might otherwise * occur when the injected function calls build() on the ImmutableMap builder. So we use our own hash map and * exclude "minecraft", as the injected function has already loaded those keys at this point. @@ -70,6 +72,9 @@ public class MixinLanguage loadModLangFile( id, translations::put ); } ); + // This is needed to remove keys that exist in vanilla Minecraft (Consistency+ does this) + translations.keySet().removeIf( originalTranslation::containsKey ); + builder.putAll( translations ); } }