Adds PortalFinder tracer/line option as well as alpha. Also changes all colors to integers for the upcoming color picker

This commit is contained in:
noil 2020-11-25 18:20:05 -05:00
parent d4a147e6e5
commit 52e37a7f33
3 changed files with 31 additions and 28 deletions

View File

@ -22,9 +22,9 @@ public final class NoBiomeColorModule extends Module {
DEFAULT, CUSTOM
}
public final Value<Float> red = new Value<Float>("Red", new String[]{"R"}, "Red value for custom biome color.", 255.0f, 0.0f, 255.0f, 1.0f);
public final Value<Float> green = new Value<Float>("Green", new String[]{"G"}, "Green value for custom biome color.", 255.0f, 0.0f, 255.0f, 1.0f);
public final Value<Float> blue = new Value<Float>("Blue", new String[]{"B"}, "Blue value for custom biome color.", 255.0f, 0.0f, 255.0f, 1.0f);
public final Value<Integer> red = new Value<Integer>("Red", new String[]{"R"}, "Red value for custom biome color.", 255, 0, 255, 1);
public final Value<Integer> green = new Value<Integer>("Green", new String[]{"G"}, "Green value for custom biome color.", 255, 0, 255, 1);
public final Value<Integer> blue = new Value<Integer>("Blue", new String[]{"B"}, "Blue value for custom biome color.", 255, 0, 255, 1);
private float prevRed;
private float prevGreen;

View File

@ -9,6 +9,7 @@ import me.rigamortis.seppuku.api.event.render.EventRender3D;
import me.rigamortis.seppuku.api.event.world.EventChunk;
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;
@ -49,10 +50,12 @@ public final class PortalFinderModule extends Module {
public final Value<Boolean> showInfo = new Value<Boolean>("ShowInfo", new String[]{"SI", "DrawInfo", "DrawText"}, "Draws information about the portal at it's location.", true);
public final Value<Float> infoScale = new Value<Float>("InfoScale", new String[]{"IS", "Scale", "TextScale"}, "Scale of the text size on the drawn information.", 1.0f, 0.0f, 3.0f, 0.25f);
public final Value<Boolean> tracer = new Value<Boolean>("Tracer", new String[]{"TracerLine", "trace", "line"}, "Display a tracer line to each found portal.", true);
public final Value<Float> width = new Value<Float>("Width", new String[]{"W", "Width"}, "Width of each line that is drawn to indicate a portal's location.", 0.5f, 0.0f, 5.0f, 0.1f);
public final Value<Float> red = new Value<Float>("Red", new String[]{"R"}, "Red value for each drawn line.", 255.0f, 0.0f, 255.0f, 1.0f);
public final Value<Float> green = new Value<Float>("Green", new String[]{"G"}, "Green value for each drawn line.", 255.0f, 0.0f, 255.0f, 1.0f);
public final Value<Float> blue = new Value<Float>("Blue", new String[]{"B"}, "Blue value for each drawn line.", 255.0f, 0.0f, 255.0f, 1.0f);
public final Value<Integer> red = new Value<Integer>("Red", new String[]{"R"}, "Red value for each drawn line.", 255, 0, 255, 1);
public final Value<Integer> green = new Value<Integer>("Green", new String[]{"G"}, "Green value for each drawn line.", 255, 0, 255, 1);
public final Value<Integer> blue = new Value<Integer>("Blue", new String[]{"B"}, "Blue value for each drawn line.", 255, 0, 255, 1);
public final Value<Integer> alpha = new Value<Integer>("Alpha", new String[]{"A", "Opacity", "Op"}, "Alpha value for each drawn line.", 255, 0, 255, 1);
private final List<Vec3d> portals = new CopyOnWriteArrayList<>();
@ -75,17 +78,20 @@ public final class PortalFinderModule extends Module {
for (Vec3d portal : this.portals) {
final GLUProjection.Projection projection = GLUProjection.getInstance().project(portal.x - mc.getRenderManager().viewerPosX, portal.y - mc.getRenderManager().viewerPosY, portal.z - mc.getRenderManager().viewerPosZ, GLUProjection.ClampMode.NONE, true);
if (projection != null) {
RenderUtil.drawLine((float) projection.getX(), (float) projection.getY(), event.getScaledResolution().getScaledWidth() / 2, event.getScaledResolution().getScaledHeight() / 2, this.width.getValue(), new Color(red.getValue() / 255.0f, green.getValue() / 255.0f, blue.getValue() / 255.0f).getRGB());
if (this.showInfo.getValue() && projection.isType(GLUProjection.Projection.Type.INSIDE)) {
final float scale = this.infoScale.getValue();
GlStateManager.pushMatrix();
GlStateManager.scale(scale, scale, scale);
this.drawPortalInfoText(portal, (float) projection.getX() / scale, (float) projection.getY() / scale);
GlStateManager.scale(-scale, -scale, -scale);
GlStateManager.popMatrix();
}
// Line
if (this.tracer.getValue()) {
RenderUtil.drawLine((float) projection.getX(), (float) projection.getY(), event.getScaledResolution().getScaledWidth() / 2.0f, event.getScaledResolution().getScaledHeight() / 2.0f, this.width.getValue(), ColorUtil.changeAlpha(new Color(red.getValue() / 255.0f, green.getValue() / 255.0f, blue.getValue() / 255.0f).getRGB(), this.alpha.getValue()));
}
// Info
if (this.showInfo.getValue() && projection.isType(GLUProjection.Projection.Type.INSIDE)) {
final float scale = this.infoScale.getValue();
GlStateManager.pushMatrix();
GlStateManager.scale(scale, scale, scale);
this.drawPortalInfoText(portal, (float) projection.getX() / scale, (float) projection.getY() / scale);
GlStateManager.scale(-scale, -scale, -scale);
GlStateManager.popMatrix();
}
}
}
@ -105,7 +111,9 @@ public final class PortalFinderModule extends Module {
final Vec3d forward = new Vec3d(0, 0, 1).rotatePitch(-(float) Math.toRadians(Minecraft.getMinecraft().player.rotationPitch)).rotateYaw(-(float) Math.toRadians(Minecraft.getMinecraft().player.rotationYaw));
// Line
RenderUtil.drawLine3D((float) forward.x, (float) forward.y + mc.player.getEyeHeight(), (float) forward.z, (float) (portal.x - mc.getRenderManager().renderPosX), (float) (portal.y - mc.getRenderManager().renderPosY), (float) (portal.z - mc.getRenderManager().renderPosZ), this.width.getValue(), new Color(red.getValue() / 255.0f, green.getValue() / 255.0f, blue.getValue() / 255.0f).getRGB());
if (this.tracer.getValue()) {
RenderUtil.drawLine3D((float) forward.x, (float) forward.y + mc.player.getEyeHeight(), (float) forward.z, (float) (portal.x - mc.getRenderManager().renderPosX), (float) (portal.y - mc.getRenderManager().renderPosY), (float) (portal.z - mc.getRenderManager().renderPosZ), this.width.getValue(), ColorUtil.changeAlpha(new Color(red.getValue() / 255.0f, green.getValue() / 255.0f, blue.getValue() / 255.0f).getRGB(), this.alpha.getValue()));
}
// Info
if (this.showInfo.getValue()) {
@ -143,8 +151,7 @@ public final class PortalFinderModule extends Module {
case LOAD:
final Chunk chunk = event.getChunk();
final ExtendedBlockStorage[] blockStoragesLoad = chunk.getBlockStorageArray();
for (int i = 0; i < blockStoragesLoad.length; i++) {
final ExtendedBlockStorage extendedBlockStorage = blockStoragesLoad[i];
for (final ExtendedBlockStorage extendedBlockStorage : blockStoragesLoad) {
if (extendedBlockStorage == null) {
continue;
}
@ -183,11 +190,7 @@ public final class PortalFinderModule extends Module {
break;
case UNLOAD:
if (this.remove.getValue()) {
for (Vec3d portal : this.portals) {
if (mc.player.getDistance(portal.x, portal.y, portal.z) > this.removeDistance.getValue()) {
this.portals.remove(portal);
}
}
this.portals.removeIf(portal -> mc.player.getDistance(portal.x, portal.y, portal.z) > this.removeDistance.getValue());
}
break;
}

View File

@ -46,10 +46,10 @@ public final class ProjectilesModule extends Module {
private final Queue<Vec3d> flightPoint = new ConcurrentLinkedQueue<>();
public final Value<Float> width = new Value<Float>("Width", new String[]{"W", "Width"}, "Pixel width of the projectile path.", 1.0f, 0.0f, 5.0f, 0.1f);
public final Value<Float> red = new Value<Float>("Red", new String[]{"R"}, "Red value for the projectile path.", 255.0f, 0.0f, 255.0f, 1.0f);
public final Value<Float> green = new Value<Float>("Green", new String[]{"G"}, "Green value for the projectile path.", 255.0f, 0.0f, 255.0f, 1.0f);
public final Value<Float> blue = new Value<Float>("Blue", new String[]{"B"}, "Blue value for the projectile path.", 255.0f, 0.0f, 255.0f, 1.0f);
public final Value<Float> alpha = new Value<Float>("Alpha", new String[]{"A"}, "Alpha value for the projectile path.", 255.0f, 0.0f, 255.0f, 1.0f);
public final Value<Integer> red = new Value<Integer>("Red", new String[]{"R"}, "Red value for the projectile path.", 255, 0, 255, 1);
public final Value<Integer> green = new Value<Integer>("Green", new String[]{"G"}, "Green value for the projectile path.", 255, 0, 255, 1);
public final Value<Integer> blue = new Value<Integer>("Blue", new String[]{"B"}, "Blue value for the projectile path.", 255, 0, 255, 1);
public final Value<Integer> alpha = new Value<Integer>("Alpha", new String[]{"A"}, "Alpha value for the projectile path.", 255, 0, 255, 1);
public ProjectilesModule() {
super("Projectiles", new String[]{"Proj"}, "Projects the possible path of an entity that was fired.", "NONE", -1, ModuleType.RENDER);