Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,29 @@
import meteordevelopment.meteorclient.gui.tabs.Tab;
import meteordevelopment.meteorclient.gui.tabs.TabScreen;
import meteordevelopment.meteorclient.gui.tabs.WindowTabScreen;
import meteordevelopment.meteorclient.gui.widgets.WAccount;
import meteordevelopment.meteorclient.gui.widgets.containers.WHorizontalList;
import meteordevelopment.meteorclient.gui.widgets.containers.WTable;
import meteordevelopment.meteorclient.gui.widgets.input.WTextBox;
import meteordevelopment.meteorclient.gui.widgets.pressable.WButton;
import meteordevelopment.meteorclient.gui.widgets.pressable.WMinus;
import meteordevelopment.meteorclient.gui.widgets.pressable.WPlus;
import meteordevelopment.meteorclient.systems.friends.Friend;
import meteordevelopment.meteorclient.systems.friends.Friends;
import meteordevelopment.meteorclient.utils.entity.EntityUtils;
import meteordevelopment.meteorclient.utils.misc.NbtUtils;
import meteordevelopment.meteorclient.utils.network.MeteorExecutor;

import net.minecraft.client.gui.screen.Screen;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.player.PlayerEntity;

import static meteordevelopment.meteorclient.MeteorClient.mc;

public class FriendsTab extends Tab {


public FriendsTab() {
super("Friends");
}
Expand Down Expand Up @@ -71,6 +80,46 @@ public void initWidgets() {
}
};

WButton list_players = list.add(theme.button("Nearby Players")).widget();
list_players.action = () -> {
if (mc.world != null) {
for (Entity entity : mc.world.getEntities()) {
EntityType<?> type = entity.getType();

//Only show players
if (type == EntityType.PLAYER) {
if (entity == mc.player) continue;
if (EntityUtils.getGameMode((PlayerEntity) entity) == null) continue;
if (Friends.get().isFriend((PlayerEntity) entity)) continue;
} else {
continue;
}
String name = entity.getNameForScoreboard();

//Display all rendered players
table.add(theme.label(name));
WPlus addAsFriend = table.add(theme.plus()).expandCellX().right().widget();
addAsFriend.action = () -> {
Friend friend = new Friend(entity.getStringifiedName());

if (Friends.get().add(friend)) {
nameW.set("");
reload();
//Add them as Friend
MeteorExecutor.execute(() -> {
friend.updateInfo();
mc.execute(this::reload);
});
}
};
table.row();

};
}
};



enterAction = add.action;
}

Expand Down
Loading