@Override public int inGameLoop(Minecraft mc) { EntityPlayer player = mc.thePlayer; if (player.getDistance(startX, startY, startZ) >= 100) returnHome = true; if (returnHome && player.getDistance(startX, startY, startZ) <= 1) McBot.stopBot(); if (returnHome) { McBot.walkTo(startX + .5, startY, startZ + .5, true); return 0; } MovingObjectPosition mop = player.rayTrace(1, 1); if (mc.theWorld != null) { if (mop != null && mc.theWorld.getBlockId(mop.blockX, mop.blockY, mop.blockZ) != 0) { McBot.mineBlock(mop.blockX, mop.blockY, mop.blockZ, false); if (!McBot.isBlockDangerous(mop.blockX, mop.blockY, mop.blockZ) && !McBot.isBlockDangerous(mop.blockX, mop.blockY - 1, mop.blockZ) && !McBot.isBlockDangerous(mop.blockX, mop.blockY - 2, mop.blockZ)) ; McBot.walkTo(mop.blockX + .5, mop.blockY + .5, mop.blockZ + .5, false); } else { if (Camera.getPitch() == 45) Camera.setPitch(0); else Camera.setPitch(45); mop = player.rayTrace(10, 1); if (mop != null && !McBot.isBlockDangerous(mop.blockX, mop.blockY, mop.blockZ) && !McBot.isBlockDangerous(mop.blockX, mop.blockY - 1, mop.blockZ) && !McBot.isBlockDangerous(mop.blockX, mop.blockY - 2, mop.blockZ)) McBot.walkTo(mop.blockX + .5, mop.blockY + .5, mop.blockZ + .5, false); } } return 1; }
@Override public void onStart() { if (Minecraft.getMinecraft() != null && Minecraft.getMinecraft().thePlayer != null) { EntityPlayer player = Minecraft.getMinecraft().thePlayer; startX = (int) Math.floor(player.posX); startY = (int) Math.floor(player.posY); startZ = (int) Math.floor(player.posZ); Camera.setPitch(0); } }