Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class KillPoint extends Module {
- private EntityLivingBase target;
- private long current, last;
- private int delay = 8;
- private float yaw, pitch;
- private boolean others;
- public KillPoint() {
- super("KillPoint", Keyboard.CHAR_NONE, Category.PLAYER);
- }
- public void onEnable() {
- super.onEnable();
- }
- public void onDisable() {
- super.onDisable();
- }
- @EventTarget
- public void onPre(EventMotion event) {
- if(event.getType().equals(Type.PRE)) {
- target = getClosest(mc.playerController.getBlockReachDistance());
- if(target == null)
- return;
- updateTime();
- yaw = mc.thePlayer.rotationYaw;
- pitch = mc.thePlayer.rotationPitch;
- if(current - last > 1000 / delay) {
- teleport(target);
- resetTime();
- }
- }
- }
- @EventTarget
- public void onPost(EventMotion event) {
- if(event.getType().equals(Type.POST)) {
- if(target == null)
- return;
- mc.thePlayer.rotationYaw = yaw;
- mc.thePlayer.rotationPitch = pitch;
- }
- }
- private void teleport(Entity entity) {
- double newX;
- double newZ;
- float yaw = target.getRotationYawHead();
- if(yaw < 0) yaw += 360;
- newX = Math.cos(Math.toRadians(yaw));
- newZ = Math.sin(Math.toRadians(yaw));
- double newD;
- EnumFacing Face = target.getHorizontalFacing();
- if(Face.EAST != null) {
- mc.thePlayer.setPositionAndRotation(target.posX - 2.5, target.posY, target.posZ, -90, 0);
- }
- if(Face.SOUTH != null) {
- mc.thePlayer.setPositionAndRotation(target.posX, target.posY, target.posZ - 2.5, 0, 0);
- }
- if(Face.WEST != null) {
- mc.thePlayer.setPositionAndRotation(target.posX + 2.5, target.posY, target.posZ, 90, 0);
- }
- if(Face.NORTH != null) {
- mc.thePlayer.setPositionAndRotation(target.posX, target.posY, target.posZ + 2.5, 180, 0);
- } else {
- mc.thePlayer.setPositionAndRotation(target.posX + newX, target.posY, target.posZ + newZ, target.getRotationYawHead(), target.cameraPitch);
- }
- toggle();
- }
- private void updateTime() {
- current = (System.nanoTime() / 1000000L);
- }
- private void resetTime() {
- last = (System.nanoTime() / 1000000L);
- }
- private EntityLivingBase getClosest(double range) {
- double dist = range;
- EntityLivingBase target = null;
- for(Object object : mc.theWorld.loadedEntityList) {
- Entity entity = (Entity)object;
- if(entity instanceof EntityLivingBase) {
- EntityLivingBase player = (EntityLivingBase)entity;
- if(canAttack(player)) {
- if(!(player instanceof EntityMob) && (!(player instanceof EntityAnimal) || others)) {
- double currentDist = mc.thePlayer.getDistanceToEntity(player);
- if(currentDist <= dist) {
- dist = currentDist;
- target = player;
- }
- }
- }
- }
- }
- return target;
- }
- private boolean canAttack(EntityLivingBase player) {
- return player != mc.thePlayer && player.isEntityAlive() && mc.thePlayer.getDistanceToEntity(player) <= mc.playerController.getBlockReachDistance() && player.ticksExisted > 30;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement