stabilize PlayerSelector, improve its rendering a bit, rewrite Notifier's player notifications
All checks were successful
/ Build BaseBand DSM & Broadway (push) Successful in 2m28s
All checks were successful
/ Build BaseBand DSM & Broadway (push) Successful in 2m28s
This commit is contained in:
parent
acc9856b34
commit
b21e85a998
14 changed files with 95 additions and 38 deletions
|
@ -10,7 +10,7 @@ import de.com.baseband.client.feature.modules.combat.AutoKill;
|
|||
import de.com.baseband.client.feature.modules.combat.AutoTotem;
|
||||
import de.com.baseband.client.feature.modules.experimental.Inventory;
|
||||
import de.com.baseband.client.feature.modules.experimental.NoParticles;
|
||||
import de.com.baseband.client.feature.modules.experimental.PlayerSelector;
|
||||
import de.com.baseband.client.feature.modules.render.PlayerSelector;
|
||||
import de.com.baseband.client.feature.modules.movement.*;
|
||||
import de.com.baseband.client.feature.modules.ingame.AutoRespawn;
|
||||
import de.com.baseband.client.feature.modules.ingame.InteractionTweaks;
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
package de.com.baseband.client.event.events;
|
||||
|
||||
import de.com.baseband.client.event.Event;
|
||||
import net.minecraft.client.network.NetworkPlayerInfo;
|
||||
|
||||
public class PlayerJoinedEvent extends Event {
|
||||
public final NetworkPlayerInfo playerInfo;
|
||||
|
||||
public PlayerJoinedEvent(NetworkPlayerInfo playerInfo) {
|
||||
this.playerInfo = playerInfo;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
package de.com.baseband.client.event.events;
|
||||
|
||||
import de.com.baseband.client.event.Event;
|
||||
import net.minecraft.client.network.NetworkPlayerInfo;
|
||||
|
||||
public class PlayerLeftEvent extends Event {
|
||||
public final NetworkPlayerInfo playerInfo;
|
||||
public final int index;
|
||||
|
||||
public PlayerLeftEvent(NetworkPlayerInfo playerInfo, int index) {
|
||||
this.playerInfo = playerInfo;
|
||||
this.index = index;
|
||||
}
|
||||
}
|
|
@ -11,7 +11,7 @@ import java.lang.reflect.AnnotatedElement;
|
|||
|
||||
public enum Category {
|
||||
|
||||
CHAT("Chat", Chat.class),
|
||||
CHAT("Chat", ChatCategory.class),
|
||||
COMBAT("Combat", Combat.class),
|
||||
MOVEMENT("Movement", Movement.class),
|
||||
RENDER("Render", Render.class),
|
||||
|
|
|
@ -2,6 +2,8 @@ package de.com.baseband.client.feature.background;
|
|||
|
||||
import de.com.baseband.client.BaseBand;
|
||||
import de.com.baseband.client.event.events.PlayerEnteredViewEvent;
|
||||
import de.com.baseband.client.event.events.PlayerJoinedEvent;
|
||||
import de.com.baseband.client.event.events.PlayerLeftEvent;
|
||||
import de.com.baseband.client.event.events.PlayerLeftViewEvent;
|
||||
import de.com.baseband.client.feature.Feature;
|
||||
import de.com.baseband.client.feature.category.Background;
|
||||
|
@ -15,27 +17,43 @@ import java.util.Optional;
|
|||
public class PlayerListHandler extends Feature {
|
||||
|
||||
public static ArrayList<NetworkPlayerInfo> playersInRenderDistance = new ArrayList<>();
|
||||
public static ArrayList<EntityPlayer> entityPlayersInRenderDistance = new ArrayList<>();
|
||||
public static ArrayList<NetworkPlayerInfo> playersInTab = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
public void onTick() {
|
||||
ArrayList<NetworkPlayerInfo> players = new ArrayList<>();
|
||||
ArrayList<NetworkPlayerInfo> playersRD = new ArrayList<>(), playersTab = new ArrayList<>();
|
||||
for (NetworkPlayerInfo playerInfo : mc.player.connection.getPlayerInfoMap()) {
|
||||
Optional<EntityPlayer> player = mc.world.playerEntities.stream().filter(x -> x.getGameProfile().getId().equals(playerInfo.getGameProfile().getId())).findAny();
|
||||
playersTab.add(playerInfo);
|
||||
if(!playersInTab.contains(playerInfo)) {
|
||||
playersInTab.add(playerInfo);
|
||||
BaseBand.publish(new PlayerJoinedEvent(playerInfo));
|
||||
}
|
||||
if(player.isPresent()) {
|
||||
players.add(playerInfo);
|
||||
playersRD.add(playerInfo);
|
||||
if(!playersInRenderDistance.contains(playerInfo)) {
|
||||
playersInRenderDistance.add(playerInfo);
|
||||
entityPlayersInRenderDistance.add(player.get());
|
||||
BaseBand.publish(new PlayerEnteredViewEvent(playerInfo, player.get()));
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < playersInRenderDistance.size(); i++) {
|
||||
NetworkPlayerInfo playerInfo = playersInRenderDistance.get(i);
|
||||
if (!players.contains(playerInfo)) {
|
||||
if (!playersRD.contains(playerInfo)) {
|
||||
BaseBand.publish(new PlayerLeftViewEvent(playerInfo, i));
|
||||
entityPlayersInRenderDistance.remove(i);
|
||||
playersInRenderDistance.remove(i--);
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < playersInTab.size(); i++) {
|
||||
NetworkPlayerInfo playerInfo = playersInTab.get(i);
|
||||
if (!playersTab.contains(playerInfo)) {
|
||||
BaseBand.publish(new PlayerLeftEvent(playerInfo, i));
|
||||
playersInTab.remove(i--);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -7,5 +7,5 @@ import java.lang.annotation.Target;
|
|||
|
||||
@Target(ElementType.TYPE)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface Chat {
|
||||
public @interface ChatCategory {
|
||||
}
|
|
@ -1,13 +1,14 @@
|
|||
package de.com.baseband.client.feature.modules.chat;
|
||||
|
||||
import de.com.baseband.client.feature.Feature;
|
||||
import de.com.baseband.client.feature.category.ChatCategory;
|
||||
import de.com.baseband.client.registry.annotation.Config;
|
||||
import de.com.baseband.client.registry.annotation.Gate;
|
||||
import de.com.baseband.client.util.adapt.Marker;
|
||||
import net.minecraftforge.client.event.ClientChatEvent;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
|
||||
@de.com.baseband.client.feature.category.Chat
|
||||
@ChatCategory
|
||||
public class ChatAppend extends Feature {
|
||||
|
||||
@Override
|
||||
|
|
|
@ -3,6 +3,7 @@ package de.com.baseband.client.feature.modules.chat;
|
|||
import de.com.baseband.client.BaseBand;
|
||||
import de.com.baseband.client.event.events.PacketEvent;
|
||||
import de.com.baseband.client.feature.Feature;
|
||||
import de.com.baseband.client.feature.category.ChatCategory;
|
||||
import de.com.baseband.client.feature.modules.render.HUD;
|
||||
import de.com.baseband.client.mixin.mixins.ICPacketChat;
|
||||
import de.com.baseband.client.registry.annotation.*;
|
||||
|
@ -23,7 +24,7 @@ import java.util.Arrays;
|
|||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
@de.com.baseband.client.feature.category.Chat
|
||||
@ChatCategory
|
||||
public class ChatCrypt extends Feature {
|
||||
@Override
|
||||
public String toString() {
|
||||
|
|
|
@ -4,6 +4,7 @@ import com.mojang.realmsclient.gui.ChatFormatting;
|
|||
import de.com.baseband.client.BaseBand;
|
||||
import de.com.baseband.client.event.events.PacketEvent;
|
||||
import de.com.baseband.client.feature.Feature;
|
||||
import de.com.baseband.client.feature.category.ChatCategory;
|
||||
import de.com.baseband.client.registry.annotation.Config;
|
||||
import de.com.baseband.client.registry.annotation.Description;
|
||||
import de.com.baseband.client.registry.annotation.Gate;
|
||||
|
@ -23,7 +24,7 @@ import java.util.List;
|
|||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
@de.com.baseband.client.feature.category.Chat
|
||||
@ChatCategory
|
||||
public class ChatExtras extends Feature {
|
||||
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@ package de.com.baseband.client.feature.modules.chat;
|
|||
import de.com.baseband.client.BaseBand;
|
||||
import de.com.baseband.client.event.events.PacketEvent;
|
||||
import de.com.baseband.client.feature.Feature;
|
||||
import de.com.baseband.client.feature.category.ChatCategory;
|
||||
import de.com.baseband.client.registry.annotation.Config;
|
||||
import de.com.baseband.client.util.adapt.FieldFinder;
|
||||
import net.minecraft.network.play.server.SPacketChat;
|
||||
|
@ -12,7 +13,7 @@ import net.minecraft.util.text.TextComponentString;
|
|||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
@de.com.baseband.client.feature.category.Chat
|
||||
@ChatCategory
|
||||
public class ChatFilter extends Feature {
|
||||
|
||||
public enum Mode {
|
||||
|
|
|
@ -2,6 +2,7 @@ package de.com.baseband.client.feature.modules.chat;
|
|||
|
||||
import de.com.baseband.client.event.events.PlayerDestroyEvent;
|
||||
import de.com.baseband.client.feature.Feature;
|
||||
import de.com.baseband.client.feature.category.ChatCategory;
|
||||
import de.com.baseband.client.registry.PlayerDB;
|
||||
import de.com.baseband.client.registry.annotation.Config;
|
||||
import de.com.baseband.client.registry.annotation.Description;
|
||||
|
@ -9,7 +10,7 @@ import de.com.baseband.client.util.interact.Chat;
|
|||
import net.minecraftforge.client.event.ClientChatReceivedEvent;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
|
||||
@de.com.baseband.client.feature.category.Chat
|
||||
@ChatCategory
|
||||
@Description("Accepts TPA-Requests automatically")
|
||||
public class TPAccept extends Feature {
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ import de.com.baseband.client.event.events.PacketEvent;
|
|||
import de.com.baseband.client.event.events.PlayerDestroyEvent;
|
||||
import de.com.baseband.client.feature.Feature;
|
||||
import de.com.baseband.client.feature.category.ClientCategory;
|
||||
import de.com.baseband.client.feature.modules.experimental.PlayerSelector;
|
||||
import de.com.baseband.client.feature.modules.render.PlayerSelector;
|
||||
import de.com.baseband.client.gui.GuiTheme;
|
||||
import de.com.baseband.client.registry.Configuration;
|
||||
import de.com.baseband.client.registry.annotation.*;
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
package de.com.baseband.client.feature.modules.client;
|
||||
|
||||
import de.com.baseband.client.BaseBand;
|
||||
import de.com.baseband.client.event.events.PacketEvent;
|
||||
import de.com.baseband.client.event.events.TotemPopEvent;
|
||||
import de.com.baseband.client.event.events.*;
|
||||
import de.com.baseband.client.feature.Feature;
|
||||
import de.com.baseband.client.feature.category.ClientCategory;
|
||||
import de.com.baseband.client.registry.annotation.Config;
|
||||
|
@ -10,14 +9,10 @@ import net.minecraft.entity.Entity;
|
|||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.network.play.server.SPacketEntityTeleport;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
@ClientCategory
|
||||
public class Notifier extends Feature {
|
||||
|
||||
private final ArrayList<String> names = new ArrayList<>();
|
||||
private final ArrayList<String> newnames = new ArrayList<>();
|
||||
private final HashMap<String, Integer> popList = new HashMap<>();
|
||||
|
||||
@Config("Totem Pops")
|
||||
|
@ -26,6 +21,9 @@ public class Notifier extends Feature {
|
|||
@Config("Visual Range")
|
||||
public boolean visualRange;
|
||||
|
||||
@Config("Join messages")
|
||||
public boolean joins;
|
||||
|
||||
@Config("Trace Teleport")
|
||||
public boolean traceTeleport;
|
||||
|
||||
|
@ -34,21 +32,32 @@ public class Notifier extends Feature {
|
|||
return "Notifier";
|
||||
}
|
||||
|
||||
public void onPlayerEnterView(PlayerEnteredViewEvent event) {
|
||||
if(visualRange && !event.playerInfo.getGameProfile().getId().equals(mc.getSession().getProfile().getId())) {
|
||||
BaseBand.notify("[" + this + "] Player §aentered§r render distance: " + event.playerInfo.getGameProfile().getName());
|
||||
}
|
||||
}
|
||||
|
||||
public void onPlayerLeaveView(PlayerLeftViewEvent event) {
|
||||
if(visualRange && !event.playerInfo.getGameProfile().getId().equals(mc.getSession().getProfile().getId())) {
|
||||
BaseBand.notify("[" + this + "] Player §cleft§r render distance: " + event.playerInfo.getGameProfile().getName());
|
||||
}
|
||||
}
|
||||
|
||||
public void onPlayerJoin(PlayerJoinedEvent event) {
|
||||
if(joins && !event.playerInfo.getGameProfile().getId().equals(mc.getSession().getProfile().getId())) {
|
||||
BaseBand.notify("[" + this + "] Player §ajoined§r: " + event.playerInfo.getGameProfile().getName());
|
||||
}
|
||||
}
|
||||
|
||||
public void onPlayerLeave(PlayerLeftEvent event) {
|
||||
if(joins && !event.playerInfo.getGameProfile().getId().equals(mc.getSession().getProfile().getId())) {
|
||||
BaseBand.notify("[" + this + "] Player §cleft§r: " + event.playerInfo.getGameProfile().getName());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTick() {
|
||||
if(visualRange) {
|
||||
newnames.clear();
|
||||
try {
|
||||
for (final Entity entity : mc.world.loadedEntityList) if (entity instanceof EntityPlayer && !entity.getName().equalsIgnoreCase(mc.player.getName())) newnames.add(entity.getName());
|
||||
if (!names.equals(newnames)) {
|
||||
for (final String name : newnames) if (!names.contains(name)) BaseBand.notify("[" + this + "] "+name+" has entered Visual Range.");
|
||||
for (final String name : names) if (!newnames.contains(name)) BaseBand.notify("[" + this + "] "+name+" has left Visual Range.");
|
||||
names.clear();
|
||||
names.addAll(newnames);
|
||||
}
|
||||
} catch (Exception ignored) {}
|
||||
}
|
||||
|
||||
if(totemPops) {
|
||||
for (EntityPlayer player : mc.world.playerEntities) {
|
||||
if (player.getHealth() <= 0) {
|
||||
|
@ -80,7 +89,6 @@ public class Notifier extends Feature {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
public void totemPop(TotemPopEvent event) {
|
||||
if(popList.get(event.getEntity().getName()) == null) {
|
||||
popList.put(event.getEntity().getName(), 1);
|
||||
|
@ -96,8 +104,6 @@ public class Notifier extends Feature {
|
|||
|
||||
@Override
|
||||
public void onDisable() {
|
||||
names.clear();
|
||||
newnames.clear();
|
||||
popList.clear();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
package de.com.baseband.client.feature.modules.experimental;
|
||||
package de.com.baseband.client.feature.modules.render;
|
||||
|
||||
import de.com.baseband.client.event.KeyManager;
|
||||
import de.com.baseband.client.event.events.PlayerLeftViewEvent;
|
||||
import de.com.baseband.client.feature.Feature;
|
||||
import de.com.baseband.client.feature.background.PlayerListHandler;
|
||||
import de.com.baseband.client.feature.category.Experimental;
|
||||
import de.com.baseband.client.feature.category.Render;
|
||||
import de.com.baseband.client.registry.AnyGate;
|
||||
import de.com.baseband.client.registry.annotation.Gate;
|
||||
import de.com.baseband.client.registry.annotation.Requires;
|
||||
|
@ -22,7 +22,7 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
import java.util.function.BiConsumer;
|
||||
|
||||
@Experimental
|
||||
@Render
|
||||
@Requires(PlayerListHandler.class)
|
||||
public class PlayerSelector extends Feature {
|
||||
|
||||
|
@ -36,6 +36,7 @@ public class PlayerSelector extends Feature {
|
|||
private Mode mode = Mode.LIST;
|
||||
|
||||
List<NetworkPlayerInfo> display = new ArrayList<>();
|
||||
List<EntityPlayer> displayPlayers = new ArrayList<>();
|
||||
|
||||
int cursor = 0;
|
||||
int optionCursor = 0;
|
||||
|
@ -95,7 +96,7 @@ public class PlayerSelector extends Feature {
|
|||
mode = Mode.OPTIONS;
|
||||
optionCursor = 0;
|
||||
}
|
||||
mc.fontRenderer.drawStringWithShadow((selected ? "§c§m| §r§a " : "§c| §r ") + playerInfo.getGameProfile().getName() + (selected ? " §c>" : ""), x, y, 0xffffffff);
|
||||
mc.fontRenderer.drawStringWithShadow((selected ? "§c§m| §r§a " : "§c| §r ") + displayPlayers.get(i).getDisplayName().getFormattedText() + (selected ? " §c>" : ""), x, y, 0xffffffff);
|
||||
y += mc.fontRenderer.FONT_HEIGHT;
|
||||
}
|
||||
}
|
||||
|
@ -128,6 +129,7 @@ public class PlayerSelector extends Feature {
|
|||
@Override
|
||||
public void onTick() {
|
||||
display = PlayerListHandler.playersInRenderDistance;
|
||||
displayPlayers = PlayerListHandler.entityPlayersInRenderDistance;
|
||||
}
|
||||
|
||||
@Override
|
Loading…
Add table
Reference in a new issue