Skip to content

Commit

Permalink
Prevent EMI plugins from being loaded twice
Browse files Browse the repository at this point in the history
Fixes #5
  • Loading branch information
Su5eD committed Oct 9, 2023
1 parent d6cd22e commit 6d9229f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,18 @@
import org.spongepowered.asm.mixin.injection.ModifyVariable;

import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;

@Mixin(EmiAgnosForge.class)
public class EmiAgnosForgeMixin {
@ModifyVariable(method = "getPluginsAgnos", at = @At("RETURN"), remap = false)
private List<EmiPluginContainer> connectorextras_emi_bridge$addFabricPlugins(List<EmiPluginContainer> orig) {
Set<String> ids = orig.stream().map(EmiPluginContainer::id).collect(Collectors.toSet());
orig.addAll(FabricLoader.getInstance()
.getEntrypointContainers("emi", EmiPlugin.class)
.stream()
.filter(plugin -> !ids.contains(plugin.getProvider().getMetadata().getId()))
.map(p -> new EmiPluginContainer(p.getEntrypoint(), p.getProvider().getMetadata().getId()))
.toList());
return orig;
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ loom.platform=forge
# Versions
versionMc=1.20.1
versionForge=47.1.3
versionConnectorExtras=1.3.0
versionConnectorExtras=1.3.1

# Publishing
curseForgeId=913445
Expand Down

0 comments on commit 6d9229f

Please sign in to comment.