Skip to content

Commit a274d2f

Browse files
committed
implement modretrieval
1 parent 9f2558f commit a274d2f

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

src/client/java/com/coflnet/CoflModClient.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
import CoflCore.commands.CommandType;
4848
import CoflCore.commands.RawCommand;
4949
import CoflCore.commands.models.FlipData;
50+
import CoflCore.commands.models.ModListData;
5051
import CoflCore.handlers.DescriptionHandler;
5152
import CoflCore.handlers.EventRegistry;
5253
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
@@ -1505,4 +1506,14 @@ private void checkAndHandleAccountSwitch() {
15051506
// Update last checked username
15061507
lastCheckedUsername = currentUsername;
15071508
}
1509+
1510+
public static void cacheMods() {
1511+
ModListData modListData = new ModListData();
1512+
for (net.fabricmc.loader.api.ModContainer mod : FabricLoader.getInstance().getAllMods()) {
1513+
modListData.addModname(mod.getMetadata().getName());
1514+
modListData.addFilename(mod.getMetadata().getName());
1515+
modListData.addFilename(mod.getMetadata().getId());
1516+
}
1517+
CoflCore.Wrapper.SendMessage(new RawCommand("foundMods", gson.toJson(modListData)));
1518+
}
15081519
}

src/client/java/com/coflnet/EventSubscribers.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,4 +191,9 @@ public void onLoggedIn(OnLoggedIn event){
191191
System.out.println("Backend logged in event received, uploading scoreboard and tab list...");
192192
CoflModClient.uploadScoreboardAndTabList();
193193
}
194+
195+
@Subscribe
196+
public void onModRequestReceive(OnModRequestReceive event){
197+
CoflModClient.cacheMods();
198+
}
194199
}

0 commit comments

Comments
 (0)