Skip to content

Commit cc49913

Browse files
committed
Added Module ExtraTab
1 parent 89c6c99 commit cc49913

File tree

3 files changed

+87
-0
lines changed

3 files changed

+87
-0
lines changed
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
/*
2+
* Copyright 2025 Lambda
3+
*
4+
* This program is free software: you can redistribute it and/or modify
5+
* it under the terms of the GNU General Public License as published by
6+
* the Free Software Foundation, either version 3 of the License, or
7+
* (at your option) any later version.
8+
*
9+
* This program is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
* GNU General Public License for more details.
13+
*
14+
* You should have received a copy of the GNU General Public License
15+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
16+
*/
17+
18+
package com.lambda.mixin.render;
19+
20+
import com.lambda.module.modules.render.ExtraTab;
21+
import net.minecraft.client.MinecraftClient;
22+
import net.minecraft.client.gui.hud.PlayerListHud;
23+
import net.minecraft.client.network.PlayerListEntry;
24+
import org.spongepowered.asm.mixin.Final;
25+
import org.spongepowered.asm.mixin.Mixin;
26+
import org.spongepowered.asm.mixin.Shadow;
27+
import org.spongepowered.asm.mixin.injection.At;
28+
import org.spongepowered.asm.mixin.injection.Inject;
29+
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
30+
31+
import java.util.Comparator;
32+
import java.util.List;
33+
34+
@Mixin(PlayerListHud.class)
35+
public class PlayerListHudMixin {
36+
@Shadow @Final private static Comparator<PlayerListEntry> ENTRY_ORDERING;
37+
38+
@Shadow @Final private MinecraftClient client;
39+
40+
@Inject(method = "collectPlayerEntries", at = @At(value = "HEAD"), cancellable = true)
41+
private void onCollectPlayerEntriesHead(CallbackInfoReturnable<List<PlayerListEntry>> cir) {
42+
if (ExtraTab.INSTANCE.isDisabled()) return;
43+
if (client.player == null) return;
44+
cir.setReturnValue(
45+
client.player.networkHandler
46+
.getListedPlayerListEntries()
47+
.stream()
48+
.sorted(ENTRY_ORDERING)
49+
.limit(ExtraTab.getTabEntries())
50+
.toList()
51+
);
52+
}
53+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/*
2+
* Copyright 2025 Lambda
3+
*
4+
* This program is free software: you can redistribute it and/or modify
5+
* it under the terms of the GNU General Public License as published by
6+
* the Free Software Foundation, either version 3 of the License, or
7+
* (at your option) any later version.
8+
*
9+
* This program is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
* GNU General Public License for more details.
13+
*
14+
* You should have received a copy of the GNU General Public License
15+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
16+
*/
17+
18+
package com.lambda.module.modules.render
19+
20+
import com.lambda.module.Module
21+
import com.lambda.module.tag.ModuleTag
22+
23+
object ExtraTab : Module(
24+
name = "ExtraTab",
25+
description = "Adds more tabs to the main menu",
26+
defaultTags = setOf(ModuleTag.RENDER)
27+
) {
28+
@JvmStatic
29+
val tabEntries by setting("Tab Entries", 80L, 1L..500L, 1L)
30+
31+
@JvmStatic
32+
val rows by setting("Rows", 20, 1..100, 1)
33+
}

common/src/main/resources/lambda.mixins.common.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
"render.InGameOverlayRendererMixin",
3737
"render.LightmapTextureManagerMixin",
3838
"render.LivingEntityRendererMixin",
39+
"render.PlayerListHudMixin",
3940
"render.RenderLayersMixin",
4041
"render.RenderSystemMixin",
4142
"render.RenderTickCounterMixin",

0 commit comments

Comments
 (0)