Skip to content

Commit

Permalink
Added Color Settings to many modules.
Browse files Browse the repository at this point in the history
  • Loading branch information
coltonk9043 committed Nov 9, 2023
1 parent 828b370 commit 028e088
Show file tree
Hide file tree
Showing 20 changed files with 103 additions and 40 deletions.
2 changes: 1 addition & 1 deletion src/main/java/net/aoba/gui/tabs/HudsTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public HudsTab(List<AbstractHud> hudList) {
stackPanel.addChild(hudComponent);
}

stackPanel.addChild(new ColorPickerComponent("Hud Color", stackPanel, Aoba.getInstance().hudManager.color));
stackPanel.addChild(new ColorPickerComponent(stackPanel, Aoba.getInstance().hudManager.color));

this.children.add(stackPanel);
this.setWidth(300);
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/net/aoba/gui/tabs/ModuleSettingsTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import net.aoba.gui.HudManager;
import net.aoba.gui.hud.AbstractHud;
import net.aoba.gui.tabs.components.CheckboxComponent;
import net.aoba.gui.tabs.components.ColorPickerComponent;
import net.aoba.gui.tabs.components.Component;
import net.aoba.gui.tabs.components.KeybindComponent;
import net.aoba.gui.tabs.components.ListComponent;
Expand All @@ -18,6 +19,7 @@
import net.aoba.module.Module;
import net.aoba.settings.Setting;
import net.aoba.settings.types.BooleanSetting;
import net.aoba.settings.types.ColorSetting;
import net.aoba.settings.types.FloatSetting;
import net.aoba.settings.types.IndexedStringListSetting;
import net.aoba.settings.types.StringListSetting;
Expand Down Expand Up @@ -47,6 +49,8 @@ public ModuleSettingsTab(String title, float x, float y, Module module) {
c = new CheckboxComponent(this, (BooleanSetting) setting);
} else if (setting instanceof StringListSetting) {
c = new ListComponent(this, (IndexedStringListSetting) setting);
} else if (setting instanceof ColorSetting) {
c = new ColorPickerComponent(this, (ColorSetting) setting);
} else {
c = null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,16 @@ public ColorPickerComponent(String text, IHudElement parent) {
Aoba.getInstance().eventManager.AddListener(LeftMouseUpListener.class, this);
}

public ColorPickerComponent(String text, IHudElement parent, ColorSetting color) {
public ColorPickerComponent(IHudElement parent, ColorSetting color) {
super(parent);

this.text = color.displayName;
this.color = color;

this.hue = color.getValue().hue;
this.saturation = color.getValue().saturation;
this.luminance = color.getValue().luminance;

this.text = text;

this.setHeight(145);
this.setLeft(4);
this.setRight(4);
Expand Down
10 changes: 7 additions & 3 deletions src/main/java/net/aoba/gui/tabs/components/ModuleComponent.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public class ModuleComponent extends Component implements LeftMouseDownListener

private ModuleSettingsTab lastSettingsTab = null;

public static final Identifier gear = new Identifier("minecraft", "textures/gear.png");
public static final Identifier gear = new Identifier("aoba", "/textures/gear.png");

public ModuleComponent(String text, IHudElement parent, Module module) {
super(parent);
Expand All @@ -49,9 +49,13 @@ public void draw(DrawContext drawContext, float partialTicks, Color color) {

renderUtils.drawString(drawContext, this.text, actualX + 8, actualY + 8, module.getState() ? 0x00FF00 : this.hovered ? color.getColorAsInt() : 0xFFFFFF);

if (module.hasSettings()) {
drawContext.drawTexture(gear, (int) (actualX + actualWidth - 16), (int) (actualY + 6), 0, 0, 12, 12);
if(module.hasSettings()) {
renderUtils.drawString(drawContext, ">>", (actualX + actualWidth - 24), actualY + 8, color.getColorAsInt());

}
//if (module.hasSettings()) {
// drawContext.drawTexture(gear, (int) (actualX + actualWidth - 16), (int) (actualY + 6), 0, 0, 4, 4, 4, 4);
//}
}

@Override
Expand Down
15 changes: 8 additions & 7 deletions src/main/java/net/aoba/module/modules/render/Breadcrumbs.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import org.lwjgl.glfw.GLFW;
import net.aoba.module.Module;
import net.aoba.settings.types.BooleanSetting;
import net.aoba.settings.types.ColorSetting;
import net.aoba.settings.types.FloatSetting;
import net.aoba.settings.types.KeybindSetting;
import net.minecraft.client.option.KeyBinding;
Expand All @@ -41,10 +42,11 @@

public class Breadcrumbs extends Module implements RenderListener, TickListener {
private Color currentColor;
private Color color;

private ColorSetting color = new ColorSetting("breadcrumbs_color", "Color", "Color", new Color(0, 1f, 1f));

private RainbowColor rainbowColor;

public FloatSetting hue = new FloatSetting("breadcrumbs_hue", "Hue", "Hue", 4, 0, 360, 1);
public BooleanSetting rainbow = new BooleanSetting("breadcrumbs_rainbow", "Rainbow", "Rainbow", false);
public FloatSetting effectSpeed = new FloatSetting("breadcrumbs_effectspeed", "Effect Spd.", "Effect Spd", 4, 1, 20, 0.1);

Expand All @@ -58,10 +60,10 @@ public Breadcrumbs() {
this.setName("Breadcrumbs");
this.setCategory(Category.Render);
this.setDescription("Shows breadcrumbs of where you last stepped;");
color = new Color(0f, 1f, 1f);
currentColor = color;
currentColor = color.getValue();
rainbowColor = new RainbowColor();
this.addSetting(hue);

this.addSetting(color);
this.addSetting(rainbow);
this.addSetting(effectSpeed);
}
Expand Down Expand Up @@ -103,8 +105,7 @@ public void OnUpdate(TickEvent event) {
this.rainbowColor.update(this.effectSpeed.getValue().floatValue());
this.currentColor = this.rainbowColor.getColor();
}else {
this.color.setHSV(hue.getValue().floatValue(), 1f, 1f);
this.currentColor = color;
this.currentColor = color.getValue();
}
}
}
15 changes: 8 additions & 7 deletions src/main/java/net/aoba/module/modules/render/ChestESP.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import net.aoba.misc.RainbowColor;
import net.aoba.module.Module;
import net.aoba.settings.types.BooleanSetting;
import net.aoba.settings.types.ColorSetting;
import net.aoba.settings.types.FloatSetting;
import net.aoba.settings.types.KeybindSetting;
import net.minecraft.block.entity.BlockEntity;
Expand All @@ -45,23 +46,24 @@

public class ChestESP extends Module implements RenderListener, TickListener {
private Color currentColor;
private Color color;
private RainbowColor rainbowColor;

public FloatSetting hue = new FloatSetting("chestesp_hue", "Hue","Hue", 4, 0, 360, 1);
private ColorSetting color = new ColorSetting("chestesp_color", "Color", "Color", new Color(0, 1f, 1f));

public BooleanSetting rainbow = new BooleanSetting("chestesp_rainbow", "Rainbow", "Rainbow", false);
public FloatSetting effectSpeed = new FloatSetting("chestesp_effectspeed", "Effect Speed", "Effect Speed", 4, 1, 20, 0.1);


public ChestESP() {
super(new KeybindSetting("key.chestesp", "ChestESP Key", InputUtil.fromKeyCode(GLFW.GLFW_KEY_UNKNOWN, 0)));

this.setName("ChestESP");
this.setCategory(Category.Render);
this.setDescription("Allows the player to see Chests with an ESP.");
color = new Color(hue.getValue().floatValue(), 1f, 1f);
currentColor = color;

currentColor = color.getValue();
rainbowColor = new RainbowColor();
this.addSetting(hue);
this.addSetting(color);
this.addSetting(rainbow);
this.addSetting(effectSpeed);
}
Expand Down Expand Up @@ -100,8 +102,7 @@ public void OnUpdate(TickEvent event) {
this.rainbowColor.update(this.effectSpeed.getValue().floatValue());
this.currentColor = this.rainbowColor.getColor();
}else {
this.color.setHSV(hue.getValue().floatValue(), 1f, 1f);
this.currentColor = color;
this.currentColor = color.getValue();
}
}

Expand Down
30 changes: 18 additions & 12 deletions src/main/java/net/aoba/module/modules/render/EntityESP.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import net.aoba.misc.RainbowColor;
import net.aoba.module.Module;
import net.aoba.settings.types.BooleanSetting;
import net.aoba.settings.types.ColorSetting;
import net.aoba.settings.types.FloatSetting;
import net.aoba.settings.types.KeybindSetting;
import net.minecraft.client.option.KeyBinding;
Expand All @@ -45,10 +46,12 @@
import net.minecraft.util.math.Vec3d;

public class EntityESP extends Module implements RenderListener, TickListener {
private Color color;
private RainbowColor rainbowColor;

public FloatSetting hue = new FloatSetting("entitysp_hue", "Hue","Hue", 4, 0, 360, 1);
private ColorSetting color_passive = new ColorSetting("entityesp_color_passive", "Passive Color", "Passive Color", new Color(0, 1f, 1f));
private ColorSetting color_enemies = new ColorSetting("entityesp_color_enemy", "Enemy Color", "Enemy Color", new Color(0, 1f, 1f));
private ColorSetting color_misc = new ColorSetting("entityesp_color_misYOUBliterc", "Misc. Color", "Misc. Color", new Color(0, 1f, 1f));

public BooleanSetting rainbow = new BooleanSetting("entityesp_rainbow", "Rainbow","Rainbow", false);
public FloatSetting effectSpeed = new FloatSetting("entityesp_effectspeed", "Effect Speed", "Effect Speed", 4, 1, 20, 0.1);

Expand All @@ -58,10 +61,12 @@ public EntityESP() {
this.setName("EntityESP");
this.setCategory(Category.Render);
this.setDescription("Allows the player to see entities with an ESP.");
color = new Color(255, 0, 0);
rainbowColor = new RainbowColor();

this.addSetting(hue);
this.addSetting(color_passive);
this.addSetting(color_enemies);
this.addSetting(color_misc);

this.addSetting(rainbow);
this.addSetting(effectSpeed);
}
Expand Down Expand Up @@ -101,11 +106,11 @@ public void OnRender(RenderEvent event) {
boundingBox = boundingBox.offset(velocityPartial);

if (entity instanceof AnimalEntity) {
this.getRenderUtils().draw3DBox(matrixStack, boundingBox, new Color(0, 255, 0), 0.2f);
this.getRenderUtils().draw3DBox(matrixStack, boundingBox, color_passive.getValue(), 0.2f);
} else if (entity instanceof Monster) {
this.getRenderUtils().draw3DBox(matrixStack, boundingBox, new Color(255, 0, 0), 0.2f);
this.getRenderUtils().draw3DBox(matrixStack, boundingBox, color_enemies.getValue(), 0.2f);
} else {
this.getRenderUtils().draw3DBox(matrixStack, boundingBox, new Color(0, 0, 255), 0.2f);
this.getRenderUtils().draw3DBox(matrixStack, boundingBox, color_misc.getValue(), 0.2f);
}
}
}
Expand All @@ -114,10 +119,11 @@ public void OnRender(RenderEvent event) {

@Override
public void OnUpdate(TickEvent event) {
if(this.rainbow.getValue()) {
this.rainbowColor.update(this.effectSpeed.getValue().floatValue());
}else {
this.color.setHSV(hue.getValue().floatValue(), 1f, 1f);
}
/*
* if(this.rainbow.getValue()) {
* this.rainbowColor.update(this.effectSpeed.getValue().floatValue()); }else {
*
* this.color.setHSV(hue.getValue().floatValue(), 1f, 1f); }
*/
}
}
8 changes: 7 additions & 1 deletion src/main/java/net/aoba/module/modules/render/ItemESP.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import net.aoba.event.listeners.RenderListener;
import net.aoba.gui.Color;
import net.aoba.module.Module;
import net.aoba.settings.types.ColorSetting;
import net.aoba.settings.types.KeybindSetting;
import net.minecraft.client.option.KeyBinding;
import net.minecraft.client.util.InputUtil;
Expand All @@ -35,12 +36,17 @@

public class ItemESP extends Module implements RenderListener {

private ColorSetting color = new ColorSetting("itemesp_color", "Color", "Color", new Color(0, 1f, 1f));


public ItemESP() {
super(new KeybindSetting("key.itemesp", "ItemESP Key", InputUtil.fromKeyCode(GLFW.GLFW_KEY_UNKNOWN, 0)));

this.setName("ItemESP");
this.setCategory(Category.Render);
this.setDescription("Allows the player to see items with an ESP.");

this.addSetting(color);
}

@Override
Expand All @@ -62,7 +68,7 @@ public void onToggle() {
public void OnRender(RenderEvent event) {
for (Entity entity : MC.world.getEntities()) {
if(entity instanceof ItemEntity) {
this.getRenderUtils().draw3DBox(event.GetMatrixStack(), entity.getBoundingBox(), new Color(255, 0, 0), 0.2f);
this.getRenderUtils().draw3DBox(event.GetMatrixStack(), entity.getBoundingBox(), color.getValue(), 0.2f);
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/net/aoba/module/modules/render/POV.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ public class POV extends Module implements TickListener {
private Entity povEntity = null;

private boolean fakePlayerSpawned = false;


public POV() {
super(new KeybindSetting("key.pov", "POV Key", InputUtil.fromKeyCode(GLFW.GLFW_KEY_UNKNOWN, 0)));

Expand Down
13 changes: 11 additions & 2 deletions src/main/java/net/aoba/module/modules/render/PlayerESP.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,28 @@
import net.aoba.event.listeners.RenderListener;
import net.aoba.gui.Color;
import net.aoba.module.Module;
import net.aoba.settings.types.ColorSetting;
import net.aoba.settings.types.KeybindSetting;
import net.minecraft.client.network.AbstractClientPlayerEntity;
import net.minecraft.client.option.KeyBinding;
import net.minecraft.client.util.InputUtil;

public class PlayerESP extends Module implements RenderListener {


private ColorSetting color_default = new ColorSetting("playeresp_color_default", "Default Color", "Default Color", new Color(1f, 1f, 0f));
private ColorSetting color_friendly = new ColorSetting("playeresp_color_friendly", "Friendly Color", "Friendly Color", new Color(0f, 1f, 0f));
private ColorSetting color_enemy = new ColorSetting("playeresp_color_enemy", "Enemy Color", "Enemy Color", new Color(1f, 0f, 0f));

public PlayerESP() {
super(new KeybindSetting("key.playeresp", "PlayerESP Key", InputUtil.fromKeyCode(GLFW.GLFW_KEY_UNKNOWN, 0)));

this.setName("PlayerESP");
this.setCategory(Category.Render);
this.setDescription("Allows the player to see other players with an ESP.");

this.addSetting(color_default);
this.addSetting(color_friendly);
this.addSetting(color_enemy);
}

@Override
Expand All @@ -61,7 +70,7 @@ public void onToggle() {
public void OnRender(RenderEvent event) {
for (AbstractClientPlayerEntity entity : MC.world.getPlayers()) {
if(entity != MC.player) {
this.getRenderUtils().draw3DBox(event.GetMatrixStack(), entity.getBoundingBox(), new Color(255, 0, 0), 0.2f);
this.getRenderUtils().draw3DBox(event.GetMatrixStack(), entity.getBoundingBox(), color_default.getValue(), 0.2f);
}
}
}
Expand Down
7 changes: 6 additions & 1 deletion src/main/java/net/aoba/module/modules/render/SpawnerESP.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import net.aoba.gui.Color;
import net.aoba.misc.ModuleUtils;
import net.aoba.module.Module;
import net.aoba.settings.types.ColorSetting;
import net.aoba.settings.types.KeybindSetting;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.block.entity.MobSpawnerBlockEntity;
Expand All @@ -39,12 +40,16 @@

public class SpawnerESP extends Module implements RenderListener {

private ColorSetting color = new ColorSetting("spawneresp_color", "Color", "Color", new Color(0, 1f, 1f));

public SpawnerESP() {
super(new KeybindSetting("key.spawneresp", "SpawnerESP Key", InputUtil.fromKeyCode(GLFW.GLFW_KEY_UNKNOWN, 0)));

this.setName("SpawnerESP");
this.setCategory(Category.Render);
this.setDescription("Allows the player to see spawners with an ESP.");

this.addSetting(color);
}

@Override
Expand All @@ -69,7 +74,7 @@ public void OnRender(RenderEvent event) {
for(BlockEntity blockEntity : blockEntities) {
if(blockEntity instanceof MobSpawnerBlockEntity) {
Box box = new Box(blockEntity.getPos());
this.getRenderUtils().draw3DBox(event.GetMatrixStack(), box, new Color(255,255,0), 0.2f);
this.getRenderUtils().draw3DBox(event.GetMatrixStack(), box, color.getValue(), 0.2f);
}
}
}
Expand Down
6 changes: 6 additions & 0 deletions src/main/java/net/aoba/module/modules/render/Tracer.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@
import net.aoba.Aoba;
import net.aoba.event.events.RenderEvent;
import net.aoba.event.listeners.RenderListener;
import net.aoba.gui.Color;
import net.aoba.module.Module;
import net.aoba.settings.types.ColorSetting;
import net.aoba.settings.types.KeybindSetting;
import net.minecraft.client.option.KeyBinding;
import net.minecraft.client.util.InputUtil;
Expand All @@ -34,12 +36,16 @@

public class Tracer extends Module implements RenderListener {

private ColorSetting color = new ColorSetting("tracer_color", "Color", "Color", new Color(0, 1f, 1f));

public Tracer() {
super(new KeybindSetting("key.tracer", "Tracer Key", InputUtil.fromKeyCode(GLFW.GLFW_KEY_UNKNOWN, 0)));

this.setName("Tracer");
this.setCategory(Category.Render);
this.setDescription("Points toward other players and entities with a line.");

this.addSetting(color);
}

@Override
Expand Down
Loading

0 comments on commit 028e088

Please sign in to comment.