Waypoints: renamed values, AutoTorch: fixed placing bugs

This commit is contained in:
noil 2021-02-10 21:34:35 -05:00
parent c72a0b34de
commit a2d0d7111c
4 changed files with 41 additions and 34 deletions

View File

@ -8,11 +8,10 @@ import me.rigamortis.seppuku.api.event.EventStageable;
import me.rigamortis.seppuku.api.event.network.EventReceivePacket;
import me.rigamortis.seppuku.api.event.render.EventRender2D;
import me.rigamortis.seppuku.api.event.render.EventRenderName;
import me.rigamortis.seppuku.api.event.world.EventAddEntity;
import me.rigamortis.seppuku.api.friend.Friend;
import me.rigamortis.seppuku.api.module.Module;
import me.rigamortis.seppuku.api.util.*;
import me.rigamortis.seppuku.api.util.Timer;
import me.rigamortis.seppuku.api.util.*;
import me.rigamortis.seppuku.api.value.Value;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GlStateManager;
@ -45,7 +44,6 @@ import org.apache.commons.io.IOUtils;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import org.json.simple.JSONValue;
import org.lwjgl.Sys;
import team.stiff.pomelo.impl.annotated.handler.annotation.Listener;
import java.awt.*;

View File

@ -11,6 +11,7 @@ import me.rigamortis.seppuku.api.util.RenderUtil;
import me.rigamortis.seppuku.api.util.Timer;
import me.rigamortis.seppuku.api.value.Value;
import net.minecraft.block.Block;
import net.minecraft.block.BlockLeaves;
import net.minecraft.block.BlockLiquid;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
@ -152,11 +153,14 @@ public final class AutoTorchModule extends Module {
final Block block = BlockUtil.getBlock(blockPos);
final IBlockState state = mc.world.getBlockState(blockPos);
if (block == Blocks.AIR || !state.isFullBlock() || block instanceof BlockLiquid)
if (block == Blocks.AIR || !state.isFullBlock() || !block.canPlaceTorchOnTop(state, mc.world, blockPos) || block instanceof BlockLiquid || block instanceof BlockLeaves)
continue;
final BlockPos aboveBlockPos = blockPos.up();
final Block aboveBlock = BlockUtil.getBlock(aboveBlockPos);
if (aboveBlock instanceof BlockLiquid)
continue;
if (aboveBlock == Blocks.AIR || aboveBlock.isReplaceable(mc.world, aboveBlockPos)) {
final int light = mc.world.getChunk(aboveBlockPos).getLightFor(EnumSkyBlock.BLOCK, aboveBlockPos);
if (light < 15) {
@ -196,11 +200,14 @@ public final class AutoTorchModule extends Module {
final Block block = BlockUtil.getBlock(blockPos);
final IBlockState state = mc.world.getBlockState(blockPos);
if (block == Blocks.AIR || !state.isFullBlock() || block instanceof BlockLiquid)
if (block == Blocks.AIR || !state.isFullBlock() || !block.canPlaceTorchOnTop(state, mc.world, blockPos) || block instanceof BlockLiquid || block instanceof BlockLeaves)
continue;
final BlockPos aboveBlockPos = blockPos.up();
final Block aboveBlock = BlockUtil.getBlock(aboveBlockPos);
if (aboveBlock instanceof BlockLiquid)
continue;
if (aboveBlock == Blocks.AIR || aboveBlock.isReplaceable(mc.world, aboveBlockPos)) {
final int light = mc.world.getChunk(blockPos).getLightFor(EnumSkyBlock.BLOCK, aboveBlockPos);
final double curDist = mc.player.getDistance(blockPos.getX(), blockPos.getY(), blockPos.getZ());

View File

@ -15,7 +15,6 @@ 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 org.lwjgl.util.glu.Sphere;
import team.stiff.pomelo.impl.annotated.handler.annotation.Listener;
import java.sql.Timestamp;
@ -35,15 +34,15 @@ public final class WaypointsModule extends Module {
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<Shape> shape = new Value<Shape>("Shape", new String[]{"s"}, "Selects what shape should be rendered.", Shape.CUBE);
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);
public final Value<Float> diamondYIncrease = new Value<Float>("DiamondExtraY", new String[]{"de", "dextray", "diamondy"}, "Extra height added to the top of the diamond object.", 0.5f, 0.1f, 3.0f, 0.1f);
public final Value<Boolean> point = new Value<Boolean>("Point", new String[]{"p", "waypoint", "object", "o"}, "Renders a 3D object at each waypoint.", true);
public final Value<Shape> pointShape = new Value<Shape>("PointShape", new String[]{"wps", "ps", "shape"}, "Selects what shape should be rendered.", Shape.CUBE);
public final Value<Boolean> pointRotate = new Value<Boolean>("PointRotate", new String[]{"protate", "rotate", "wpr"}, "Rotates each 3D object around in a circle.", true);
public final Value<Float> pointRotateSpeed = new Value<Float>("PointRotateSpeed", new String[]{"protatespeed", "rotatespeed", "pspinspeed", "prs"}, "The speed at which the 3D object rotates around.", 0.5f, 0.1f, 2.0f, 0.1f);
public final Value<Float> pointWidth = new Value<Float>("PointWidth", new String[]{"pwidth", "pw"}, "Pixel width of the 3D objects lines.", 1f, 0.1f, 5.0f, 0.1f);
public final Value<Integer> pointAlpha = new Value<Integer>("PointAlpha", new String[]{"palpha", "pa", "popacity", "pop"}, "Alpha value for the 3D rendered object.", 127, 1, 255, 1);
public final Value<Float> pointSize = new Value<Float>("PointSize", new String[]{"psize", "pscale", "ps", "size", "scale", "s"}, "Size of the 3D rendered object.", 0.5f, 0.1f, 3.0f, 0.1f);
public final Value<Float> pointYOffset = new Value<Float>("PointYOffset", new String[]{"pyoffset", "pyoff", "pyo"}, "Y-level offset of the 3D rendered object.", 0.0f, -1.0f, 1.0f, 0.1f);
public final Value<Float> pointDiamondHeight = new Value<Float>("PointDiamondHeight", new String[]{"diamondheight", "diamondh", "pdh", "dh"}, "Extra height added to the top of the diamond object.", 0.5f, 0.1f, 3.0f, 0.1f);
public enum Shape {
CUBE, PYRAMID, DIAMOND, SPHERE
@ -85,14 +84,14 @@ public final class WaypointsModule extends Module {
@Listener
public void onRender3D(EventRender3D event) {
if (!this.box.getValue()) // doesn't want to render the 3D object
if (!this.point.getValue()) // doesn't want to render the 3D object
return;
if (this.boxRotate.getValue()) {
if (this.pointRotate.getValue()) {
if (this.angle > 360.0f)
this.angle = 0.0f;
else
this.angle += this.boxRotateSpeed.getValue();
this.angle += this.pointRotateSpeed.getValue();
}
@ -102,35 +101,35 @@ public final class WaypointsModule extends Module {
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());
final int color = ColorUtil.changeAlpha(waypointData.color, this.pointAlpha.getValue());
GlStateManager.pushMatrix();
GlStateManager.translate(waypointData.x - mc.getRenderManager().viewerPosX, waypointData.y - mc.getRenderManager().viewerPosY, waypointData.z - mc.getRenderManager().viewerPosZ);
if (this.boxRotate.getValue()) {
if (this.pointRotate.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());
-this.pointSize.getValue(),
-this.pointSize.getValue() + this.pointYOffset.getValue(),
-this.pointSize.getValue(),
this.pointSize.getValue(),
this.pointSize.getValue() + this.pointYOffset.getValue(),
this.pointSize.getValue());
switch (shape.getValue()) {
switch (this.pointShape.getValue()) {
case CUBE:
RenderUtil.drawFilledBox(bb, color);
RenderUtil.drawBoundingBox(bb, this.boxWidth.getValue(), color);
RenderUtil.drawBoundingBox(bb, this.pointWidth.getValue(), color);
break;
case PYRAMID:
RenderUtil.drawFilledPyramid(bb, color);
RenderUtil.drawBoundingBoxPyramid(bb, this.boxWidth.getValue(), color);
RenderUtil.drawBoundingBoxPyramid(bb, this.pointWidth.getValue(), color);
break;
case DIAMOND:
RenderUtil.drawFilledDiamond(bb, this.boxYOffset.getValue(), this.diamondYIncrease.getValue(), color);
RenderUtil.drawBoundingBoxDiamond(bb, this.boxWidth.getValue(), this.boxYOffset.getValue(), this.diamondYIncrease.getValue(), color);
RenderUtil.drawFilledDiamond(bb, this.pointYOffset.getValue(), this.pointDiamondHeight.getValue(), color);
RenderUtil.drawBoundingBoxDiamond(bb, this.pointWidth.getValue(), this.pointYOffset.getValue(), this.pointDiamondHeight.getValue(), color);
break;
case SPHERE:
RenderUtil.drawSphere(boxSize.getValue(), 32, 32, color);
RenderUtil.drawSphere(this.pointSize.getValue(), 32, 32, color);
break;
}

View File

@ -31,8 +31,11 @@ public final class BlockRendererDispatcherPatch extends ClassPatch {
mcpDesc = "(Lnet/minecraft/block/state/IBlockState;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/world/IBlockAccess;Lnet/minecraft/client/renderer/BufferBuilder;)Z",
notchDesc = "(Lawt;Let;Lamy;Lbuk;)Z")
public void renderBlock(MethodNode methodNode, PatchManager.Environment env) {
//create a list of instructions
final InsnList insnList = new InsnList();
// insnList.add(new FieldInsnNode(GETSTATIC, Type.getInternalName(Seppuku.class), "INSTANCE", "Lme/rigamortis/seppuku/Seppuku;"));
// insnList.add(new MethodInsnNode(INVOKEVIRTUAL, Type.getInternalName(Seppuku.class), "getCameraManager", "()Lme/rigamortis/seppuku/impl/management/CameraManager;", false));
// insnList.add(new MethodInsnNode(INVOKEVIRTUAL, Type.getInternalName(CameraManager.class), "isCameraRecording", "()Z", false));
// insnList.add(new JumpInsnNode(IFNE, jmp));
//aload the parameters
insnList.add(new VarInsnNode(ALOAD, 1));
insnList.add(new VarInsnNode(ALOAD, 2));
@ -40,7 +43,7 @@ public final class BlockRendererDispatcherPatch extends ClassPatch {
insnList.add(new VarInsnNode(ALOAD, 4));
//call our hook function
insnList.add(new MethodInsnNode(INVOKESTATIC, Type.getInternalName(this.getClass()), "renderBlockHook", env == PatchManager.Environment.IDE ? "(Lnet/minecraft/block/state/IBlockState;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/world/IBlockAccess;Lnet/minecraft/client/renderer/BufferBuilder;)Z" : "(Lawt;Let;Lamy;Lbuk;)Z", false));
//add a label to jump to
//create label
final LabelNode jmp = new LabelNode();
//add if equals and pass the label
insnList.add(new JumpInsnNode(IFEQ, jmp));