Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unconditionally cancelled inject causing compatibility issues on Fabric #31

Open
enjarai opened this issue Jul 16, 2023 · 2 comments
Open

Comments

@enjarai
Copy link

enjarai commented Jul 16, 2023

The Fabric version of this mod contains an inject mixin in KeyMapping that is unconditionally cancelled. This is effectively the same as using an overwrite mixin, and is very bad practice:

@Inject(method = "resetMapping", at = @At(value = "HEAD"), cancellable = true)
private static void resetMapping(CallbackInfo info)
{
MAP.clear();
Iterator<?> var0 = ALL.values().iterator();
while (var0.hasNext())
{
KeyMapping keyMapping = (KeyMapping)var0.next();
if (!keyMapping.equals(EquipmentCompare.showComparisonTooltip))
{
MAP.put(keyMapping.key, keyMapping);
}
}
info.cancel();
}

Doing your mixin this way creates incompatibilities with one of my mods (specifically here (uses Yarn)) and is likely to create issues with other mods that modify keybind behaviour.

If possible, it'd be great if you could switch to a more limited injection scope, potentially making use of the excellent @WrapWithCondition provided by MixinExtras.

@enjarai
Copy link
Author

enjarai commented Aug 9, 2023

Is a fix planned for this? If not, mind if I create a PR for it?

@SettingDust
Copy link

https://modrinth.com/mod/equipment-compare-keybind-fix (Under review 2023-11-13)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants