Skip to content
This repository was archived by the owner on Nov 28, 2025. It is now read-only.

Commit bed08d1

Browse files
committed
move discordrpc to common
1 parent 186853a commit bed08d1

File tree

24 files changed

+405
-490
lines changed

24 files changed

+405
-490
lines changed

1.16_combat-6/src/main/java/io/github/axolotlclient/AxolotlClient.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
import io.github.axolotlclient.modules.hud.HudManager;
3636
import io.github.axolotlclient.modules.hypixel.HypixelMods;
3737
import io.github.axolotlclient.modules.particles.Particles;
38-
import io.github.axolotlclient.modules.rpc.DiscordRPC;
3938
import io.github.axolotlclient.modules.screenshotUtils.ScreenshotUtils;
4039
import io.github.axolotlclient.modules.scrollableTooltips.ScrollableTooltips;
4140
import io.github.axolotlclient.modules.sky.SkyResourceManager;
@@ -64,7 +63,6 @@ private void addBuiltinModules() {
6463
registerModule(MotionBlur.getInstance());
6564
registerModule(MenuBlur.getInstance());
6665
registerModule(ScrollableTooltips.getInstance());
67-
registerModule(DiscordRPC.getInstance());
6866

6967
registerModule(Particles.getInstance());
7068
registerModule(ScreenshotUtils.getInstance());

1.16_combat-6/src/main/java/io/github/axolotlclient/bridge/mixin/MinecraftClientMixin.java

Lines changed: 54 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,11 @@
2222

2323
package io.github.axolotlclient.bridge.mixin;
2424

25-
import java.util.Collection;
26-
import java.util.Optional;
25+
import java.util.*;
26+
import java.util.stream.Collectors;
2727

28+
import com.google.common.collect.Iterables;
29+
import com.google.common.collect.Lists;
2830
import io.github.axolotlclient.bridge.AxoMinecraftClient;
2931
import io.github.axolotlclient.bridge.AxoPlayerListEntry;
3032
import io.github.axolotlclient.bridge.AxoSession;
@@ -47,6 +49,10 @@
4749
import net.minecraft.client.world.ClientWorld;
4850
import net.minecraft.entity.Entity;
4951
import net.minecraft.resource.ResourceManager;
52+
import net.minecraft.scoreboard.Scoreboard;
53+
import net.minecraft.scoreboard.ScoreboardObjective;
54+
import net.minecraft.scoreboard.ScoreboardPlayerScore;
55+
import net.minecraft.scoreboard.Team;
5056
import net.minecraft.text.Text;
5157
import net.minecraft.util.thread.ReentrantThreadExecutor;
5258
import org.jetbrains.annotations.Nullable;
@@ -141,6 +147,11 @@ public MinecraftClientMixin(String string) {
141147
return Optional.ofNullable(getCurrentServerEntry()).map(x -> x.address).orElse(null);
142148
}
143149

150+
@Override
151+
public String br$getServerName() {
152+
return Optional.ofNullable(getCurrentServerEntry()).map(x -> x.name).orElse(null);
153+
}
154+
144155
@Override
145156
public Collection<? extends AxoPlayerListEntry> br$getOnlinePlayers() {
146157
return player.networkHandler.getPlayerList();
@@ -179,7 +190,47 @@ public MinecraftClientMixin(String string) {
179190
}
180191

181192
@Override
182-
public AxoEntity axo$getCameraEntity() {
193+
public AxoEntity br$getCameraEntity() {
183194
return cameraEntity;
184195
}
196+
197+
@Override
198+
public List<String> br$getSidebar() {
199+
List<String> lines = new ArrayList<>();
200+
MinecraftClient client = MinecraftClient.getInstance();
201+
if (client.world == null)
202+
return lines;
203+
204+
Scoreboard scoreboard = client.world.getScoreboard();
205+
if (scoreboard == null)
206+
return lines;
207+
ScoreboardObjective sidebar = scoreboard.getObjectiveForSlot(1);
208+
if (sidebar == null)
209+
return lines;
210+
211+
Collection<ScoreboardPlayerScore> scores = scoreboard.getAllPlayerScores(sidebar);
212+
List<ScoreboardPlayerScore> list = scores.stream().filter(
213+
input -> input != null && input.getPlayerName() != null && !input.getPlayerName().startsWith("#"))
214+
.collect(Collectors.toList());
215+
216+
if (list.size() > 15) {
217+
scores = Lists.newArrayList(Iterables.skip(list, scores.size() - 15));
218+
} else {
219+
scores = list;
220+
}
221+
222+
for (ScoreboardPlayerScore score : scores) {
223+
Team team = scoreboard.getPlayerTeam(score.getPlayerName());
224+
if (team == null)
225+
return lines;
226+
String text = team.getPrefix().getString() + team.getSuffix().getString();
227+
if (!text.trim().isEmpty())
228+
lines.add(text);
229+
}
230+
231+
lines.add(sidebar.getDisplayName().getString());
232+
Collections.reverse(lines);
233+
234+
return lines;
235+
}
185236
}

1.16_combat-6/src/main/java/io/github/axolotlclient/modules/rpc/DiscordRPC.java

Lines changed: 0 additions & 79 deletions
This file was deleted.

1.20/src/main/java/io/github/axolotlclient/AxolotlClient.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
import io.github.axolotlclient.modules.hud.HudManager;
3636
import io.github.axolotlclient.modules.hypixel.HypixelMods;
3737
import io.github.axolotlclient.modules.particles.Particles;
38-
import io.github.axolotlclient.modules.rpc.DiscordRPC;
3938
import io.github.axolotlclient.modules.screenshotUtils.ScreenshotUtils;
4039
import io.github.axolotlclient.modules.scrollableTooltips.ScrollableTooltips;
4140
import io.github.axolotlclient.modules.sky.SkyResourceManager;
@@ -64,7 +63,6 @@ private void addBuiltinModules() {
6463
registerModule(MotionBlur.getInstance());
6564
registerModule(MenuBlur.getInstance());
6665
registerModule(ScrollableTooltips.getInstance());
67-
registerModule(DiscordRPC.getInstance());
6866

6967
registerModule(Particles.getInstance());
7068
registerModule(ScreenshotUtils.getInstance());

1.20/src/main/java/io/github/axolotlclient/bridge/mixin/MinecraftClientMixin.java

Lines changed: 54 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,11 @@
2222

2323
package io.github.axolotlclient.bridge.mixin;
2424

25-
import java.util.Collection;
26-
import java.util.Optional;
25+
import java.util.*;
26+
import java.util.stream.Collectors;
2727

28+
import com.google.common.collect.Iterables;
29+
import com.google.common.collect.Lists;
2830
import io.github.axolotlclient.bridge.AxoMinecraftClient;
2931
import io.github.axolotlclient.bridge.AxoPlayerListEntry;
3032
import io.github.axolotlclient.bridge.AxoSession;
@@ -47,6 +49,10 @@
4749
import net.minecraft.client.world.ClientWorld;
4850
import net.minecraft.entity.Entity;
4951
import net.minecraft.resource.ResourceManager;
52+
import net.minecraft.scoreboard.Scoreboard;
53+
import net.minecraft.scoreboard.ScoreboardObjective;
54+
import net.minecraft.scoreboard.ScoreboardPlayerScore;
55+
import net.minecraft.scoreboard.Team;
5056
import net.minecraft.text.Text;
5157
import org.jetbrains.annotations.Nullable;
5258
import org.spongepowered.asm.mixin.Final;
@@ -136,6 +142,11 @@ public abstract class MinecraftClientMixin implements AxoMinecraftClient {
136142
return Optional.ofNullable(getCurrentServerEntry()).map(x -> x.address).orElse(null);
137143
}
138144

145+
@Override
146+
public String br$getServerName() {
147+
return Optional.ofNullable(getCurrentServerEntry()).map(x -> x.name).orElse(null);
148+
}
149+
139150
@Override
140151
public Collection<? extends AxoPlayerListEntry> br$getOnlinePlayers() {
141152
return player.networkHandler.getPlayerList();
@@ -178,7 +189,47 @@ public abstract class MinecraftClientMixin implements AxoMinecraftClient {
178189
}
179190

180191
@Override
181-
public AxoEntity axo$getCameraEntity() {
192+
public AxoEntity br$getCameraEntity() {
182193
return cameraEntity;
183194
}
195+
196+
@Override
197+
public List<String> br$getSidebar() {
198+
List<String> lines = new ArrayList<>();
199+
MinecraftClient client = MinecraftClient.getInstance();
200+
if (client.world == null)
201+
return lines;
202+
203+
Scoreboard scoreboard = client.world.getScoreboard();
204+
if (scoreboard == null)
205+
return lines;
206+
ScoreboardObjective sidebar = scoreboard.getObjectiveForSlot(Scoreboard.SIDEBAR_DISPLAY_SLOT_ID);
207+
if (sidebar == null)
208+
return lines;
209+
210+
Collection<ScoreboardPlayerScore> scores = scoreboard.getAllPlayerScores(sidebar);
211+
List<ScoreboardPlayerScore> list = scores.stream().filter(
212+
input -> input != null && input.getPlayerName() != null && !input.getPlayerName().startsWith("#"))
213+
.collect(Collectors.toList());
214+
215+
if (list.size() > 15) {
216+
scores = Lists.newArrayList(Iterables.skip(list, scores.size() - 15));
217+
} else {
218+
scores = list;
219+
}
220+
221+
for (ScoreboardPlayerScore score : scores) {
222+
Team team = scoreboard.getPlayerTeam(score.getPlayerName());
223+
if (team == null)
224+
return lines;
225+
String text = team.getPrefix().getString() + team.getSuffix().getString();
226+
if (!text.trim().isEmpty())
227+
lines.add(text);
228+
}
229+
230+
lines.add(sidebar.getDisplayName().getString());
231+
Collections.reverse(lines);
232+
233+
return lines;
234+
}
184235
}

1.20/src/main/java/io/github/axolotlclient/modules/rpc/DiscordRPC.java

Lines changed: 0 additions & 78 deletions
This file was deleted.

1.21/src/main/java/io/github/axolotlclient/AxolotlClient.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
import io.github.axolotlclient.modules.hud.HudManager;
3535
import io.github.axolotlclient.modules.hypixel.HypixelMods;
3636
import io.github.axolotlclient.modules.particles.Particles;
37-
import io.github.axolotlclient.modules.rpc.DiscordRPC;
3837
import io.github.axolotlclient.modules.screenshotUtils.ScreenshotUtils;
3938
import io.github.axolotlclient.modules.scrollableTooltips.ScrollableTooltips;
4039
import io.github.axolotlclient.modules.tablist.Tablist;
@@ -60,7 +59,6 @@ private void addBuiltinModules() {
6059
registerModule(HypixelMods.getInstance());
6160
registerModule(MotionBlur.getInstance());
6261
registerModule(ScrollableTooltips.getInstance());
63-
registerModule(DiscordRPC.getInstance());
6462

6563
registerModule(Particles.getInstance());
6664
registerModule(ScreenshotUtils.getInstance());

0 commit comments

Comments
 (0)