Chams colors, many Waypoints options

This commit is contained in:
noil 2021-02-08 18:36:20 -05:00
parent 580885498a
commit a5995d5baa
3 changed files with 138 additions and 24 deletions

View File

@ -1,8 +1,10 @@
package me.rigamortis.seppuku.impl.module.render;
import me.rigamortis.seppuku.Seppuku;
import me.rigamortis.seppuku.api.event.EventStageable;
import me.rigamortis.seppuku.api.event.render.EventRenderEntity;
import me.rigamortis.seppuku.api.module.Module;
import me.rigamortis.seppuku.api.util.RenderUtil;
import me.rigamortis.seppuku.api.value.Value;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GlStateManager;
@ -19,6 +21,8 @@ import net.minecraft.entity.player.EntityPlayer;
import org.lwjgl.opengl.GL11;
import team.stiff.pomelo.impl.annotated.handler.annotation.Listener;
import java.awt.*;
import static org.lwjgl.opengl.GL11.*;
/**
@ -27,15 +31,29 @@ import static org.lwjgl.opengl.GL11.*;
*/
public final class ChamsModule extends Module {
public final Value<Boolean> players = new Value<Boolean>("Players", new String[]{"Player"}, "Choose to enable on players.", true);
public final Value<Boolean> mobs = new Value<Boolean>("Mobs", new String[]{"Mob"}, "Choose to enable on mobs.", true);
public final Value<Boolean> animals = new Value<Boolean>("Animals", new String[]{"Animal"}, "Choose to enable on animals.", true);
public final Value<Boolean> vehicles = new Value<Boolean>("Vehicles", new String[]{"Vehic", "Vehicle"}, "Choose to enable on vehicles.", true);
public final Value<Boolean> crystals = new Value<Boolean>("Crystals", new String[]{"crystal", "crystals", "endcrystal", "endcrystals"}, "Choose to enable on end crystals.", true);
public final Value<Boolean> items = new Value<Boolean>("Items", new String[]{"Item", "i"}, "Choose to enable on items.", false);
public final Value<Mode> mode = new Value<Mode>("Mode", new String[]{"Mode"}, "The chams mode to use.", Mode.NORMAL);
public final Value<Boolean> players = new Value<Boolean>("Players", new String[]{"Player"}, "Choose to enable on players.", true);
public final Value<Color> playersColor = new Value<Color>("PlayersColor", new String[]{"playerscolor", "pc"}, "Change the color of players on chams.", new Color(255, 68, 68));
public final Value<Boolean> mobs = new Value<Boolean>("Mobs", new String[]{"Mob"}, "Choose to enable on mobs.", true);
public final Value<Color> mobsColor = new Value<Color>("MobsColor", new String[]{"mobscolor", "mc"}, "Change the color of mobs on chams.", new Color(255, 170, 0));
public final Value<Boolean> animals = new Value<Boolean>("Animals", new String[]{"Animal"}, "Choose to enable on animals.", true);
public final Value<Color> animalsColor = new Value<Color>("AnimalsColor", new String[]{"animalscolor", "ac"}, "Change the color of animals on chams.", new Color(0, 255, 68));
public final Value<Boolean> vehicles = new Value<Boolean>("Vehicles", new String[]{"Vehic", "Vehicle"}, "Choose to enable on vehicles.", true);
public final Value<Color> vehiclesColor = new Value<Color>("VehiclesColor", new String[]{"vehiclescolor", "vc"}, "Change the color of vehicles on chams.", new Color(213, 255, 0));
public final Value<Boolean> items = new Value<Boolean>("Items", new String[]{"Item", "i"}, "Choose to enable on items.", false);
public final Value<Color> itemsColor = new Value<Color>("ItemsColor", new String[]{"itemscolor", "ic"}, "Change the color of items on chams.", new Color(0, 255, 170));
public final Value<Boolean> crystals = new Value<Boolean>("Crystals", new String[]{"crystal", "crystals", "endcrystal", "endcrystals"}, "Choose to enable on end crystals.", true);
public final Value<Color> crystalsColor = new Value<Color>("CrystalsColor", new String[]{"endercrystalscolor", "endercrystalcolor", "crystalscolor", "crystalcolor", "ecc"}, "Change the color of ender crystals on chams.", new Color(205, 0, 205));
public final Value<Color> friendsColor = new Value<Color>("FriendsColor", new String[]{"friendscolor", "friendcolor", "fc"}, "Change the color of friendly players on esp.", new Color(153, 0, 238));
public final Value<Color> sneakingColor = new Value<Color>("SneakingColor", new String[]{"sneakingcolor", "sneakcolor", "sc"}, "Change the color of sneaking players on esp.", new Color(238, 153, 0));
private enum Mode {
NORMAL, TEXTURE, FLAT, WIREFRAME
}
@ -71,14 +89,14 @@ public final class ChamsModule extends Module {
glEnable(GL11.GL_POLYGON_OFFSET_FILL);
glPolygonOffset(1.0f, -1100000.0f);
glDisable(GL11.GL_TEXTURE_2D);
GlStateManager.color(1, 1, 1);
RenderUtil.glColor(this.getColor(event.getEntity()));
break;
case "flat":
glEnable(GL11.GL_POLYGON_OFFSET_FILL);
glPolygonOffset(1.0f, -1100000.0f);
glDisable(GL11.GL_TEXTURE_2D);
glDisable(GL11.GL_LIGHTING);
GlStateManager.color(1, 1, 1);
RenderUtil.glColor(this.getColor(event.getEntity()));
break;
case "wireframe":
glPolygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_LINE);
@ -89,7 +107,7 @@ public final class ChamsModule extends Module {
glEnable(GL_LINE_SMOOTH);
glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
glLineWidth(1);
GlStateManager.color(1, 1, 1);
RenderUtil.glColor(this.getColor(event.getEntity()));
break;
}
GlStateManager.popMatrix();
@ -129,6 +147,42 @@ public final class ChamsModule extends Module {
}
}
private int getColor(Entity entity) {
int ret = 0xFFFFFFFF;
if (entity instanceof IAnimals && !(entity instanceof IMob)) {
ret = this.animalsColor.getValue().getRGB();
}
if (entity instanceof IMob) {
ret = this.mobsColor.getValue().getRGB();
}
if (entity instanceof EntityBoat || entity instanceof EntityMinecart) {
ret = this.vehiclesColor.getValue().getRGB();
}
if (entity instanceof EntityItem) {
ret = this.itemsColor.getValue().getRGB();
}
if (entity instanceof EntityEnderCrystal) {
ret = this.crystalsColor.getValue().getRGB();
}
if (entity instanceof EntityPlayer) {
ret = this.playersColor.getValue().getRGB();
if (entity == Minecraft.getMinecraft().player) {
ret = -1;
}
if (entity.isSneaking()) {
ret = this.sneakingColor.getValue().getRGB();
}
if (Seppuku.INSTANCE.getFriendManager().isFriend(entity) != null) {
ret = this.friendsColor.getValue().getRGB();
}
}
return ret;
}
private boolean checkFilter(Entity entity) {
boolean ret = false;

View File

@ -554,7 +554,6 @@ public final class WallHackModule extends Module {
}
if (entity instanceof EntityEnderCrystal) {
ret = this.crystalsColor.getValue().getRGB();
;
}
if (entity instanceof EntityEnderPearl) {
ret = this.pearlsColor.getValue().getRGB();

View File

@ -4,13 +4,17 @@ import me.rigamortis.seppuku.Seppuku;
import me.rigamortis.seppuku.api.event.EventStageable;
import me.rigamortis.seppuku.api.event.network.EventSendPacket;
import me.rigamortis.seppuku.api.event.render.EventRender2D;
import me.rigamortis.seppuku.api.event.render.EventRender3D;
import me.rigamortis.seppuku.api.event.world.EventLoadWorld;
import me.rigamortis.seppuku.api.module.Module;
import me.rigamortis.seppuku.api.util.ColorUtil;
import me.rigamortis.seppuku.api.util.GLUProjection;
import me.rigamortis.seppuku.api.util.RenderUtil;
import me.rigamortis.seppuku.api.value.Value;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.network.play.client.CPacketClientStatus;
import net.minecraft.util.math.AxisAlignedBB;
import team.stiff.pomelo.impl.annotated.handler.annotation.Listener;
import java.sql.Timestamp;
@ -23,10 +27,24 @@ import java.text.SimpleDateFormat;
*/
public final class WaypointsModule extends Module {
public final Value<Boolean> tracers = new Value<Boolean>("Tracers", new String[]{"Tracer", "Trace"}, "Draws a line from the center of the screen to each waypoint.", false);
public final Value<Boolean> death = new Value<Boolean>("Death", new String[]{"deathpoint", "d"}, "Creates a waypoint on death.", true);
public final Value<Float> hideDistance = new Value<Float>("HideDistance", new String[]{"hidedist", "hd"}, "Distance (blocks) away from a waypoint to hide it.", 5.0f, 1.0f, 10.0f, 0.5f);
public final Value<Float> width = new Value<Float>("Width", new String[]{"Wid"}, "Pixel width of each tracer line.", 0.5f, 0.1f, 5.0f, 0.1f);
public final Value<Boolean> tracers = new Value<Boolean>("Tracers", new String[]{"Tracer", "Trace"}, "Draws a line from the center of the screen to each waypoint.", false);
public final Value<Float> tracersWidth = new Value<Float>("TracersWidth", new String[]{"twidth", "tw"}, "Pixel width of each tracer line.", 1.0f, 0.1f, 5.0f, 0.1f);
public final Value<Integer> tracersAlpha = new Value<Integer>("TracersAlpha", new String[]{"talpha", "ta", "topacity", "top"}, "Alpha value for each drawn line.", 255, 1, 255, 1);
public final Value<Boolean> box = new Value<Boolean>("Box", new String[]{"b"}, "Renders a 3D object at each waypoint.", true);
public final Value<Boolean> boxRotate = new Value<Boolean>("BoxRotate", new String[]{"brotate", "rotate", "br"}, "Rotates each 3D object around in a circle.", true);
public final Value<Float> boxRotateSpeed = new Value<Float>("BoxRotateSpeed", new String[]{"brotatespeed", "rotatespeed", "spinspeed", "brs"}, "The speed at which the 3D object rotates around.", 0.5f, 0.1f, 2.0f, 0.1f);
public final Value<Float> boxWidth = new Value<Float>("BoxWidth", new String[]{"width", "w"}, "Pixel width of the 3D objects lines.", 1f, 0.1f, 5.0f, 0.1f);
public final Value<Integer> boxAlpha = new Value<Integer>("BoxAlpha", new String[]{"balpha", "ba", "bopacity", "bop"}, "Alpha value for the 3D rendered object.", 127, 1, 255, 1);
public final Value<Float> boxSize = new Value<Float>("BoxSize", new String[]{"size", "scale", "s"}, "Size of the 3D rendered object.", 0.5f, 0.1f, 3.0f, 0.1f);
public final Value<Float> boxYOffset = new Value<Float>("BoxYOffset", new String[]{"byoffset", "byoff", "byo"}, "Y-level offset of the 3D rendered object.", 0.0f, -1.0f, 1.0f, 0.1f);
private final Minecraft mc = Minecraft.getMinecraft();
private String host = "";
private float angle = 0;
public WaypointsModule() {
super("Waypoints", new String[]{"Wp", "Waypoint"}, "Highlights waypoints", "NONE", -1, ModuleType.WORLD);
@ -34,28 +52,22 @@ public final class WaypointsModule extends Module {
@Listener
public void render2D(EventRender2D event) {
final Minecraft mc = Minecraft.getMinecraft();
final String host = mc.getCurrentServerData() == null ? "localhost" : mc.getCurrentServerData().serverIP;
for (WaypointData waypointData : Seppuku.INSTANCE.getWaypointManager().getWaypointDataList()) {
if (waypointData != null) {
if (host.equalsIgnoreCase(waypointData.getHost()) && mc.player.dimension == waypointData.dimension) {
final double dist = mc.player.getDistance(waypointData.getX(), waypointData.getY(), waypointData.getZ());
if (dist >= 5.0f) {
if (dist >= this.hideDistance.getValue()) {
final int color = ColorUtil.changeAlpha(waypointData.color, this.tracersAlpha.getValue());
final GLUProjection.Projection projection = GLUProjection.getInstance().project(waypointData.getX() - mc.getRenderManager().viewerPosX, waypointData.getY() - mc.getRenderManager().viewerPosY, waypointData.getZ() - mc.getRenderManager().viewerPosZ, GLUProjection.ClampMode.NONE, false);
if (projection != null && projection.getType() == GLUProjection.Projection.Type.INSIDE) {
if (projection.getType() == GLUProjection.Projection.Type.INSIDE) {
final String name = "\247f" + waypointData.getName() + " \247r(\2477" + new DecimalFormat("#.#").format(dist) + "m\247r)";
mc.fontRenderer.drawStringWithShadow(name, (float) projection.getX() - mc.fontRenderer.getStringWidth(name) / 2, (float) projection.getY() - mc.fontRenderer.FONT_HEIGHT / 2, waypointData.getColor());
mc.fontRenderer.drawStringWithShadow(name, (float) projection.getX() - mc.fontRenderer.getStringWidth(name) / 2.0f, (float) projection.getY() - mc.fontRenderer.FONT_HEIGHT / 2.0f, color);
}
if (this.tracers.getValue()) {
final GLUProjection.Projection screen = GLUProjection.getInstance().project(waypointData.getX() - mc.getRenderManager().viewerPosX, waypointData.getY() - mc.getRenderManager().viewerPosY, waypointData.getZ() - mc.getRenderManager().viewerPosZ, GLUProjection.ClampMode.NONE, true);
if (screen != null) {
RenderUtil.drawLine((float) screen.getX(), (float) screen.getY(), event.getScaledResolution().getScaledWidth() / 2, event.getScaledResolution().getScaledHeight() / 2, this.width.getValue(), -1);
}
RenderUtil.drawLine((float) screen.getX(), (float) screen.getY(), event.getScaledResolution().getScaledWidth() / 2.0f, event.getScaledResolution().getScaledHeight() / 2.0f, this.tracersWidth.getValue(), color);
}
}
}
@ -63,6 +75,55 @@ public final class WaypointsModule extends Module {
}
}
@Listener
public void onRender3D(EventRender3D event) {
if (!this.box.getValue()) // doesn't want to render the 3D object
return;
if (this.boxRotate.getValue()) {
if (this.angle > 360.0f)
this.angle = 0.0f;
else
this.angle += this.boxRotateSpeed.getValue();
}
RenderUtil.begin3D();
for (WaypointData waypointData : Seppuku.INSTANCE.getWaypointManager().getWaypointDataList()) {
if (waypointData != null) {
if (host.equalsIgnoreCase(waypointData.getHost()) && mc.player.dimension == waypointData.dimension) {
final double dist = mc.player.getDistance(waypointData.getX(), waypointData.getY(), waypointData.getZ());
if (dist >= this.hideDistance.getValue()) {
final int color = ColorUtil.changeAlpha(waypointData.color, this.boxAlpha.getValue());
GlStateManager.pushMatrix();
GlStateManager.translate(waypointData.x - mc.getRenderManager().viewerPosX, waypointData.y - mc.getRenderManager().viewerPosY, waypointData.z - mc.getRenderManager().viewerPosZ);
if (this.boxRotate.getValue()) {
GlStateManager.rotate(this.angle, 0, 1, 0);
}
final AxisAlignedBB bb = new AxisAlignedBB(
-this.boxSize.getValue(),
-this.boxSize.getValue() + this.boxYOffset.getValue(),
-this.boxSize.getValue(),
this.boxSize.getValue(),
this.boxSize.getValue() + this.boxYOffset.getValue(),
this.boxSize.getValue());
RenderUtil.drawFilledBox(bb, color);
RenderUtil.drawBoundingBox(bb, this.boxWidth.getValue(), color);
GlStateManager.popMatrix();
}
}
}
}
RenderUtil.end3D();
}
@Listener
public void onLoadWorld(EventLoadWorld event) {
if (event.getWorld() != null) {
this.host = mc.getCurrentServerData() == null ? "localhost" : mc.getCurrentServerData().serverIP;
}
}
@Listener
public void onSendPacket(EventSendPacket event) {
if (event.getStage() != EventStageable.EventStage.PRE)