• Recently Browsing

    No registered users viewing this page.

  • Posts

    • So I downloaded Twitch and installed one of the mod packs, but when I hit play in twitch and then hit play in the launcher that pops up, I get the error that my game has crashed.
    • Well basically I want to make the player, when looking at an entity's bounding box, to slowly move to the center. I've got most of it working except I can't get it to move to the center as it can't determine whether it should move the crosshair left of the center or right. My code is currently this: private Vec2f handleAimAssist(float targetYaw, float targetPitch) { Minecraft mc = Minecraft.getInstance(); PlayerEntity player = mc.player; if (player == null) { return new Vec2f(targetPitch, targetYaw); } float resultPitch = targetPitch; float resultYaw = targetYaw; if (mc.objectMouseOver != null && mc.objectMouseOver.getType() == RayTraceResult.Type.ENTITY) { EntityRayTraceResult entityRayTraceResult = (EntityRayTraceResult) mc.objectMouseOver; Entity entity = entityRayTraceResult.getEntity(); float difX = targetPitch - player.getPitchYaw().x; float difY = targetYaw - player.getPitchYaw().y; Vec3d playerLookVec = player.getLookVec(); Vec3d targetCoords = entity.getBoundingBox().getCenter(); if (entity.getBoundingBox().maxX > playerLookVec.x + difX || entity.getBoundingBox().minX < playerLookVec.x - difX || entity.getBoundingBox().intersects(targetCoords, targetCoords)) { resultYaw *= (float) (0.2 * targetCoords.normalize().distanceTo(playerLookVec)); // Slows the sensitivity to stop slingshotting the bounding box. It can still be slingshotted though if attempted. resultYaw = toTarget( resultYaw, (float) targetCoords.normalize().distanceTo(playerLookVec.normalize()), (float) targetCoords.normalize().x < playerLookVec.normalize().x && targetCoords.normalize().distanceTo(playerLookVec.normalize()) > 0.5, 2.5); // This is the code that is supposed to move the cross hair to the center System.out.println(targetCoords.getX() + " " + playerLookVec); // resultYaw += (float) (targetCoords.distanceTo(playerLookVec)) * 0.2; // resultYaw += toTarget(resultYaw, (float) playerLookVec.x, (float) targetCoords.normalize().x, 0.2); // resultPitch += playerLookVec.getX() + (resultPitch - targetCoords.getX()); } } return new Vec2f(resultPitch, resultYaw); } private float toTarget(float current, float distance, boolean direction, double multiplier) { if (direction) { return (float) ((current - distance) * multiplier); } else { return (float) ((current + distance) * multiplier); } }     And yes, the code for manipulating the pitch isn't written yet but it is appreciated if it's also explained.   This isn't used for hacking, but rather for a controller mod in which to make it easier to kill entities.
    • Make a computer that has infinite accuracy. Your problem lies with the precision of floating point notation.
    • Then what you need to do, is when you try something and it doesn't work, come back here, explain what you tried, with either links to the code on your github, or at least a mention of which classes/where you changed it. Explain what did not work, and post logs, even if the game doesn't crash, sometimes there's stuff in there that helps find what's going wrong. And of course, the more Java/programming you know, and the longer you've done it, the easier it will be.
  • Topics

  • Who's Online (See full list)