diff --git a/src/main/java/me/rigamortis/seppuku/impl/module/render/WallHackModule.java b/src/main/java/me/rigamortis/seppuku/impl/module/render/WallHackModule.java index 36c718e..e5cea25 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/module/render/WallHackModule.java +++ b/src/main/java/me/rigamortis/seppuku/impl/module/render/WallHackModule.java @@ -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.*; diff --git a/src/main/java/me/rigamortis/seppuku/impl/module/world/AutoTorchModule.java b/src/main/java/me/rigamortis/seppuku/impl/module/world/AutoTorchModule.java index 3aa8cad..b74063b 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/module/world/AutoTorchModule.java +++ b/src/main/java/me/rigamortis/seppuku/impl/module/world/AutoTorchModule.java @@ -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()); diff --git a/src/main/java/me/rigamortis/seppuku/impl/module/world/WaypointsModule.java b/src/main/java/me/rigamortis/seppuku/impl/module/world/WaypointsModule.java index 5d80e28..d59b2ba 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/module/world/WaypointsModule.java +++ b/src/main/java/me/rigamortis/seppuku/impl/module/world/WaypointsModule.java @@ -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 tracersWidth = new Value("TracersWidth", new String[]{"twidth", "tw"}, "Pixel width of each tracer line.", 1.0f, 0.1f, 5.0f, 0.1f); public final Value tracersAlpha = new Value("TracersAlpha", new String[]{"talpha", "ta", "topacity", "top"}, "Alpha value for each drawn line.", 255, 1, 255, 1); - public final Value box = new Value("Box", new String[]{"b"}, "Renders a 3D object at each waypoint.", true); - public final Value shape = new Value("Shape", new String[]{"s"}, "Selects what shape should be rendered.", Shape.CUBE); - public final Value boxRotate = new Value("BoxRotate", new String[]{"brotate", "rotate", "br"}, "Rotates each 3D object around in a circle.", true); - public final Value boxRotateSpeed = new Value("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 boxWidth = new Value("BoxWidth", new String[]{"width", "w"}, "Pixel width of the 3D objects lines.", 1f, 0.1f, 5.0f, 0.1f); - public final Value boxAlpha = new Value("BoxAlpha", new String[]{"balpha", "ba", "bopacity", "bop"}, "Alpha value for the 3D rendered object.", 127, 1, 255, 1); - public final Value boxSize = new Value("BoxSize", new String[]{"size", "scale", "s"}, "Size of the 3D rendered object.", 0.5f, 0.1f, 3.0f, 0.1f); - public final Value boxYOffset = new Value("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 diamondYIncrease = new Value("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 point = new Value("Point", new String[]{"p", "waypoint", "object", "o"}, "Renders a 3D object at each waypoint.", true); + public final Value pointShape = new Value("PointShape", new String[]{"wps", "ps", "shape"}, "Selects what shape should be rendered.", Shape.CUBE); + public final Value pointRotate = new Value("PointRotate", new String[]{"protate", "rotate", "wpr"}, "Rotates each 3D object around in a circle.", true); + public final Value pointRotateSpeed = new Value("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 pointWidth = new Value("PointWidth", new String[]{"pwidth", "pw"}, "Pixel width of the 3D objects lines.", 1f, 0.1f, 5.0f, 0.1f); + public final Value pointAlpha = new Value("PointAlpha", new String[]{"palpha", "pa", "popacity", "pop"}, "Alpha value for the 3D rendered object.", 127, 1, 255, 1); + public final Value pointSize = new Value("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 pointYOffset = new Value("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 pointDiamondHeight = new Value("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; } diff --git a/src/main/java/me/rigamortis/seppuku/impl/patch/BlockRendererDispatcherPatch.java b/src/main/java/me/rigamortis/seppuku/impl/patch/BlockRendererDispatcherPatch.java index 459850d..bb20a72 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/patch/BlockRendererDispatcherPatch.java +++ b/src/main/java/me/rigamortis/seppuku/impl/patch/BlockRendererDispatcherPatch.java @@ -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));