Skip to content

Commit

Permalink
> vB1.10.1a
Browse files Browse the repository at this point in the history
Additions:
- Added more renderers for SeedOverlay
- Added functions to binds (,bind help)
- Added GuiPlayerSelect for selecting targets
- KillAura has a new "target" mode, `,bind killaura select <key>` to use
- You can now select AltControl targets with a GUI, `,bind altcontrol kill <key>`, more of that in the bind help

Deletions:
none

Other:
none

Notes:
- Time taken: ~6 hours

https://discord.gg/2WsVCQDpwy
  • Loading branch information
tudbut committed Jan 23, 2021
1 parent 6906c59 commit 0fa07c0
Show file tree
Hide file tree
Showing 14 changed files with 343 additions and 109 deletions.
9 changes: 8 additions & 1 deletion help.chat.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
§k||||||||||||||||||||||||||||||||
§c§lTTC connection
§k||||||||||||||||||||||||||||||||
§avB1.10.0a
§avB1.10.1a
§a§lHelp

§aCurrent prefix: %p
Expand Down Expand Up @@ -42,6 +42,13 @@
§bBind a module to a key
§7where <module> is any module and [key] is either nothing or a key name.

§d%pbind <module> <function> [key]
§bBind a module's function to a key
§7where <module> is any module, <function> is a function, and [key] is either nothing or a key name.

§d%pbind help
§bHelp and infos about your binds

§d%pchatsuffix <suffix...>
§bSet the chatsuffix
§7where <suffix...> is anything.
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/tudbut/mod/client/ttc/TTC.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public class TTC {
// FML stuff and version
public static final String MODID = "ttc";
public static final String NAME = "TTC Client";
public static final String VERSION = "vB1.10.0a";
public static final String VERSION = "vB1.10.1a";

// Registered modules, will make an api for it later
public static Module[] modules;
Expand Down
22 changes: 6 additions & 16 deletions src/main/java/tudbut/mod/client/ttc/events/FMLEventHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -265,29 +265,19 @@ public void onTick(TickEvent.PlayerTickEvent event) {
}
ParticleLoop.run();
for (int i = 0; i < TTC.modules.length; i++) {
if(TTC.modules[i].key != null) {
if (Keyboard.isKeyDown(TTC.modules[i].key) && TTC.mc.currentScreen == null) {
if (!TTC.modules[i].keyDown) {
TTC.modules[i].keyDown = true;
ChatUtils.print("§a" + TTC.modules[i].getClass().getSimpleName() + " now " + !TTC.modules[i].enabled);

if (TTC.modules[i].enabled = !TTC.modules[i].enabled)
TTC.modules[i].onEnable();
else
TTC.modules[i].onDisable();
}
}
else
TTC.modules[i].keyDown = false;
}
TTC.modules[i].key.onTick();

if (TTC.modules[i].enabled)
if (TTC.modules[i].enabled) {
try {
for (String key : TTC.modules[i].customKeyBinds.keySet()) {
TTC.modules[i].customKeyBinds.get(key).onTick();
}
TTC.modules[i].onTick();
}
catch (Exception e) {
e.printStackTrace(ChatUtils.chatPrinterDebug());
}
}
TTC.modules[i].onEveryTick();
}
}
Expand Down
22 changes: 14 additions & 8 deletions src/main/java/tudbut/mod/client/ttc/gui/GuiPlayerSelect.java
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public void updateScreen() {

// Reset the buttons array
private void resetButtons() {
System.out.println("Resetting buttons on ClickGUI");
System.out.println("Resetting buttons on PlayerSelectGUI");
for (int i = 0, j = 0; i < players.length; i++) {
int x = j / 8;
int y = j - x * 8;
Expand All @@ -87,7 +87,9 @@ private void resetButtons() {
10 + (160 * x), 10 + (y * 30), players[r].getName(),
(text) -> {
EntityPlayer player = players[r];
event.run(player);
if(event.run(player)) {
close();
}
}
);
buttons[i] = b;
Expand All @@ -108,9 +110,9 @@ private void updateButtons() {
if (buttons == null)
resetButtons();
}
for (int i = 0; i < TTC.modules.length; i++) {
for (int i = 0; i < buttons.length; i++) {
if (buttons[i] != null)
buttons[i].text.set(TTC.modules[i].getClass().getSimpleName() + ": " + TTC.modules[i].enabled);
buttons[i].text.set(players[i].getName());
}
}

Expand All @@ -125,11 +127,17 @@ protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOEx
// Notify buttons
for (GuiPlayerSelect.Button button : buttons) {
if (button != null)
if (button.mouseClicked(mouseX, mouseY, mouseButton))
if (button.mouseClicked(mouseX, mouseY, mouseButton)) {
return;
}
}
}

public void close() {
onGuiClosed();
TTC.mc.displayGuiScreen(null);
}



// Update cx and cy
Expand Down Expand Up @@ -177,8 +185,6 @@ public static class Button {
public AtomicReference<String> text;
// Color for rendering
public int color = 0x8000ff00;
// The associated module, can be null if it is a sub button
public Module module;
// Called when the button is clicked
GuiTTC.ButtonClickEvent event;

Expand Down Expand Up @@ -232,6 +238,6 @@ protected void click(int button) {
}

public interface ButtonClickEvent {
void run(EntityPlayer player);
boolean run(EntityPlayer player);
}
}
74 changes: 63 additions & 11 deletions src/main/java/tudbut/mod/client/ttc/mods/AltControl.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.math.Vec3d;
import tudbut.mod.client.ttc.TTC;
import tudbut.mod.client.ttc.gui.GuiPlayerSelect;
import tudbut.mod.client.ttc.gui.GuiTTC;
import tudbut.mod.client.ttc.utils.*;
import tudbut.net.ic.PBIC;
Expand All @@ -29,23 +30,64 @@ public static AltControl getInstance() {
private int confirmationInstance = 0;
public int mode = -1;
private boolean botMain = true;
private boolean useElytra = false;
private boolean useElytra = true;
private boolean stopped = true;
private final Atomic<Vec3d> commonTarget = new Atomic<>();
private EntityPlayer commonTargetPlayer = null;
private long lostTimer = 0;

PBIC.Server server;
PBIC.Client client;

Alt main = new Alt();
ArrayList<Alt> alts = new ArrayList<>();
Map<PBIC.Connection, Alt> altsMap = new HashMap<>();

{updateButtons();}

{
customKeyBinds.put("kill", new KeyBind(null, () -> {
TTC.mc.displayGuiScreen(
new GuiPlayerSelect(
TTC.world.playerEntities.stream().filter(
player -> !player.getName().equals(TTC.player.getName())
).toArray(EntityPlayer[]::new),
player -> {
if (server != null)
onChat("kill " + player.getName(), ("kill " + player.getName()).split(" "));
return true;
}
)
);
}));
customKeyBinds.put("follow", new KeyBind(null, () -> {
TTC.mc.displayGuiScreen(
new GuiPlayerSelect(
TTC.world.playerEntities.toArray(new EntityPlayer[0]),
player -> {
if (server != null)
onChat("follow " + player.getName(), ("follow " + player.getName()).split(" "));
return true;
}
)
);
}));
customKeyBinds.put("stop", new KeyBind(null, () -> {
onChat("stop", "stop".split(" "));
}));
}

@Override
public void loadConfig() {
botMain = Boolean.parseBoolean(cfg.get("botMain"));
useElytra = Boolean.parseBoolean(cfg.get("useElytra"));
updateButtons();
}

@Override
public void updateConfig() {
cfg.put("botMain", botMain + "");
cfg.put("useElytra", useElytra + "");
}

private void updateButtons() {
Expand Down Expand Up @@ -111,13 +153,6 @@ public boolean isAlt(EntityPlayer player) {
}
}

PBIC.Server server;
PBIC.Client client;

Alt main = new Alt();
ArrayList<Alt> alts = new ArrayList<>();
Map<PBIC.Connection, Alt> altsMap = new HashMap<>();

@Override
public void onConfirm(boolean result) {
if(result) {
Expand All @@ -144,7 +179,7 @@ public void onTick() {

if (main.uuid.equals(TTC.player.getUniqueID())) {
if (new Date().getTime() - lostTimer > 10000) {
FlightBot.setSpeed(0.75);
FlightBot.setSpeed(1.00);
} else if (new Date().getTime() - lostTimer > 5000) {
FlightBot.setSpeed(0.75);
}
Expand Down Expand Up @@ -251,6 +286,8 @@ public void onPacketSC(PacketSC packet) {
FlightBot.deactivate();
break;
case ELYTRA:
if(!useElytra && !stopped)
ChatUtils.simulateSend("#stop", false);
useElytra = true;
break;
case KEEPALIVE:
Expand Down Expand Up @@ -479,6 +516,16 @@ public void onChat(String s, String[] args) {
stop(st);
}
}

if (args[0].equals("follow")) {
if(useElytra) {
sendPacketSC(PacketsSC.ELYTRA, "");
} else {
sendPacketSC(PacketsSC.WALK, "");
}
sendPacketSC(PacketsSC.FOLLOW, args[1]);
follow(args[1]);
}
}

if (s.equals("stop")) {
Expand Down Expand Up @@ -594,6 +641,8 @@ private void sendList() {
}

public void follow(String name) {
if(TTC.player.getName().equals(name))
return;
commonTargetPlayer = TTC.world.getPlayerEntityByName(name);
follow();
}
Expand All @@ -612,7 +661,8 @@ public void stop(String name) {
commonTarget.set(null);
stopped = true;
FlightBot.deactivate();
ChatUtils.simulateSend("#stop", false);
if(!useElytra)
ChatUtils.simulateSend("#stop", false);
if(name == null || name.equals("")) {
aura.targets.clear();
aura.enabled = false;
Expand All @@ -629,8 +679,10 @@ public void stop(String name) {
}

public void follow() {
if(commonTargetPlayer == null)
if(commonTargetPlayer == null) {
FlightBot.deactivate();
return;
}

stopped = false;

Expand Down
33 changes: 30 additions & 3 deletions src/main/java/tudbut/mod/client/ttc/mods/Bind.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import org.lwjgl.input.Keyboard;
import tudbut.mod.client.ttc.TTC;
import tudbut.mod.client.ttc.utils.ChatUtils;
import tudbut.mod.client.ttc.utils.Module;

public class Bind extends Module {
Expand All @@ -27,12 +28,38 @@ public void onChat(String s, String[] args) {

@Override
public void onEveryChat(String s, String[] args) {
if(s.equals("help")) {

ChatUtils.print("§a§lBinds");
for (int i = 0; i < TTC.modules.length; i++) {
ChatUtils.print("§aModule: " + TTC.modules[i].toString());
if(TTC.modules[i].key.key != null)
ChatUtils.print("State: " + Keyboard.getKeyName(TTC.modules[i].key.key));
for (String kb : TTC.modules[i].customKeyBinds.keySet()) {
ChatUtils.print("Function " + kb + ": " + Keyboard.getKeyName(TTC.modules[i].customKeyBinds.get(kb).key));
}
}

return;
}

for (int i = 0; i < TTC.modules.length; i++) {
if (args[0].equalsIgnoreCase(TTC.modules[i].getClass().getSimpleName().toLowerCase())) {
if(args.length == 2)
TTC.modules[i].key = Keyboard.getKeyIndex(args[1].toUpperCase());
if(args.length == 2) {
int key = Keyboard.getKeyIndex(args[1].toUpperCase());
if(key == Keyboard.KEY_NONE) {
TTC.modules[i].customKeyBinds.get(args[1]).key = null;
}
else
TTC.modules[i].key.key = key;
}
else if (args.length == 3) {
if (TTC.modules[i].customKeyBinds.containsKey(args[1])) {
TTC.modules[i].customKeyBinds.get(args[1]).key = Keyboard.getKeyIndex(args[2].toUpperCase());
}
}
else
TTC.modules[i].key = null;
TTC.modules[i].key.key = null;
}
}
}
Expand Down
38 changes: 38 additions & 0 deletions src/main/java/tudbut/mod/client/ttc/mods/HUD.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
package tudbut.mod.client.ttc.mods;

import net.minecraft.client.gui.ScaledResolution;
import tudbut.mod.client.ttc.TTC;
import tudbut.mod.client.ttc.gui.GuiTTCIngame;
import tudbut.mod.client.ttc.utils.Module;
import tudbut.obj.Vector2i;

public class HUD extends Module {

Expand All @@ -24,4 +27,39 @@ public void renderHUD() {
public void onChat(String s, String[] args) {

}

public static class HUDElement {




}

/*
public enum Anchor {
TL,
TR,
BL,
BR,
;
public Vector2i getCoords(Vector2i offset) {
ScaledResolution sr = new ScaledResolution(TTC.mc);
Vector2i screenSize = new Vector2i(sr.getScaledWidth(), sr.getScaledHeight());
switch (this) {
case TL:
return new Vector2i(0,0).add(offset);
case TR:
return new Vector2i(sr.getScaledWidth() / 2, 0).add(offset);
case BL:
return new Vector2i(0, screenSize.getY() / 2).add(offset);
case BR:
return new Vector2i(screenSize.getX() / 2, screenSize.getY() / 2).add(offset);
}
return new Vector2i(0,0);
}
}*/
}
Loading

0 comments on commit 0fa07c0

Please sign in to comment.